mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amit Sunil Dhamne via B4 Relay <devnull+amitsd.google.com@kernel.org>
To: Badhri Jagan Sridharan <badhri@google.com>,
	 Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	"André Draszik" <andre.draszik@linaro.org>,
	"RD Babiera" <rdbabiera@google.com>,
	"Kyle Tso" <kyletso@google.com>,
	"Amit Sunil Dhamne" <amitsd@google.com>
Subject: [PATCH v2 1/3] usb: typec: tcpm: only call get_current_limit() for cc=Rp-def
Date: Sun, 04 Oct 2026 03:40:59 +0000	[thread overview]
Message-ID: <20261004-max77759-icl-typec-v2-1-866caf9e7d9a@google.com> (raw)
In-Reply-To: <20261004-max77759-icl-typec-v2-0-866caf9e7d9a@google.com>

From: Amit Sunil Dhamne <amitsd@google.com>

tcpm_get_current_limit() folds the default label into the
TYPEC_CC_RP_DEF case, so tcpc_dev::get_current_limit() is also called
for CC states that do not advertise Rp, such as TYPEC_CC_OPEN,
TYPEC_CC_RA and TYPEC_CC_RD. Its kerneldoc has always scoped it to
cc=Rp-def:

  @get_current_limit:
          Optional; called by the tcpm core when configured as a snk
          and cc=Rp-def. This allows the tcpm to provide a fallback
          current-limit detection method for the cc=Rp-def case.

A chip driver has nothing to interpret in the other states. Therefore,
split the cases and report 0 when CC is not an Rp.

Assisted-by: LLM
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
---
 drivers/usb/typec/tcpm/tcpm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 2d6b14aa2085..cb69d6a7ce5a 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -1279,12 +1279,14 @@ static u32 tcpm_get_current_limit(struct tcpm_port *port)
 		limit = 3000;
 		break;
 	case TYPEC_CC_RP_DEF:
-	default:
 		if (port->tcpc->get_current_limit)
 			limit = port->tcpc->get_current_limit(port->tcpc);
 		else
 			limit = 0;
 		break;
+	default:
+		limit = 0;
+		break;
 	}
 
 	return limit;

-- 
2.56.0.rc1.315.gc6ed9934b7-goog



  reply	other threads:[~2026-10-04  3:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04  3:40 [PATCH v2 0/3] usb: typec: report a current limit for non-PD Rp-def sources Amit Sunil Dhamne via B4 Relay
2026-10-04  3:40 ` Amit Sunil Dhamne via B4 Relay [this message]
2026-10-04  3:41 ` [PATCH v2 2/3] usb: typec: tcpci: implement get_current_limit Amit Sunil Dhamne via B4 Relay
2026-10-04  3:41 ` [PATCH v2 3/3] usb: typec: tcpci_maxim: " Amit Sunil Dhamne via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261004-max77759-icl-typec-v2-1-866caf9e7d9a@google.com \
    --to=devnull+amitsd.google.com@kernel.org \
    --cc=amitsd@google.com \
    --cc=andre.draszik@linaro.org \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rdbabiera@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®