Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: typec: tcpm: try to get role switch from tcpc fwnode
@ 2023-03-28  8:23 Li Jun
  2023-03-28 14:11 ` Heikki Krogerus
  2023-03-29 10:44 ` Heikki Krogerus
  0 siblings, 2 replies; 5+ messages in thread
From: Li Jun @ 2023-03-28  8:23 UTC (permalink / raw)
  To: linux, heikki.krogerus; +Cc: gregkh, linux-usb, xu.yang_2, Li Jun

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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: typec: tcpm: try to get role switch from tcpc fwnode
  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
  2023-03-28 14:56   ` Guenter Roeck
  2023-03-28 17:12   ` Bryan O'Donoghue
  2023-03-29 10:44 ` Heikki Krogerus
  1 sibling, 2 replies; 5+ messages in thread
From: Heikki Krogerus @ 2023-03-28 14:11 UTC (permalink / raw)
  To: Li Jun; +Cc: linux, gregkh, linux-usb, xu.yang_2, Bryan O'Donoghue

+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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: typec: tcpm: try to get role switch from tcpc fwnode
  2023-03-28 14:11 ` Heikki Krogerus
@ 2023-03-28 14:56   ` Guenter Roeck
  2023-03-28 17:12   ` Bryan O'Donoghue
  1 sibling, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-03-28 14:56 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Li Jun, gregkh, linux-usb, xu.yang_2, Bryan O'Donoghue

On Tue, Mar 28, 2023 at 05:11:49PM +0300, Heikki Krogerus wrote:
> +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.
> 

Ok with me.

Guenter

> thanks,
> 
> -- 
> heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: typec: tcpm: try to get role switch from tcpc fwnode
  2023-03-28 14:11 ` Heikki Krogerus
  2023-03-28 14:56   ` Guenter Roeck
@ 2023-03-28 17:12   ` Bryan O'Donoghue
  1 sibling, 0 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2023-03-28 17:12 UTC (permalink / raw)
  To: Heikki Krogerus, Li Jun; +Cc: linux, gregkh, linux-usb, xu.yang_2

On 28/03/2023 15:11, Heikki Krogerus wrote:
> +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,
> 

It does look exactly the same. I don't mind letting Li have the commit.

---
bod

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: typec: tcpm: try to get role switch from tcpc fwnode
  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
@ 2023-03-29 10:44 ` Heikki Krogerus
  1 sibling, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2023-03-29 10:44 UTC (permalink / raw)
  To: Li Jun; +Cc: linux, gregkh, linux-usb, xu.yang_2

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>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.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;
> -- 
> 2.34.1

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-29 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-03-28 14:56   ` Guenter Roeck
2023-03-28 17:12   ` Bryan O'Donoghue
2023-03-29 10:44 ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox