All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2,3/7] usb: chipidea: Support generic usb extcon
@ 2018-08-28  6:33 Peter Chen
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Chen @ 2018-08-28  6:33 UTC (permalink / raw)
  To: Loic Poulain
  Cc: linux-usb, linux-arm-msm, david.brown, robh+dt, bjorn.andersson,
	andy.gross, andy.shevchenko

> 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

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

* [v2,3/7] usb: chipidea: Support generic usb extcon
@ 2018-08-29  8:06 Loic Poulain
  0 siblings, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2018-08-29  8:06 UTC (permalink / raw)
  To: Peter Chen
  Cc: linux-usb, linux-arm-msm, david.brown, robh+dt, bjorn.andersson,
	andy.gross, andy.shevchenko

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

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

* [v2,3/7] usb: chipidea: Support generic usb extcon
@ 2018-08-27  9:33 Loic Poulain
  0 siblings, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2018-08-27  9:33 UTC (permalink / raw)
  To: Peter.Chen
  Cc: linux-usb, linux-arm-msm, david.brown, robh+dt, bjorn.andersson,
	andy.gross, andy.shevchenko, Loic Poulain

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;
+			}
+		}
 	}
 
 	cable = &platdata->vbus_extcon;

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

end of thread, other threads:[~2018-08-29  8:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-28  6:33 [v2,3/7] usb: chipidea: Support generic usb extcon Peter Chen
  -- strict thread matches above, loose matches on Subject: below --
2018-08-29  8:06 Loic Poulain
2018-08-27  9:33 Loic Poulain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.