Message ID | 1535362415-16559-3-git-send-email-loic.poulain@linaro.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | Andy Gross |
Headers | show |
Series | [v2,1/7] usb: chipidea: Add dynamic pinctrl selection | expand |
> Add compatibility for extcon-usb-gpio which can handle more than one cable per > instance, allowing coherency of USB cable states (USB/USB-HOST). These states > can be generated from ID or/and VBUS pins. > > In case only one extcon device is associated to the USB device, and this device > supports USB and USB-HOST cable states, we now use it for both VBUS (USB) and > ID (USB-HOST) notifier. > > Signed-off-by: Loic Poulain <loic.poulain@linaro.org> > --- > v2: no change > > drivers/usb/chipidea/core.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index > cdac778..afe85e2 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -702,6 +702,17 @@ static int ci_get_platdata(struct device *dev, > ext_id = extcon_get_edev_by_phandle(dev, 1); > if (IS_ERR(ext_id) && PTR_ERR(ext_id) != -ENODEV) > return PTR_ERR(ext_id); > + > + /* > + * Some extcon devices like extcon-usb-gpio have only one > + * instance for both USB and USB-HOST cable states. > + */ > + if (!IS_ERR(ext_vbus) && IS_ERR(ext_id)) { > + if (extcon_get_state(ext_vbus, EXTCON_USB) >= 0 && > + extcon_get_state(ext_vbus, EXTCON_USB_HOST) >= 0) { > + ext_id = ext_vbus; > + } > + } > } > Hi Loic, For your case, I suggest changing dts instead of changing source code, you would have both vbus and id phandle at your controller dts, and both point to the same extcon device. Other patches are ok for me. Peter
Hi Peter, On 28 August 2018 at 08:33, Peter Chen <peter.chen@nxp.com> wrote: > >> Add compatibility for extcon-usb-gpio which can handle more than one cable per >> instance, allowing coherency of USB cable states (USB/USB-HOST). These states >> can be generated from ID or/and VBUS pins. >> >> In case only one extcon device is associated to the USB device, and this device >> supports USB and USB-HOST cable states, we now use it for both VBUS (USB) and >> ID (USB-HOST) notifier. >> >> Signed-off-by: Loic Poulain <loic.poulain@linaro.org> >> --- >> v2: no change >> >> drivers/usb/chipidea/core.c | 11 +++++++++++ >> 1 file changed, 11 insertions(+) >> >> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index >> cdac778..afe85e2 100644 >> --- a/drivers/usb/chipidea/core.c >> +++ b/drivers/usb/chipidea/core.c >> @@ -702,6 +702,17 @@ static int ci_get_platdata(struct device *dev, >> ext_id = extcon_get_edev_by_phandle(dev, 1); >> if (IS_ERR(ext_id) && PTR_ERR(ext_id) != -ENODEV) >> return PTR_ERR(ext_id); >> + >> + /* >> + * Some extcon devices like extcon-usb-gpio have only one >> + * instance for both USB and USB-HOST cable states. >> + */ >> + if (!IS_ERR(ext_vbus) && IS_ERR(ext_id)) { >> + if (extcon_get_state(ext_vbus, EXTCON_USB) >= 0 && >> + extcon_get_state(ext_vbus, EXTCON_USB_HOST) >= 0) { >> + ext_id = ext_vbus; >> + } >> + } >> } >> > > Hi Loic, > > For your case, I suggest changing dts instead of changing source code, you would have both > vbus and id phandle at your controller dts, and both point to the same extcon device. Good point, will do. Regards, Loic
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index cdac778..afe85e2 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -702,6 +702,17 @@ static int ci_get_platdata(struct device *dev, ext_id = extcon_get_edev_by_phandle(dev, 1); if (IS_ERR(ext_id) && PTR_ERR(ext_id) != -ENODEV) return PTR_ERR(ext_id); + + /* + * Some extcon devices like extcon-usb-gpio have only one + * instance for both USB and USB-HOST cable states. + */ + if (!IS_ERR(ext_vbus) && IS_ERR(ext_id)) { + if (extcon_get_state(ext_vbus, EXTCON_USB) >= 0 && + extcon_get_state(ext_vbus, EXTCON_USB_HOST) >= 0) { + ext_id = ext_vbus; + } + } } cable = &platdata->vbus_extcon;
Add compatibility for extcon-usb-gpio which can handle more than one cable per instance, allowing coherency of USB cable states (USB/USB-HOST). These states can be generated from ID or/and VBUS pins. In case only one extcon device is associated to the USB device, and this device supports USB and USB-HOST cable states, we now use it for both VBUS (USB) and ID (USB-HOST) notifier. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> --- v2: no change drivers/usb/chipidea/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)