From patchwork Wed Jul 17 00:49:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jameson Thies X-Patchwork-Id: 813109 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A0CD848C for ; Wed, 17 Jul 2024 00:51:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721177489; cv=none; b=P5m2nac+T+G/EC+iB2j5pN1yf818a0ETvJBiWr5NTz9TyzblrxK058Rpr6Kb4AJun7txMZU/pX+N50h4ka7b7LsTqbUc+ikrz421TiJRarSwb60hoGqr70r8xYsLsvuROMGIB7n5GoPtOGDBKaKut/9lJpgUxgH9irqCD1sBwxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721177489; c=relaxed/simple; bh=imrdTBKFl9/ler02ONXWrJRcIjmutDnfzz+XiKEiY3w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=HqEJrO05+t0tSWV3akTbGPXehMobyr1MPdxOkHLvRFMOJVsUKGDNrrdRcO/UDNy+iGGP88+caiVkYEQekhdfL6HHOvUKROkqf7n9e7BFIJ2yjjS8j59qqIUFtacTcrjkPOxM9kLf3JkG4DFagA3Gyqiz47uTNDv9QC2tJlizsC8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uyEn5/QS; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uyEn5/QS" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6511c587946so127333097b3.1 for ; Tue, 16 Jul 2024 17:51:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721177487; x=1721782287; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ssDYc+w2ZBOTZEW4SaOXob+zs6JJwedZnb8idSmatOU=; b=uyEn5/QS8n3nHDLDaN/Do694H85t8KqwVDP0WL9KiSf7eUfr8HuGb8GzasWKojQD56 wqIu2tshIeHy5U9x+ass+kgnv2vhwOTbqGxNlUSggrOBi7P+2YmOgLkxU+8nEty/INg/ hZ7rz5G8amu7n4axw51bI6EkslGvSQRHBmlSEO+FlBw0qyBok+nfNTyNZ8NCI1f37IXe qSuJ4b7+GkNCn5FWqgAbGZVBLmSTA62bmFmrdtfr5RSylYInMIrxISoHiGt2JL/+S5pT iey4mQWEFGXWxKnjBaAAxjNJlWfAkGpx0Cyt78cgb2TDleUCVUYXgmOLfciQna+Z6n51 PmNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721177487; x=1721782287; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ssDYc+w2ZBOTZEW4SaOXob+zs6JJwedZnb8idSmatOU=; b=VlYiDI/Xp7O5ciRUoKxedPDp8FWuouEkb1jDfYl3RAjAsL+U/9FAz+GPgg3JF4vUSp zQ19lMkEWnBkdvAtfVFiz7IErRyYUfLd3Uad/NvvYINWGUolIx30OZ6WaSz41U/asTBP /17OjQ+Vf0w325uEByoPix7WgV/JnVnHaq50UhqTDOU1vOH22YdFGR5PB38xFd1O1zCf 1CkcSI4kj7brpQ7NkeX9cwBXkpUQMIXfDv2u0FASMP32+4CJL05xL9Y0csJ9ErIlfMLe QkgNrdZJSoaEXwm8rQe1zLDLZq7uPd1C2vyO/XTX9SOkBuJb8c33mP4LSmNANdw/kxRg xsRg== X-Forwarded-Encrypted: i=1; AJvYcCUrfJjyhF2btxAXB3E5XWmUofwPpFkiV+YYgePcUIBrw+fL3duJJFnOJSnDOEW8n9Xu33wXeLC95Rl42jp6fUIiziafj/+B6J9q X-Gm-Message-State: AOJu0Yw8+kRgOYgiZJ3Bt/pdVYgasRog7iVZyk9unWMygDkSQ/dF+a86 XHgvtE8K+UkfhxrHxiFcY9tSeQcUP5cgROQ18Cv5WsrTpu3aJyr2CqVjug5Y3eL00dODaT1qphj laA== X-Google-Smtp-Source: AGHT+IGfziVk8mk/t5qqLgrjh2nAuQB6H4AHqRgQ9isrB7miUbLCHuZyYh4XWKyG4GLGSr/PpOKF+I1vupI= X-Received: from jthies.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:23db]) (user=jthies job=sendgmr) by 2002:a05:690c:660f:b0:62a:2a39:ccd9 with SMTP id 00721157ae682-66500955504mr5567b3.6.1721177487061; Tue, 16 Jul 2024 17:51:27 -0700 (PDT) Date: Wed, 17 Jul 2024 00:49:47 +0000 In-Reply-To: <20240717004949.3638557-1-jthies@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240717004949.3638557-1-jthies@google.com> X-Mailer: git-send-email 2.45.2.1089.g2a221341d9-goog Message-ID: <20240717004949.3638557-3-jthies@google.com> Subject: [PATCH v1 2/4] usb: typec: ucsi: Add USB PD DRP to USB type From: Jameson Thies To: heikki.krogerus@linux.intel.com, linux-usb@vger.kernel.org Cc: jthies@google.com, bleung@google.com, abhishekpandit@chromium.org, andersson@kernel.org, dmitry.baryshkov@linaro.org, fabrice.gasnier@foss.st.com, gregkh@linuxfoundation.org, hdegoede@redhat.com, neil.armstrong@linaro.org, rajaram.regupathy@intel.com, saranya.gopal@intel.com, linux-kernel@vger.kernel.org Add POWER_SUPPLY_USB_TYPE_PD_DRP as a USB type in the UCSI power supply driver. The DRP type is set when the partner supports USB PD and offers both source and sink PDOs. Signed-off-by: Jameson Thies --- drivers/usb/typec/ucsi/psy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/ucsi/psy.c b/drivers/usb/typec/ucsi/psy.c index d0b52cee41d2..45113e013696 100644 --- a/drivers/usb/typec/ucsi/psy.c +++ b/drivers/usb/typec/ucsi/psy.c @@ -204,8 +204,12 @@ static int ucsi_psy_get_usb_type(struct ucsi_connector *con, val->intval = POWER_SUPPLY_USB_TYPE_C; if (flags & UCSI_CONSTAT_CONNECTED && - UCSI_CONSTAT_PWR_OPMODE(flags) == UCSI_CONSTAT_PWR_OPMODE_PD) - val->intval = POWER_SUPPLY_USB_TYPE_PD; + UCSI_CONSTAT_PWR_OPMODE(flags) == UCSI_CONSTAT_PWR_OPMODE_PD) { + if (!con->partner_source_caps || !con->partner_sink_caps) + val->intval = POWER_SUPPLY_USB_TYPE_PD; + else + val->intval = POWER_SUPPLY_USB_TYPE_PD_DRP; + } return 0; } @@ -275,6 +279,7 @@ static enum power_supply_usb_type ucsi_psy_usb_types[] = { POWER_SUPPLY_USB_TYPE_C, POWER_SUPPLY_USB_TYPE_PD, POWER_SUPPLY_USB_TYPE_PD_PPS, + POWER_SUPPLY_USB_TYPE_PD_DRP, }; int ucsi_register_port_psy(struct ucsi_connector *con) From patchwork Wed Jul 17 00:49:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jameson Thies X-Patchwork-Id: 813108 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84B36BA53 for ; Wed, 17 Jul 2024 00:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721177498; cv=none; b=Lwy8kznUjP/aHlb0Se9fGjz+j+RCi2IF+tZL6hX6OgsHkTWfjo0awfRNKEAYx5K3hqm//zeLSS4y388plWq0awiOTRVf/eQtQADL1wbczaWAkMnBfaXKDDm8O4PfXjXX0cK3uSfLpUdHTMRUDz/C1c8SH6cT7EhC6orHcDD1YDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721177498; c=relaxed/simple; bh=TxBuHJK85vkREbw0WLP5ADupaB4b16I7uMojTYknRa8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=hdOVLF+wof0QWQoI+e8ywyEy6tjTD1Rc1A8yC+wFgjx9B7jnJjHSqEpMKct4yjj1+vYhT/7BP3flicmkHeDGmVkp8PaqGnnAgJOcO36RXpFoAisuKrr+svRzFsR7j8doIEXjkhTBvzuF4rXX4alt2hJdkYMkZQNa1ks/w+kRetc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=IQEtIZwq; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IQEtIZwq" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6511c587946so127336067b3.1 for ; Tue, 16 Jul 2024 17:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721177495; x=1721782295; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=HTO1tsJpanrsIXuREfXU+lZcoE2mxE9RW1fzcKxRuPY=; b=IQEtIZwqThfL2tkpbppOAJIWrEBFeGp3JwQsUjLtFGvkKsUrCT2pEDg7MyBBoxyUGt ZxUx4caN1wQfl7C4IqBbD0err8tciyYKAN+fRjlQ0V/0ez+9/DnETUu1YAOkrXOXH/jn 8Fg/+yy7AAraMqKS8laXtfRbjiMdBgWsZFn2+DHpJwlmnc74Uav7A8q5+WLs2m4RAkl3 88+Y5ECH4bCBGSqBtID+FiQsBaAyskBiKCFBst4Gxzw4Rds1vSrfTNk89/5aUCg0q0eR EX4d0r7RJkPtjJH+KAZNbiq2sN/C6DjhZ1HCSjTmKSkzSlxirdTo/f/gihcOZOuDeMHf M//w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721177495; x=1721782295; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HTO1tsJpanrsIXuREfXU+lZcoE2mxE9RW1fzcKxRuPY=; b=t0qyUomhNsLy72zKt2yeDA+xJs7vBm9a8b2ucvirATZOu00Z97bChpiG9ZetTUm+eB oTAEEOWu6ZY06SgCT0je6FCUeHOhtjZb+5/S6NCQiPQzIpsH5uXycP+1CrJ5b3zU7OKa Ii0ir3adEW+WrO3mogBVFW/6l401j/s1g5WlPGXXAWrdNruBgLEonCcCEZyQTGeObdSZ OfzU+dyHELp7IqUWPHlkZZQJSG8pT6UOEavD98ff3i4dSGYN15uBQdEspYiBhxaNwVaG 7YNWh/qa70YZlJq3EwZ41g6mT4+Le+O+9oGI0Akmigzu5nfjcL36H73tHoYnR/F1Etv8 ouig== X-Forwarded-Encrypted: i=1; AJvYcCVsJ4neF5hJFSaHy2xK2u1aBtVCPVy6KqEVyRG8XMYwjnDfeBmZsNZadCEkXXHZMA+uj5XGXMu4OCjjx5r9OiF5904W73/O+FqO X-Gm-Message-State: AOJu0YxzaF5J09Vwjjkvq8+t4gfNzDXtmEEwY//PEtkpDgwTIr3l0qGy ng6E9kjVnehYTI2gIr3LPcetY9gHNg2RoauGeAvD7bnIW3D4UbHRzhGusvYg1oR2irYnxmG9Vnq VpQ== X-Google-Smtp-Source: AGHT+IGg09Ayrrw6aRkughQryryAOlXFSVSJLvjMGLhBlG76jIsoZGI0TJ101PkcfAxrh48DyXAxTN6wUSc= X-Received: from jthies.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:23db]) (user=jthies job=sendgmr) by 2002:a05:690c:289:b0:65c:4528:d8ee with SMTP id 00721157ae682-664ff0079f7mr6537b3.4.1721177495402; Tue, 16 Jul 2024 17:51:35 -0700 (PDT) Date: Wed, 17 Jul 2024 00:49:49 +0000 In-Reply-To: <20240717004949.3638557-1-jthies@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240717004949.3638557-1-jthies@google.com> X-Mailer: git-send-email 2.45.2.1089.g2a221341d9-goog Message-ID: <20240717004949.3638557-5-jthies@google.com> Subject: [PATCH v1 4/4] usb: typec: ucsi: Fix SET_PDR typo in UCSI header file From: Jameson Thies To: heikki.krogerus@linux.intel.com, linux-usb@vger.kernel.org Cc: jthies@google.com, bleung@google.com, abhishekpandit@chromium.org, andersson@kernel.org, dmitry.baryshkov@linaro.org, fabrice.gasnier@foss.st.com, gregkh@linuxfoundation.org, hdegoede@redhat.com, neil.armstrong@linaro.org, rajaram.regupathy@intel.com, saranya.gopal@intel.com, linux-kernel@vger.kernel.org Fix SET_PDR typo in UCSI header file. Signed-off-by: Jameson Thies --- drivers/usb/typec/ucsi/ucsi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h index 57129f3c0814..375f1881c1e2 100644 --- a/drivers/usb/typec/ucsi/ucsi.h +++ b/drivers/usb/typec/ucsi/ucsi.h @@ -152,7 +152,7 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num); #define UCSI_SET_UOR_ROLE(_r_) (((_r_) == TYPEC_HOST ? 1 : 2) << 23) #define UCSI_SET_UOR_ACCEPT_ROLE_SWAPS BIT(25) -/* SET_PDF command bits */ +/* SET_PDR command bits */ #define UCSI_SET_PDR_ROLE(_r_) (((_r_) == TYPEC_SOURCE ? 1 : 2) << 23) #define UCSI_SET_PDR_ACCEPT_ROLE_SWAPS BIT(25)