mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Daniel Baluta <daniel.baluta@nxp.com>
Cc: badhri@google.com, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	stefan.ghetu@nxp.com, imx@lists.linux.dev,
	Li Jun <jun.li@nxp.com>
Subject: Re: [PATCH] usb: typec: tcpm: allow external charger detection to set USB_TYPE
Date: Wed, 11 Nov 2026 15:05:14 +0100	[thread overview]
Message-ID: <avR2GnwIdOKSrTlE@black.igk.intel.com> (raw)
In-Reply-To: <20261106115742.730704-1-daniel.baluta@nxp.com>

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

  reply	other threads:[~2026-11-11 14:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 11:57 Daniel Baluta
2026-11-11 14:05 ` Heikki Krogerus [this message]
2026-11-11 14:32   ` Heikki Krogerus

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=avR2GnwIdOKSrTlE@black.igk.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=badhri@google.com \
    --cc=daniel.baluta@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jun.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stefan.ghetu@nxp.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®