Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Li Jun <jun.li@nxp.com>
Cc: linux@roeck-us.net, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, xu.yang_2@nxp.com,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Subject: Re: [PATCH] usb: typec: tcpm: try to get role switch from tcpc fwnode
Date: Tue, 28 Mar 2023 17:11:49 +0300	[thread overview]
Message-ID: <ZCL1pULmTtMOpaKB@kuha.fi.intel.com> (raw)
In-Reply-To: <1679991784-25500-1-git-send-email-jun.li@nxp.com>

+Bryan

On Tue, Mar 28, 2023 at 04:23:04PM +0800, Li Jun wrote:
> Try to get usb role switch from tcpc fwnode if failed to
> get role switch from port dev, this is for case the port
> for role switch endpoint is located in connector node,
> as per connector binding doc, port@0 for HS is required.
> 
> ptn5110: tcpc@50 {
> 	compatible = "nxp,ptn5110";
> 	...
> 	status = "okay";
> 
> 	connector {
> 		compatible = "usb-c-connector";
> 		label = "USB-C";
> 		...
> 
> 		ports {
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 
> 			port@0 {
> 				reg = <0>;
> 
> 				typec_conn: endpoint {
> 					remote-endpoint = <&usb2_controller>;
> 				};
> 			};
> 		};
> 	};
> };
> 
> Signed-off-by: Li Jun <jun.li@nxp.com>
> ---
>  drivers/usb/typec/tcpm/tcpm.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index a0d943d78580..f0534bdb4462 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -6557,6 +6557,8 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
>  	port->port_type = port->typec_caps.type;
>  
>  	port->role_sw = usb_role_switch_get(port->dev);
> +	if (!port->role_sw)
> +		port->role_sw = fwnode_usb_role_switch_get(tcpc->fwnode);
>  	if (IS_ERR(port->role_sw)) {
>  		err = PTR_ERR(port->role_sw);
>  		goto out_destroy_wq;

This looks like exactly the same as the RFC from Bryan that I just
commented. I have not objections if this looks okay to you Brian. I
think we should still wait for comments also from Guenter.

thanks,

-- 
heikki

  reply	other threads:[~2023-03-28 14:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28  8:23 [PATCH] usb: typec: tcpm: try to get role switch from tcpc fwnode Li Jun
2023-03-28 14:11 ` Heikki Krogerus [this message]
2023-03-28 14:56   ` Guenter Roeck
2023-03-28 17:12   ` Bryan O'Donoghue
2023-03-29 10:44 ` 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=ZCL1pULmTtMOpaKB@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=xu.yang_2@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