Message ID | 20200804174828.8339-4-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Remodel HD3SS3220 device nodes | expand |
Hello! On 04.08.2020 20:48, Biju Das wrote: > Some platforms have only super speed data bus connected to this device > and high speed data bus directly connected to the SoC. In such platforms > modelling connector as a child of this device is making it non complaint Compliant? Complaint is when you complain. :-) > with usb connector bindings. By modelling connector node as standalone > device node along with this device and the SoC data bus will make it > complaint with usb connector bindings. Ditto. > Update the driver to handle this model by using OF graph API to get the > connector fwnode and usb role switch class API to get role switch handle. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > --- > Ref:https://patchwork.kernel.org/patch/11669423/ [...] MBR, Sergei
Hi Sergei, Thanks for the feedback. > Subject: Re: [PATCH 3/5] usb: typec: hd3ss3220: Use OF graph API to get the > connector fwnode > > Hello! > > On 04.08.2020 20:48, Biju Das wrote: > > > Some platforms have only super speed data bus connected to this device > > and high speed data bus directly connected to the SoC. In such > > platforms modelling connector as a child of this device is making it > > non complaint > > Compliant? Complaint is when you complain. :-) Will fix this. > > with usb connector bindings. By modelling connector node as standalone > > device node along with this device and the SoC data bus will make it > > complaint with usb connector bindings. > > Ditto. Yep, Will fix this. Regards, Biju Renesas Electronics Europe GmbH, Geschaeftsfuehrer/President: Carsten Jauch, Sitz der Gesellschaft/Registered office: Duesseldorf, Arcadiastrasse 10, 40472 Duesseldorf, Germany, Handelsregister/Commercial Register: Duesseldorf, HRB 3708 USt-IDNr./Tax identification no.: DE 119353406 WEEE-Reg.-Nr./WEEE reg. no.: DE 14978647
diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c index 323dfa8160ab..f633ec15b1a1 100644 --- a/drivers/usb/typec/hd3ss3220.c +++ b/drivers/usb/typec/hd3ss3220.c @@ -155,7 +155,7 @@ static int hd3ss3220_probe(struct i2c_client *client, { struct typec_capability typec_cap = { }; struct hd3ss3220 *hd3ss3220; - struct fwnode_handle *connector; + struct fwnode_handle *connector, *ep; int ret; unsigned int data; @@ -173,11 +173,21 @@ static int hd3ss3220_probe(struct i2c_client *client, hd3ss3220_set_source_pref(hd3ss3220, HD3SS3220_REG_GEN_CTRL_SRC_PREF_DRP_DEFAULT); + /* For backward compatibility check the connector child node first */ connector = device_get_named_child_node(hd3ss3220->dev, "connector"); - if (!connector) - return -ENODEV; + if (connector) { + hd3ss3220->role_sw = fwnode_usb_role_switch_get(connector); + } else { + ep = fwnode_graph_get_next_endpoint(dev_fwnode(hd3ss3220->dev), NULL); + if (!ep) + return -ENODEV; + connector = fwnode_graph_get_remote_port_parent(ep); + fwnode_handle_put(ep); + if (!connector) + return -ENODEV; + hd3ss3220->role_sw = usb_role_switch_get(hd3ss3220->dev); + } - hd3ss3220->role_sw = fwnode_usb_role_switch_get(connector); if (IS_ERR(hd3ss3220->role_sw)) { ret = PTR_ERR(hd3ss3220->role_sw); goto err_put_fwnode;