[PATCH v2 1/3] usb: typec: tcpm: only call get_current_limit() for cc=Rp-def
From: Amit Sunil Dhamne via B4 Relay
Date: Sat Oct 03 2026 - 23:41:35 EST
From: Amit Sunil Dhamne <amitsd@xxxxxxxxxx>
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@xxxxxxxxxx>
Reviewed-by: Badhri Jagan Sridharan <badhri@xxxxxxxxxx>
---
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