RE: [PATCH v2 3/7] usb: chipidea: Support generic usb extcon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
> 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@xxxxxxxxxx>
> ---
>  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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux