drivers/usb/typec/tcpm/tcpm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
From: Li Jun <jun.li@nxp.com>
Teach tcpm_psy_set_prop() to accept writes of
POWER_SUPPLY_PROP_USB_TYPE and store the value in port->usb_type, and
advertise the BC1.2 USB types (SDP/DCP/CDP/ACA) in
psy_desc.usb_types so power_supply_set_property() callers are not
rejected by power_supply_has_property().
This is a prerequisite for a follow-up PHY charger-detection driver
that calls power_supply_set_property() on the tcpm-backed power
supply once it determines the attached BC1.2 charger type.
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
drivers/usb/typec/tcpm/tcpm.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index d721baef52104..24f4e8854f37f 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -8766,6 +8766,10 @@ static int tcpm_psy_set_prop(struct power_supply *psy,
case POWER_SUPPLY_PROP_CURRENT_NOW:
ret = tcpm_aug_set_op_curr(port, val->intval / 1000);
break;
+ case POWER_SUPPLY_PROP_USB_TYPE:
+ port->usb_type = val->intval;
+ ret = 0;
+ break;
default:
ret = -EINVAL;
break;
@@ -8807,7 +8811,11 @@ static int devm_tcpm_psy_register(struct tcpm_port *port)
port_dev_name);
port->psy_desc.name = psy_name;
port->psy_desc.type = POWER_SUPPLY_TYPE_USB;
- port->psy_desc.usb_types = BIT(POWER_SUPPLY_USB_TYPE_C) |
+ port->psy_desc.usb_types = BIT(POWER_SUPPLY_USB_TYPE_SDP) |
+ BIT(POWER_SUPPLY_USB_TYPE_DCP) |
+ BIT(POWER_SUPPLY_USB_TYPE_CDP) |
+ BIT(POWER_SUPPLY_USB_TYPE_ACA) |
+ BIT(POWER_SUPPLY_USB_TYPE_C) |
BIT(POWER_SUPPLY_USB_TYPE_PD) |
BIT(POWER_SUPPLY_USB_TYPE_PD_PPS) |
BIT(POWER_SUPPLY_USB_TYPE_PD_PPS_SPR_AVS) |
--
2.45.2
On Fri, Nov 06, 2026 at 01:57:41PM +0200, Daniel Baluta wrote: > From: Li Jun <jun.li@nxp.com> > > Teach tcpm_psy_set_prop() to accept writes of > POWER_SUPPLY_PROP_USB_TYPE and store the value in port->usb_type, and > advertise the BC1.2 USB types (SDP/DCP/CDP/ACA) in > psy_desc.usb_types so power_supply_set_property() callers are not > rejected by power_supply_has_property(). > > This is a prerequisite for a follow-up PHY charger-detection driver > that calls power_supply_set_property() on the tcpm-backed power > supply once it determines the attached BC1.2 charger type. > > Signed-off-by: Li Jun <jun.li@nxp.com> > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/tcpm/tcpm.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index d721baef52104..24f4e8854f37f 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -8766,6 +8766,10 @@ static int tcpm_psy_set_prop(struct power_supply *psy, > case POWER_SUPPLY_PROP_CURRENT_NOW: > ret = tcpm_aug_set_op_curr(port, val->intval / 1000); > break; > + case POWER_SUPPLY_PROP_USB_TYPE: > + port->usb_type = val->intval; > + ret = 0; > + break; > default: > ret = -EINVAL; > break; > @@ -8807,7 +8811,11 @@ static int devm_tcpm_psy_register(struct tcpm_port *port) > port_dev_name); > port->psy_desc.name = psy_name; > port->psy_desc.type = POWER_SUPPLY_TYPE_USB; > - port->psy_desc.usb_types = BIT(POWER_SUPPLY_USB_TYPE_C) | > + port->psy_desc.usb_types = BIT(POWER_SUPPLY_USB_TYPE_SDP) | > + BIT(POWER_SUPPLY_USB_TYPE_DCP) | > + BIT(POWER_SUPPLY_USB_TYPE_CDP) | > + BIT(POWER_SUPPLY_USB_TYPE_ACA) | > + BIT(POWER_SUPPLY_USB_TYPE_C) | > BIT(POWER_SUPPLY_USB_TYPE_PD) | > BIT(POWER_SUPPLY_USB_TYPE_PD_PPS) | > BIT(POWER_SUPPLY_USB_TYPE_PD_PPS_SPR_AVS) | > -- > 2.45.2 -- heikki
On Wed, Nov 11, 2026 at 03:05:14PM +0100, Heikki Krogerus wrote: > On Fri, Nov 06, 2026 at 01:57:41PM +0200, Daniel Baluta wrote: > > From: Li Jun <jun.li@nxp.com> > > > > Teach tcpm_psy_set_prop() to accept writes of > > POWER_SUPPLY_PROP_USB_TYPE and store the value in port->usb_type, and > > advertise the BC1.2 USB types (SDP/DCP/CDP/ACA) in > > psy_desc.usb_types so power_supply_set_property() callers are not > > rejected by power_supply_has_property(). > > > > This is a prerequisite for a follow-up PHY charger-detection driver > > that calls power_supply_set_property() on the tcpm-backed power > > supply once it determines the attached BC1.2 charger type. > > > > Signed-off-by: Li Jun <jun.li@nxp.com> > > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> > > Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Ah, sorry. Sashiko found some issues with this it seems. Thanks, -- heikki
© 2016 - 2026 Red Hat, Inc.