Message ID | 1552025622-15582-2-git-send-email-chunfeng.yun@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | add USB Type-B connector driver | expand |
Hi, On 08-03-19 07:13, Chunfeng Yun wrote: > Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for > usb-b-connector > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > --- > .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt > index a9a2f2fc44f2..7a07b0f4f973 100644 > --- a/Documentation/devicetree/bindings/connector/usb-connector.txt > +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt > @@ -17,6 +17,16 @@ Optional properties: > - self-powered: Set this property if the usb device that has its own power > source. > > +Optional properties for usb-b-connector: > +- id-gpios: gpio for USB ID pin. What about boards where the ID pin is *not* connected to a GPIO, but e.g. to a special pin on the PMIC which can also detect an ACA adapter ? Currently this case is handled by extcon drivers, but we have no way to set e.g. vbus-supply for the connector. Maybe in this case the usb-connector node should be a child of the PMIC node ? And in many cases there also is a mux to switch the datalines between the host and device(gadget) controllers, how should that be described in this model? See the new usb-role-switch code under drivers/usb/roles In some cases the mux is controlled through a gpio, so we may want to add a "mux-gpios" here in which case we also need to define what 0/1 means. > +- vbus-gpios: gpio for USB VBUS pin. > + see gpio/gpio.txt. > +- vbus-supply: reference to the VBUS regulator, needed when supports > + dual-role mode. I think this needs some text that there can be either a vbus-gpio or a vbus-supply. Oh wait reading: https://patchwork.kernel.org/patch/10819377/ I see that this GPIO is for detecting vbus presence, not for driving/enabling 5v to Vbus from the board, that needs to be described more clearly. > +- pinctrl-names : a pinctrl state named "default" is optional > +- pinctrl-0 : pin control group > + see pinctrl/pinctrl-bindings.txt > + > Optional properties for usb-c-connector: > - power-role: should be one of "source", "sink" or "dual"(DRP) if typec > connector has power support. > Regards, Hans
Hi, On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: > Hi, > > On 08-03-19 07:13, Chunfeng Yun wrote: > > Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for > > usb-b-connector > > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > > --- > > .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt > > index a9a2f2fc44f2..7a07b0f4f973 100644 > > --- a/Documentation/devicetree/bindings/connector/usb-connector.txt > > +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt > > @@ -17,6 +17,16 @@ Optional properties: > > - self-powered: Set this property if the usb device that has its own power > > source. > > > > +Optional properties for usb-b-connector: > > +- id-gpios: gpio for USB ID pin. > > What about boards where the ID pin is *not* connected to a GPIO, > but e.g. to a special pin on the PMIC which can also detect > an ACA adapter ? Currently this case is handled by extcon > drivers, but we have no way to set e.g. vbus-supply for the > connector. Maybe in this case the usb-connector node should > be a child of the PMIC node ? Yes, it would be, PMIC is in charger of detecting the status of ID pin > > And in many cases there also is a mux to switch the datalines > between the host and device(gadget) controllers, how should > that be described in this model? See the new usb-role-switch > code under drivers/usb/roles > > In some cases the mux is controlled through a gpio, so we > may want to add a "mux-gpios" here in which case we also > need to define what 0/1 means. I'm not sure, the mux seems not belong to this connector, and may need another driver to register usb-role-switch, similar to: [v2,2/2] usb: typec: add typec switch via GPIO control https://patchwork.kernel.org/patch/10834327/ > > > +- vbus-gpios: gpio for USB VBUS pin. > > + see gpio/gpio.txt. > > +- vbus-supply: reference to the VBUS regulator, needed when supports > > + dual-role mode. > > I think this needs some text that there can be either a vbus-gpio or > a vbus-supply. Oh wait reading: > > https://patchwork.kernel.org/patch/10819377/ > > I see that this GPIO is for detecting vbus presence, not for driving/enabling > 5v to Vbus from the board, that needs to be described more clearly. Ok Thanks a lot > > > +- pinctrl-names : a pinctrl state named "default" is optional > > +- pinctrl-0 : pin control group > > + see pinctrl/pinctrl-bindings.txt > > + > > Optional properties for usb-c-connector: > > - power-role: should be one of "source", "sink" or "dual"(DRP) if typec > > connector has power support. > > > > > Regards, > > Hans
> -----Original Message----- > From: Chunfeng Yun <chunfeng.yun@mediatek.com> > Sent: 2019年3月11日 13:33 > To: Hans de Goede <hdegoede@redhat.com> > Cc: Rob Herring <robh+dt@kernel.org>; Greg Kroah-Hartman > <gregkh@linuxfoundation.org>; Heikki Krogerus > <heikki.krogerus@linux.intel.com>; Mark Rutland <mark.rutland@arm.com>; > Matthias Brugger <matthias.bgg@gmail.com>; Adam Thomson > <Adam.Thomson.Opensource@diasemi.com>; Jun Li <jun.li@nxp.com>; Badhri > Jagan Sridharan <badhri@google.com>; Andy Shevchenko > <andy.shevchenko@gmail.com>; Min Guo <min.guo@mediatek.com>; > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; > linux-usb@vger.kernel.org; linux-arm-kernel@lists.infradead.org; > linux-mediatek@lists.infradead.org > Subject: Re: [PATCH 1/5] dt-bindings: connector: add optional properties for > Type-B > > Hi, > > On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: > > Hi, > > > > On 08-03-19 07:13, Chunfeng Yun wrote: > > > Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for > > > usb-b-connector > > > > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > > > --- > > > .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ > > > 1 file changed, 10 insertions(+) > > > > > > diff --git > > > a/Documentation/devicetree/bindings/connector/usb-connector.txt > > > b/Documentation/devicetree/bindings/connector/usb-connector.txt > > > index a9a2f2fc44f2..7a07b0f4f973 100644 > > > --- a/Documentation/devicetree/bindings/connector/usb-connector.txt > > > +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt > > > @@ -17,6 +17,16 @@ Optional properties: > > > - self-powered: Set this property if the usb device that has its own power > > > source. > > > > > > +Optional properties for usb-b-connector: > > > +- id-gpios: gpio for USB ID pin. > > > > What about boards where the ID pin is *not* connected to a GPIO, but > > e.g. to a special pin on the PMIC which can also detect an ACA adapter > > ? Currently this case is handled by extcon drivers, but we have no way > > to set e.g. vbus-supply for the connector. Maybe in this case the > > usb-connector node should be a child of the PMIC node ? > Yes, it would be, PMIC is in charger of detecting the status of ID pin > > > > And in many cases there also is a mux to switch the datalines between > > the host and device(gadget) controllers, how should that be described > > in this model? See the new usb-role-switch code under > > drivers/usb/roles > > > > In some cases the mux is controlled through a gpio, so we may want to > > add a "mux-gpios" here in which case we also need to define what 0/1 > > means. > I'm not sure, the mux seems not belong to this connector, and may need another > driver to register usb-role-switch, similar to: > > [v2,2/2] usb: typec: add typec switch via GPIO control > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork > .kernel.org%2Fpatch%2F10834327%2F&data=02%7C01%7Cjun.li%40nxp.co > m%7C963df62e15ed4bedb14d08d6a5e30de2%7C686ea1d3bc2b4c6fa92cd99c5 > c301635%7C0%7C0%7C636878791953122760&sdata=grPIs2MbdaarTa17dr > pASVkGpyW7TAexB24igOJopGU%3D&reserved=0 > No, this is not for usb role switch, this is a typec switch driver to select the super speed active channel by orientation(CC1/CC2). Li Jun > > > > > > +- vbus-gpios: gpio for USB VBUS pin. > > > + see gpio/gpio.txt. > > > +- vbus-supply: reference to the VBUS regulator, needed when > > > +supports > > > + dual-role mode. > > > > I think this needs some text that there can be either a vbus-gpio or a > > vbus-supply. Oh wait reading: > > > > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpat > > > chwork.kernel.org%2Fpatch%2F10819377%2F&data=02%7C01%7Cjun.li%4 > 0nx > > > p.com%7C963df62e15ed4bedb14d08d6a5e30de2%7C686ea1d3bc2b4c6fa92cd9 > 9c5c3 > > > 01635%7C0%7C0%7C636878791953122760&sdata=Judz7gdwQTOC7Jh84 > 57N4x21a > > fWci%2FEH79ARqWZzbX8%3D&reserved=0 > > > > I see that this GPIO is for detecting vbus presence, not for > > driving/enabling 5v to Vbus from the board, that needs to be described more > clearly. > Ok > > Thanks a lot > > > > > +- pinctrl-names : a pinctrl state named "default" is optional > > > +- pinctrl-0 : pin control group > > > + see pinctrl/pinctrl-bindings.txt > > > + > > > Optional properties for usb-c-connector: > > > - power-role: should be one of "source", "sink" or "dual"(DRP) if typec > > > connector has power support. > > > > > > > > > Regards, > > > > Hans >
Hi Jun, On Mon, 2019-03-11 at 06:06 +0000, Jun Li wrote: > > > -----Original Message----- > > From: Chunfeng Yun <chunfeng.yun@mediatek.com> > > Sent: 2019年3月11日 13:33 > > To: Hans de Goede <hdegoede@redhat.com> > > Cc: Rob Herring <robh+dt@kernel.org>; Greg Kroah-Hartman > > <gregkh@linuxfoundation.org>; Heikki Krogerus > > <heikki.krogerus@linux.intel.com>; Mark Rutland <mark.rutland@arm.com>; > > Matthias Brugger <matthias.bgg@gmail.com>; Adam Thomson > > <Adam.Thomson.Opensource@diasemi.com>; Jun Li <jun.li@nxp.com>; Badhri > > Jagan Sridharan <badhri@google.com>; Andy Shevchenko > > <andy.shevchenko@gmail.com>; Min Guo <min.guo@mediatek.com>; > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; > > linux-usb@vger.kernel.org; linux-arm-kernel@lists.infradead.org; > > linux-mediatek@lists.infradead.org > > Subject: Re: [PATCH 1/5] dt-bindings: connector: add optional properties for > > Type-B > > > > Hi, > > > > On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: > > > Hi, > > > > > > On 08-03-19 07:13, Chunfeng Yun wrote: > > > > Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for > > > > usb-b-connector > > > > > > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > > > > --- > > > > .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ > > > > 1 file changed, 10 insertions(+) > > > > > > > > diff --git > > > > a/Documentation/devicetree/bindings/connector/usb-connector.txt > > > > b/Documentation/devicetree/bindings/connector/usb-connector.txt > > > > index a9a2f2fc44f2..7a07b0f4f973 100644 > > > > --- a/Documentation/devicetree/bindings/connector/usb-connector.txt > > > > +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt > > > > @@ -17,6 +17,16 @@ Optional properties: > > > > - self-powered: Set this property if the usb device that has its own power > > > > source. > > > > > > > > +Optional properties for usb-b-connector: > > > > +- id-gpios: gpio for USB ID pin. > > > > > > What about boards where the ID pin is *not* connected to a GPIO, but > > > e.g. to a special pin on the PMIC which can also detect an ACA adapter > > > ? Currently this case is handled by extcon drivers, but we have no way > > > to set e.g. vbus-supply for the connector. Maybe in this case the > > > usb-connector node should be a child of the PMIC node ? > > Yes, it would be, PMIC is in charger of detecting the status of ID pin > > > > > > And in many cases there also is a mux to switch the datalines between > > > the host and device(gadget) controllers, how should that be described > > > in this model? See the new usb-role-switch code under > > > drivers/usb/roles > > > > > > In some cases the mux is controlled through a gpio, so we may want to > > > add a "mux-gpios" here in which case we also need to define what 0/1 > > > means. > > I'm not sure, the mux seems not belong to this connector, and may need another > > driver to register usb-role-switch, similar to: > > > > [v2,2/2] usb: typec: add typec switch via GPIO control > > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork > > .kernel.org%2Fpatch%2F10834327%2F&data=02%7C01%7Cjun.li%40nxp.co > > m%7C963df62e15ed4bedb14d08d6a5e30de2%7C686ea1d3bc2b4c6fa92cd99c5 > > c301635%7C0%7C0%7C636878791953122760&sdata=grPIs2MbdaarTa17dr > > pASVkGpyW7TAexB24igOJopGU%3D&reserved=0 > > > > No, this is not for usb role switch, this is a typec switch driver to select the super speed > active channel by orientation(CC1/CC2). Got it, it's just an analogy:) > > Li Jun > > > > > > > > > +- vbus-gpios: gpio for USB VBUS pin. > > > > + see gpio/gpio.txt. > > > > +- vbus-supply: reference to the VBUS regulator, needed when > > > > +supports > > > > + dual-role mode. > > > > > > I think this needs some text that there can be either a vbus-gpio or a > > > vbus-supply. Oh wait reading: > > > > > > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpat > > > > > chwork.kernel.org%2Fpatch%2F10819377%2F&data=02%7C01%7Cjun.li%4 > > 0nx > > > > > p.com%7C963df62e15ed4bedb14d08d6a5e30de2%7C686ea1d3bc2b4c6fa92cd9 > > 9c5c3 > > > > > 01635%7C0%7C0%7C636878791953122760&sdata=Judz7gdwQTOC7Jh84 > > 57N4x21a > > > fWci%2FEH79ARqWZzbX8%3D&reserved=0 > > > > > > I see that this GPIO is for detecting vbus presence, not for > > > driving/enabling 5v to Vbus from the board, that needs to be described more > > clearly. > > Ok > > > > Thanks a lot > > > > > > > +- pinctrl-names : a pinctrl state named "default" is optional > > > > +- pinctrl-0 : pin control group > > > > + see pinctrl/pinctrl-bindings.txt > > > > + > > > > Optional properties for usb-c-connector: > > > > - power-role: should be one of "source", "sink" or "dual"(DRP) if typec > > > > connector has power support. > > > > > > > > > > > > > Regards, > > > > > > Hans > > >
Hi, On 11-03-19 06:33, Chunfeng Yun wrote: > Hi, > > On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: >> Hi, >> >> On 08-03-19 07:13, Chunfeng Yun wrote: >>> Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for >>> usb-b-connector >>> >>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> >>> --- >>> .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ >>> 1 file changed, 10 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt >>> index a9a2f2fc44f2..7a07b0f4f973 100644 >>> --- a/Documentation/devicetree/bindings/connector/usb-connector.txt >>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt >>> @@ -17,6 +17,16 @@ Optional properties: >>> - self-powered: Set this property if the usb device that has its own power >>> source. >>> >>> +Optional properties for usb-b-connector: >>> +- id-gpios: gpio for USB ID pin. >> >> What about boards where the ID pin is *not* connected to a GPIO, >> but e.g. to a special pin on the PMIC which can also detect >> an ACA adapter ? Currently this case is handled by extcon >> drivers, but we have no way to set e.g. vbus-supply for the >> connector. Maybe in this case the usb-connector node should >> be a child of the PMIC node ? > Yes, it would be, PMIC is in charger of detecting the status of ID pin Ok, then I think this should be documented too. >> And in many cases there also is a mux to switch the datalines >> between the host and device(gadget) controllers, how should >> that be described in this model? See the new usb-role-switch >> code under drivers/usb/roles >> >> In some cases the mux is controlled through a gpio, so we >> may want to add a "mux-gpios" here in which case we also >> need to define what 0/1 means. > I'm not sure, the mux seems not belong to this connector, > and may need another driver to register usb-role-switch, > similar to: > > [v2,2/2] usb: typec: add typec switch via GPIO control > https://patchwork.kernel.org/patch/10834327/ Right the mux/role-switch will need a driver, but the "owner" of the usb_connector, e.g. the PMIC or the owner of the id GPIO pin needs to know which device is the role-switch so that it can set the role correctly based on the id-pin. Your binding already contains Vbus info, allowing the owner of the usb_connector to enable/disable Vbus based on the id-pin, but the owner will also be responsible for setting the role-switch. Note we cannot simply assume there will be only one role-switch, we really need some link from the usb_connector to the role-switch (or if it is a GPIO driven role-switch simply a role-switch-gpios member in the usb_connector). Regards, Hans
Hi, On 11-03-19 09:06, Hans de Goede wrote: > Hi, > > On 11-03-19 06:33, Chunfeng Yun wrote: >> Hi, >> >> On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: >>> Hi, >>> >>> On 08-03-19 07:13, Chunfeng Yun wrote: >>>> Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for >>>> usb-b-connector >>>> >>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> >>>> --- >>>> .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ >>>> 1 file changed, 10 insertions(+) >>>> >>>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt >>>> index a9a2f2fc44f2..7a07b0f4f973 100644 >>>> --- a/Documentation/devicetree/bindings/connector/usb-connector.txt >>>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt >>>> @@ -17,6 +17,16 @@ Optional properties: >>>> - self-powered: Set this property if the usb device that has its own power >>>> source. >>>> +Optional properties for usb-b-connector: >>>> +- id-gpios: gpio for USB ID pin. >>> >>> What about boards where the ID pin is *not* connected to a GPIO, >>> but e.g. to a special pin on the PMIC which can also detect >>> an ACA adapter ? Currently this case is handled by extcon >>> drivers, but we have no way to set e.g. vbus-supply for the >>> connector. Maybe in this case the usb-connector node should >>> be a child of the PMIC node ? >> Yes, it would be, PMIC is in charger of detecting the status of ID pin > > Ok, then I think this should be documented too. > >>> And in many cases there also is a mux to switch the datalines >>> between the host and device(gadget) controllers, how should >>> that be described in this model? See the new usb-role-switch >>> code under drivers/usb/roles >>> >>> In some cases the mux is controlled through a gpio, so we >>> may want to add a "mux-gpios" here in which case we also >>> need to define what 0/1 means. >> I'm not sure, the mux seems not belong to this connector, >> and may need another driver to register usb-role-switch, >> similar to: >> >> [v2,2/2] usb: typec: add typec switch via GPIO control >> https://patchwork.kernel.org/patch/10834327/ > > Right the mux/role-switch will need a driver, but the "owner" > of the usb_connector, e.g. the PMIC or the owner of the > id GPIO pin needs to know which device is the role-switch so > that it can set the role correctly based on the id-pin. > > Your binding already contains Vbus info, allowing the owner > of the usb_connector to enable/disable Vbus based on the id-pin, > but the owner will also be responsible for setting the role-switch. > > Note we cannot simply assume there will be only one role-switch, > we really need some link from the usb_connector to the role-switch > (or if it is a GPIO driven role-switch simply a role-switch-gpios > member in the usb_connector). I see now in your "[PATCH v3 1/2] dt-bindings: usb: add documentation for typec switch via GPIO" that you plan to use a Documentation/devicetree/bindings/graph.txt style binding for this, adding a remote-endpoint to the orientation-switch (in that patch), or to the role-switch. But a Type-C port can have both an orientation-switch and a role-switch (and a mux if it supports e.g. DP-altmode), how is the driver driving the device which has the actual usb_c_connecter child-node to which the remote-endpoints for both the orientation- and the role-switch points supposed to figure out which is which ? Also it feels the wrong-way around to me to have the orientation-switch point to the usb_c_connector, to me it would make more sense to have the usb_c_connector point to a port on the orientation-switch. Regards, Hans
Hi, On 11-03-19 12:00, Hans de Goede wrote: > Hi, > > On 11-03-19 09:06, Hans de Goede wrote: >> Hi, >> >> On 11-03-19 06:33, Chunfeng Yun wrote: >>> Hi, >>> >>> On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: >>>> Hi, >>>> >>>> On 08-03-19 07:13, Chunfeng Yun wrote: >>>>> Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for >>>>> usb-b-connector >>>>> >>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> >>>>> --- >>>>> .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ >>>>> 1 file changed, 10 insertions(+) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt >>>>> index a9a2f2fc44f2..7a07b0f4f973 100644 >>>>> --- a/Documentation/devicetree/bindings/connector/usb-connector.txt >>>>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt >>>>> @@ -17,6 +17,16 @@ Optional properties: >>>>> - self-powered: Set this property if the usb device that has its own power >>>>> source. >>>>> +Optional properties for usb-b-connector: >>>>> +- id-gpios: gpio for USB ID pin. >>>> >>>> What about boards where the ID pin is *not* connected to a GPIO, >>>> but e.g. to a special pin on the PMIC which can also detect >>>> an ACA adapter ? Currently this case is handled by extcon >>>> drivers, but we have no way to set e.g. vbus-supply for the >>>> connector. Maybe in this case the usb-connector node should >>>> be a child of the PMIC node ? >>> Yes, it would be, PMIC is in charger of detecting the status of ID pin >> >> Ok, then I think this should be documented too. >> >>>> And in many cases there also is a mux to switch the datalines >>>> between the host and device(gadget) controllers, how should >>>> that be described in this model? See the new usb-role-switch >>>> code under drivers/usb/roles >>>> >>>> In some cases the mux is controlled through a gpio, so we >>>> may want to add a "mux-gpios" here in which case we also >>>> need to define what 0/1 means. >>> I'm not sure, the mux seems not belong to this connector, >>> and may need another driver to register usb-role-switch, >>> similar to: >>> >>> [v2,2/2] usb: typec: add typec switch via GPIO control >>> https://patchwork.kernel.org/patch/10834327/ >> >> Right the mux/role-switch will need a driver, but the "owner" >> of the usb_connector, e.g. the PMIC or the owner of the >> id GPIO pin needs to know which device is the role-switch so >> that it can set the role correctly based on the id-pin. >> >> Your binding already contains Vbus info, allowing the owner >> of the usb_connector to enable/disable Vbus based on the id-pin, >> but the owner will also be responsible for setting the role-switch. >> >> Note we cannot simply assume there will be only one role-switch, >> we really need some link from the usb_connector to the role-switch >> (or if it is a GPIO driven role-switch simply a role-switch-gpios >> member in the usb_connector). > > I see now in your "[PATCH v3 1/2] dt-bindings: usb: add documentation for > typec switch via GPIO" that you plan to use a > Documentation/devicetree/bindings/graph.txt style binding for this, > adding a remote-endpoint to the orientation-switch (in that patch), or > to the role-switch. > > But a Type-C port can have both an orientation-switch and a role-switch > (and a mux if it supports e.g. DP-altmode), how is the driver driving > the device which has the actual usb_c_connecter child-node to which > the remote-endpoints for both the orientation- and the role-switch points > supposed to figure out which is which ? > > Also it feels the wrong-way around to me to have the orientation-switch > point to the usb_c_connector, to me it would make more sense to have > the usb_c_connector point to a port on the orientation-switch. I just noticed you put an "orientation-switch" bool property in the device which has the orientation-switch property, if we do something similar for the role-switch then that should solve this. Regards, Hans
Hi Jun, Please pay attention to Hans' comments for your patch On Mon, 2019-03-11 at 12:04 +0100, Hans de Goede wrote: > Hi, > > On 11-03-19 12:00, Hans de Goede wrote: > > Hi, > > > > On 11-03-19 09:06, Hans de Goede wrote: > >> Hi, > >> > >> On 11-03-19 06:33, Chunfeng Yun wrote: > >>> Hi, > >>> > >>> On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: > >>>> Hi, > >>>> > >>>> On 08-03-19 07:13, Chunfeng Yun wrote: > >>>>> Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for > >>>>> usb-b-connector > >>>>> > >>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > >>>>> --- > >>>>> .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ > >>>>> 1 file changed, 10 insertions(+) > >>>>> > >>>>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt > >>>>> index a9a2f2fc44f2..7a07b0f4f973 100644 > >>>>> --- a/Documentation/devicetree/bindings/connector/usb-connector.txt > >>>>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt > >>>>> @@ -17,6 +17,16 @@ Optional properties: > >>>>> - self-powered: Set this property if the usb device that has its own power > >>>>> source. > >>>>> +Optional properties for usb-b-connector: > >>>>> +- id-gpios: gpio for USB ID pin. > >>>> > >>>> What about boards where the ID pin is *not* connected to a GPIO, > >>>> but e.g. to a special pin on the PMIC which can also detect > >>>> an ACA adapter ? Currently this case is handled by extcon > >>>> drivers, but we have no way to set e.g. vbus-supply for the > >>>> connector. Maybe in this case the usb-connector node should > >>>> be a child of the PMIC node ? > >>> Yes, it would be, PMIC is in charger of detecting the status of ID pin > >> > >> Ok, then I think this should be documented too. > >> > >>>> And in many cases there also is a mux to switch the datalines > >>>> between the host and device(gadget) controllers, how should > >>>> that be described in this model? See the new usb-role-switch > >>>> code under drivers/usb/roles > >>>> > >>>> In some cases the mux is controlled through a gpio, so we > >>>> may want to add a "mux-gpios" here in which case we also > >>>> need to define what 0/1 means. > >>> I'm not sure, the mux seems not belong to this connector, > >>> and may need another driver to register usb-role-switch, > >>> similar to: > >>> > >>> [v2,2/2] usb: typec: add typec switch via GPIO control > >>> https://patchwork.kernel.org/patch/10834327/ > >> > >> Right the mux/role-switch will need a driver, but the "owner" > >> of the usb_connector, e.g. the PMIC or the owner of the > >> id GPIO pin needs to know which device is the role-switch so > >> that it can set the role correctly based on the id-pin. > >> > >> Your binding already contains Vbus info, allowing the owner > >> of the usb_connector to enable/disable Vbus based on the id-pin, > >> but the owner will also be responsible for setting the role-switch. > >> > >> Note we cannot simply assume there will be only one role-switch, > >> we really need some link from the usb_connector to the role-switch > >> (or if it is a GPIO driven role-switch simply a role-switch-gpios > >> member in the usb_connector). > > > > I see now in your "[PATCH v3 1/2] dt-bindings: usb: add documentation for > > typec switch via GPIO" that you plan to use a > > Documentation/devicetree/bindings/graph.txt style binding for this, > > adding a remote-endpoint to the orientation-switch (in that patch), or > > to the role-switch. > > > > But a Type-C port can have both an orientation-switch and a role-switch > > (and a mux if it supports e.g. DP-altmode), how is the driver driving > > the device which has the actual usb_c_connecter child-node to which > > the remote-endpoints for both the orientation- and the role-switch points > > supposed to figure out which is which ? > > > > Also it feels the wrong-way around to me to have the orientation-switch > > point to the usb_c_connector, to me it would make more sense to have > > the usb_c_connector point to a port on the orientation-switch. > > I just noticed you put an "orientation-switch" bool property in the device > which has the orientation-switch property, if we do something similar for > the role-switch then that should solve this. > > Regards, > > Hans
Hi, On Mon, 2019-03-11 at 09:06 +0100, Hans de Goede wrote: > Hi, > > On 11-03-19 06:33, Chunfeng Yun wrote: > > Hi, > > > > On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: > >> Hi, > >> > >> On 08-03-19 07:13, Chunfeng Yun wrote: > >>> Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for > >>> usb-b-connector > >>> > >>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > >>> --- > >>> .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ > >>> 1 file changed, 10 insertions(+) > >>> > >>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt > >>> index a9a2f2fc44f2..7a07b0f4f973 100644 > >>> --- a/Documentation/devicetree/bindings/connector/usb-connector.txt > >>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt > >>> @@ -17,6 +17,16 @@ Optional properties: > >>> - self-powered: Set this property if the usb device that has its own power > >>> source. > >>> > >>> +Optional properties for usb-b-connector: > >>> +- id-gpios: gpio for USB ID pin. > >> > >> What about boards where the ID pin is *not* connected to a GPIO, > >> but e.g. to a special pin on the PMIC which can also detect > >> an ACA adapter ? Currently this case is handled by extcon > >> drivers, but we have no way to set e.g. vbus-supply for the > >> connector. Maybe in this case the usb-connector node should > >> be a child of the PMIC node ? > > Yes, it would be, PMIC is in charger of detecting the status of ID pin > > Ok, then I think this should be documented too. > > >> And in many cases there also is a mux to switch the datalines > >> between the host and device(gadget) controllers, how should > >> that be described in this model? See the new usb-role-switch > >> code under drivers/usb/roles > >> > >> In some cases the mux is controlled through a gpio, so we > >> may want to add a "mux-gpios" here in which case we also > >> need to define what 0/1 means. > > I'm not sure, the mux seems not belong to this connector, > > and may need another driver to register usb-role-switch, > > similar to: > > > > [v2,2/2] usb: typec: add typec switch via GPIO control > > https://patchwork.kernel.org/patch/10834327/ > > Right the mux/role-switch will need a driver, but the "owner" > of the usb_connector, e.g. the PMIC or the owner of the > id GPIO pin needs to know which device is the role-switch so > that it can set the role correctly based on the id-pin. > > Your binding already contains Vbus info, allowing the owner > of the usb_connector to enable/disable Vbus based on the id-pin, > but the owner will also be responsible for setting the role-switch. In this patch series, I make usb_connector driver enable/disable Vbus, but not the parent(USB controller) of usb_connector which registers a usb-role-switch, which way do you think it is better? Thanks > > Note we cannot simply assume there will be only one role-switch, > we really need some link from the usb_connector to the role-switch > (or if it is a GPIO driven role-switch simply a role-switch-gpios > member in the usb_connector). > > Regards, > > Hans >
Hi, On 12-03-19 04:18, Chunfeng Yun wrote: > Hi, > On Mon, 2019-03-11 at 09:06 +0100, Hans de Goede wrote: >> Hi, >> >> On 11-03-19 06:33, Chunfeng Yun wrote: >>> Hi, >>> >>> On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: >>>> Hi, >>>> >>>> On 08-03-19 07:13, Chunfeng Yun wrote: >>>>> Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for >>>>> usb-b-connector >>>>> >>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> >>>>> --- >>>>> .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ >>>>> 1 file changed, 10 insertions(+) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt >>>>> index a9a2f2fc44f2..7a07b0f4f973 100644 >>>>> --- a/Documentation/devicetree/bindings/connector/usb-connector.txt >>>>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt >>>>> @@ -17,6 +17,16 @@ Optional properties: >>>>> - self-powered: Set this property if the usb device that has its own power >>>>> source. >>>>> >>>>> +Optional properties for usb-b-connector: >>>>> +- id-gpios: gpio for USB ID pin. >>>> >>>> What about boards where the ID pin is *not* connected to a GPIO, >>>> but e.g. to a special pin on the PMIC which can also detect >>>> an ACA adapter ? Currently this case is handled by extcon >>>> drivers, but we have no way to set e.g. vbus-supply for the >>>> connector. Maybe in this case the usb-connector node should >>>> be a child of the PMIC node ? >>> Yes, it would be, PMIC is in charger of detecting the status of ID pin >> >> Ok, then I think this should be documented too. >> >>>> And in many cases there also is a mux to switch the datalines >>>> between the host and device(gadget) controllers, how should >>>> that be described in this model? See the new usb-role-switch >>>> code under drivers/usb/roles >>>> >>>> In some cases the mux is controlled through a gpio, so we >>>> may want to add a "mux-gpios" here in which case we also >>>> need to define what 0/1 means. >>> I'm not sure, the mux seems not belong to this connector, >>> and may need another driver to register usb-role-switch, >>> similar to: >>> >>> [v2,2/2] usb: typec: add typec switch via GPIO control >>> https://patchwork.kernel.org/patch/10834327/ >> >> Right the mux/role-switch will need a driver, but the "owner" >> of the usb_connector, e.g. the PMIC or the owner of the >> id GPIO pin needs to know which device is the role-switch so >> that it can set the role correctly based on the id-pin. >> >> Your binding already contains Vbus info, allowing the owner >> of the usb_connector to enable/disable Vbus based on the id-pin, >> but the owner will also be responsible for setting the role-switch. > In this patch series, I make usb_connector driver enable/disable Vbus, > but not the parent(USB controller) of usb_connector which registers a > usb-role-switch, which way do you think it is better? IMHO there should not be a driver for the usb_connector child-node, only for the parent-device of that child-node. There are going to be too many specific setups surrounding PMICs to be able to do a single generic driver for the connector. Regards, Hans
Hi, On Tue, 2019-03-12 at 13:45 +0100, Hans de Goede wrote: > Hi, > On 12-03-19 04:18, Chunfeng Yun wrote: > > Hi, > > On Mon, 2019-03-11 at 09:06 +0100, Hans de Goede wrote: > >> Hi, > >> > >> On 11-03-19 06:33, Chunfeng Yun wrote: > >>> Hi, > >>> > >>> On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: > >>>> Hi, > >>>> > >>>> On 08-03-19 07:13, Chunfeng Yun wrote: > >>>>> Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for > >>>>> usb-b-connector > >>>>> > >>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > >>>>> --- > >>>>> .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ > >>>>> 1 file changed, 10 insertions(+) > >>>>> > >>>>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt > >>>>> index a9a2f2fc44f2..7a07b0f4f973 100644 > >>>>> --- a/Documentation/devicetree/bindings/connector/usb-connector.txt > >>>>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt > >>>>> @@ -17,6 +17,16 @@ Optional properties: > >>>>> - self-powered: Set this property if the usb device that has its own power > >>>>> source. > >>>>> > >>>>> +Optional properties for usb-b-connector: > >>>>> +- id-gpios: gpio for USB ID pin. > >>>> > >>>> What about boards where the ID pin is *not* connected to a GPIO, > >>>> but e.g. to a special pin on the PMIC which can also detect > >>>> an ACA adapter ? Currently this case is handled by extcon > >>>> drivers, but we have no way to set e.g. vbus-supply for the > >>>> connector. Maybe in this case the usb-connector node should > >>>> be a child of the PMIC node ? > >>> Yes, it would be, PMIC is in charger of detecting the status of ID pin > >> > >> Ok, then I think this should be documented too. > >> > >>>> And in many cases there also is a mux to switch the datalines > >>>> between the host and device(gadget) controllers, how should > >>>> that be described in this model? See the new usb-role-switch > >>>> code under drivers/usb/roles > >>>> > >>>> In some cases the mux is controlled through a gpio, so we > >>>> may want to add a "mux-gpios" here in which case we also > >>>> need to define what 0/1 means. > >>> I'm not sure, the mux seems not belong to this connector, > >>> and may need another driver to register usb-role-switch, > >>> similar to: > >>> > >>> [v2,2/2] usb: typec: add typec switch via GPIO control > >>> https://patchwork.kernel.org/patch/10834327/ > >> > >> Right the mux/role-switch will need a driver, but the "owner" > >> of the usb_connector, e.g. the PMIC or the owner of the > >> id GPIO pin needs to know which device is the role-switch so > >> that it can set the role correctly based on the id-pin. > >> > >> Your binding already contains Vbus info, allowing the owner > >> of the usb_connector to enable/disable Vbus based on the id-pin, > >> but the owner will also be responsible for setting the role-switch. > > In this patch series, I make usb_connector driver enable/disable Vbus, > > but not the parent(USB controller) of usb_connector which registers a > > usb-role-switch, which way do you think it is better? > > IMHO there should not be a driver for the usb_connector child-node, > only for the parent-device of that child-node. If so, each USB controller driver should process this special case by itself when use a gpio to detect the status of ID pin, it's not a friendly way. And it's easy by using extcon-usb-gpio driver before, so we also want to provide a simple way when support usb_connector, no matter what method we choose. Ideally, the only one thing that USB controller driver need to do, just register a usb-role-switch, and leave decision when switch the role to other drivers, such as type-C, PMIC/charger, also include gpio > > There are going to be too many specific setups surrounding PMICs to > be able to do a single generic driver for the connector. > Fortunately, these patches only focus on the simplest gpio driven role switch :) Thanks > Regards, > > Hans >
Hi, On 3/13/19 11:15 AM, Chunfeng Yun wrote: > Hi, > On Tue, 2019-03-12 at 13:45 +0100, Hans de Goede wrote: >> Hi, >> On 12-03-19 04:18, Chunfeng Yun wrote: >>> Hi, >>> On Mon, 2019-03-11 at 09:06 +0100, Hans de Goede wrote: >>>> Hi, >>>> >>>> On 11-03-19 06:33, Chunfeng Yun wrote: >>>>> Hi, >>>>> >>>>> On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: >>>>>> Hi, >>>>>> >>>>>> On 08-03-19 07:13, Chunfeng Yun wrote: >>>>>>> Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for >>>>>>> usb-b-connector >>>>>>> >>>>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> >>>>>>> --- >>>>>>> .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ >>>>>>> 1 file changed, 10 insertions(+) >>>>>>> >>>>>>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt >>>>>>> index a9a2f2fc44f2..7a07b0f4f973 100644 >>>>>>> --- a/Documentation/devicetree/bindings/connector/usb-connector.txt >>>>>>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt >>>>>>> @@ -17,6 +17,16 @@ Optional properties: >>>>>>> - self-powered: Set this property if the usb device that has its own power >>>>>>> source. >>>>>>> >>>>>>> +Optional properties for usb-b-connector: >>>>>>> +- id-gpios: gpio for USB ID pin. >>>>>> >>>>>> What about boards where the ID pin is *not* connected to a GPIO, >>>>>> but e.g. to a special pin on the PMIC which can also detect >>>>>> an ACA adapter ? Currently this case is handled by extcon >>>>>> drivers, but we have no way to set e.g. vbus-supply for the >>>>>> connector. Maybe in this case the usb-connector node should >>>>>> be a child of the PMIC node ? >>>>> Yes, it would be, PMIC is in charger of detecting the status of ID pin >>>> >>>> Ok, then I think this should be documented too. >>>> >>>>>> And in many cases there also is a mux to switch the datalines >>>>>> between the host and device(gadget) controllers, how should >>>>>> that be described in this model? See the new usb-role-switch >>>>>> code under drivers/usb/roles >>>>>> >>>>>> In some cases the mux is controlled through a gpio, so we >>>>>> may want to add a "mux-gpios" here in which case we also >>>>>> need to define what 0/1 means. >>>>> I'm not sure, the mux seems not belong to this connector, >>>>> and may need another driver to register usb-role-switch, >>>>> similar to: >>>>> >>>>> [v2,2/2] usb: typec: add typec switch via GPIO control >>>>> https://patchwork.kernel.org/patch/10834327/ >>>> >>>> Right the mux/role-switch will need a driver, but the "owner" >>>> of the usb_connector, e.g. the PMIC or the owner of the >>>> id GPIO pin needs to know which device is the role-switch so >>>> that it can set the role correctly based on the id-pin. >>>> >>>> Your binding already contains Vbus info, allowing the owner >>>> of the usb_connector to enable/disable Vbus based on the id-pin, >>>> but the owner will also be responsible for setting the role-switch. >>> In this patch series, I make usb_connector driver enable/disable Vbus, >>> but not the parent(USB controller) of usb_connector which registers a >>> usb-role-switch, which way do you think it is better? >> >> IMHO there should not be a driver for the usb_connector child-node, >> only for the parent-device of that child-node. > If so, each USB controller driver should process this special case by > itself when use a gpio to detect the status of ID pin, it's not a > friendly way. And it's easy by using extcon-usb-gpio driver before, so > we also want to provide a simple way when support usb_connector, no > matter what method we choose. > > Ideally, the only one thing that USB controller driver need to do, just > register a usb-role-switch, and leave decision when switch the role to > other drivers, such as type-C, PMIC/charger, also include gpio > >> >> There are going to be too many specific setups surrounding PMICs to >> be able to do a single generic driver for the connector. >> > Fortunately, these patches only focus on the simplest gpio driven role > switch :) In that case there should be an extra compatible added to the usb_b_connector node to which the "simple gpio" driver binds, so that not all devicetree-s declaring a usb_b_connector child-node automatically get that driver bound, and the gpio / vbus properties should be mandatory properties for usb_b_connector child nodes declaring the extra compatible, rather then being optional for the generic compatible. Regards, Hans
Hi, On Wed, 2019-03-13 at 11:18 +0100, Hans de Goede wrote: > Hi, > > On 3/13/19 11:15 AM, Chunfeng Yun wrote: > > Hi, > > On Tue, 2019-03-12 at 13:45 +0100, Hans de Goede wrote: > >> Hi, > >> On 12-03-19 04:18, Chunfeng Yun wrote: > >>> Hi, > >>> On Mon, 2019-03-11 at 09:06 +0100, Hans de Goede wrote: > >>>> Hi, > >>>> > >>>> On 11-03-19 06:33, Chunfeng Yun wrote: > >>>>> Hi, > >>>>> > >>>>> On Fri, 2019-03-08 at 13:07 +0100, Hans de Goede wrote: > >>>>>> Hi, > >>>>>> > >>>>>> On 08-03-19 07:13, Chunfeng Yun wrote: > >>>>>>> Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for > >>>>>>> usb-b-connector > >>>>>>> > >>>>>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> > >>>>>>> --- > >>>>>>> .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ > >>>>>>> 1 file changed, 10 insertions(+) > >>>>>>> > >>>>>>> diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt > >>>>>>> index a9a2f2fc44f2..7a07b0f4f973 100644 > >>>>>>> --- a/Documentation/devicetree/bindings/connector/usb-connector.txt > >>>>>>> +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt > >>>>>>> @@ -17,6 +17,16 @@ Optional properties: > >>>>>>> - self-powered: Set this property if the usb device that has its own power > >>>>>>> source. > >>>>>>> > >>>>>>> +Optional properties for usb-b-connector: > >>>>>>> +- id-gpios: gpio for USB ID pin. > >>>>>> > >>>>>> What about boards where the ID pin is *not* connected to a GPIO, > >>>>>> but e.g. to a special pin on the PMIC which can also detect > >>>>>> an ACA adapter ? Currently this case is handled by extcon > >>>>>> drivers, but we have no way to set e.g. vbus-supply for the > >>>>>> connector. Maybe in this case the usb-connector node should > >>>>>> be a child of the PMIC node ? > >>>>> Yes, it would be, PMIC is in charger of detecting the status of ID pin > >>>> > >>>> Ok, then I think this should be documented too. > >>>> > >>>>>> And in many cases there also is a mux to switch the datalines > >>>>>> between the host and device(gadget) controllers, how should > >>>>>> that be described in this model? See the new usb-role-switch > >>>>>> code under drivers/usb/roles > >>>>>> > >>>>>> In some cases the mux is controlled through a gpio, so we > >>>>>> may want to add a "mux-gpios" here in which case we also > >>>>>> need to define what 0/1 means. > >>>>> I'm not sure, the mux seems not belong to this connector, > >>>>> and may need another driver to register usb-role-switch, > >>>>> similar to: > >>>>> > >>>>> [v2,2/2] usb: typec: add typec switch via GPIO control > >>>>> https://patchwork.kernel.org/patch/10834327/ > >>>> > >>>> Right the mux/role-switch will need a driver, but the "owner" > >>>> of the usb_connector, e.g. the PMIC or the owner of the > >>>> id GPIO pin needs to know which device is the role-switch so > >>>> that it can set the role correctly based on the id-pin. > >>>> > >>>> Your binding already contains Vbus info, allowing the owner > >>>> of the usb_connector to enable/disable Vbus based on the id-pin, > >>>> but the owner will also be responsible for setting the role-switch. > >>> In this patch series, I make usb_connector driver enable/disable Vbus, > >>> but not the parent(USB controller) of usb_connector which registers a > >>> usb-role-switch, which way do you think it is better? > >> > >> IMHO there should not be a driver for the usb_connector child-node, > >> only for the parent-device of that child-node. > > If so, each USB controller driver should process this special case by > > itself when use a gpio to detect the status of ID pin, it's not a > > friendly way. And it's easy by using extcon-usb-gpio driver before, so > > we also want to provide a simple way when support usb_connector, no > > matter what method we choose. > > > > Ideally, the only one thing that USB controller driver need to do, just > > register a usb-role-switch, and leave decision when switch the role to > > other drivers, such as type-C, PMIC/charger, also include gpio > > > >> > >> There are going to be too many specific setups surrounding PMICs to > >> be able to do a single generic driver for the connector. > >> > > Fortunately, these patches only focus on the simplest gpio driven role > > switch :) > > In that case there should be an extra compatible added to the > usb_b_connector node to which the "simple gpio" driver binds, > so that not all devicetree-s declaring a usb_b_connector child-node > automatically get that driver bound, Yes > and the gpio / vbus > properties should be mandatory properties for usb_b_connector > child nodes declaring the extra compatible, rather then being > optional for the generic compatible. At least one of id-gpios and vbus-gpios should exist, so both of them are optional, of course if only vbus-gpios exists, then only device mode is supported, in this case vbus is also optional. > > Regards, > > Hans >
diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt index a9a2f2fc44f2..7a07b0f4f973 100644 --- a/Documentation/devicetree/bindings/connector/usb-connector.txt +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt @@ -17,6 +17,16 @@ Optional properties: - self-powered: Set this property if the usb device that has its own power source. +Optional properties for usb-b-connector: +- id-gpios: gpio for USB ID pin. +- vbus-gpios: gpio for USB VBUS pin. + see gpio/gpio.txt. +- vbus-supply: reference to the VBUS regulator, needed when supports + dual-role mode. +- pinctrl-names : a pinctrl state named "default" is optional +- pinctrl-0 : pin control group + see pinctrl/pinctrl-bindings.txt + Optional properties for usb-c-connector: - power-role: should be one of "source", "sink" or "dual"(DRP) if typec connector has power support.
Add id-gpios, vbus-gpios, vbus-supply and pinctrl properties for usb-b-connector Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> --- .../devicetree/bindings/connector/usb-connector.txt | 10 ++++++++++ 1 file changed, 10 insertions(+)