Re: [PATCH v1 2/5] extcon: Return -EPROBE_DEFER when extcon device is not found

2018-11-14 Thread Chanwoo Choi
On 2018년 11월 14일 23:04, Andy Shevchenko wrote:
> On Wed, Nov 14, 2018 at 1:17 PM Andy Shevchenko
>  wrote:
>> On Wed, Nov 14, 2018 at 1:05 PM Chanwoo Choi  wrote:
> 
>>>> Changing NULL to -ENODEV is a trading bad to worse.
> 
>> P.S. I still disagree with your arguments in relation to de facto use of an 
>> API.
> 
> I spoke to colleagues of mine and they are agree that semantically
> -EPROBE_DEFER is a wrong error code from API that matches against some
> list.
> On the other hand, they agree with me that changing NULL to -ENODEV is
> a trading bad to worse.
> 
> So, I withdraw mine complaints against API.
> 

OK. Thanks.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics


Re: [PATCH v1 2/5] extcon: Return -EPROBE_DEFER when extcon device is not found

2018-11-14 Thread Chanwoo Choi
On 2018년 11월 14일 19:20, Andy Shevchenko wrote:
> On Wed, Nov 14, 2018 at 11:48 AM Chanwoo Choi  wrote:
>>
>> On 2018년 11월 14일 18:36, Andy Shevchenko wrote:
>>> On Wed, Nov 14, 2018 at 06:13:37PM +0900, Chanwoo Choi wrote:
>>>> On 2018년 11월 14일 17:35, Andy Shevchenko wrote:
>>>>> On Wed, Nov 14, 2018 at 1:53 AM Chanwoo Choi  
>>>>> wrote:
>>>>>
>>>>>> I was thinking about again to change from NULL to EPROBE_DEFER.
>>>>>>
>>>>>> extcon_get_extcon_dev() function was almost called in the probe function.
>>>>>> But, this function might be called on other position instead of probe.
>>>>>
>>>>> *Might be* sounds like a theoretical thing, care to share what is in you 
>>>>> mind?
>>>>> Current users and more important the new coming one are *all* doing the 
>>>>> same.
>>>>>
>>>>>> ENODEV is more correct error instead of EPROBE_DEFER.
>>>>>
>>>>> So, you are proposing to continue duplicating conversion from ENODEV
>>>>> to EPROBE_DEFER in *each* caller?
>>>>
>>>> The extcon core don't know the caller situation is in either probe() or 
>>>> other position
>>>> in the caller driver. The caller driver should decide the kind of error 
>>>> value
>>>> by using the return value of extcon_get_extcon_dev().
>>>>
>>>> extcon_get_extcon_dev() function cannot be modified for only one case.
>>>> If some device driver call extcon_get_extcon_dev() out of probe() fuction,
>>>> EPROBE_DEFER is not always correct.
>>>
>>> I agree with this, but look at the current state of affairs. All users do 
>>> the same.
>>> If we need to have another case we may consider this later.
>>
>> Because we know the potential wrong case of this change, I can't agree this 
>> change.
>> If extcon_get_extcon_dev() returns ENODEV instead of EPROBE_DEFER,
>> it is clear and then there are no problem on both current and future.
> 
> Changing NULL to -ENODEV is a trading bad to worse.
> I would not go that way, so, it's your call.

If you think that this change is not necessary, just keep the current code
without the modification. Please drop this patch on next version.

> 
>>> API inside the kernel are not carved in the stone.
> 
> Only can repeat myself (see above). While I see *theoretical*
> rationale on your side, mine has *practical* proofs.
> So, I'm giving up on this and will duplicate same what it's done in 4
> current callers.
> 

I think that it is more important for removing the potential wrong case
instead of removing the duplicate code. The many device drivers already
decided the proper error value by using the return value of function of 
kernel framework.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics


Re: [PATCH v1 2/5] extcon: Return -EPROBE_DEFER when extcon device is not found

2018-11-14 Thread Chanwoo Choi
On 2018년 11월 14일 18:36, Andy Shevchenko wrote:
> On Wed, Nov 14, 2018 at 06:13:37PM +0900, Chanwoo Choi wrote:
>> On 2018년 11월 14일 17:35, Andy Shevchenko wrote:
>>> On Wed, Nov 14, 2018 at 1:53 AM Chanwoo Choi  wrote:
>>>
>>>> I was thinking about again to change from NULL to EPROBE_DEFER.
>>>>
>>>> extcon_get_extcon_dev() function was almost called in the probe function.
>>>> But, this function might be called on other position instead of probe.
>>>
>>> *Might be* sounds like a theoretical thing, care to share what is in you 
>>> mind?
>>> Current users and more important the new coming one are *all* doing the 
>>> same.
>>>
>>>> ENODEV is more correct error instead of EPROBE_DEFER.
>>>
>>> So, you are proposing to continue duplicating conversion from ENODEV
>>> to EPROBE_DEFER in *each* caller?
>>
>> The extcon core don't know the caller situation is in either probe() or 
>> other position
>> in the caller driver. The caller driver should decide the kind of error value
>> by using the return value of extcon_get_extcon_dev().
>>
>> extcon_get_extcon_dev() function cannot be modified for only one case.
>> If some device driver call extcon_get_extcon_dev() out of probe() fuction,
>> EPROBE_DEFER is not always correct.
> 
> I agree with this, but look at the current state of affairs. All users do the 
> same.
> If we need to have another case we may consider this later.

Because we know the potential wrong case of this change, I can't agree this 
change.
If extcon_get_extcon_dev() returns ENODEV instead of EPROBE_DEFER,
it is clear and then there are no problem on both current and future.

> 
> API inside the kernel are not carved in the stone.
> 
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics


Re: [PATCH v1 2/5] extcon: Return -EPROBE_DEFER when extcon device is not found

2018-11-14 Thread Chanwoo Choi
On 2018년 11월 14일 17:35, Andy Shevchenko wrote:
> On Wed, Nov 14, 2018 at 1:53 AM Chanwoo Choi  wrote:
> 
>> I was thinking about again to change from NULL to EPROBE_DEFER.
>>
>> extcon_get_extcon_dev() function was almost called in the probe function.
>> But, this function might be called on other position instead of probe.
> 
> *Might be* sounds like a theoretical thing, care to share what is in you mind?
> Current users and more important the new coming one are *all* doing the same.
> 
>> ENODEV is more correct error instead of EPROBE_DEFER.
> 
> So, you are proposing to continue duplicating conversion from ENODEV
> to EPROBE_DEFER in *each* caller?

The extcon core don't know the caller situation is in either probe() or other 
position
in the caller driver. The caller driver should decide the kind of error value
by using the return value of extcon_get_extcon_dev().

extcon_get_extcon_dev() function cannot be modified for only one case.
If some device driver call extcon_get_extcon_dev() out of probe() fuction,
EPROBE_DEFER is not always correct.

> 
>> Sorry. I'll withdraw my opinion related acked-by tag until we are clarifying 
>> it.
> 
> I honestly don't know what to clarify here.
> 
> When we would have a real case we can change API correspondingly.
> For now, the score is 5:0 with use cases in practice.
> 
>> On 2018년 11월 12일 09:24, Chanwoo Choi wrote:
>>> On 2018년 11월 11일 03:10, Andy Shevchenko wrote:
>>>> All current users of extcon_get_extcon_dev() API considers
>>>> an extcon device a mandatory to appear. Thus, they all convert
>>>> NULL pointer to -EPROBE_DEFER error code.
>>>>
>>>> There is one more caller anticipated with the same requirements.
>>>>
>>>> To decrease a code duplication and a burden to the callers,
>>>> return -EPROBE_DEFER directly from extcon_get_extcon_dev().
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics


Re: [PATCH v1 2/5] extcon: Return -EPROBE_DEFER when extcon device is not found

2018-11-13 Thread Chanwoo Choi
Hi Andy,

I was thinking about again to change from NULL to EPROBE_DEFER.

extcon_get_extcon_dev() function was almost called in the probe function.
But, this function might be called on other position instead of probe.

ENODEV is more correct error instead of EPROBE_DEFER.

Sorry. I'll withdraw my opinion related acked-by tag until we are clarifying it.

On 2018년 11월 12일 09:24, Chanwoo Choi wrote:
> Hi Andy,
> 
> On 2018년 11월 11일 03:10, Andy Shevchenko wrote:
>> All current users of extcon_get_extcon_dev() API considers
>> an extcon device a mandatory to appear. Thus, they all convert
>> NULL pointer to -EPROBE_DEFER error code.
>>
>> There is one more caller anticipated with the same requirements.
>>
>> To decrease a code duplication and a burden to the callers,
>> return -EPROBE_DEFER directly from extcon_get_extcon_dev().
>>
>> Signed-off-by: Andy Shevchenko 
>> ---
>>  drivers/extcon/extcon-axp288.c| 4 ++--
>>  drivers/extcon/extcon.c   | 2 +-
>>  drivers/power/supply/axp288_charger.c | 8 
>>  drivers/usb/phy/phy-omap-otg.c| 6 +++---
>>  drivers/usb/typec/tcpm/fusb302.c  | 4 ++--
>>  5 files changed, 12 insertions(+), 12 deletions(-)
> 
> Acked-by: Chanwoo Choi 
> 
> Best Regards,
> Chanwoo Choi
> 
>>
>> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
>> index a983708b77a6..3472d3b756ed 100644
>> --- a/drivers/extcon/extcon-axp288.c
>> +++ b/drivers/extcon/extcon-axp288.c
>> @@ -360,8 +360,8 @@ static int axp288_extcon_probe(struct platform_device 
>> *pdev)
>>  name = acpi_dev_get_first_match_name("INT3496", NULL, -1);
>>  if (name) {
>>  info->id_extcon = extcon_get_extcon_dev(name);
>> -if (!info->id_extcon)
>> -return -EPROBE_DEFER;
>> +if (IS_ERR(info->id_extcon))
>> +return PTR_ERR(info->id_extcon);
>>  
>>  dev_info(dev, "controlling USB role\n");
>>  } else {
>> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
>> index 5ab0498be652..2bd0f2f33f05 100644
>> --- a/drivers/extcon/extcon.c
>> +++ b/drivers/extcon/extcon.c
>> @@ -884,7 +884,7 @@ struct extcon_dev *extcon_get_extcon_dev(const char 
>> *extcon_name)
>>  if (!strcmp(sd->name, extcon_name))
>>  goto out;
>>  }
>> -sd = NULL;
>> +sd = ERR_PTR(-EPROBE_DEFER);


(snip)

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics


Re: [PATCH v1 2/5] extcon: Return -EPROBE_DEFER when extcon device is not found

2018-11-11 Thread Chanwoo Choi
Hi Andy,

On 2018년 11월 11일 03:10, Andy Shevchenko wrote:
> All current users of extcon_get_extcon_dev() API considers
> an extcon device a mandatory to appear. Thus, they all convert
> NULL pointer to -EPROBE_DEFER error code.
> 
> There is one more caller anticipated with the same requirements.
> 
> To decrease a code duplication and a burden to the callers,
> return -EPROBE_DEFER directly from extcon_get_extcon_dev().
> 
> Signed-off-by: Andy Shevchenko 
> ---
>  drivers/extcon/extcon-axp288.c| 4 ++--
>  drivers/extcon/extcon.c   | 2 +-
>  drivers/power/supply/axp288_charger.c | 8 
>  drivers/usb/phy/phy-omap-otg.c| 6 +++---
>  drivers/usb/typec/tcpm/fusb302.c  | 4 ++--
>  5 files changed, 12 insertions(+), 12 deletions(-)

Acked-by: Chanwoo Choi 

Best Regards,
Chanwoo Choi

> 
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index a983708b77a6..3472d3b756ed 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -360,8 +360,8 @@ static int axp288_extcon_probe(struct platform_device 
> *pdev)
>   name = acpi_dev_get_first_match_name("INT3496", NULL, -1);
>   if (name) {
>   info->id_extcon = extcon_get_extcon_dev(name);
> - if (!info->id_extcon)
> - return -EPROBE_DEFER;
> + if (IS_ERR(info->id_extcon))
> + return PTR_ERR(info->id_extcon);
>  
>   dev_info(dev, "controlling USB role\n");
>   } else {
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 5ab0498be652..2bd0f2f33f05 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -884,7 +884,7 @@ struct extcon_dev *extcon_get_extcon_dev(const char 
> *extcon_name)
>   if (!strcmp(sd->name, extcon_name))
>   goto out;
>   }
> - sd = NULL;
> + sd = ERR_PTR(-EPROBE_DEFER);
>  out:
>   mutex_unlock(&extcon_dev_list_lock);
>   return sd;
> diff --git a/drivers/power/supply/axp288_charger.c 
> b/drivers/power/supply/axp288_charger.c
> index 735658ee1c60..8558577fccf5 100644
> --- a/drivers/power/supply/axp288_charger.c
> +++ b/drivers/power/supply/axp288_charger.c
> @@ -768,17 +768,17 @@ static int axp288_charger_probe(struct platform_device 
> *pdev)
>   info->regmap_irqc = axp20x->regmap_irqc;
>  
>   info->cable.edev = extcon_get_extcon_dev(AXP288_EXTCON_DEV_NAME);
> - if (info->cable.edev == NULL) {
> + if (IS_ERR(info->cable.edev)) {
>   dev_dbg(&pdev->dev, "%s is not ready, probe deferred\n",
>   AXP288_EXTCON_DEV_NAME);
> - return -EPROBE_DEFER;
> + return PTR_ERR(info->cable.edev);
>   }
>  
>   if (acpi_dev_present(USB_HOST_EXTCON_HID, NULL, -1)) {
>   info->otg.cable = extcon_get_extcon_dev(USB_HOST_EXTCON_NAME);
> - if (info->otg.cable == NULL) {
> + if (IS_ERR(info->otg.cable)) {
>   dev_dbg(dev, "EXTCON_USB_HOST is not ready, probe 
> deferred\n");
> - return -EPROBE_DEFER;
> + return PTR_ERR(info->otg.cable);
>   }
>   dev_info(&pdev->dev,
>"Using " USB_HOST_EXTCON_HID " extcon for usb-id\n");
> diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
> index ee0863c6553e..605314ddcd3d 100644
> --- a/drivers/usb/phy/phy-omap-otg.c
> +++ b/drivers/usb/phy/phy-omap-otg.c
> @@ -91,12 +91,12 @@ static int omap_otg_probe(struct platform_device *pdev)
>   int ret;
>   u32 rev;
>  
> - if (!config || !config->extcon)
> + if (!config)
>   return -ENODEV;
>  
>   extcon = extcon_get_extcon_dev(config->extcon);
> - if (!extcon)
> - return -EPROBE_DEFER;
> + if (IS_ERR(extcon))
> + return PTR_ERR(extcon);
>  
>   otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL);
>   if (!otg_dev)
> diff --git a/drivers/usb/typec/tcpm/fusb302.c 
> b/drivers/usb/typec/tcpm/fusb302.c
> index 43b64d9309d0..6d332066202b 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
> @@ -1767,8 +1767,8 @@ static int fusb302_probe(struct i2c_client *client,
>*/
>   if (device_property_read_string(dev, "fcs,extcon-name", &name) == 0) {
>   chip->extcon = extcon_get_extcon_dev(name);
> - if (!chip->extcon)
> - return -EPROBE_DEFER;
> + if (IS_ERR(chip->extcon))
> + return PTR_ERR(chip->extcon);
>   }
>  
>   chip->vbus = devm_regulator_get(chip->dev, "vbus");
> 



Re: [RFC 06/10] thermal: samsung: Remove support for Exynos5440

2018-04-25 Thread Chanwoo Choi
Hi Krzysztof,

On 2018년 04월 25일 05:32, Krzysztof Kozlowski wrote:
> The Exynos5440 is not actively developed, there are no development
> boards available and probably there are no real products with it.
> Remove wide-tree support for Exynos5440.
> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  .../devicetree/bindings/thermal/exynos-thermal.txt |  14 +-
>  drivers/thermal/samsung/exynos_tmu.c   | 155 
> +
>  drivers/thermal/samsung/exynos_tmu.h   |   1 -
>  3 files changed, 4 insertions(+), 166 deletions(-)


After applied this patch, I tested the build and found out
'exynos5440' keyword. There is one comment including 'exynos5440' as following:

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index f92f470bce21..cb525228cfe1 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -943,7 +943,7 @@ static void exynos4210_tmu_clear_irqs(struct 
exynos_tmu_data *data)
 * Exynos3250, Exynos4412, Exynos5250 and Exynos5260 incorrectly
 * states that INTCLEAR register has a different placing of bits
 * responsible for FALL IRQs than INTSTAT register.  Exynos5420
-* and Exynos5440 documentation is correct (Exynos4210 doesn't
+* documentation is correct (Exynos4210 doesn't
 * support FALL IRQs at all).
 */
writel(val_irq, data->base + tmu_intclear);

After removing it, looks good to me.
Reviewed-by: Chanwoo Choi 

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 07/10] pinctrl: samsung: Remove support for Exynos5440

2018-04-25 Thread Chanwoo Choi
Hi,

On 2018년 04월 25일 05:32, Krzysztof Kozlowski wrote:
> The Exynos5440 is not actively developed, there are no development
> boards available and probably there are no real products with it.
> Remove wide-tree support for Exynos5440.
> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  drivers/pinctrl/samsung/Kconfig  |   10 +-
>  drivers/pinctrl/samsung/Makefile |1 -
>  drivers/pinctrl/samsung/pinctrl-exynos5440.c | 1005 
> --
>  3 files changed, 2 insertions(+), 1014 deletions(-)
>  delete mode 100644 drivers/pinctrl/samsung/pinctrl-exynos5440.c

Looks good to me.
Reviewed-by: Chanwoo Choi 

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 03/10] cpufreq: exynos: Remove support for Exynos5440

2018-04-25 Thread Chanwoo Choi
Hi Krzysztof,

On 2018년 04월 25일 05:32, Krzysztof Kozlowski wrote:
> The Exynos5440 is not actively developed, there are no development
> boards available and probably there are no real products with it.
> Remove wide-tree support for Exynos5440.
> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  .../bindings/cpufreq/cpufreq-exynos5440.txt|  28 --
>  drivers/cpufreq/Kconfig.arm|  14 -
>  drivers/cpufreq/Makefile   |   1 -
>  drivers/cpufreq/exynos5440-cpufreq.c   | 452 
> -
>  4 files changed, 495 deletions(-)
>  delete mode 100644 
> Documentation/devicetree/bindings/cpufreq/cpufreq-exynos5440.txt
>  delete mode 100644 drivers/cpufreq/exynos5440-cpufreq.c
> 

Reviewed-by: Chanwoo Choi 

[snip]


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 04/10] clk: samsung: Remove support for Exynos5440

2018-04-25 Thread Chanwoo Choi
Hi Krzysztof,

On 2018년 04월 25일 05:32, Krzysztof Kozlowski wrote:
> The Exynos5440 is not actively developed, there are no development
> boards available and probably there are no real products with it.
> Remove wide-tree support for Exynos5440.
> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  .../devicetree/bindings/clock/exynos5440-clock.txt |  28 
>  drivers/clk/samsung/Makefile   |   1 -
>  drivers/clk/samsung/clk-exynos5440.c   | 167 
> -
>  include/dt-bindings/clock/exynos5440.h |  44 --
>  4 files changed, 240 deletions(-)
>  delete mode 100644 
> Documentation/devicetree/bindings/clock/exynos5440-clock.txt
>  delete mode 100644 drivers/clk/samsung/clk-exynos5440.c
>  delete mode 100644 include/dt-bindings/clock/exynos5440.h
> 

Looks good to me. Thanks.

Acked-by: Chanwoo Choi 

[snip]

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: always build usb/common/ targets; fixes extcon-axp288 build error

2018-04-24 Thread Chanwoo Choi
On 2018년 04월 17일 18:01, Hans de Goede wrote:
> Hi,
> 
> On 17-04-18 07:14, Randy Dunlap wrote:
>> From: Randy Dunlap 
>>
>> The extcon-axp288 driver selects USB_ROLE_SWITCH, but the USB
>> Makefile does not currently build drivers/usb/common/ (where
>> USB_ROLE_SWITCH code is) unless USB_COMMON is set, so modify
>> the USB Makefile to always descend into drivers/usb/common/
>> to build its configured targets.
>>
>> Fixes these build errors:
>>
>> ERROR: "usb_role_switch_get" [drivers/extcon/extcon-axp288.ko] undefined!
>> ERROR: "usb_role_switch_set_role" [drivers/extcon/extcon-axp288.ko] 
>> undefined!
>> ERROR: "usb_role_switch_get_role" [drivers/extcon/extcon-axp288.ko] 
>> undefined!
>> ERROR: "usb_role_switch_put" [drivers/extcon/extcon-axp288.ko] undefined!
>>
>> An alternative patch would be to select USB_COMMON in the EXTCON_AXP288
>> driver Kconfig entry, but this would build more code in
>> drivers/usb/common/ than is necessary.
> 
> Ah, that variant of fixing this got posted yesterday and I acked that,
> but I agree that this version is better.
> 
> Greg, what is your take on this fix?
> 
> Chanwoo Choi, please wait with merging the fix from yesterday until
> we've a decision which fix to use.

OK. I'll not send pull request for fix patches until deciding them.

> 
> Regards,
> 
> Hans
> 
> 
> 
>>
>> Reported-by: Fengguang Wu 
>> Signed-off-by: Randy Dunlap 
>> Cc: MyungJoo Ham 
>> Cc: Chanwoo Choi 
>> Cc: Hans de Goede 
>> Cc: Greg Kroah-Hartman 
>> Cc: Andy Shevchenko 
>> Cc: Heikki Krogerus 
>> Cc: linux-usb@vger.kernel.org
>> ---
>>   drivers/usb/Makefile |2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> --- lnx-417-rc1.orig/drivers/usb/Makefile
>> +++ lnx-417-rc1/drivers/usb/Makefile
>> @@ -60,7 +60,7 @@ obj-$(CONFIG_USB_CHIPIDEA)+= chipidea/
>>   obj-$(CONFIG_USB_RENESAS_USBHS)+= renesas_usbhs/
>>   obj-$(CONFIG_USB_GADGET)+= gadget/
>>   -obj-$(CONFIG_USB_COMMON)+= common/
>> +obj-y+= common/
>> obj-$(CONFIG_USBIP_CORE)+= usbip/
>>  
>>
> 
> 
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v9 12/12] extcon: axp288: Set USB role where necessary

2018-03-22 Thread Chanwoo Choi
On 2018년 03월 20일 21:57, Heikki Krogerus wrote:
> From: Hans de Goede 
> 
> The AXP288 BC1.2 charger detection / extcon code may seem like a strange
> place to add code to control the USB role-switch on devices with an AXP288,
> but there are 2 reasons to do this inside the axp288 extcon code:
> 
> 1) On many devices the USB role is controlled by ACPI AML code, but the AML
>code only switches between the host and none roles, because of Windows
>not really using device mode. To make device mode work we need to toggle
>between the none/device roles based on Vbus presence, and the axp288
>extcon gets interrupts on Vbus insertion / removal.
> 
> 2) In order for our BC1.2 charger detection to work properly the role
>mux must be properly set to device mode before we do the detection.
> 
> Also note the Kconfig help-text / obsolete depends on USB_PHY which are
> remnants from older never upstreamed code also controlling the mux from
> the axp288 extcon code.
> 
> This commit also adds code to get notifications from the INT3496 extcon
> device, which is used on some devices to notify the kernel about id-pin
> changes instead of them being handled through AML code.
> 
> This fixes:
> -Device mode not working on most CHT devices with an AXP288
> -Host mode not working on devices with an INT3496 ACPI device
> -Charger-type misdetection (always SDP) on devices with an INT3496 when the
>  USB role (always) gets initialized as host
> 
> Signed-off-by: Hans de Goede 
> Reviewed-by: Andy Shevchenko 
> Signed-off-by: Heikki Krogerus 
> ---
> Changes in v4:
> -Add Andy's Reviewed-by
> 
> Changes in v2:
> -Add depends on X86 to Kconfig (the AXP288 PMIC is only used on X86)
> -Use new acpi_dev_get_first_match_name() helper to get the INT3496 device-name
> -Add Heikki's Reviewed-by
> ---
>  drivers/extcon/Kconfig |   3 +-
>  drivers/extcon/extcon-axp288.c | 176 
> +++++++--
>  2 files changed, 170 insertions(+), 9 deletions(-)

Acked-by: Chanwoo Choi 

[snip]

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/6] dt-bindings: add bindings for USB physical connector

2018-03-11 Thread Chanwoo Choi
Hi Andrzej and Rob,

On 2018년 03월 09일 18:20, Andrzej Hajda wrote:
> Hi Chanwoo,
> 
> On 08.03.2018 02:52, Chanwoo Choi wrote:
>> Hi Andrzej, Archit,
>>
>> On 2018년 03월 07일 20:13, Andrzej Hajda wrote:
>>> Hi Chanwoo, Archit,
>>>
>>> On 07.03.2018 05:48, Chanwoo Choi wrote:
>>>> On 2018년 03월 07일 11:12, Chanwoo Choi wrote:
>>>>> Hi Rob and Andrzej,
>>>>>
>>>>> On 2018년 03월 06일 21:53, Andrzej Hajda wrote:
>>>>>> Hi Rob, Chanwoo, Krzysztof,
>>>>>>
>>>>>>
>>>>>> On 27.02.2018 08:11, Andrzej Hajda wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Thanks for reviews of previous iterations.
>>>>>>>
>>>>>>> This patchset introduces USB physical connector bindings, together with
>>>>>>> working example.
>>>>>>> I have removed RFC prefix - the patchset seems to be heading
>>>>>>> to a happy end :)
>>>>>>>
>>>>>>> v5: fixed extra parenthesis in dts, renamed extcon function.
>>>>>>> v4: improved binding descriptions, added missing reg in dts.
>>>>>>> v3: Separate binding for Samsung 11-pin connector, added full-blown 
>>>>>>> USB-C
>>>>>>> example.
>>>>>>> v2: I have addressed comments by Rob and Laurent, thanks 
>>>>>>>
>>>>>>> Changes in datail are described in the patches.
>>>>>>>
>>>>>>> Regards
>>>>>>> Andrzej
>>>>>>>
>>>>>>>
>>>>>>> Andrzej Hajda (5):
>>>>>>>   dt-bindings: add bindings for USB physical connector
>>>>>>>   dt-bindings: add bindings for Samsung micro-USB 11-pin connector
>>>>>>>   arm64: dts: exynos: add micro-USB connector node to TM2 platforms
>>>>>>>   arm64: dts: exynos: add OF graph between MHL and USB connector
>>>>>>>   extcon: add possibility to get extcon device by OF node
>>>>>>>
>>>>>>> Maciej Purski (1):
>>>>>>>   drm/bridge/sii8620: use micro-USB cable detection logic to detect MHL
>>>>>> It looks like all patches received R-B or acks (I forgot add Krzysztof's
>>>>>> acks for dts part).
>>>>>> Now I have a question how to merge them.
>>>>>> The only functional dependency is between bridge and extcon, and from
>>>>>> the formal PoV bindings should be merged 1st.
>>>>>> I can merge it:
>>>>>> 1. All patches via drm-misc tree.
>>>>>> 2. All patches except dts via drm-misc, and Krzysztof will merge dts via
>>>>>> samsung-soc tree.
>>>>>>
>>>>>> Is it OK, for all? Better ideas?
>>>>> Krzysztof picked the dts patches. I'll make the immutable branch based on 
>>>>> v4.16-rc1
>>>>> and apply them except for dts patchs. And I'll send the immutable branch 
>>>>> to Rob and Andrzej.
>>>>>
>>>>>
>>>> I made the immutable branch[1] as following: If you agree, I'll send pull 
>>>> request.
>>>> [1] 
>>>> https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git/log/?h=ib-extcon-drm-dt-v4.17
>>>>
>>>> Or you can make the immutable branch and send pull request to Rob and me.
>>>>
>>> It seems you took v5 instead of v6 version of extcon patch.
>> My mistake. I picked v6 and made the new immutable branch.
>> After Archit confirm it, I'll send pull request.
>>
> 
> 
> Lets just queue all patches (except dts) via extcon branch (thanks
> Daniel for advice), without making immutable branch.
> It seems to be a simplest acceptable approach.
> 
> You can add my ack to sii8620 bridge patch (as bridge maintainer), to
> fulfill process requirements.

I added your ack to sii8620 bridge patch and
send pull request for extcon, drm bridge and device-tree.

---

The following changes since commit 7928b2cbe55b2a410a0f5c1f154610059c57b1b2:

  Linux 4.16-rc1 (2018-02-11 15:04:29 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
ib-extcon-drm-dt-v4.17

for you to fetch changes up to 688838442147d9dd94c2ef7c2c31a35cf150c5fa:

  drm/bridge/sii8620: use micro-USB cable detection logic to detect MHL 
(2018-03-12 10:18:26 +0900)


Andrzej Hajda (3):
  dt-bindings: add bindings for USB physical connector
  dt-bindings: add bindings for Samsung micro-USB 11-pin connector
  extcon: add possibility to get extcon device by OF node

Maciej Purski (1):
  drm/bridge/sii8620: use micro-USB cable detection logic to detect MHL

 .../connector/samsung,usb-connector-11pin.txt  | 49 +++
 .../bindings/connector/usb-connector.txt   | 75 +
 drivers/extcon/extcon.c| 44 +++---
 drivers/gpu/drm/bridge/sil-sii8620.c   | 97 +-
 include/linux/extcon.h |  6 ++
 5 files changed, 258 insertions(+), 13 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/connector/samsung,usb-connector-11pin.txt
 create mode 100644 
Documentation/devicetree/bindings/connector/usb-connector.txt

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/6] dt-bindings: add bindings for USB physical connector

2018-03-07 Thread Chanwoo Choi
Hi Andrzej, Archit,

On 2018년 03월 07일 20:13, Andrzej Hajda wrote:
> Hi Chanwoo, Archit,
> 
> On 07.03.2018 05:48, Chanwoo Choi wrote:
>> On 2018년 03월 07일 11:12, Chanwoo Choi wrote:
>>> Hi Rob and Andrzej,
>>>
>>> On 2018년 03월 06일 21:53, Andrzej Hajda wrote:
>>>> Hi Rob, Chanwoo, Krzysztof,
>>>>
>>>>
>>>> On 27.02.2018 08:11, Andrzej Hajda wrote:
>>>>> Hi,
>>>>>
>>>>> Thanks for reviews of previous iterations.
>>>>>
>>>>> This patchset introduces USB physical connector bindings, together with
>>>>> working example.
>>>>> I have removed RFC prefix - the patchset seems to be heading
>>>>> to a happy end :)
>>>>>
>>>>> v5: fixed extra parenthesis in dts, renamed extcon function.
>>>>> v4: improved binding descriptions, added missing reg in dts.
>>>>> v3: Separate binding for Samsung 11-pin connector, added full-blown USB-C
>>>>> example.
>>>>> v2: I have addressed comments by Rob and Laurent, thanks 
>>>>>
>>>>> Changes in datail are described in the patches.
>>>>>
>>>>> Regards
>>>>> Andrzej
>>>>>
>>>>>
>>>>> Andrzej Hajda (5):
>>>>>   dt-bindings: add bindings for USB physical connector
>>>>>   dt-bindings: add bindings for Samsung micro-USB 11-pin connector
>>>>>   arm64: dts: exynos: add micro-USB connector node to TM2 platforms
>>>>>   arm64: dts: exynos: add OF graph between MHL and USB connector
>>>>>   extcon: add possibility to get extcon device by OF node
>>>>>
>>>>> Maciej Purski (1):
>>>>>   drm/bridge/sii8620: use micro-USB cable detection logic to detect MHL
>>>> It looks like all patches received R-B or acks (I forgot add Krzysztof's
>>>> acks for dts part).
>>>> Now I have a question how to merge them.
>>>> The only functional dependency is between bridge and extcon, and from
>>>> the formal PoV bindings should be merged 1st.
>>>> I can merge it:
>>>> 1. All patches via drm-misc tree.
>>>> 2. All patches except dts via drm-misc, and Krzysztof will merge dts via
>>>> samsung-soc tree.
>>>>
>>>> Is it OK, for all? Better ideas?
>>> Krzysztof picked the dts patches. I'll make the immutable branch based on 
>>> v4.16-rc1
>>> and apply them except for dts patchs. And I'll send the immutable branch to 
>>> Rob and Andrzej.
>>>
>>>
>> I made the immutable branch[1] as following: If you agree, I'll send pull 
>> request.
>> [1] 
>> https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git/log/?h=ib-extcon-drm-dt-v4.17
>>
>> Or you can make the immutable branch and send pull request to Rob and me.
>>
> 
> It seems you took v5 instead of v6 version of extcon patch.

My mistake. I picked v6 and made the new immutable branch.
After Archit confirm it, I'll send pull request.

> 
> Beside it I am OK with your immutable branch, Archit is it OK to do it
> this way in drm-misc?
> 
> 
> Regards
> 
> Andrzej
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/6] dt-bindings: add bindings for USB physical connector

2018-03-06 Thread Chanwoo Choi
On 2018년 03월 07일 11:12, Chanwoo Choi wrote:
> Hi Rob and Andrzej,
> 
> On 2018년 03월 06일 21:53, Andrzej Hajda wrote:
>> Hi Rob, Chanwoo, Krzysztof,
>>
>>
>> On 27.02.2018 08:11, Andrzej Hajda wrote:
>>> Hi,
>>>
>>> Thanks for reviews of previous iterations.
>>>
>>> This patchset introduces USB physical connector bindings, together with
>>> working example.
>>> I have removed RFC prefix - the patchset seems to be heading
>>> to a happy end :)
>>>
>>> v5: fixed extra parenthesis in dts, renamed extcon function.
>>> v4: improved binding descriptions, added missing reg in dts.
>>> v3: Separate binding for Samsung 11-pin connector, added full-blown USB-C
>>> example.
>>> v2: I have addressed comments by Rob and Laurent, thanks 
>>>
>>> Changes in datail are described in the patches.
>>>
>>> Regards
>>> Andrzej
>>>
>>>
>>> Andrzej Hajda (5):
>>>   dt-bindings: add bindings for USB physical connector
>>>   dt-bindings: add bindings for Samsung micro-USB 11-pin connector
>>>   arm64: dts: exynos: add micro-USB connector node to TM2 platforms
>>>   arm64: dts: exynos: add OF graph between MHL and USB connector
>>>   extcon: add possibility to get extcon device by OF node
>>>
>>> Maciej Purski (1):
>>>   drm/bridge/sii8620: use micro-USB cable detection logic to detect MHL
>>
>> It looks like all patches received R-B or acks (I forgot add Krzysztof's
>> acks for dts part).
>> Now I have a question how to merge them.
>> The only functional dependency is between bridge and extcon, and from
>> the formal PoV bindings should be merged 1st.
>> I can merge it:
>> 1. All patches via drm-misc tree.
>> 2. All patches except dts via drm-misc, and Krzysztof will merge dts via
>> samsung-soc tree.
>>
>> Is it OK, for all? Better ideas?
> 
> Krzysztof picked the dts patches. I'll make the immutable branch based on 
> v4.16-rc1
> and apply them except for dts patchs. And I'll send the immutable branch to 
> Rob and Andrzej.
> 
> 

I made the immutable branch[1] as following: If you agree, I'll send pull 
request.
[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git/log/?h=ib-extcon-drm-dt-v4.17

Or you can make the immutable branch and send pull request to Rob and me.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 0/6] dt-bindings: add bindings for USB physical connector

2018-03-06 Thread Chanwoo Choi
Hi Rob and Andrzej,

On 2018년 03월 06일 21:53, Andrzej Hajda wrote:
> Hi Rob, Chanwoo, Krzysztof,
> 
> 
> On 27.02.2018 08:11, Andrzej Hajda wrote:
>> Hi,
>>
>> Thanks for reviews of previous iterations.
>>
>> This patchset introduces USB physical connector bindings, together with
>> working example.
>> I have removed RFC prefix - the patchset seems to be heading
>> to a happy end :)
>>
>> v5: fixed extra parenthesis in dts, renamed extcon function.
>> v4: improved binding descriptions, added missing reg in dts.
>> v3: Separate binding for Samsung 11-pin connector, added full-blown USB-C
>> example.
>> v2: I have addressed comments by Rob and Laurent, thanks 
>>
>> Changes in datail are described in the patches.
>>
>> Regards
>> Andrzej
>>
>>
>> Andrzej Hajda (5):
>>   dt-bindings: add bindings for USB physical connector
>>   dt-bindings: add bindings for Samsung micro-USB 11-pin connector
>>   arm64: dts: exynos: add micro-USB connector node to TM2 platforms
>>   arm64: dts: exynos: add OF graph between MHL and USB connector
>>   extcon: add possibility to get extcon device by OF node
>>
>> Maciej Purski (1):
>>   drm/bridge/sii8620: use micro-USB cable detection logic to detect MHL
> 
> It looks like all patches received R-B or acks (I forgot add Krzysztof's
> acks for dts part).
> Now I have a question how to merge them.
> The only functional dependency is between bridge and extcon, and from
> the formal PoV bindings should be merged 1st.
> I can merge it:
> 1. All patches via drm-misc tree.
> 2. All patches except dts via drm-misc, and Krzysztof will merge dts via
> samsung-soc tree.
> 
> Is it OK, for all? Better ideas?

Krzysztof picked the dts patches. I'll make the immutable branch based on 
v4.16-rc1
and apply them except for dts patchs. And I'll send the immutable branch to Rob 
and Andrzej.


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 12/12] extcon: axp288: Set USB role where necessary

2018-03-01 Thread Chanwoo Choi
Hi,

Basically, I have no objection. But I'll reply the my ack tag 
after finishing the review of 'devcon and usb_role_switch' from USB maintainer.

And I have a question.
Before this patch, extcon-axp288 is used to detect charger connector
and extcon-intel-int3496 is used to detect the USB_HOST connector
on one h/w device?

Best Regards,
Chanwoo Choi
Samsung Electronics

On 2018년 03월 01일 00:07, Hans de Goede wrote:
> The AXP288 BC1.2 charger detection / extcon code may seem like a strange
> place to add code to control the USB role-switch on devices with an AXP288,
> but there are 2 reasons to do this inside the axp288 extcon code:
> 
> 1) On many devices the USB role is controlled by ACPI AML code, but the AML
>code only switches between the host and none roles, because of Windows
>not really using device mode. To make device mode work we need to toggle
>between the none/device roles based on Vbus presence, and the axp288
>extcon gets interrupts on Vbus insertion / removal.
> 
> 2) In order for our BC1.2 charger detection to work properly the role
>mux must be properly set to device mode before we do the detection.
> 
> Also note the Kconfig help-text / obsolete depends on USB_PHY which are
> remnants from older never upstreamed code also controlling the mux from
> the axp288 extcon code.
> 
> This commit also adds code to get notifications from the INT3496 extcon
> device, which is used on some devices to notify the kernel about id-pin
> changes instead of them being handled through AML code.
> 
> This fixes:
> -Device mode not working on most CHT devices with an AXP288
> -Host mode not working on devices with an INT3496 ACPI device
> -Charger-type misdetection (always SDP) on devices with an INT3496 when the
>  USB role (always) gets initialized as host
> 
> Reviewed-by: Heikki Krogerus 
> Reviewed-by: Andy Shevchenko 
> Signed-off-by: Hans de Goede 
> ---
> Changes in v4:
> -Add Andy's Reviewed-by
> 
> Changes in v2:
> -Add depends on X86 to Kconfig (the AXP288 PMIC is only used on X86)
> -Use new acpi_dev_get_first_match_name() helper to get the INT3496 device-name
> -Add Heikki's Reviewed-by
> ---
>  drivers/extcon/Kconfig |   3 +-
>  drivers/extcon/extcon-axp288.c | 177 
> +++--
>  2 files changed, 171 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
> index a7bca4207f44..de15bf55895b 100644
> --- a/drivers/extcon/Kconfig
> +++ b/drivers/extcon/Kconfig
> @@ -30,7 +30,8 @@ config EXTCON_ARIZONA
>  
>  config EXTCON_AXP288
>   tristate "X-Power AXP288 EXTCON support"
> - depends on MFD_AXP20X && USB_PHY
> + depends on MFD_AXP20X && USB_SUPPORT && X86
> + select USB_ROLE_SWITCH
>   help
> Say Y here to enable support for USB peripheral detection
> and USB MUX switching by X-Power AXP288 PMIC.
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index 3ec4c715e240..51e77c7a32c2 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -1,6 +1,7 @@
>  /*
>   * extcon-axp288.c - X-Power AXP288 PMIC extcon cable detection driver
>   *
> + * Copyright (c) 2017-2018 Hans de Goede 
>   * Copyright (C) 2015 Intel Corporation
>   * Author: Ramakrishna Pallala 
>   *
> @@ -14,6 +15,8 @@
>   * GNU General Public License for more details.
>   */
>  
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -25,6 +28,11 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
>  
>  /* Power source status register */
>  #define PS_STAT_VBUS_TRIGGER BIT(0)
> @@ -97,9 +105,19 @@ struct axp288_extcon_info {
>   struct device *dev;
>   struct regmap *regmap;
>   struct regmap_irq_chip_data *regmap_irqc;
> + struct usb_role_switch *role_sw;
> + struct work_struct role_work;
>   int irq[EXTCON_IRQ_END];
>   struct extcon_dev *edev;
> + struct extcon_dev *id_extcon;
> + struct notifier_block id_nb;
>   unsigned int previous_cable;
> + bool vbus_attach;
> +};
> +
> +static const struct x86_cpu_id cherry_trail_cpu_ids[] = {
> + { X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_AIRMONT, X86_FEATURE_ANY },
> + {}
>  };
>  
>  /* Power up/down reason string array */
> @@ -137,20 +155,74 @@ static void axp288_extcon_log_rsi(struct 
> axp288_extcon_info *info)
>   regmap_write(info->regmap, AXP288_PS_BOOT_REASON_REG, clear_mask);
>  }
>  
> -static int axp288_handle_chrg_det_event(struct axp288_extcon_info *inf

Re: [PATCH v5 6/6] drm/bridge/sii8620: use micro-USB cable detection logic to detect MHL

2018-03-01 Thread Chanwoo Choi
On 2018년 02월 28일 22:44, Andrzej Hajda wrote:
> On 27.02.2018 23:26, Chanwoo Choi wrote:
>> Hi,
>>
>> On 2018년 02월 27일 21:05, Andrzej Hajda wrote:
>>> On 27.02.2018 12:08, Chanwoo Choi wrote:
>>>> Hi,
>>>>
>>>> On 2018년 02월 27일 16:11, Andrzej Hajda wrote:
>>>>> From: Maciej Purski 
>>>>>
>>>>> Currently MHL chip must be turned on permanently to detect MHL cable. It
>>>>> duplicates micro-USB controller's (MUIC) functionality and consumes
>>>>> unnecessary power. Lets use extcon attached to MUIC to enable MHL chip
>>>>> only if it detects MHL cable.
>>>>>
>>>>> Signed-off-by: Maciej Purski 
>>>>> Signed-off-by: Andrzej Hajda 
>>>>> ---
>>>>> v5: updated extcon API
>>>>>
>>>>> This is rework of the patch by Maciej with following changes:
>>>>> - use micro-USB port bindings to get extcon, instead of extcon property,
>>>>> - fixed remove sequence,
>>>>> - fixed extcon get state logic.
>>>>>
>>>>> Code finding extcon node is hacky IMO, I guess ultimately it should be 
>>>>> done
>>>>> via some framework (maybe even extcon), or at least via helper, I hope it
>>>>> can stay as is until the proper solution will be merged.
>>>>>
>>>>> Signed-off-by: Andrzej Hajda 
>>>>> ---
>>>>>  drivers/gpu/drm/bridge/sil-sii8620.c | 97 
>>>>> ++--
>>>>>  1 file changed, 94 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c 
>>>>> b/drivers/gpu/drm/bridge/sil-sii8620.c
>>>>> index 9e785b8e0ea2..62b0adabcac2 100644
>>>>> --- a/drivers/gpu/drm/bridge/sil-sii8620.c
>>>>> +++ b/drivers/gpu/drm/bridge/sil-sii8620.c
>>>>> @@ -17,6 +17,7 @@
>>>>>  
>>>>>  #include 
>>>>>  #include 
>>>>> +#include 
>>>>>  #include 
>>>>>  #include 
>>>>>  #include 
>>>>> @@ -25,6 +26,7 @@
>>>>>  #include 
>>>>>  #include 
>>>>>  #include 
>>>>> +#include 
>>>>>  #include 
>>>>>  #include 
>>>>>  
>>>>> @@ -81,6 +83,10 @@ struct sii8620 {
>>>>>   struct edid *edid;
>>>>>   unsigned int gen2_write_burst:1;
>>>>>   enum sii8620_mt_state mt_state;
>>>>> + struct extcon_dev *extcon;
>>>>> + struct notifier_block extcon_nb;
>>>>> + struct work_struct extcon_wq;
>>>>> + int cable_state;
>>>>>   struct list_head mt_queue;
>>>>>   struct {
>>>>>   int r_size;
>>>>> @@ -2175,6 +2181,77 @@ static void sii8620_init_rcp_input_dev(struct 
>>>>> sii8620 *ctx)
>>>>>   ctx->rc_dev = rc_dev;
>>>>>  }
>>>>>  
>>>>> +static void sii8620_cable_out(struct sii8620 *ctx)
>>>>> +{
>>>>> + disable_irq(to_i2c_client(ctx->dev)->irq);
>>>>> + sii8620_hw_off(ctx);
>>>>> +}
>>>>> +
>>>>> +static void sii8620_extcon_work(struct work_struct *work)
>>>>> +{
>>>>> + struct sii8620 *ctx =
>>>>> + container_of(work, struct sii8620, extcon_wq);
>>>>> + int state = extcon_get_state(ctx->extcon, EXTCON_DISP_MHL);
>>>>> +
>>>>> + if (state == ctx->cable_state)
>>>>> + return;
>>>>> +
>>>>> + ctx->cable_state = state;
>>>>> +
>>>>> + if (state > 0)
>>>>> + sii8620_cable_in(ctx);
>>>>> + else
>>>>> + sii8620_cable_out(ctx);
>>>>> +}
>>>>> +
>>>>> +static int sii8620_extcon_notifier(struct notifier_block *self,
>>>>> + unsigned long event, void *ptr)
>>>>> +{
>>>>> + struct sii8620 *ctx =
>>>>> + container_of(self, struct sii8620, extcon_nb);
>>>>> +
>>>>> + schedule_work(&ctx->extcon_wq);
>>>>> +
>>>>> + return NOTIFY_DONE;
>>>>> +}
>>>>> +
>>>>> +static int sii8620_extcon_init

Re: [PATCH v5 6/6] drm/bridge/sii8620: use micro-USB cable detection logic to detect MHL

2018-02-27 Thread Chanwoo Choi
Hi,

On 2018년 02월 27일 21:05, Andrzej Hajda wrote:
> On 27.02.2018 12:08, Chanwoo Choi wrote:
>> Hi,
>>
>> On 2018년 02월 27일 16:11, Andrzej Hajda wrote:
>>> From: Maciej Purski 
>>>
>>> Currently MHL chip must be turned on permanently to detect MHL cable. It
>>> duplicates micro-USB controller's (MUIC) functionality and consumes
>>> unnecessary power. Lets use extcon attached to MUIC to enable MHL chip
>>> only if it detects MHL cable.
>>>
>>> Signed-off-by: Maciej Purski 
>>> Signed-off-by: Andrzej Hajda 
>>> ---
>>> v5: updated extcon API
>>>
>>> This is rework of the patch by Maciej with following changes:
>>> - use micro-USB port bindings to get extcon, instead of extcon property,
>>> - fixed remove sequence,
>>> - fixed extcon get state logic.
>>>
>>> Code finding extcon node is hacky IMO, I guess ultimately it should be done
>>> via some framework (maybe even extcon), or at least via helper, I hope it
>>> can stay as is until the proper solution will be merged.
>>>
>>> Signed-off-by: Andrzej Hajda 
>>> ---
>>>  drivers/gpu/drm/bridge/sil-sii8620.c | 97 
>>> ++--
>>>  1 file changed, 94 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c 
>>> b/drivers/gpu/drm/bridge/sil-sii8620.c
>>> index 9e785b8e0ea2..62b0adabcac2 100644
>>> --- a/drivers/gpu/drm/bridge/sil-sii8620.c
>>> +++ b/drivers/gpu/drm/bridge/sil-sii8620.c
>>> @@ -17,6 +17,7 @@
>>>  
>>>  #include 
>>>  #include 
>>> +#include 
>>>  #include 
>>>  #include 
>>>  #include 
>>> @@ -25,6 +26,7 @@
>>>  #include 
>>>  #include 
>>>  #include 
>>> +#include 
>>>  #include 
>>>  #include 
>>>  
>>> @@ -81,6 +83,10 @@ struct sii8620 {
>>> struct edid *edid;
>>> unsigned int gen2_write_burst:1;
>>> enum sii8620_mt_state mt_state;
>>> +   struct extcon_dev *extcon;
>>> +   struct notifier_block extcon_nb;
>>> +   struct work_struct extcon_wq;
>>> +   int cable_state;
>>> struct list_head mt_queue;
>>> struct {
>>> int r_size;
>>> @@ -2175,6 +2181,77 @@ static void sii8620_init_rcp_input_dev(struct 
>>> sii8620 *ctx)
>>> ctx->rc_dev = rc_dev;
>>>  }
>>>  
>>> +static void sii8620_cable_out(struct sii8620 *ctx)
>>> +{
>>> +   disable_irq(to_i2c_client(ctx->dev)->irq);
>>> +   sii8620_hw_off(ctx);
>>> +}
>>> +
>>> +static void sii8620_extcon_work(struct work_struct *work)
>>> +{
>>> +   struct sii8620 *ctx =
>>> +   container_of(work, struct sii8620, extcon_wq);
>>> +   int state = extcon_get_state(ctx->extcon, EXTCON_DISP_MHL);
>>> +
>>> +   if (state == ctx->cable_state)
>>> +   return;
>>> +
>>> +   ctx->cable_state = state;
>>> +
>>> +   if (state > 0)
>>> +   sii8620_cable_in(ctx);
>>> +   else
>>> +   sii8620_cable_out(ctx);
>>> +}
>>> +
>>> +static int sii8620_extcon_notifier(struct notifier_block *self,
>>> +   unsigned long event, void *ptr)
>>> +{
>>> +   struct sii8620 *ctx =
>>> +   container_of(self, struct sii8620, extcon_nb);
>>> +
>>> +   schedule_work(&ctx->extcon_wq);
>>> +
>>> +   return NOTIFY_DONE;
>>> +}
>>> +
>>> +static int sii8620_extcon_init(struct sii8620 *ctx)
>>> +{
>>> +   struct extcon_dev *edev;
>>> +   struct device_node *musb, *muic;
>>> +   int ret;
>>> +
>>> +   /* get micro-USB connector node */
>>> +   musb = of_graph_get_remote_node(ctx->dev->of_node, 1, -1);
>>> +   /* next get micro-USB Interface Controller node */
>>> +   muic = of_get_next_parent(musb);
>>> +
>>> +   if (!muic) {
>>> +   dev_info(ctx->dev, "no extcon found, switching to 'always on' 
>>> mode\n");
>>> +   return 0;
>>> +   }
>>> +
>>> +   edev = extcon_find_edev_by_node(muic);
>>> +   of_node_put(muic);
>>> +   if (IS_ERR(edev)) {
>>> +   if (PTR_ERR(edev) == -EPROBE_DEFER)
>>> +   return -EPROB

Re: [PATCH v5 6/6] drm/bridge/sii8620: use micro-USB cable detection logic to detect MHL

2018-02-27 Thread Chanwoo Choi
tx);
> + if (ret < 0) {
> + dev_err(ctx->dev, "failed to initialize EXTCON\n");
> + return ret;
> + }
> +
>   i2c_set_clientdata(client, ctx);
>  
>   ctx->bridge.funcs = &sii8620_bridge_funcs;
>   ctx->bridge.of_node = dev->of_node;
>   drm_bridge_add(&ctx->bridge);
>  
> - sii8620_cable_in(ctx);
> + if (!ctx->extcon)
> + sii8620_cable_in(ctx);
>  
>   return 0;
>  }
> @@ -2322,8 +2406,15 @@ static int sii8620_remove(struct i2c_client *client)
>  {
>   struct sii8620 *ctx = i2c_get_clientdata(client);
>  
> - disable_irq(to_i2c_client(ctx->dev)->irq);
> -     sii8620_hw_off(ctx);
> +     if (ctx->extcon) {
> + extcon_unregister_notifier(ctx->extcon, EXTCON_DISP_MHL,
> +&ctx->extcon_nb);

Don't need to unregister the notifier if using devm_extcon_register_notifier().

> + flush_work(&ctx->extcon_wq);
> + if (ctx->cable_state > 0)
> + sii8620_cable_out(ctx);
> + } else {
> + sii8620_cable_out(ctx);
> + }
>   drm_bridge_remove(&ctx->bridge);
>  
>   return 0;
> 

If you use the resource managed function (devm_extcon_register_notifier), Looks 
good to me.
Reviewed-by: Chanwoo Choi 

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 5/6] extcon: add possibility to get extcon device by OF node

2018-02-27 Thread Chanwoo Choi
Hi,

On 2018년 02월 27일 16:11, Andrzej Hajda wrote:
> Since extcon property is not allowed in DT, extcon subsystem requires
> another way to get extcon device. Lets try the simplest approach - get
> edev by of_node.
> 
> Signed-off-by: Andrzej Hajda 
> Acked-by: Chanwoo Choi 
> ---
> v5: function renamed to extcon_find_edev_by_node (Andy)
> v2: changed label to follow local convention (Chanwoo)
> ---
>  drivers/extcon/extcon.c | 44 ++--
>  include/linux/extcon.h  |  6 ++
>  2 files changed, 40 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index cb38c2747684..47a5ca9eb86d 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -1336,6 +1336,28 @@ void extcon_dev_unregister(struct extcon_dev *edev)
>  EXPORT_SYMBOL_GPL(extcon_dev_unregister);
>  
>  #ifdef CONFIG_OF
> +
> +/*
> + * extcon_find_edev_by_node - Find the extcon device from devicetree.
> + * @node : OF node identyfying edev

s/identyfying/identifying

> + *
> + * Return the pointer of extcon device if success or ERR_PTR(err) if fail.
> + */
> +struct extcon_dev *extcon_find_edev_by_node(struct device_node *node)
> +{
> + struct extcon_dev *edev;
> +
> + mutex_lock(&extcon_dev_list_lock);
> + list_for_each_entry(edev, &extcon_dev_list, entry)
> + if (edev->dev.parent && edev->dev.parent->of_node == node)
> + goto out;
> + edev = ERR_PTR(-EPROBE_DEFER);
> +out:
> + mutex_unlock(&extcon_dev_list_lock);
> +
> + return edev;
> +}
> +
>  /*
>   * extcon_get_edev_by_phandle - Get the extcon device from devicetree.
>   * @dev  : the instance to the given device
> @@ -1363,25 +1385,27 @@ struct extcon_dev *extcon_get_edev_by_phandle(struct 
> device *dev, int index)
>   return ERR_PTR(-ENODEV);
>   }
>  
> - mutex_lock(&extcon_dev_list_lock);
> - list_for_each_entry(edev, &extcon_dev_list, entry) {
> - if (edev->dev.parent && edev->dev.parent->of_node == node) {
> - mutex_unlock(&extcon_dev_list_lock);
> - of_node_put(node);
> - return edev;
> - }
> - }
> - mutex_unlock(&extcon_dev_list_lock);
> + edev = extcon_find_edev_by_node(node);
>   of_node_put(node);
>  
> - return ERR_PTR(-EPROBE_DEFER);
> + return edev;
>  }
> +
>  #else
> +
> +struct extcon_dev *extcon_find_edev_by_node(struct device_node *node)
> +{
> + return ERR_PTR(-ENOSYS);
> +}
> +
>  struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)
>  {
>   return ERR_PTR(-ENOSYS);
>  }
> +
>  #endif /* CONFIG_OF */
> +
> +EXPORT_SYMBOL_GPL(extcon_find_edev_by_node);
>  EXPORT_SYMBOL_GPL(extcon_get_edev_by_phandle);
>  
>  /**
> diff --git a/include/linux/extcon.h b/include/linux/extcon.h
> index 6d94e82c8ad9..7f033b1ea568 100644
> --- a/include/linux/extcon.h
> +++ b/include/linux/extcon.h
> @@ -230,6 +230,7 @@ extern void devm_extcon_unregister_notifier_all(struct 
> device *dev,
>   * Following APIs get the extcon_dev from devicetree or by through extcon 
> name.
>   */
>  extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
> +extern struct extcon_dev *extcon_find_edev_by_node(struct device_node *node);
>  extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev,
>int index);
>  
> @@ -283,6 +284,11 @@ static inline struct extcon_dev 
> *extcon_get_extcon_dev(const char *extcon_name)
>   return ERR_PTR(-ENODEV);
>  }
>  
> +static inline struct extcon_dev *extcon_find_edev_by_node(struct device_node 
> *node)
> +{
> + return ERR_PTR(-ENODEV);
> +}
> +
>  static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device 
> *dev,
>   int index)
>  {
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] extcon: Split out extcon header file for consumer and provider device

2017-10-22 Thread Chanwoo Choi
Dear all,

I got the reviews from all maintainers related to this patch.
So, I make the immutable branch on extcon.git and then send
the pull request in order to prevent the possible merge conflict.

Best Regards,
Chanwoo Choi
Samsung Electronics


The following changes since commit 2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e:

  Linux 4.14-rc1 (2017-09-16 15:47:51 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
ib-extcon-v4.15

for you to fetch changes up to 176aa36012135d172394a928a03fb03dfecd83f9:

  extcon: Split out extcon header file for consumer and provider device 
(2017-10-23 14:07:58 +0900)


Chanwoo Choi (1):
  extcon: Split out extcon header file for consumer and provider device

 drivers/extcon/extcon-adc-jack.c  |   2 +-
 drivers/extcon/extcon-arizona.c   |   2 +-
 drivers/extcon/extcon-axp288.c|   2 +-
 drivers/extcon/extcon-gpio.c  |   2 +-
 drivers/extcon/extcon-intel-cht-wc.c  |   2 +-
 drivers/extcon/extcon-intel-int3496.c |   2 +-
 drivers/extcon/extcon-max14577.c  |   2 +-
 drivers/extcon/extcon-max3355.c   |   2 +-
 drivers/extcon/extcon-max77693.c  |   2 +-
 drivers/extcon/extcon-max77843.c  |   2 +-
 drivers/extcon/extcon-max8997.c   |   2 +-
 drivers/extcon/extcon-qcom-spmi-misc.c|   2 +-
 drivers/extcon/extcon-rt8973a.c   |   2 +-
 drivers/extcon/extcon-sm5502.c|   2 +-
 drivers/extcon/extcon-usb-gpio.c  |   2 +-
 drivers/extcon/extcon-usbc-cros-ec.c  |   2 +-
 drivers/extcon/extcon.h   |   2 +-
 drivers/phy/allwinner/phy-sun4i-usb.c |   2 +-
 drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |   2 +-
 drivers/phy/renesas/phy-rcar-gen3-usb2.c  |   2 +-
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c |   2 +-
 drivers/power/supply/qcom_smbb.c  |   2 +-
 drivers/usb/gadget/udc/renesas_usb3.c |   2 +-
 drivers/usb/phy/phy-tahvo.c   |   2 +-
 include/linux/extcon-provider.h   | 142 ++
 include/linux/extcon.h| 109 +---
 include/linux/mfd/palmas.h|   2 +-
 27 files changed, 172 insertions(+), 129 deletions(-)
 create mode 100644 include/linux/extcon-provider.h


On 2017년 10월 23일 14:05, Kishon Vijay Abraham I wrote:
> 
> 
> On Wednesday 18 October 2017 07:44 AM, Chanwoo Choi wrote:
>> Gently Ping.
>>
>> Dear Kishon,
>>
>> Could you please review this patch for 'drivers/phy/*'?
> 
> sorry for the delay.. here it is
> 
> Acked-by: Kishon Vijay Abraham I 
>>
>> Regards,
>> Chanwoo Choi
>>
>> On 2017년 10월 12일 12:40, Chanwoo Choi wrote:
>>> Dear Kishon,
>>>
>>> Could you please review this patch?
>>> After that, I'll make the immutable brand and then send the pull request
>>> for power_supply, mfd, phy, usb and extcon framework.
>>>
>>> On 2017년 10월 10일 19:17, Chanwoo Choi wrote:
>>>> The extcon has two type of extcon devices as following.
>>>> - 'extcon provider deivce' adds new extcon device and detect the
>>>>state/properties of external connector. Also, it notifies the
>>>>state/properties to the extcon consumer device.
>>>> - 'extcon consumer device' gets the change state/properties
>>>>from extcon provider device.
>>>> Prior to that, include/linux/extcon.h contains all exported API for
>>>> both provider and consumer device driver. To clarify the meaning of
>>>> header file and to remove the wrong use-case on consumer device,
>>>> this patch separates into extcon.h and extcon-provider.h.
>>>>
>>>> [Description for include/linux/{extcon.h|extcon-provider.h}]
>>>> - extcon.h includes the extcon API and data structure for extcon consumer
>>>>   device driver. This header file contains the following APIs:
>>>>   : Register/unregister the notifier to catch the change of extcon device
>>>>   : Get the extcon device instance
>>>>   : Get the extcon device name
>>>>   : Get the state of each external connector
>>>>   : Get the property value of each external connector
>>>>   : Get the property capability of each external connector
>>>>
>>>> - extcon-provider.h includes the extcon API and data structure for extcon
>>>>   provider device driver. This header file contains the following APIs:
>>>>   : Include 'include/linux/extcon.h'
>

Re: [PATCH v3 10/14] extcon: intel-int3496: Add support for controlling the USB-role mux

2017-10-18 Thread Chanwoo Choi
On 2017년 10월 18일 18:14, Hans de Goede wrote:
> Hi,
> 
> On 18-10-17 04:33, Chanwoo Choi wrote:
>> Hi Hans,
>>
>> On 2017년 09월 23일 03:37, Hans de Goede wrote:
>>> Cherry Trail SoCs have a built-in USB-role mux for switching between
>>> the host and device controllers, rather then using an external mux
>>> controller by a GPIO.
>>>
>>> There is a driver using the mux-subsys to control this mux, this
>>> commit adds support to the intel-int3496 driver to get a mux_controller
>>> handle for the mux and set the mux through the mux-subsys rather then
>>> through a GPIO.
>>>
>>> Signed-off-by: Hans de Goede 
>>> ---
>>> Changes in v2:
>>> -Drop || COMPILE_TEST from Kconfig depends on, as we will now fail to
>>>   compile on !X86
>>> -Minor code style tweaks
>>> ---
>>>   drivers/extcon/Kconfig        |  3 +-
>>>   drivers/extcon/extcon-intel-int3496.c | 59 
>>> +++
>>>   2 files changed, 61 insertions(+), 1 deletion(-)
>>
>> Acked-by: Chanwoo Choi 
> 
> Note that there have been some comments on this series, and it
> is not sure yet how we are going to end up handling this. So
> please do not merge this yet, as we may end up with another
> solution.

Sure. I don't merge only this patch. After finishing the review
of this patchset, one maintainer apply all patches and then
send immutable pull request.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 3/4] extcon: add possibility to get extcon device by of node

2017-10-17 Thread Chanwoo Choi
Hi,

On 2017년 09월 28일 22:07, Andrzej Hajda wrote:
> Since extcon property is not allowed in DT, extcon subsystem requires
> another way to get extcon device. Lets try the simplest approach - get
> edev by of_node.
> 
> Signed-off-by: Andrzej Hajda 
> ---
>  drivers/extcon/extcon.c | 44 ++--
>  include/linux/extcon.h  |  6 ++
>  2 files changed, 40 insertions(+), 10 deletions(-)

Looks good to me. Just I added the minor comment.
Acked-by: Chanwoo Choi 

> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index cb38c2747684..fdb8c1d767c1 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -1336,6 +1336,28 @@ void extcon_dev_unregister(struct extcon_dev *edev)
>  EXPORT_SYMBOL_GPL(extcon_dev_unregister);
>  
>  #ifdef CONFIG_OF
> +
> +/*
> + * extcon_get_edev_by_of_node - Get the extcon device from devicetree.
> + * @node : OF node identyfying edev
> + *
> + * Return the pointer of extcon device if success or ERR_PTR(err) if fail.
> + */
> +struct extcon_dev *extcon_get_edev_by_of_node(struct device_node *node)
> +{
> + struct extcon_dev *edev;
> +
> + mutex_lock(&extcon_dev_list_lock);
> + list_for_each_entry(edev, &extcon_dev_list, entry)
> + if (edev->dev.parent && edev->dev.parent->of_node == node)
> + goto end;
> + edev = ERR_PTR(-EPROBE_DEFER);
> +end:

The extcon.c already use the 'out' statement for goto.
I'd like you to use 'out' instead of 'end'.

> + mutex_unlock(&extcon_dev_list_lock);
> +
> + return edev;
> +}
> +
>  /*
>   * extcon_get_edev_by_phandle - Get the extcon device from devicetree.
>   * @dev  : the instance to the given device
> @@ -1363,25 +1385,27 @@ struct extcon_dev *extcon_get_edev_by_phandle(struct 
> device *dev, int index)
>   return ERR_PTR(-ENODEV);
>   }
>  
> - mutex_lock(&extcon_dev_list_lock);
> - list_for_each_entry(edev, &extcon_dev_list, entry) {
> - if (edev->dev.parent && edev->dev.parent->of_node == node) {
> - mutex_unlock(&extcon_dev_list_lock);
> - of_node_put(node);
> - return edev;
> - }
> - }
> - mutex_unlock(&extcon_dev_list_lock);
> + edev = extcon_get_edev_by_of_node(node);
>   of_node_put(node);
>  
> - return ERR_PTR(-EPROBE_DEFER);
> + return edev;
>  }
> +
>  #else
> +
> +struct extcon_dev *extcon_get_edev_by_of_node(struct device_node *node)
> +{
> + return ERR_PTR(-ENOSYS);
> +}
> +
>  struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)
>  {
>   return ERR_PTR(-ENOSYS);
>  }
> +
>  #endif /* CONFIG_OF */
> +
> +EXPORT_SYMBOL_GPL(extcon_get_edev_by_of_node);
>  EXPORT_SYMBOL_GPL(extcon_get_edev_by_phandle);
>  
>  /**
> diff --git a/include/linux/extcon.h b/include/linux/extcon.h
> index 744d60ca80c3..2f88e7491672 100644
> --- a/include/linux/extcon.h
> +++ b/include/linux/extcon.h
> @@ -261,6 +261,7 @@ extern void devm_extcon_unregister_notifier_all(struct 
> device *dev,
>   * Following APIs get the extcon_dev from devicetree or by through extcon 
> name.
>   */
>  extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
> +extern struct extcon_dev *extcon_get_edev_by_of_node(struct device_node 
> *node);
>  extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev,
>int index);
>  
> @@ -382,6 +383,11 @@ static inline struct extcon_dev 
> *extcon_get_extcon_dev(const char *extcon_name)
>   return ERR_PTR(-ENODEV);
>  }
>  
> +static inline struct extcon_dev *extcon_get_edev_by_of_node(struct 
> device_node *node)
> +{
> + return ERR_PTR(-ENODEV);
> +}
> +
>  static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device 
> *dev,
>   int index)
>  {
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 10/14] extcon: intel-int3496: Add support for controlling the USB-role mux

2017-10-17 Thread Chanwoo Choi
Hi Hans,

On 2017년 09월 23일 03:37, Hans de Goede wrote:
> Cherry Trail SoCs have a built-in USB-role mux for switching between
> the host and device controllers, rather then using an external mux
> controller by a GPIO.
> 
> There is a driver using the mux-subsys to control this mux, this
> commit adds support to the intel-int3496 driver to get a mux_controller
> handle for the mux and set the mux through the mux-subsys rather then
> through a GPIO.
> 
> Signed-off-by: Hans de Goede 
> ---
> Changes in v2:
> -Drop || COMPILE_TEST from Kconfig depends on, as we will now fail to
>  compile on !X86
> -Minor code style tweaks
> ---
>  drivers/extcon/Kconfig|  3 +-
>  drivers/extcon/extcon-intel-int3496.c | 59 
> +++
>  2 files changed, 61 insertions(+), 1 deletion(-)

Acked-by: Chanwoo Choi 

[snip]

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] extcon: Split out extcon header file for consumer and provider device

2017-10-17 Thread Chanwoo Choi
Gently Ping.

Dear Kishon,

Could you please review this patch for 'drivers/phy/*'?

Regards,
Chanwoo Choi

On 2017년 10월 12일 12:40, Chanwoo Choi wrote:
> Dear Kishon,
> 
> Could you please review this patch?
> After that, I'll make the immutable brand and then send the pull request
> for power_supply, mfd, phy, usb and extcon framework.
> 
> On 2017년 10월 10일 19:17, Chanwoo Choi wrote:
>> The extcon has two type of extcon devices as following.
>> - 'extcon provider deivce' adds new extcon device and detect the
>>state/properties of external connector. Also, it notifies the
>>state/properties to the extcon consumer device.
>> - 'extcon consumer device' gets the change state/properties
>>from extcon provider device.
>> Prior to that, include/linux/extcon.h contains all exported API for
>> both provider and consumer device driver. To clarify the meaning of
>> header file and to remove the wrong use-case on consumer device,
>> this patch separates into extcon.h and extcon-provider.h.
>>
>> [Description for include/linux/{extcon.h|extcon-provider.h}]
>> - extcon.h includes the extcon API and data structure for extcon consumer
>>   device driver. This header file contains the following APIs:
>>   : Register/unregister the notifier to catch the change of extcon device
>>   : Get the extcon device instance
>>   : Get the extcon device name
>>   : Get the state of each external connector
>>   : Get the property value of each external connector
>>   : Get the property capability of each external connector
>>
>> - extcon-provider.h includes the extcon API and data structure for extcon
>>   provider device driver. This header file contains the following APIs:
>>   : Include 'include/linux/extcon.h'
>>   : Allocate the memory for extcon device instance
>>   : Register/unregister extcon device
>>   : Set the state of each external connector
>>   : Set the property value of each external connector
>>   : Set the property capability of each external connector
>>
>> Cc: Felipe Balbi 
>> Cc: Kishon Vijay Abraham I 
>> Cc: Greg Kroah-Hartman 
>> Acked-by: Sebastian Reichel 
>> Acked-by: Chen-Yu Tsai 
>> Acked-by: Charles Keepax 
>> Acked-by: Lee Jones 
>> Signed-off-by: Chanwoo Choi 
>> ---
>> Changes from v1:
>> - Don't touch drivers/usb/renesas_usbhs/common.h.
>> - Add acked-by from Sebastian Reichel (for drivers/power/supply/)
>> - Add acked-by from Chen-Yu Tsai (for phy-sun4i-usb.c & extcon-axp288.c)
>> - Add acked-by from Charles Keepax (for drivers/extcon/extcon-arizona.c)
>> - Add acked-by from Lee Jones (fo include/linux/mfd/palmas.h)
>>
>>  drivers/extcon/extcon-adc-jack.c  |   2 +-
>>  drivers/extcon/extcon-arizona.c   |   2 +-
>>  drivers/extcon/extcon-axp288.c|   2 +-
>>  drivers/extcon/extcon-gpio.c  |   2 +-
>>  drivers/extcon/extcon-intel-cht-wc.c  |   2 +-
>>  drivers/extcon/extcon-intel-int3496.c |   2 +-
>>  drivers/extcon/extcon-max14577.c  |   2 +-
>>  drivers/extcon/extcon-max3355.c   |   2 +-
>>  drivers/extcon/extcon-max77693.c  |   2 +-
>>  drivers/extcon/extcon-max77843.c  |   2 +-
>>  drivers/extcon/extcon-max8997.c   |   2 +-
>>  drivers/extcon/extcon-qcom-spmi-misc.c|   2 +-
>>  drivers/extcon/extcon-rt8973a.c   |   2 +-
>>  drivers/extcon/extcon-sm5502.c|   2 +-
>>  drivers/extcon/extcon-usb-gpio.c  |   2 +-
>>  drivers/extcon/extcon-usbc-cros-ec.c  |   2 +-
>>  drivers/extcon/extcon.h   |   2 +-
>>  drivers/phy/allwinner/phy-sun4i-usb.c |   2 +-
>>  drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |   2 +-
>>  drivers/phy/renesas/phy-rcar-gen3-usb2.c  |   2 +-
>>  drivers/phy/rockchip/phy-rockchip-inno-usb2.c |   2 +-
>>  drivers/power/supply/qcom_smbb.c  |   2 +-
>>  drivers/usb/gadget/udc/renesas_usb3.c |   2 +-
>>  drivers/usb/phy/phy-tahvo.c   |   2 +-
>>  include/linux/extcon-provider.h   | 142 
>> ++
>>  include/linux/extcon.h| 109 +---
>>  include/linux/mfd/palmas.h|   2 +-
>>  27 files changed, 172 insertions(+), 129 deletions(-)
>>  create mode 100644 include/linux/extcon-provider.h
>>
>> diff --git a/drivers/extcon/extcon-adc-jack.c 
>> b/drivers/extcon/extcon-adc-jack.c
>> in

Re: [PATCH v2] extcon: Split out extcon header file for consumer and provider device

2017-10-11 Thread Chanwoo Choi
Dear Kishon,

Could you please review this patch?
After that, I'll make the immutable brand and then send the pull request
for power_supply, mfd, phy, usb and extcon framework.

On 2017년 10월 10일 19:17, Chanwoo Choi wrote:
> The extcon has two type of extcon devices as following.
> - 'extcon provider deivce' adds new extcon device and detect the
>state/properties of external connector. Also, it notifies the
>state/properties to the extcon consumer device.
> - 'extcon consumer device' gets the change state/properties
>from extcon provider device.
> Prior to that, include/linux/extcon.h contains all exported API for
> both provider and consumer device driver. To clarify the meaning of
> header file and to remove the wrong use-case on consumer device,
> this patch separates into extcon.h and extcon-provider.h.
> 
> [Description for include/linux/{extcon.h|extcon-provider.h}]
> - extcon.h includes the extcon API and data structure for extcon consumer
>   device driver. This header file contains the following APIs:
>   : Register/unregister the notifier to catch the change of extcon device
>   : Get the extcon device instance
>   : Get the extcon device name
>   : Get the state of each external connector
>   : Get the property value of each external connector
>   : Get the property capability of each external connector
> 
> - extcon-provider.h includes the extcon API and data structure for extcon
>   provider device driver. This header file contains the following APIs:
>   : Include 'include/linux/extcon.h'
>   : Allocate the memory for extcon device instance
>   : Register/unregister extcon device
>   : Set the state of each external connector
>   : Set the property value of each external connector
>   : Set the property capability of each external connector
> 
> Cc: Felipe Balbi 
> Cc: Kishon Vijay Abraham I 
> Cc: Greg Kroah-Hartman 
> Acked-by: Sebastian Reichel 
> Acked-by: Chen-Yu Tsai 
> Acked-by: Charles Keepax 
> Acked-by: Lee Jones 
> Signed-off-by: Chanwoo Choi 
> ---
> Changes from v1:
> - Don't touch drivers/usb/renesas_usbhs/common.h.
> - Add acked-by from Sebastian Reichel (for drivers/power/supply/)
> - Add acked-by from Chen-Yu Tsai (for phy-sun4i-usb.c & extcon-axp288.c)
> - Add acked-by from Charles Keepax (for drivers/extcon/extcon-arizona.c)
> - Add acked-by from Lee Jones (fo include/linux/mfd/palmas.h)
> 
>  drivers/extcon/extcon-adc-jack.c  |   2 +-
>  drivers/extcon/extcon-arizona.c   |   2 +-
>  drivers/extcon/extcon-axp288.c|   2 +-
>  drivers/extcon/extcon-gpio.c  |   2 +-
>  drivers/extcon/extcon-intel-cht-wc.c  |   2 +-
>  drivers/extcon/extcon-intel-int3496.c |   2 +-
>  drivers/extcon/extcon-max14577.c  |   2 +-
>  drivers/extcon/extcon-max3355.c   |   2 +-
>  drivers/extcon/extcon-max77693.c  |   2 +-
>  drivers/extcon/extcon-max77843.c  |   2 +-
>  drivers/extcon/extcon-max8997.c   |   2 +-
>  drivers/extcon/extcon-qcom-spmi-misc.c|   2 +-
>  drivers/extcon/extcon-rt8973a.c   |   2 +-
>  drivers/extcon/extcon-sm5502.c|   2 +-
>  drivers/extcon/extcon-usb-gpio.c  |   2 +-
>  drivers/extcon/extcon-usbc-cros-ec.c  |   2 +-
>  drivers/extcon/extcon.h   |   2 +-
>  drivers/phy/allwinner/phy-sun4i-usb.c |   2 +-
>  drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |   2 +-
>  drivers/phy/renesas/phy-rcar-gen3-usb2.c  |   2 +-
>  drivers/phy/rockchip/phy-rockchip-inno-usb2.c |   2 +-
>  drivers/power/supply/qcom_smbb.c  |   2 +-
>  drivers/usb/gadget/udc/renesas_usb3.c |   2 +-
>  drivers/usb/phy/phy-tahvo.c   |   2 +-
>  include/linux/extcon-provider.h   | 142 
> ++
>  include/linux/extcon.h| 109 +---
>  include/linux/mfd/palmas.h|   2 +-
>  27 files changed, 172 insertions(+), 129 deletions(-)
>  create mode 100644 include/linux/extcon-provider.h
> 
> diff --git a/drivers/extcon/extcon-adc-jack.c 
> b/drivers/extcon/extcon-adc-jack.c
> index 6f6537ab0a79..3877d86c746a 100644
> --- a/drivers/extcon/extcon-adc-jack.c
> +++ b/drivers/extcon/extcon-adc-jack.c
> @@ -26,7 +26,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  
>  /**
>   * struct adc_jack_data - internal data for adc_jack device driver
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index f84da4a17724..da0e9bc4262f 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/ext

[PATCH v2] extcon: Split out extcon header file for consumer and provider device

2017-10-10 Thread Chanwoo Choi
The extcon has two type of extcon devices as following.
- 'extcon provider deivce' adds new extcon device and detect the
   state/properties of external connector. Also, it notifies the
   state/properties to the extcon consumer device.
- 'extcon consumer device' gets the change state/properties
   from extcon provider device.
Prior to that, include/linux/extcon.h contains all exported API for
both provider and consumer device driver. To clarify the meaning of
header file and to remove the wrong use-case on consumer device,
this patch separates into extcon.h and extcon-provider.h.

[Description for include/linux/{extcon.h|extcon-provider.h}]
- extcon.h includes the extcon API and data structure for extcon consumer
  device driver. This header file contains the following APIs:
  : Register/unregister the notifier to catch the change of extcon device
  : Get the extcon device instance
  : Get the extcon device name
  : Get the state of each external connector
  : Get the property value of each external connector
  : Get the property capability of each external connector

- extcon-provider.h includes the extcon API and data structure for extcon
  provider device driver. This header file contains the following APIs:
  : Include 'include/linux/extcon.h'
  : Allocate the memory for extcon device instance
  : Register/unregister extcon device
  : Set the state of each external connector
  : Set the property value of each external connector
  : Set the property capability of each external connector

Cc: Felipe Balbi 
Cc: Kishon Vijay Abraham I 
Cc: Greg Kroah-Hartman 
Acked-by: Sebastian Reichel 
Acked-by: Chen-Yu Tsai 
Acked-by: Charles Keepax 
Acked-by: Lee Jones 
Signed-off-by: Chanwoo Choi 
---
Changes from v1:
- Don't touch drivers/usb/renesas_usbhs/common.h.
- Add acked-by from Sebastian Reichel (for drivers/power/supply/)
- Add acked-by from Chen-Yu Tsai (for phy-sun4i-usb.c & extcon-axp288.c)
- Add acked-by from Charles Keepax (for drivers/extcon/extcon-arizona.c)
- Add acked-by from Lee Jones (fo include/linux/mfd/palmas.h)

 drivers/extcon/extcon-adc-jack.c  |   2 +-
 drivers/extcon/extcon-arizona.c   |   2 +-
 drivers/extcon/extcon-axp288.c|   2 +-
 drivers/extcon/extcon-gpio.c  |   2 +-
 drivers/extcon/extcon-intel-cht-wc.c  |   2 +-
 drivers/extcon/extcon-intel-int3496.c |   2 +-
 drivers/extcon/extcon-max14577.c  |   2 +-
 drivers/extcon/extcon-max3355.c   |   2 +-
 drivers/extcon/extcon-max77693.c  |   2 +-
 drivers/extcon/extcon-max77843.c  |   2 +-
 drivers/extcon/extcon-max8997.c   |   2 +-
 drivers/extcon/extcon-qcom-spmi-misc.c|   2 +-
 drivers/extcon/extcon-rt8973a.c   |   2 +-
 drivers/extcon/extcon-sm5502.c|   2 +-
 drivers/extcon/extcon-usb-gpio.c  |   2 +-
 drivers/extcon/extcon-usbc-cros-ec.c  |   2 +-
 drivers/extcon/extcon.h   |   2 +-
 drivers/phy/allwinner/phy-sun4i-usb.c |   2 +-
 drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |   2 +-
 drivers/phy/renesas/phy-rcar-gen3-usb2.c  |   2 +-
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c |   2 +-
 drivers/power/supply/qcom_smbb.c  |   2 +-
 drivers/usb/gadget/udc/renesas_usb3.c |   2 +-
 drivers/usb/phy/phy-tahvo.c   |   2 +-
 include/linux/extcon-provider.h   | 142 ++
 include/linux/extcon.h| 109 +---
 include/linux/mfd/palmas.h|   2 +-
 27 files changed, 172 insertions(+), 129 deletions(-)
 create mode 100644 include/linux/extcon-provider.h

diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
index 6f6537ab0a79..3877d86c746a 100644
--- a/drivers/extcon/extcon-adc-jack.c
+++ b/drivers/extcon/extcon-adc-jack.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 /**
  * struct adc_jack_data - internal data for adc_jack device driver
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index f84da4a17724..da0e9bc4262f 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index f4fd03e58e37..981fba56bc18 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -22,7 +22,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index ebed22f22d75..ab770adcca7e 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -17,7 +17,7 @@
  * GNU General Public License for more details.
  */
 
-#include 
+#include 
 #include 
 #include 
 #incl

Re: [PATCH] extcon: Split out extcon header file for consumer and provider device

2017-09-28 Thread Chanwoo Choi
Hi,

On 2017년 09월 29일 11:03, Yoshihiro Shimoda wrote:
> Hi,
> 
>> From: Chanwoo Choi
>> Sent: Friday, September 29, 2017 9:02 AM
>>
> < snip >
>>  drivers/phy/renesas/phy-rcar-gen3-usb2.c  |   2 +-
> < snip >
>>  drivers/usb/gadget/udc/renesas_usb3.c |   2 +-
> 
> These two drivers need the modification.
> But...
> 
> < snip >
>> diff --git a/drivers/usb/renesas_usbhs/common.h 
>> b/drivers/usb/renesas_usbhs/common.h
>> index 8c5fc12ad778..a78764bc23eb 100644
>> --- a/drivers/usb/renesas_usbhs/common.h
>> +++ b/drivers/usb/renesas_usbhs/common.h
>> @@ -17,7 +17,7 @@
>>  #ifndef RENESAS_USB_DRIVER_H
>>  #define RENESAS_USB_DRIVER_H
>>
>> -#include 
>> +#include 
> 
> Since this driver doesn't use any extcon-provider APIs for now,
> we doesn't need the modification, IIUC.

I don't modify 'drivers/usb/renesas_usbhs/common.h'
on v2 patch. Thanks for your comment.

> 
> Best regards,
> Yoshihiro Shimoda
> 
> 
> 
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] extcon: Split out extcon header file for consumer and provider device

2017-09-28 Thread Chanwoo Choi
The extcon has two type of extcon devices as following.
- 'extcon provider deivce' adds new extcon device and detect the
   state/properties of external connector. Also, it notifies the
   state/properties to the extcon consumer device.
- 'extcon consumer device' gets the change state/properties
   from extcon provider device.
Prior to that, include/linux/extcon.h contains all exported API for
both provider and consumer device driver. To clarify the meaning of
header file and to remove the wrong use-case on consumer device,
this patch separates into extcon.h and extcon-provider.h.

[Description for include/linux/{extcon.h|extcon-provider.h}]
- extcon.h includes the extcon API and data structure for extcon consumer
  device driver. This header file contains the following APIs:
  : Register/unregister the notifier to catch the change of extcon device
  : Get the extcon device instance
  : Get the extcon device name
  : Get the state of each external connector
  : Get the property value of each external connector
  : Get the property capability of each external connector

- extcon-provider.h includes the extcon API and data structure for extcon
  provider device driver. This header file contains the following APIs:
  : Include 'include/linux/extcon.h'
  : Allocate the memory for extcon device instance
  : Register/unregister extcon device
  : Set the state of each external connector
  : Set the property value of each external connector
  : Set the property capability of each external connector

Cc: Felipe Balbi 
Cc: Kishon Vijay Abraham I 
Cc: Greg Kroah-Hartman 
Cc: Sebastian Reichel 
Cc: Lee Jones 
Signed-off-by: Chanwoo Choi 
---
 drivers/extcon/extcon-adc-jack.c  |   2 +-
 drivers/extcon/extcon-arizona.c   |   2 +-
 drivers/extcon/extcon-axp288.c|   2 +-
 drivers/extcon/extcon-gpio.c  |   2 +-
 drivers/extcon/extcon-intel-cht-wc.c  |   2 +-
 drivers/extcon/extcon-intel-int3496.c |   2 +-
 drivers/extcon/extcon-max14577.c  |   2 +-
 drivers/extcon/extcon-max3355.c   |   2 +-
 drivers/extcon/extcon-max77693.c  |   2 +-
 drivers/extcon/extcon-max77843.c  |   2 +-
 drivers/extcon/extcon-max8997.c   |   2 +-
 drivers/extcon/extcon-qcom-spmi-misc.c|   2 +-
 drivers/extcon/extcon-rt8973a.c   |   2 +-
 drivers/extcon/extcon-sm5502.c|   2 +-
 drivers/extcon/extcon-usb-gpio.c  |   2 +-
 drivers/extcon/extcon-usbc-cros-ec.c  |   2 +-
 drivers/extcon/extcon.h   |   2 +-
 drivers/phy/allwinner/phy-sun4i-usb.c |   2 +-
 drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |   2 +-
 drivers/phy/renesas/phy-rcar-gen3-usb2.c  |   2 +-
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c |   2 +-
 drivers/power/supply/qcom_smbb.c  |   2 +-
 drivers/usb/gadget/udc/renesas_usb3.c |   2 +-
 drivers/usb/phy/phy-tahvo.c   |   2 +-
 drivers/usb/renesas_usbhs/common.h|   2 +-
 include/linux/extcon-provider.h   | 142 ++
 include/linux/extcon.h| 109 +---
 include/linux/mfd/palmas.h|   2 +-
 28 files changed, 173 insertions(+), 130 deletions(-)
 create mode 100644 include/linux/extcon-provider.h

diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
index 6f6537ab0a79..3877d86c746a 100644
--- a/drivers/extcon/extcon-adc-jack.c
+++ b/drivers/extcon/extcon-adc-jack.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 /**
  * struct adc_jack_data - internal data for adc_jack device driver
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index f84da4a17724..da0e9bc4262f 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index f4fd03e58e37..981fba56bc18 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -22,7 +22,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index ebed22f22d75..ab770adcca7e 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -17,7 +17,7 @@
  * GNU General Public License for more details.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-intel-cht-wc.c 
b/drivers/extcon/extcon-intel-cht-wc.c
index 91a0023074af..7c4bc8c44c3f 100644
--- a/drivers/extcon/extcon-intel-cht-wc.c
+++ b/drivers/extcon/extcon-intel-cht-wc.c
@@ -15,7 +15,7 @@
  * more details.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-int

Re: [PATCH v2 0/5] usb: Replace the deprecated extcon API

2017-08-15 Thread Chanwoo Choi
Dear Kishon and Felipe,

I applied these patches on extcon-next branch for v4.14-rc1.

And I created the immutable branch ('ib-extcon-usb-phy-4.14')
and send the pull-request for these patches in order to
prevent the merge conflict.

Best Regards,
Chanwoo Choi


The following changes since commit 5771a8c08880cdca3bfb4a3fc6d309d6bba20877:

  Linux v4.13-rc1 (2017-07-15 15:22:10 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git 
ib-extcon-usb-phy-4.14

for you to fetch changes up to 808ae8f3c7fefef3aece08820c108b68cdb06e1e:

  extcon: Remove deprecated extcon_set/get_cable_state_() (2017-08-16 09:21:49 
+0900)

--------
Chanwoo Choi (5):
  phy: qcom-usb-hs: Replace the extcon API
  phy: rockchip-inno-usb2: Replace the extcon API
  phy: phy-bcm-ns2-usbdrd: Replace the deprecated extcon API
  usb: gadget: udc: Replace the deprecated extcon API
  extcon: Remove deprecated extcon_set/get_cable_state_()

 drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |  8 
 drivers/phy/qualcomm/phy-qcom-usb-hs.c| 14 +++---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 +-
 drivers/usb/gadget/udc/snps_udc_plat.c|  6 +++---
 include/linux/extcon.h| 11 ---
 5 files changed, 15 insertions(+), 34 deletions(-)


On 2017년 08월 03일 17:20, Chanwoo Choi wrote:
> These patches replace the deprecated extcon API and remove them from extcon.
> 
> Patch4 (drivers/usb/gadget/udc/snps_udc_plat.c) neeeds the review
> from usb maintainer. After finishing the review of patch4,
> I'll create the immutable branch and send the pull request
> to both usb and phy maintainer.
> 
> Changes from v1:
> - Fix capital error for 'acked-by' tag on patch2
> - Add the acked-by tag of 'Kishon Vijay Abraham I' to patch3
> 
> Chanwoo Choi (5):
>   phy: qcom-usb-hs: Replace the extcon API
>   phy: rockchip-inno-usb2: Replace the extcon API
>   phy: phy-bcm-ns2-usbdrd: Replace the deprecated extcon API
>   usb: gadget: udc: Replace the deprecated extcon API
>   extcon: Remove deprecated extcon_set/get_cable_state_()
> 
>  drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |  8 
>  drivers/phy/qualcomm/phy-qcom-usb-hs.c| 14 +++---
>  drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 +-
>  drivers/usb/gadget/udc/snps_udc_plat.c|  6 +++---
>  include/linux/extcon.h| 11 ---
>  5 files changed, 15 insertions(+), 34 deletions(-)
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/5] usb: gadget: udc: Replace the deprecated extcon API

2017-08-15 Thread Chanwoo Choi
Hi,

On 2017년 08월 15일 18:48, Felipe Balbi wrote:
> 
> Hi,
> 
> Chanwoo Choi  writes:
>> This patch replaces the deprecated extcon API as following:
>> - extcon_get_cable_state_() -> extcon_get_state()
>>
>> Cc: Felipe Balbi 
>> Cc: Greg Kroah-Hartman 
>> Cc: Raviteja Garimella 
>> Signed-off-by: Chanwoo Choi 
> 
> Do you want to take these through your tree or mine? In case you want
> them in your tree:
> 
> Acked-by: Felipe Balbi 
> 

Thanks for review. These patches included the patch related to extcon (patch5).
So, After creating the immutable branch, I'll send the pull request to both
phy and usb maintainers.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/5] usb: gadget: udc: Replace the deprecated extcon API

2017-08-09 Thread Chanwoo Choi
Ping.

Hi Felipe,

I sent the first patch[1] more than three weeks ago.
But I didn't receive the any review.
[1] https://lkml.org/lkml/2017/7/16/523

This patch is very simple. After finishing the review
I'll remove the deprecated extcon API and then send
the immutable branch to both phy and usb maintainer.


Usually, I send the extcon's pull request to the GregKH
for the next merge after releasing 4.x-rc6.
(4.x-rc4 was released)

Please review this patch.


On 2017년 08월 07일 11:07, Chanwoo Choi wrote:
> Dear Felipe,
> 
> Could you please review this patch?
> I hope to remove the deprecated extcon API.
> 
> Regards,
> Chanwoo Choi
> 
> On 2017년 08월 03일 17:20, Chanwoo Choi wrote:
>> This patch replaces the deprecated extcon API as following:
>> - extcon_get_cable_state_() -> extcon_get_state()
>>
>> Cc: Felipe Balbi 
>> Cc: Greg Kroah-Hartman 
>> Cc: Raviteja Garimella 
>> Signed-off-by: Chanwoo Choi 
>> ---
>>  drivers/usb/gadget/udc/snps_udc_plat.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c 
>> b/drivers/usb/gadget/udc/snps_udc_plat.c
>> index 2e11f19e07ae..0ce7b3ba60ff 100644
>> --- a/drivers/usb/gadget/udc/snps_udc_plat.c
>> +++ b/drivers/usb/gadget/udc/snps_udc_plat.c
>> @@ -184,7 +184,7 @@ static int udc_plat_probe(struct platform_device *pdev)
>>  goto exit_phy;
>>  }
>>  
>> -ret = extcon_get_cable_state_(udc->edev, EXTCON_USB);
>> +ret = extcon_get_state(udc->edev, EXTCON_USB);
>>  if (ret < 0) {
>>  dev_err(dev, "Can't get cable state\n");
>>  goto exit_extcon;
>> @@ -273,7 +273,7 @@ static int udc_plat_suspend(struct device *dev)
>>  udc = dev_get_drvdata(dev);
>>  stop_udc(udc);
>>  
>> -if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
>> +if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
>>  dev_dbg(udc->dev, "device -> idle\n");
>>  stop_udc(udc);
>>  }
>> @@ -303,7 +303,7 @@ static int udc_plat_resume(struct device *dev)
>>  return ret;
>>  }
>>  
>> -if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
>> +if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
>>  dev_dbg(udc->dev, "idle -> device\n");
>>  start_udc(udc);
>>  }
>>
> 
> 
> 
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/5] usb: gadget: udc: Replace the deprecated extcon API

2017-08-06 Thread Chanwoo Choi
Dear Felipe,

Could you please review this patch?
I hope to remove the deprecated extcon API.

Regards,
Chanwoo Choi

On 2017년 08월 03일 17:20, Chanwoo Choi wrote:
> This patch replaces the deprecated extcon API as following:
> - extcon_get_cable_state_() -> extcon_get_state()
> 
> Cc: Felipe Balbi 
> Cc: Greg Kroah-Hartman 
> Cc: Raviteja Garimella 
> Signed-off-by: Chanwoo Choi 
> ---
>  drivers/usb/gadget/udc/snps_udc_plat.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c 
> b/drivers/usb/gadget/udc/snps_udc_plat.c
> index 2e11f19e07ae..0ce7b3ba60ff 100644
> --- a/drivers/usb/gadget/udc/snps_udc_plat.c
> +++ b/drivers/usb/gadget/udc/snps_udc_plat.c
> @@ -184,7 +184,7 @@ static int udc_plat_probe(struct platform_device *pdev)
>   goto exit_phy;
>   }
>  
> - ret = extcon_get_cable_state_(udc->edev, EXTCON_USB);
> + ret = extcon_get_state(udc->edev, EXTCON_USB);
>   if (ret < 0) {
>   dev_err(dev, "Can't get cable state\n");
>   goto exit_extcon;
> @@ -273,7 +273,7 @@ static int udc_plat_suspend(struct device *dev)
>   udc = dev_get_drvdata(dev);
>   stop_udc(udc);
>  
> - if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
> + if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
>   dev_dbg(udc->dev, "device -> idle\n");
>   stop_udc(udc);
>   }
> @@ -303,7 +303,7 @@ static int udc_plat_resume(struct device *dev)
>   return ret;
>   }
>  
> - if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
> + if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
>   dev_dbg(udc->dev, "idle -> device\n");
>   start_udc(udc);
>   }
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 5/5] extcon: Remove deprecated extcon_set/get_cable_state_()

2017-08-03 Thread Chanwoo Choi
The commit 575c2b867ee0 ("extcon: Rename the extcon_set/get_state()
to maintain the function naming pattern") renames the extcon function as
following: But, the extcon just keeps the old API to prevent the build error.
This patch removes the deprecatd extcon API.

- extcon_get_cable_state_() -> extcon_get_state()
- extcon_set_cable_state_() -> extcon_set_state_sync()

Signed-off-by: Chanwoo Choi 
---
 include/linux/extcon.h | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 7e206a9f88db..3ba02eecba2e 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -422,15 +422,4 @@ static inline int extcon_unregister_interest(struct 
extcon_specific_cable_nb
 {
return -EINVAL;
 }
-
-static inline int extcon_get_cable_state_(struct extcon_dev *edev, unsigned 
int id)
-{
-   return extcon_get_state(edev, id);
-}
-
-static inline int extcon_set_cable_state_(struct extcon_dev *edev, unsigned 
int id,
-  bool cable_state)
-{
-   return extcon_set_state_sync(edev, id, cable_state);
-}
 #endif /* __LINUX_EXTCON_H__ */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/5] usb: gadget: udc: Replace the deprecated extcon API

2017-08-03 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Cc: Felipe Balbi 
Cc: Greg Kroah-Hartman 
Cc: Raviteja Garimella 
Signed-off-by: Chanwoo Choi 
---
 drivers/usb/gadget/udc/snps_udc_plat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c 
b/drivers/usb/gadget/udc/snps_udc_plat.c
index 2e11f19e07ae..0ce7b3ba60ff 100644
--- a/drivers/usb/gadget/udc/snps_udc_plat.c
+++ b/drivers/usb/gadget/udc/snps_udc_plat.c
@@ -184,7 +184,7 @@ static int udc_plat_probe(struct platform_device *pdev)
goto exit_phy;
}
 
-   ret = extcon_get_cable_state_(udc->edev, EXTCON_USB);
+   ret = extcon_get_state(udc->edev, EXTCON_USB);
if (ret < 0) {
dev_err(dev, "Can't get cable state\n");
goto exit_extcon;
@@ -273,7 +273,7 @@ static int udc_plat_suspend(struct device *dev)
udc = dev_get_drvdata(dev);
stop_udc(udc);
 
-   if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
+   if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
dev_dbg(udc->dev, "device -> idle\n");
stop_udc(udc);
}
@@ -303,7 +303,7 @@ static int udc_plat_resume(struct device *dev)
return ret;
}
 
-   if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
+   if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
dev_dbg(udc->dev, "idle -> device\n");
start_udc(udc);
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/5] phy: phy-bcm-ns2-usbdrd: Replace the deprecated extcon API

2017-08-03 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_set_cable_state_() -> extcon_get_state()

Cc: Raviteja Garimella 
Acked-by: Kishon Vijay Abraham I 
Signed-off-by: Chanwoo Choi 
---
 drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c 
b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
index 9ae59e223131..d099a0c8cee5 100644
--- a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
+++ b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
@@ -253,16 +253,16 @@ static void extcon_work(struct work_struct *work)
vbus = gpiod_get_value_cansleep(driver->vbus_gpiod);
 
if (!id && vbus) { /* Host connected */
-   extcon_set_cable_state_(driver->edev, EXTCON_USB_HOST, true);
+   extcon_set_state_sync(driver->edev, EXTCON_USB_HOST, true);
pr_debug("Host cable connected\n");
driver->data->new_state = EVT_HOST;
connect_change(driver);
} else if (id && !vbus) { /* Disconnected */
-   extcon_set_cable_state_(driver->edev, EXTCON_USB_HOST, false);
-   extcon_set_cable_state_(driver->edev, EXTCON_USB, false);
+   extcon_set_state_sync(driver->edev, EXTCON_USB_HOST, false);
+   extcon_set_state_sync(driver->edev, EXTCON_USB, false);
pr_debug("Cable disconnected\n");
} else if (id && vbus) { /* Device connected */
-   extcon_set_cable_state_(driver->edev, EXTCON_USB, true);
+   extcon_set_state_sync(driver->edev, EXTCON_USB, true);
pr_debug("Device cable connected\n");
driver->data->new_state = EVT_DEVICE;
connect_change(driver);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/5] phy: rockchip-inno-usb2: Replace the extcon API

2017-08-03 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()
- extcon_set_cable_state_() -> extcon_set_state_sync()

Acked-by: Kishon Vijay Abraham I 
Signed-off-by: Chanwoo Choi 
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c 
b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 626883d9d176..ef033089b7a0 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -545,7 +545,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct 
*work)
rockchip_usb2phy_power_off(rport->phy);
/* fall through */
case OTG_STATE_B_IDLE:
-   if (extcon_get_cable_state_(rphy->edev, EXTCON_USB_HOST) > 0) {
+   if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) > 0) {
dev_dbg(&rport->phy->dev, "usb otg host connect\n");
rport->state = OTG_STATE_A_HOST;
rockchip_usb2phy_power_on(rport->phy);
@@ -598,7 +598,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct 
*work)
rport->vbus_attached = vbus_attach;
 
if (notify_charger && rphy->edev) {
-   extcon_set_cable_state_(rphy->edev,
+   extcon_set_state_sync(rphy->edev,
cable, vbus_attach);
if (cable == EXTCON_CHG_USB_SDP)
extcon_set_state_sync(rphy->edev,
@@ -619,7 +619,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct 
*work)
sch_work = true;
break;
case OTG_STATE_A_HOST:
-   if (extcon_get_cable_state_(rphy->edev, EXTCON_USB_HOST) == 0) {
+   if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) == 0) {
dev_dbg(&rport->phy->dev, "usb otg host disconnect\n");
rport->state = OTG_STATE_B_IDLE;
rockchip_usb2phy_power_off(rport->phy);
@@ -1006,8 +1006,8 @@ static int rockchip_usb2phy_otg_port_init(struct 
rockchip_usb2phy *rphy,
if (!IS_ERR(rphy->edev)) {
rport->event_nb.notifier_call = rockchip_otg_event;
 
-   ret = extcon_register_notifier(rphy->edev, EXTCON_USB_HOST,
-  &rport->event_nb);
+   ret = devm_extcon_register_notifier(rphy->dev, rphy->edev,
+   EXTCON_USB_HOST, &rport->event_nb);
if (ret)
dev_err(rphy->dev, "register USB HOST notifier 
failed\n");
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/5] usb: Replace the deprecated extcon API

2017-08-03 Thread Chanwoo Choi
These patches replace the deprecated extcon API and remove them from extcon.

Patch4 (drivers/usb/gadget/udc/snps_udc_plat.c) neeeds the review
from usb maintainer. After finishing the review of patch4,
I'll create the immutable branch and send the pull request
to both usb and phy maintainer.

Changes from v1:
- Fix capital error for 'acked-by' tag on patch2
- Add the acked-by tag of 'Kishon Vijay Abraham I' to patch3

Chanwoo Choi (5):
  phy: qcom-usb-hs: Replace the extcon API
  phy: rockchip-inno-usb2: Replace the extcon API
  phy: phy-bcm-ns2-usbdrd: Replace the deprecated extcon API
  usb: gadget: udc: Replace the deprecated extcon API
  extcon: Remove deprecated extcon_set/get_cable_state_()

 drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |  8 
 drivers/phy/qualcomm/phy-qcom-usb-hs.c| 14 +++---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 +-
 drivers/usb/gadget/udc/snps_udc_plat.c|  6 +++---
 include/linux/extcon.h| 11 ---
 5 files changed, 15 insertions(+), 34 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/5] phy: qcom-usb-hs: Replace the extcon API

2017-08-03 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- (deprecated) extcon_get_cable_state_() -> extcon_get_state()

Acked-by: Kishon Vijay Abraham I 
Signed-off-by: Chanwoo Choi 
---
 drivers/phy/qualcomm/phy-qcom-usb-hs.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c 
b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
index 4b20abc3ae2f..2d0c70b5589f 100644
--- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c
+++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
@@ -155,12 +155,12 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy)
}
 
if (uphy->vbus_edev) {
-   state = extcon_get_cable_state_(uphy->vbus_edev, EXTCON_USB);
+   state = extcon_get_state(uphy->vbus_edev, EXTCON_USB);
/* setup initial state */
qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state,
  uphy->vbus_edev);
-   ret = extcon_register_notifier(uphy->vbus_edev, EXTCON_USB,
-   &uphy->vbus_notify);
+   ret = devm_extcon_register_notifier(&ulpi->dev, uphy->vbus_edev,
+   EXTCON_USB, &uphy->vbus_notify);
if (ret)
goto err_ulpi;
}
@@ -179,16 +179,8 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy)
 
 static int qcom_usb_hs_phy_power_off(struct phy *phy)
 {
-   int ret;
struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
 
-   if (uphy->vbus_edev) {
-   ret = extcon_unregister_notifier(uphy->vbus_edev, EXTCON_USB,
-&uphy->vbus_notify);
-   if (ret)
-   return ret;
-   }
-
regulator_disable(uphy->v3p3);
regulator_disable(uphy->v1p8);
clk_disable_unprepare(uphy->sleep_clk);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/5] phy: rockchip-inno-usb2: Replace the extcon API

2017-08-03 Thread Chanwoo Choi
Hi,

On 2017년 08월 02일 14:12, Kishon Vijay Abraham I wrote:
> 
> 
> On Monday 17 July 2017 06:50 AM, Chanwoo Choi wrote:
>> This patch uses the resource-managed extcon API for 
>> extcon_register_notifier()
>> and replaces the deprecated extcon API as following:
>> - extcon_get_cable_state_() -> extcon_get_state()
>> - extcon_set_cable_state_() -> extcon_set_state_sync()
>>
>> Cc: linux-rockc...@lists.infradead.org
>> acked-by: Kishon Vijay Abraham I 
>   ^
> should be 'A' here.

My mistake. I'll fix it.

[snip]

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/5] phy: Replace the deprecated extcon API

2017-07-30 Thread Chanwoo Choi
Dear Kishon and Felipe,

Please review the patch3/patch4.


On 2017년 07월 17일 10:20, Chanwoo Choi wrote:
> These patches replace the deprecated extcon API
> and remove them from extcon framework.
> 
> The patch1 and patch2 were already acked by Kishon Vijay Abraham I.
> If patch3/patch4 are reviewed, I'll create the immutable branch
> and send the pull request to both usb and phy maintainer.
> 
> Chanwoo Choi (5):
>   phy: qcom-usb-hs: Replace the extcon API
>   phy: rockchip-inno-usb2: Replace the extcon API
>   phy: phy-bcm-ns2-usbdrd: Replace the deprecated extcon API
>   usb: gadget: udc: Replace the deprecated extcon API
>   extcon: Remove deprecated extcon_set/get_cable_state_()
> 
>  drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |  8 
>  drivers/phy/qualcomm/phy-qcom-usb-hs.c| 14 +++---
>  drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 +-
>  drivers/usb/gadget/udc/snps_udc_plat.c|  6 +++---
>  include/linux/extcon.h| 11 ---
>  5 files changed, 15 insertions(+), 34 deletions(-)
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] extcon: Remove deprecated extcon_set/get_cable_state_()

2017-07-16 Thread Chanwoo Choi
The commit 575c2b867ee0 ("extcon: Rename the extcon_set/get_state()
to maintain the function naming pattern") renames the extcon function as
following: But, the extcon just keeps the old API to prevent the build error.
This patch removes the deprecatd extcon API.

- extcon_get_cable_state_() -> extcon_get_state()
- extcon_set_cable_state_() -> extcon_set_state_sync()

Signed-off-by: Chanwoo Choi 
---
 include/linux/extcon.h | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 7e206a9f88db..3ba02eecba2e 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -422,15 +422,4 @@ static inline int extcon_unregister_interest(struct 
extcon_specific_cable_nb
 {
return -EINVAL;
 }
-
-static inline int extcon_get_cable_state_(struct extcon_dev *edev, unsigned 
int id)
-{
-   return extcon_get_state(edev, id);
-}
-
-static inline int extcon_set_cable_state_(struct extcon_dev *edev, unsigned 
int id,
-  bool cable_state)
-{
-   return extcon_set_state_sync(edev, id, cable_state);
-}
 #endif /* __LINUX_EXTCON_H__ */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] phy: phy-bcm-ns2-usbdrd: Replace the deprecated extcon API

2017-07-16 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_set_cable_state_() -> extcon_get_state()

Cc: Kishon Vijay Abraham I 
Cc: Raviteja Garimella 
Signed-off-by: Chanwoo Choi 
---
 drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c 
b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
index 9ae59e223131..d099a0c8cee5 100644
--- a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
+++ b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
@@ -253,16 +253,16 @@ static void extcon_work(struct work_struct *work)
vbus = gpiod_get_value_cansleep(driver->vbus_gpiod);
 
if (!id && vbus) { /* Host connected */
-   extcon_set_cable_state_(driver->edev, EXTCON_USB_HOST, true);
+   extcon_set_state_sync(driver->edev, EXTCON_USB_HOST, true);
pr_debug("Host cable connected\n");
driver->data->new_state = EVT_HOST;
connect_change(driver);
} else if (id && !vbus) { /* Disconnected */
-   extcon_set_cable_state_(driver->edev, EXTCON_USB_HOST, false);
-   extcon_set_cable_state_(driver->edev, EXTCON_USB, false);
+   extcon_set_state_sync(driver->edev, EXTCON_USB_HOST, false);
+   extcon_set_state_sync(driver->edev, EXTCON_USB, false);
pr_debug("Cable disconnected\n");
} else if (id && vbus) { /* Device connected */
-   extcon_set_cable_state_(driver->edev, EXTCON_USB, true);
+   extcon_set_state_sync(driver->edev, EXTCON_USB, true);
pr_debug("Device cable connected\n");
driver->data->new_state = EVT_DEVICE;
connect_change(driver);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] phy: Replace the deprecated extcon API

2017-07-16 Thread Chanwoo Choi
These patches replace the deprecated extcon API
and remove them from extcon framework.

The patch1 and patch2 were already acked by Kishon Vijay Abraham I.
If patch3/patch4 are reviewed, I'll create the immutable branch
and send the pull request to both usb and phy maintainer.

Chanwoo Choi (5):
  phy: qcom-usb-hs: Replace the extcon API
  phy: rockchip-inno-usb2: Replace the extcon API
  phy: phy-bcm-ns2-usbdrd: Replace the deprecated extcon API
  usb: gadget: udc: Replace the deprecated extcon API
  extcon: Remove deprecated extcon_set/get_cable_state_()

 drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c |  8 
 drivers/phy/qualcomm/phy-qcom-usb-hs.c| 14 +++---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 +-
 drivers/usb/gadget/udc/snps_udc_plat.c|  6 +++---
 include/linux/extcon.h| 11 ---
 5 files changed, 15 insertions(+), 34 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] usb: gadget: udc: Replace the deprecated extcon API

2017-07-16 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Cc: Felipe Balbi 
Cc: Greg Kroah-Hartman 
Cc: Raviteja Garimella 
Signed-off-by: Chanwoo Choi 
---
 drivers/usb/gadget/udc/snps_udc_plat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c 
b/drivers/usb/gadget/udc/snps_udc_plat.c
index 2e11f19e07ae..0ce7b3ba60ff 100644
--- a/drivers/usb/gadget/udc/snps_udc_plat.c
+++ b/drivers/usb/gadget/udc/snps_udc_plat.c
@@ -184,7 +184,7 @@ static int udc_plat_probe(struct platform_device *pdev)
goto exit_phy;
}
 
-   ret = extcon_get_cable_state_(udc->edev, EXTCON_USB);
+   ret = extcon_get_state(udc->edev, EXTCON_USB);
if (ret < 0) {
dev_err(dev, "Can't get cable state\n");
goto exit_extcon;
@@ -273,7 +273,7 @@ static int udc_plat_suspend(struct device *dev)
udc = dev_get_drvdata(dev);
stop_udc(udc);
 
-   if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
+   if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
dev_dbg(udc->dev, "device -> idle\n");
stop_udc(udc);
}
@@ -303,7 +303,7 @@ static int udc_plat_resume(struct device *dev)
return ret;
}
 
-   if (extcon_get_cable_state_(udc->edev, EXTCON_USB) > 0) {
+   if (extcon_get_state(udc->edev, EXTCON_USB) > 0) {
dev_dbg(udc->dev, "idle -> device\n");
start_udc(udc);
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] phy: rockchip-inno-usb2: Replace the extcon API

2017-07-16 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()
- extcon_set_cable_state_() -> extcon_set_state_sync()

Cc: linux-rockc...@lists.infradead.org
acked-by: Kishon Vijay Abraham I 
Signed-off-by: Chanwoo Choi 
---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c 
b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index 626883d9d176..ef033089b7a0 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -545,7 +545,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct 
*work)
rockchip_usb2phy_power_off(rport->phy);
/* fall through */
case OTG_STATE_B_IDLE:
-   if (extcon_get_cable_state_(rphy->edev, EXTCON_USB_HOST) > 0) {
+   if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) > 0) {
dev_dbg(&rport->phy->dev, "usb otg host connect\n");
rport->state = OTG_STATE_A_HOST;
rockchip_usb2phy_power_on(rport->phy);
@@ -598,7 +598,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct 
*work)
rport->vbus_attached = vbus_attach;
 
if (notify_charger && rphy->edev) {
-   extcon_set_cable_state_(rphy->edev,
+   extcon_set_state_sync(rphy->edev,
cable, vbus_attach);
if (cable == EXTCON_CHG_USB_SDP)
extcon_set_state_sync(rphy->edev,
@@ -619,7 +619,7 @@ static void rockchip_usb2phy_otg_sm_work(struct work_struct 
*work)
sch_work = true;
break;
case OTG_STATE_A_HOST:
-   if (extcon_get_cable_state_(rphy->edev, EXTCON_USB_HOST) == 0) {
+   if (extcon_get_state(rphy->edev, EXTCON_USB_HOST) == 0) {
dev_dbg(&rport->phy->dev, "usb otg host disconnect\n");
rport->state = OTG_STATE_B_IDLE;
rockchip_usb2phy_power_off(rport->phy);
@@ -1006,8 +1006,8 @@ static int rockchip_usb2phy_otg_port_init(struct 
rockchip_usb2phy *rphy,
if (!IS_ERR(rphy->edev)) {
rport->event_nb.notifier_call = rockchip_otg_event;
 
-   ret = extcon_register_notifier(rphy->edev, EXTCON_USB_HOST,
-  &rport->event_nb);
+   ret = devm_extcon_register_notifier(rphy->dev, rphy->edev,
+   EXTCON_USB_HOST, &rport->event_nb);
if (ret)
dev_err(rphy->dev, "register USB HOST notifier 
failed\n");
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] phy: qcom-usb-hs: Replace the extcon API

2017-07-16 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- (deprecated) extcon_get_cable_state_() -> extcon_get_state()

Acked-by: Kishon Vijay Abraham I 
Signed-off-by: Chanwoo Choi 
---
 drivers/phy/qualcomm/phy-qcom-usb-hs.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c 
b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
index 4b20abc3ae2f..2d0c70b5589f 100644
--- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c
+++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
@@ -155,12 +155,12 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy)
}
 
if (uphy->vbus_edev) {
-   state = extcon_get_cable_state_(uphy->vbus_edev, EXTCON_USB);
+   state = extcon_get_state(uphy->vbus_edev, EXTCON_USB);
/* setup initial state */
qcom_usb_hs_phy_vbus_notifier(&uphy->vbus_notify, state,
  uphy->vbus_edev);
-   ret = extcon_register_notifier(uphy->vbus_edev, EXTCON_USB,
-   &uphy->vbus_notify);
+   ret = devm_extcon_register_notifier(&ulpi->dev, uphy->vbus_edev,
+   EXTCON_USB, &uphy->vbus_notify);
if (ret)
goto err_ulpi;
}
@@ -179,16 +179,8 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy)
 
 static int qcom_usb_hs_phy_power_off(struct phy *phy)
 {
-   int ret;
struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
 
-   if (uphy->vbus_edev) {
-   ret = extcon_unregister_notifier(uphy->vbus_edev, EXTCON_USB,
-&uphy->vbus_notify);
-   if (ret)
-   return ret;
-   }
-
regulator_disable(uphy->v3p3);
regulator_disable(uphy->v1p8);
clk_disable_unprepare(uphy->sleep_clk);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH 0/3] add EXTCON_CHG_USB_* cables to MSM USB phy

2017-05-23 Thread Chanwoo Choi
Hi,

On 2017년 05월 17일 22:12, Damien Riegel wrote:
> Hi,
> 
> On Fri, Apr 14, 2017 at 02:43:27PM -0400, Damien Riegel wrote:
>> This patchset adds a way for the MSM USB phy to notify a power supply
>> when the charging state changes. It achieves that using the extcon
>> subsystem.
>>
>> The first patch makes sure msm_otg_notify_charger is called after the
>> charger attributes have been set.
>> The second one makes sure that function is called when unplugging a
>> "in-the-wall" charger.
>> The last one adds EXTCON_CHG_USB_* cables to the phy.
>>
>>
>> I send this patchset as RFC because it seems a bit peculiar to have
>> different drivers that generate the EXTCON_USB_* and EXTCON_CHG_USB_*
>> events, so I want to make sure to get things right.
>>
>> As far as I can tell, all the drivers in the kernel that have USB
>> charger events also have the EXTCON_USB one. In this case, this patchset
>> would make things a bit different for the MSM phy:
>>
>>+--+  +--+
>>|   gpio   |  | PMIC |<-+
>>+--+  +--+  |
>>||  |
>>`+  |  EXTCON_CHG_USB_*
>> |  |   events
>> EXTCON_USB  |  |
>>   events|  |
>>\|/ |
>>  +--+  |
>>  |   USB PHY|--+
>>  +--+
>>
>> Text version: EXTCON_USB comes from a GPIO or a PMIC, that triggers a
>> notifier in the USB phy. That notifier will determine the new
>> EXTCON_CHG_USB_XXX state and the PMIC will be notified about it and
>> determine how much current it can use to charge a battery.
>>
>> Please let me know if this is the correct way to go.
> 
> I wanted to know if someone has any comment to make on this patchset?
> I'm currently working on the PMIC driver and it uses the EXTCON
> notifications, so I just want to make sure it makes sense to do that.

It looks like some strange situation. In this case, it seems like
that usb phy just uses the extcon as a notifier chain.


IMHO, USB PHY might handle the regulator provided by PMIC
instead of extcon notifier as following:
But, I'm not sure. It is just my opinion.

+--+  +--+
|   gpio   |  | PMIC |
+--+  +--+
||
`--+ |
   |  regulator
 EXTCON_USB  |
   events|
  \|/   \|/
   +--+
   |   USB PHY|
   +--+
   |
  \|/
   USB PHY may determine how much current
   it can use to charge a battery according
   to the charger cable. Because USB PHY
   know the kind of connected charger cable.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: mtu3: Replace the extcon API

2017-03-27 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Cc: Greg Kroah-Hartman 
Cc: Chunfeng Yun 
Cc: linux-usb@vger.kernel.org
Signed-off-by: Chanwoo Choi 
---
 drivers/usb/mtu3/mtu3_dr.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_dr.c b/drivers/usb/mtu3/mtu3_dr.c
index 1a8987e7c5b0..11a0d3b84c5e 100644
--- a/drivers/usb/mtu3/mtu3_dr.c
+++ b/drivers/usb/mtu3/mtu3_dr.c
@@ -223,25 +223,25 @@ static int ssusb_extcon_register(struct otg_switch_mtk 
*otg_sx)
return 0;
 
otg_sx->vbus_nb.notifier_call = ssusb_vbus_notifier;
-   ret = extcon_register_notifier(edev, EXTCON_USB,
+   ret = devm_extcon_register_notifier(ssusb->dev, edev, EXTCON_USB,
&otg_sx->vbus_nb);
if (ret < 0)
dev_err(ssusb->dev, "failed to register notifier for USB\n");
 
otg_sx->id_nb.notifier_call = ssusb_id_notifier;
-   ret = extcon_register_notifier(edev, EXTCON_USB_HOST,
+   ret = devm_extcon_register_notifier(ssusb->dev, edev, EXTCON_USB_HOST,
&otg_sx->id_nb);
if (ret < 0)
dev_err(ssusb->dev, "failed to register notifier for 
USB-HOST\n");
 
dev_dbg(ssusb->dev, "EXTCON_USB: %d, EXTCON_USB_HOST: %d\n",
-   extcon_get_cable_state_(edev, EXTCON_USB),
-   extcon_get_cable_state_(edev, EXTCON_USB_HOST));
+   extcon_get_state(edev, EXTCON_USB),
+   extcon_get_state(edev, EXTCON_USB_HOST));
 
/* default as host, switch to device mode if needed */
-   if (extcon_get_cable_state_(edev, EXTCON_USB_HOST) == false)
+   if (extcon_get_state(edev, EXTCON_USB_HOST) == false)
ssusb_set_mailbox(otg_sx, MTU3_ID_FLOAT);
-   if (extcon_get_cable_state_(edev, EXTCON_USB) == true)
+   if (extcon_get_state(edev, EXTCON_USB) == true)
ssusb_set_mailbox(otg_sx, MTU3_VBUS_VALID);
 
return 0;
@@ -367,13 +367,6 @@ void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb)
 
cancel_delayed_work(&otg_sx->extcon_reg_dwork);
 
-   if (otg_sx->edev) {
-   extcon_unregister_notifier(otg_sx->edev,
-   EXTCON_USB, &otg_sx->vbus_nb);
-   extcon_unregister_notifier(otg_sx->edev,
-   EXTCON_USB_HOST, &otg_sx->id_nb);
-   }
-
if (otg_sx->manual_drd_enabled)
ssusb_debugfs_exit(ssusb);
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/4] usb: dwc3: Workaround for super-speed host on dra7 in dual-role mode

2017-02-24 Thread Chanwoo Choi
2017-02-25 12:46 GMT+09:00 Chanwoo Choi :
> Hi,
>
> 2017-02-24 21:02 GMT+09:00 Roger Quadros :
>> +Chanwoo
>>
>> Hi Vivek,
>>
>> On 23/02/17 10:34, Vivek Gautam wrote:
>>>
>>>
>>> On 02/16/2017 06:36 PM, Roger Quadros wrote:
>>>> dra7 OTG core limits the host controller to USB2.0 (high-speed) mode
>>>> when we're operating in dual-role.
>>>>
>>>> We work around that by bypassing the OTG core and reading the
>>>> extcon framework directly for ID/VBUS events.
>>>>
>>>> Signed-off-by: Roger Quadros 
>>>> ---
>>>>   Documentation/devicetree/bindings/usb/dwc3.txt |   2 +
>>>>   drivers/usb/dwc3/core.c| 169 
>>>> -
>>>>   drivers/usb/dwc3/core.h|   5 +
>>>>   3 files changed, 170 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
>>>> b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>> index e3e6983..9955c0d 100644
>>>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>>>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>>>> @@ -53,6 +53,8 @@ Optional properties:
>>>>- snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of 
>>>> GFLADJ
>>>>   register for post-silicon frame length adjustment when the
>>>>   fladj_30mhz_sdbnd signal is invalid or incorrect.
>>>> + - extcon: phandle to the USB connector extcon device. If present, extcon
>>>> +device will be used to get USB cable events instead of OTG controller.
>>>>  -  tx-fifo-resize: determines if the FIFO *has* to be 
>>>> reallocated.
>>>>   diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>>>> index 619fa7c..b02d911 100644
>>>> --- a/drivers/usb/dwc3/core.c
>>>> +++ b/drivers/usb/dwc3/core.c
>>>
>>> [snip]
>>>
>>>> @@ -1587,6 +1727,14 @@ static int dwc3_probe(struct platform_device *pdev)
>>>> dwc3_get_properties(dwc);
>>>>   +if (dev->of_node) {
>>>> +if (of_property_read_bool(dev->of_node, "extcon"))
>>>> +dwc->edev = extcon_get_edev_by_phandle(dev, 0);
>>>
>>> Don't we want separate edev's for vbus and id ?
>>> One can have separate pins connected to them and in that case
>>> we can't get the events out of one pin only.
>>
>> Is such kind of hardware really there? Ideally one extcon device
>> represents one connector. So VBUS and ID events of a single USB
>> port should come on one extcon device.
>> If it doesn't then you need to fix your platforms extcon driver
>> so that it does.
>> Chanwoo can correct me if I'm wrong on this understanding.
>>
>> Currently, if VBUS and ID come on GPIOs the extcon-usb-gpio driver
>> takes care of both.
>
> Basically, one extcon device driver can support the multiple
> external connectors if the detection h/w or port is same.
>
> One extcon device with extcon-usb-gpio.c can support the detection
> of both ID and VBUS.
>
> But, if there is any issue of h/w schematic, we need to consider
> how to use the extcon device.

Additionally, the extcon-usb-gpio.c use the two gpio pins
to detect both ID and VBUS pins. We can check it on documentation[1]
of extcon-usb-gpio driver.

[1] 
https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/tree/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/4] usb: dwc3: Workaround for super-speed host on dra7 in dual-role mode

2017-02-24 Thread Chanwoo Choi
Hi,

2017-02-24 21:02 GMT+09:00 Roger Quadros :
> +Chanwoo
>
> Hi Vivek,
>
> On 23/02/17 10:34, Vivek Gautam wrote:
>>
>>
>> On 02/16/2017 06:36 PM, Roger Quadros wrote:
>>> dra7 OTG core limits the host controller to USB2.0 (high-speed) mode
>>> when we're operating in dual-role.
>>>
>>> We work around that by bypassing the OTG core and reading the
>>> extcon framework directly for ID/VBUS events.
>>>
>>> Signed-off-by: Roger Quadros 
>>> ---
>>>   Documentation/devicetree/bindings/usb/dwc3.txt |   2 +
>>>   drivers/usb/dwc3/core.c| 169 
>>> -
>>>   drivers/usb/dwc3/core.h|   5 +
>>>   3 files changed, 170 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
>>> b/Documentation/devicetree/bindings/usb/dwc3.txt
>>> index e3e6983..9955c0d 100644
>>> --- a/Documentation/devicetree/bindings/usb/dwc3.txt
>>> +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
>>> @@ -53,6 +53,8 @@ Optional properties:
>>>- snps,quirk-frame-length-adjustment: Value for GFLADJ_30MHZ field of 
>>> GFLADJ
>>>   register for post-silicon frame length adjustment when the
>>>   fladj_30mhz_sdbnd signal is invalid or incorrect.
>>> + - extcon: phandle to the USB connector extcon device. If present, extcon
>>> +device will be used to get USB cable events instead of OTG controller.
>>>  -  tx-fifo-resize: determines if the FIFO *has* to be 
>>> reallocated.
>>>   diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>>> index 619fa7c..b02d911 100644
>>> --- a/drivers/usb/dwc3/core.c
>>> +++ b/drivers/usb/dwc3/core.c
>>
>> [snip]
>>
>>> @@ -1587,6 +1727,14 @@ static int dwc3_probe(struct platform_device *pdev)
>>> dwc3_get_properties(dwc);
>>>   +if (dev->of_node) {
>>> +if (of_property_read_bool(dev->of_node, "extcon"))
>>> +dwc->edev = extcon_get_edev_by_phandle(dev, 0);
>>
>> Don't we want separate edev's for vbus and id ?
>> One can have separate pins connected to them and in that case
>> we can't get the events out of one pin only.
>
> Is such kind of hardware really there? Ideally one extcon device
> represents one connector. So VBUS and ID events of a single USB
> port should come on one extcon device.
> If it doesn't then you need to fix your platforms extcon driver
> so that it does.
> Chanwoo can correct me if I'm wrong on this understanding.
>
> Currently, if VBUS and ID come on GPIOs the extcon-usb-gpio driver
> takes care of both.

Basically, one extcon device driver can support the multiple
external connectors if the detection h/w or port is same.

One extcon device with extcon-usb-gpio.c can support the detection
of both ID and VBUS.

But, if there is any issue of h/w schematic, we need to consider
how to use the extcon device.

>
>>
>>> +
>>> +if (IS_ERR(dwc->edev))
>>> +return PTR_ERR(dwc->edev);
>>
>>  Took me a while to get to this. :)
>>
>> if (IS_ERR(dwc->edev)) {
>>ret = PTR_ERR(dwc->edev);
>>goto err0;
>> }
>>
>> We want to reset the res->start back to its original offset.
>>
>> Testing this series currently. Will get back with my results.
>>
>>
> Thanks :)
>
> --
> cheers,
> -roger

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/4] usb: dwc3: Workaround for super-speed host on dra7 in dual-role mode

2017-02-24 Thread Chanwoo Choi
Hi Roger,

[snip]

>  /* dwc->lock must be held */
>  static void dwc3_otg_core_exit(struct dwc3 *dwc)
>  {
> +   if (dwc->edev)
> +   return;
> +
> /* disable all otg irqs */
> dwc3_otg_disable_events(dwc, DWC3_OTG_ALL_EVENTS);
> /* clear all events */
> @@ -1286,6 +1364,57 @@ static int dwc3_drd_init(struct dwc3 *dwc)
>
> INIT_WORK(&dwc->otg_work, dwc3_drd_work);
>
> +   /* If extcon device is present we don't rely on OTG core for ID event 
> */
> +   if (dwc->edev) {
> +   int id, vbus;
> +
> +   dwc->edev_nb.notifier_call = dwc3_drd_notifier;
> +   ret = extcon_register_notifier(dwc->edev, EXTCON_USB,
> +  &dwc->edev_nb);

I recommend that you better to use the devm_extcon_register_notifier()

> +   if (ret < 0) {
> +   dev_err(dwc->dev, "Couldn't register USB cable 
> notifier\n");
> +   return -ENODEV;
> +   }
> +
> +   ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,
> +  &dwc->edev_nb);

Ditto.

[snip]

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] extcon: ext-usb-gpio: do not enable USB as wakeup source by default

2017-02-15 Thread Chanwoo Choi
On 2017년 02월 13일 18:21, Peter Chen wrote:
> Whether the USB port as a wakeup source should be determined by user,
> but not enabled by default.
>
> Signed-off-by: Peter Chen 
> ---
>  drivers/extcon/extcon-usb-gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/extcon/extcon-usb-gpio.c 
> b/drivers/extcon/extcon-usb-gpio.c
> index a5e1882..66c749d 100644
> --- a/drivers/extcon/extcon-usb-gpio.c
> +++ b/drivers/extcon/extcon-usb-gpio.c
> @@ -195,7 +195,7 @@ static int usb_extcon_probe(struct platform_device *pdev)
>   }
>  
>   platform_set_drvdata(pdev, info);
> - device_init_wakeup(dev, true);
> + device_set_wakeup_capable(&pdev->dev, true);
>  
>   /* Perform initial detection */
>   usb_extcon_detect_cable(&info->wq_detcable.work);

Applied it.
Thanks.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/8] usb: dwc3: add dual-role support

2017-01-23 Thread Chanwoo Choi
Hi Roger,

On 2017년 01월 23일 20:19, Roger Quadros wrote:
> - Some SoC's (e.g. Qualcomm MSM) do not have the OTG controller block
> but do have both host and peripheral controllers and so can operate
> in dual role mode. Current series does not address this case.
> We can get dual-role to work with such SoCs if core.c can get
> information about ID and VBUS somehow (private interface
> from parent or directly read extcon?).

Also, Exynos SoC doesn't include the physical otg block
to detect the type of external connector(HOST or Peripheral).

So, our team member and me are preparing the patches
to identify the type of external connector with extcon
This approach is not dependent on any specific SoC.

Maybe, we will send the RFC patches within this month.

-- 
Best Regards,
Chanwoo Choi
S/W R&D Center
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/6] usb: Replace the deprecated extcon API

2017-01-16 Thread Chanwoo Choi
This patches just replace the deprecated extcon API without any change
of extcon operation and use the resource-managed function for
extcon_register_notifier().

The new extcon API instead of deprecated API.
- extcon_set_cable_state_() -> extcon_set_state_sync();
- extcon_get_cable_state_() -> extcon_get_state();

Changes from v2:
- Rebase these patches based on usb.git[1] (testing/next branch)

Changes from v1:
- Rebase these patches based on v4.10-rc1.
- Add acked-by tag from usb maintainer and reviewer.
- Drop the phy/power-supply/chipidea patches.

[1] 
https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/log/?h=testing/next

Chanwoo Choi (6):
  usb: dwc3: omap: Replace the extcon API
  usb: phy: msm: Replace the extcon API
  usb: phy: omap-otg: Replace the extcon API
  usb: phy: qcom-8x16-usb: Replace the extcon API
  usb: phy: tahvo: Replace the deprecated extcon API
  usb: renesas_usbhs: Replace the deprecated extcon API

 drivers/usb/dwc3/dwc3-omap.c| 20 +++-
 drivers/usb/phy/phy-msm-usb.c   | 33 +++--
 drivers/usb/phy/phy-omap-otg.c  | 24 ++--
 drivers/usb/phy/phy-qcom-8x16-usb.c | 13 -
 drivers/usb/phy/phy-tahvo.c | 10 +-
 drivers/usb/renesas_usbhs/common.c  |  2 +-
 6 files changed, 34 insertions(+), 68 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 5/6] usb: phy: tahvo: Replace the deprecated extcon API

2017-01-16 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_set_cable_state_() -> extcon_set_state_sync()

Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/phy/phy-tahvo.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index ab5d364f6e8c..a31c8682e998 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -121,7 +121,7 @@ static void check_vbus_state(struct tahvo_usb *tu)
prev_state = tu->vbus_state;
tu->vbus_state = reg & TAHVO_STAT_VBUS;
if (prev_state != tu->vbus_state) {
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB, tu->vbus_state);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB, tu->vbus_state);
sysfs_notify(&tu->pt_dev->dev.kobj, NULL, "vbus_state");
}
 }
@@ -130,7 +130,7 @@ static void tahvo_usb_become_host(struct tahvo_usb *tu)
 {
struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent);
 
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST, true);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST, true);
 
/* Power up the transceiver in USB host mode */
retu_write(rdev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND |
@@ -149,7 +149,7 @@ static void tahvo_usb_become_peripheral(struct tahvo_usb 
*tu)
 {
struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent);
 
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST, false);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST, false);
 
/* Power up transceiver and set it in USB peripheral mode */
retu_write(rdev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT |
@@ -379,9 +379,9 @@ static int tahvo_usb_probe(struct platform_device *pdev)
}
 
/* Set the initial cable state. */
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST,
+   extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST,
   tu->tahvo_mode == TAHVO_MODE_HOST);
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB, tu->vbus_state);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB, tu->vbus_state);
 
/* Create OTG interface */
tahvo_usb_power_off(tu);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 4/6] usb: phy: qcom-8x16-usb: Replace the extcon API

2017-01-16 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/phy/phy-qcom-8x16-usb.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/phy/phy-qcom-8x16-usb.c 
b/drivers/usb/phy/phy-qcom-8x16-usb.c
index d8593adb3621..fdf686398772 100644
--- a/drivers/usb/phy/phy-qcom-8x16-usb.c
+++ b/drivers/usb/phy/phy-qcom-8x16-usb.c
@@ -187,7 +187,7 @@ static int phy_8x16_init(struct usb_phy *phy)
val = ULPI_PWR_OTG_COMP_DISABLE;
usb_phy_io_write(phy, val, ULPI_SET(ULPI_PWR_CLK_MNG_REG));
 
-   state = extcon_get_cable_state_(qphy->vbus_edev, EXTCON_USB);
+   state = extcon_get_state(qphy->vbus_edev, EXTCON_USB);
if (state)
phy_8x16_vbus_on(qphy);
else
@@ -316,23 +316,20 @@ static int phy_8x16_probe(struct platform_device *pdev)
goto off_clks;
 
qphy->vbus_notify.notifier_call = phy_8x16_vbus_notify;
-   ret = extcon_register_notifier(qphy->vbus_edev, EXTCON_USB,
-  &qphy->vbus_notify);
+   ret = devm_extcon_register_notifier(&pdev->dev, qphy->vbus_edev,
+   EXTCON_USB, &qphy->vbus_notify);
if (ret < 0)
goto off_power;
 
ret = usb_add_phy_dev(&qphy->phy);
if (ret)
-   goto off_extcon;
+   goto off_power;
 
qphy->reboot_notify.notifier_call = phy_8x16_reboot_notify;
register_reboot_notifier(&qphy->reboot_notify);
 
return 0;
 
-off_extcon:
-   extcon_unregister_notifier(qphy->vbus_edev, EXTCON_USB,
-  &qphy->vbus_notify);
 off_power:
regulator_bulk_disable(ARRAY_SIZE(qphy->regulator), qphy->regulator);
 off_clks:
@@ -347,8 +344,6 @@ static int phy_8x16_remove(struct platform_device *pdev)
struct phy_8x16 *qphy = platform_get_drvdata(pdev);
 
unregister_reboot_notifier(&qphy->reboot_notify);
-   extcon_unregister_notifier(qphy->vbus_edev, EXTCON_USB,
-  &qphy->vbus_notify);
 
/*
 * Ensure that D+/D- lines are routed to uB connector, so
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/6] usb: phy: msm: Replace the extcon API

2017-01-16 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/phy/phy-msm-usb.c | 33 +++--
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 8a34759727bb..a15a89d4235d 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1742,14 +1742,14 @@ static int msm_otg_read_dt(struct platform_device 
*pdev, struct msm_otg *motg)
if (!IS_ERR(ext_vbus)) {
motg->vbus.extcon = ext_vbus;
motg->vbus.nb.notifier_call = msm_otg_vbus_notifier;
-   ret = extcon_register_notifier(ext_vbus, EXTCON_USB,
-   &motg->vbus.nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, ext_vbus,
+   EXTCON_USB, &motg->vbus.nb);
if (ret < 0) {
dev_err(&pdev->dev, "register VBUS notifier failed\n");
return ret;
}
 
-   ret = extcon_get_cable_state_(ext_vbus, EXTCON_USB);
+   ret = extcon_get_state(ext_vbus, EXTCON_USB);
if (ret)
set_bit(B_SESS_VLD, &motg->inputs);
else
@@ -1759,16 +1759,14 @@ static int msm_otg_read_dt(struct platform_device 
*pdev, struct msm_otg *motg)
if (!IS_ERR(ext_id)) {
motg->id.extcon = ext_id;
motg->id.nb.notifier_call = msm_otg_id_notifier;
-   ret = extcon_register_notifier(ext_id, EXTCON_USB_HOST,
-   &motg->id.nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, ext_id,
+   EXTCON_USB_HOST, &motg->id.nb);
if (ret < 0) {
dev_err(&pdev->dev, "register ID notifier failed\n");
-   extcon_unregister_notifier(motg->vbus.extcon,
-  EXTCON_USB, &motg->vbus.nb);
return ret;
}
 
-   ret = extcon_get_cable_state_(ext_id, EXTCON_USB_HOST);
+   ret = extcon_get_state(ext_id, EXTCON_USB_HOST);
if (ret)
clear_bit(ID, &motg->inputs);
else
@@ -1883,10 +1881,9 @@ static int msm_otg_probe(struct platform_device *pdev)
 */
if (motg->phy_number) {
phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4);
-   if (!phy_select) {
-   ret = -ENOMEM;
-   goto unregister_extcon;
-   }
+   if (!phy_select)
+   return -ENOMEM;
+
/* Enable second PHY with the OTG port */
writel(0x1, phy_select);
}
@@ -1897,7 +1894,7 @@ static int msm_otg_probe(struct platform_device *pdev)
if (motg->irq < 0) {
dev_err(&pdev->dev, "platform_get_irq failed\n");
ret = motg->irq;
-   goto unregister_extcon;
+   return motg->irq;
}
 
regs[0].supply = "vddcx";
@@ -1906,7 +1903,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 
ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs);
if (ret)
-   goto unregister_extcon;
+   return ret;
 
motg->vddcx = regs[0].consumer;
motg->v3p3  = regs[1].consumer;
@@ -2003,11 +2000,6 @@ static int msm_otg_probe(struct platform_device *pdev)
clk_disable_unprepare(motg->clk);
if (!IS_ERR(motg->core_clk))
clk_disable_unprepare(motg->core_clk);
-unregister_extcon:
-   extcon_unregister_notifier(motg->id.extcon,
-  EXTCON_USB_HOST, &motg->id.nb);
-   extcon_unregister_notifier(motg->vbus.extcon,
-  EXTCON_USB, &motg->vbus.nb);
 
return ret;
 }
@@ -2029,9 +2021,6 @@ static int msm_otg_remove(struct platform_device *pdev)
 */
gpiod_set_value_cansleep(motg->switch_gpio, 0);
 
-   extcon_unregister_notifier(motg->id.extcon, EXTCON_USB_HOST, 
&motg->id.nb);
-   extcon_unregister_notifier(motg->vbus.extcon, EXTCON_USB, 
&motg->vbus.nb);
-
msm_otg_debugfs_cleanup();
cancel_delayed_work_sync(&motg->chg_work);
cancel_work_sync(&motg->sm_work);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 6/6] usb: renesas_usbhs: Replace the deprecated extcon API

2017-01-16 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
Acked-by: Yoshihiro Shimoda 
---
 drivers/usb/renesas_usbhs/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/common.c 
b/drivers/usb/renesas_usbhs/common.c
index 012a37aa3e0d..623c51300393 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -389,7 +389,7 @@ static void usbhsc_hotplug(struct usbhs_priv *priv)
 
if (enable && !mod) {
if (priv->edev) {
-   cable = extcon_get_cable_state_(priv->edev, 
EXTCON_USB_HOST);
+   cable = extcon_get_state(priv->edev, EXTCON_USB_HOST);
if ((cable > 0 && id != USBHS_HOST) ||
(!cable && id != USBHS_GADGET)) {
dev_info(&pdev->dev,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/6] usb: dwc3: omap: Replace the extcon API

2017-01-16 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Cc: linux-o...@vger.kernel.org
Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/dwc3/dwc3-omap.c | 20 +++-
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index eb1b9cb3f9d1..2092e46b1380 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -426,20 +426,20 @@ static int dwc3_omap_extcon_register(struct dwc3_omap 
*omap)
}
 
omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier;
-   ret = extcon_register_notifier(edev, EXTCON_USB,
-   &omap->vbus_nb);
+   ret = devm_extcon_register_notifier(omap->dev, edev,
+   EXTCON_USB, &omap->vbus_nb);
if (ret < 0)
dev_vdbg(omap->dev, "failed to register notifier for 
USB\n");
 
omap->id_nb.notifier_call = dwc3_omap_id_notifier;
-   ret = extcon_register_notifier(edev, EXTCON_USB_HOST,
-   &omap->id_nb);
+   ret = devm_extcon_register_notifier(omap->dev, edev,
+   EXTCON_USB_HOST, &omap->id_nb);
if (ret < 0)
dev_vdbg(omap->dev, "failed to register notifier for 
USB-HOST\n");
 
-   if (extcon_get_cable_state_(edev, EXTCON_USB) == true)
+   if (extcon_get_state(edev, EXTCON_USB) == true)
dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
-   if (extcon_get_cable_state_(edev, EXTCON_USB_HOST) == true)
+   if (extcon_get_state(edev, EXTCON_USB_HOST) == true)
dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
 
omap->edev = edev;
@@ -528,17 +528,13 @@ static int dwc3_omap_probe(struct platform_device *pdev)
ret = of_platform_populate(node, NULL, NULL, dev);
if (ret) {
dev_err(&pdev->dev, "failed to create dwc3 core\n");
-   goto err2;
+   goto err1;
}
 
dwc3_omap_enable_irqs(omap);
enable_irq(omap->irq);
return 0;
 
-err2:
-   extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
-   extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
-
 err1:
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
@@ -550,8 +546,6 @@ static int dwc3_omap_remove(struct platform_device *pdev)
 {
struct dwc3_omap*omap = platform_get_drvdata(pdev);
 
-   extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
-   extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
dwc3_omap_disable_irqs(omap);
disable_irq(omap->irq);
of_platform_depopulate(omap->dev);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 3/6] usb: phy: omap-otg: Replace the extcon API

2017-01-16 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Cc: linux-o...@vger.kernel.org
Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/phy/phy-omap-otg.c | 24 ++--
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
index 6523af4f8f93..800d1d90753d 100644
--- a/drivers/usb/phy/phy-omap-otg.c
+++ b/drivers/usb/phy/phy-omap-otg.c
@@ -118,19 +118,19 @@ static int omap_otg_probe(struct platform_device *pdev)
otg_dev->id_nb.notifier_call = omap_otg_id_notifier;
otg_dev->vbus_nb.notifier_call = omap_otg_vbus_notifier;
 
-   ret = extcon_register_notifier(extcon, EXTCON_USB_HOST, 
&otg_dev->id_nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, extcon,
+   EXTCON_USB_HOST, &otg_dev->id_nb);
if (ret)
return ret;
 
-   ret = extcon_register_notifier(extcon, EXTCON_USB, &otg_dev->vbus_nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, extcon,
+   EXTCON_USB, &otg_dev->vbus_nb);
if (ret) {
-   extcon_unregister_notifier(extcon, EXTCON_USB_HOST,
-   &otg_dev->id_nb);
return ret;
}
 
-   otg_dev->id = extcon_get_cable_state_(extcon, EXTCON_USB_HOST);
-   otg_dev->vbus = extcon_get_cable_state_(extcon, EXTCON_USB);
+   otg_dev->id = extcon_get_state(extcon, EXTCON_USB_HOST);
+   otg_dev->vbus = extcon_get_state(extcon, EXTCON_USB);
omap_otg_set_mode(otg_dev);
 
rev = readl(otg_dev->base);
@@ -145,20 +145,8 @@ static int omap_otg_probe(struct platform_device *pdev)
return 0;
 }
 
-static int omap_otg_remove(struct platform_device *pdev)
-{
-   struct otg_device *otg_dev = platform_get_drvdata(pdev);
-   struct extcon_dev *edev = otg_dev->extcon;
-
-   extcon_unregister_notifier(edev, EXTCON_USB_HOST, &otg_dev->id_nb);
-   extcon_unregister_notifier(edev, EXTCON_USB, &otg_dev->vbus_nb);
-
-   return 0;
-}
-
 static struct platform_driver omap_otg_driver = {
.probe  = omap_otg_probe,
-   .remove = omap_otg_remove,
.driver = {
.name   = "omap_otg",
},
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] usb: musb: sunxi: Uses the resource-managed extcon API when registering extcon notifier

2017-01-10 Thread Chanwoo Choi
Hi Felipe,

This patch got the acked-by from Bin Liu and.
Could you please apply this patch?

On 2016년 12월 30일 13:19, Chanwoo Choi wrote:
> This patch just uses the resource-managed extcon API when registering
> the extcon notifier.
> 
> Signed-off-by: Chanwoo Choi 
> Acked-by: Maxime Ripard 
> Acked-by: Bin Liu 
> ---
> Changes from v1:
> - Rebase this patch based on v4.10-rc1.
> - Add acked-by tag from Maxime Ripard and Bin Lin.
> - Drop the phy/power-supply/chipidea patches.
> 
>  drivers/usb/musb/sunxi.c | 12 +++-
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
> index d0be0eadd0d9..2332294dee0f 100644
> --- a/drivers/usb/musb/sunxi.c
> +++ b/drivers/usb/musb/sunxi.c
> @@ -251,14 +251,14 @@ static int sunxi_musb_init(struct musb *musb)
>   writeb(SUNXI_MUSB_VEND0_PIO_MODE, musb->mregs + SUNXI_MUSB_VEND0);
>  
>   /* Register notifier before calling phy_init() */
> - ret = extcon_register_notifier(glue->extcon, EXTCON_USB_HOST,
> -&glue->host_nb);
> + ret = devm_extcon_register_notifier(glue->dev, glue->extcon,
> + EXTCON_USB_HOST, &glue->host_nb);
>   if (ret)
>   goto error_reset_assert;
>  
>   ret = phy_init(glue->phy);
>   if (ret)
> - goto error_unregister_notifier;
> + goto error_reset_assert;
>  
>   musb->isr = sunxi_musb_interrupt;
>  
> @@ -267,9 +267,6 @@ static int sunxi_musb_init(struct musb *musb)
>  
>   return 0;
>  
> -error_unregister_notifier:
> - extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
> -&glue->host_nb);
>  error_reset_assert:
>   if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags))
>   reset_control_assert(glue->rst);
> @@ -293,9 +290,6 @@ static int sunxi_musb_exit(struct musb *musb)
>  
>   phy_exit(glue->phy);
>  
> - extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
> -&glue->host_nb);
> -
>   if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags))
>   reset_control_assert(glue->rst);
>  
> 


-- 
Best Regards,
Chanwoo Choi
S/W Center, Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 0/6] usb: Replace the deprecated extcon API

2017-01-10 Thread Chanwoo Choi
Hi Felipe,

These patches have already acked-by tag from you.
Could you please apply them if there is additional comment?

On 2016년 12월 30일 13:08, Chanwoo Choi wrote:
> This patches just replace the deprecated extcon API without any change
> of extcon operation and use the resource-managed function for
> extcon_register_notifier().
> 
> The new extcon API instead of deprecated API.
> - extcon_set_cable_state_() -> extcon_set_state_sync();
> - extcon_get_cable_state_() -> extcon_get_state();
> 
> Changes from v1:
> - Rebase these patches based on v4.10-rc1.
> - Add acked-by tag from usb maintainer and reviewer.
> - Drop the phy/power-supply/chipidea patches.
> 
> Chanwoo Choi (6):
>   usb: dwc3: omap: Replace the extcon API
>   usb: phy: msm: Replace the extcon API
>   usb: phy: omap-otg: Replace the extcon API
>   usb: phy: qcom-8x16-usb: Replace the extcon API
>   usb: phy: tahvo: Replace the deprecated extcon API
>   usb: renesas_usbhs: Replace the deprecated extcon API
> 
>  drivers/usb/dwc3/dwc3-omap.c| 20 +++-
>  drivers/usb/phy/phy-msm-usb.c   | 33 +++--
>  drivers/usb/phy/phy-omap-otg.c  | 24 ++--
>  drivers/usb/phy/phy-qcom-8x16-usb.c | 13 -
>  drivers/usb/phy/phy-tahvo.c | 10 +-
>  drivers/usb/renesas_usbhs/common.c  |  2 +-
>  6 files changed, 34 insertions(+), 68 deletions(-)
> 


-- 
Best Regards,
Chanwoo Choi
S/W Center, Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] usb: chipdata: Replace the extcon API

2016-12-30 Thread Chanwoo Choi
Hi Peter,

Please ignore this patch. After posting this patch, I got that this patch was 
already merged by you. I'm sorry to make the confusion.

Regards,
Chanwoo Choi

On 2016년 12월 30일 13:15, Chanwoo Choi wrote:
> This patch uses the resource-managed extcon API for extcon_register_notifier()
> and replaces the deprecated extcon API as following:
> - extcon_get_cable_state_() -> extcon_get_state()
> 
> Cc: Peter Chen 
> Signed-off-by: Chanwoo Choi 
> ---
> Changes from v1:
> - Rebase these patches based on v4.10-rc1.
> - Drop the phy/power-supply/dwc3/omap patches.
> 
>  drivers/usb/chipidea/core.c | 30 ++
>  1 file changed, 6 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 3dbb4a21ab44..5c35f25e9bce 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -742,7 +742,7 @@ static int ci_get_platdata(struct device *dev,
>   cable->edev = ext_vbus;
>  
>   if (!IS_ERR(ext_vbus)) {
> - ret = extcon_get_cable_state_(cable->edev, EXTCON_USB);
> + ret = extcon_get_state(cable->edev, EXTCON_USB);
>   if (ret)
>   cable->state = true;
>   else
> @@ -754,7 +754,7 @@ static int ci_get_platdata(struct device *dev,
>   cable->edev = ext_id;
>  
>   if (!IS_ERR(ext_id)) {
> - ret = extcon_get_cable_state_(cable->edev, EXTCON_USB_HOST);
> + ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
>   if (ret)
>   cable->state = false;
>   else
> @@ -771,8 +771,8 @@ static int ci_extcon_register(struct ci_hdrc *ci)
>   id = &ci->platdata->id_extcon;
>   id->ci = ci;
>   if (!IS_ERR(id->edev)) {
> - ret = extcon_register_notifier(id->edev, EXTCON_USB_HOST,
> -&id->nb);
> + ret = devm_extcon_register_notifier(ci->dev, id->edev,
> + EXTCON_USB_HOST, &id->nb);
>   if (ret < 0) {
>   dev_err(ci->dev, "register ID failed\n");
>   return ret;
> @@ -782,11 +782,9 @@ static int ci_extcon_register(struct ci_hdrc *ci)
>   vbus = &ci->platdata->vbus_extcon;
>   vbus->ci = ci;
>   if (!IS_ERR(vbus->edev)) {
> - ret = extcon_register_notifier(vbus->edev, EXTCON_USB,
> -&vbus->nb);
> + ret = devm_extcon_register_notifier(ci->dev, vbus->edev,
> + EXTCON_USB, &vbus->nb);
>   if (ret < 0) {
> - extcon_unregister_notifier(id->edev, EXTCON_USB_HOST,
> -&id->nb);
>   dev_err(ci->dev, "register VBUS failed\n");
>   return ret;
>   }
> @@ -795,20 +793,6 @@ static int ci_extcon_register(struct ci_hdrc *ci)
>   return 0;
>  }
>  
> -static void ci_extcon_unregister(struct ci_hdrc *ci)
> -{
> - struct ci_hdrc_cable *cable;
> -
> - cable = &ci->platdata->id_extcon;
> - if (!IS_ERR(cable->edev))
> - extcon_unregister_notifier(cable->edev, EXTCON_USB_HOST,
> -&cable->nb);
> -
> - cable = &ci->platdata->vbus_extcon;
> - if (!IS_ERR(cable->edev))
> - extcon_unregister_notifier(cable->edev, EXTCON_USB, &cable->nb);
> -}
> -
>  static DEFINE_IDA(ci_ida);
>  
>  struct platform_device *ci_hdrc_add_device(struct device *dev,
> @@ -1054,7 +1038,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>   if (!ret)
>   return 0;
>  
> - ci_extcon_unregister(ci);
>  stop:
>   ci_role_destroy(ci);
>  deinit_phy:
> @@ -1074,7 +1057,6 @@ static int ci_hdrc_remove(struct platform_device *pdev)
>   }
>  
>   dbg_remove_files(ci);
> - ci_extcon_unregister(ci);
>   ci_role_destroy(ci);
>   ci_hdrc_enter_lpm(ci, true);
>   ci_usb_phy_exit(ci);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/12] usb: dwc3: omap: Replace the extcon API

2016-12-29 Thread Chanwoo Choi
Hi Felipe,

On 2016년 12월 30일 11:46, Chanwoo Choi wrote:
> Hi Felipe,
> 
> On 2016년 12월 02일 18:03, Felipe Balbi wrote:
>>
>> Hi,
>>
>> Chanwoo Choi  writes:
>>> Hi Felipe,
>>>
>>> On 2016년 11월 30일 19:36, Felipe Balbi wrote:
>>>>
>>>> Hi,
>>>>
>>>> Chanwoo Choi  writes:
>>>>> This patch uses the resource-managed extcon API for 
>>>>> extcon_register_notifier()
>>>>> and replaces the deprecated extcon API as following:
>>>>> - extcon_get_cable_state_() -> extcon_get_state()
>>>>>
>>>>> Signed-off-by: Chanwoo Choi 
>>>>
>>>> Acked-by: Felipe Balbi 
>>>>
>>>
>>> Thanks for your review.
>>>
>>> Each patch has no any dependency among patches.
>>> So, If possible, could you pick the patch6/8/9/10/11/12 on your tree?
>>
>> my tree is closed for v4.10, I can pick it up for v4.11
> 
> Could you please pick up these patches(patch6/8/9/10/11/12)?
> These patches were already reviewed by you.
> 

I sent v2 patchset.
[1] https://www.spinics.net/lists/kernel/msg2410950.html
- "[PATCH v2 0/6] usb: Replace the deprecated extcon API"

-- 
Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] usb: musb: sunxi: Uses the resource-managed extcon API when registering extcon notifier

2016-12-29 Thread Chanwoo Choi
This patch just uses the resource-managed extcon API when registering
the extcon notifier.

Signed-off-by: Chanwoo Choi 
Acked-by: Maxime Ripard 
Acked-by: Bin Liu 
---
Changes from v1:
- Rebase this patch based on v4.10-rc1.
- Add acked-by tag from Maxime Ripard and Bin Lin.
- Drop the phy/power-supply/chipidea patches.

 drivers/usb/musb/sunxi.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index d0be0eadd0d9..2332294dee0f 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -251,14 +251,14 @@ static int sunxi_musb_init(struct musb *musb)
writeb(SUNXI_MUSB_VEND0_PIO_MODE, musb->mregs + SUNXI_MUSB_VEND0);
 
/* Register notifier before calling phy_init() */
-   ret = extcon_register_notifier(glue->extcon, EXTCON_USB_HOST,
-  &glue->host_nb);
+   ret = devm_extcon_register_notifier(glue->dev, glue->extcon,
+   EXTCON_USB_HOST, &glue->host_nb);
if (ret)
goto error_reset_assert;
 
ret = phy_init(glue->phy);
if (ret)
-   goto error_unregister_notifier;
+   goto error_reset_assert;
 
musb->isr = sunxi_musb_interrupt;
 
@@ -267,9 +267,6 @@ static int sunxi_musb_init(struct musb *musb)
 
return 0;
 
-error_unregister_notifier:
-   extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
-  &glue->host_nb);
 error_reset_assert:
if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags))
reset_control_assert(glue->rst);
@@ -293,9 +290,6 @@ static int sunxi_musb_exit(struct musb *musb)
 
phy_exit(glue->phy);
 
-   extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
-  &glue->host_nb);
-
if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags))
reset_control_assert(glue->rst);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/6] usb: phy: msm: Replace the extcon API

2016-12-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/phy/phy-msm-usb.c | 33 +++--
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 8a34759727bb..a15a89d4235d 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1742,14 +1742,14 @@ static int msm_otg_read_dt(struct platform_device 
*pdev, struct msm_otg *motg)
if (!IS_ERR(ext_vbus)) {
motg->vbus.extcon = ext_vbus;
motg->vbus.nb.notifier_call = msm_otg_vbus_notifier;
-   ret = extcon_register_notifier(ext_vbus, EXTCON_USB,
-   &motg->vbus.nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, ext_vbus,
+   EXTCON_USB, &motg->vbus.nb);
if (ret < 0) {
dev_err(&pdev->dev, "register VBUS notifier failed\n");
return ret;
}
 
-   ret = extcon_get_cable_state_(ext_vbus, EXTCON_USB);
+   ret = extcon_get_state(ext_vbus, EXTCON_USB);
if (ret)
set_bit(B_SESS_VLD, &motg->inputs);
else
@@ -1759,16 +1759,14 @@ static int msm_otg_read_dt(struct platform_device 
*pdev, struct msm_otg *motg)
if (!IS_ERR(ext_id)) {
motg->id.extcon = ext_id;
motg->id.nb.notifier_call = msm_otg_id_notifier;
-   ret = extcon_register_notifier(ext_id, EXTCON_USB_HOST,
-   &motg->id.nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, ext_id,
+   EXTCON_USB_HOST, &motg->id.nb);
if (ret < 0) {
dev_err(&pdev->dev, "register ID notifier failed\n");
-   extcon_unregister_notifier(motg->vbus.extcon,
-  EXTCON_USB, &motg->vbus.nb);
return ret;
}
 
-   ret = extcon_get_cable_state_(ext_id, EXTCON_USB_HOST);
+   ret = extcon_get_state(ext_id, EXTCON_USB_HOST);
if (ret)
clear_bit(ID, &motg->inputs);
else
@@ -1883,10 +1881,9 @@ static int msm_otg_probe(struct platform_device *pdev)
 */
if (motg->phy_number) {
phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4);
-   if (!phy_select) {
-   ret = -ENOMEM;
-   goto unregister_extcon;
-   }
+   if (!phy_select)
+   return -ENOMEM;
+
/* Enable second PHY with the OTG port */
writel(0x1, phy_select);
}
@@ -1897,7 +1894,7 @@ static int msm_otg_probe(struct platform_device *pdev)
if (motg->irq < 0) {
dev_err(&pdev->dev, "platform_get_irq failed\n");
ret = motg->irq;
-   goto unregister_extcon;
+   return motg->irq;
}
 
regs[0].supply = "vddcx";
@@ -1906,7 +1903,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 
ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs);
if (ret)
-   goto unregister_extcon;
+   return ret;
 
motg->vddcx = regs[0].consumer;
motg->v3p3  = regs[1].consumer;
@@ -2003,11 +2000,6 @@ static int msm_otg_probe(struct platform_device *pdev)
clk_disable_unprepare(motg->clk);
if (!IS_ERR(motg->core_clk))
clk_disable_unprepare(motg->core_clk);
-unregister_extcon:
-   extcon_unregister_notifier(motg->id.extcon,
-  EXTCON_USB_HOST, &motg->id.nb);
-   extcon_unregister_notifier(motg->vbus.extcon,
-  EXTCON_USB, &motg->vbus.nb);
 
return ret;
 }
@@ -2029,9 +2021,6 @@ static int msm_otg_remove(struct platform_device *pdev)
 */
gpiod_set_value_cansleep(motg->switch_gpio, 0);
 
-   extcon_unregister_notifier(motg->id.extcon, EXTCON_USB_HOST, 
&motg->id.nb);
-   extcon_unregister_notifier(motg->vbus.extcon, EXTCON_USB, 
&motg->vbus.nb);
-
msm_otg_debugfs_cleanup();
cancel_delayed_work_sync(&motg->chg_work);
cancel_work_sync(&motg->sm_work);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] usb: chipdata: Replace the extcon API

2016-12-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Cc: Peter Chen 
Signed-off-by: Chanwoo Choi 
---
Changes from v1:
- Rebase these patches based on v4.10-rc1.
- Drop the phy/power-supply/dwc3/omap patches.

 drivers/usb/chipidea/core.c | 30 ++
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 3dbb4a21ab44..5c35f25e9bce 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -742,7 +742,7 @@ static int ci_get_platdata(struct device *dev,
cable->edev = ext_vbus;
 
if (!IS_ERR(ext_vbus)) {
-   ret = extcon_get_cable_state_(cable->edev, EXTCON_USB);
+   ret = extcon_get_state(cable->edev, EXTCON_USB);
if (ret)
cable->state = true;
else
@@ -754,7 +754,7 @@ static int ci_get_platdata(struct device *dev,
cable->edev = ext_id;
 
if (!IS_ERR(ext_id)) {
-   ret = extcon_get_cable_state_(cable->edev, EXTCON_USB_HOST);
+   ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
if (ret)
cable->state = false;
else
@@ -771,8 +771,8 @@ static int ci_extcon_register(struct ci_hdrc *ci)
id = &ci->platdata->id_extcon;
id->ci = ci;
if (!IS_ERR(id->edev)) {
-   ret = extcon_register_notifier(id->edev, EXTCON_USB_HOST,
-  &id->nb);
+   ret = devm_extcon_register_notifier(ci->dev, id->edev,
+   EXTCON_USB_HOST, &id->nb);
if (ret < 0) {
dev_err(ci->dev, "register ID failed\n");
return ret;
@@ -782,11 +782,9 @@ static int ci_extcon_register(struct ci_hdrc *ci)
vbus = &ci->platdata->vbus_extcon;
vbus->ci = ci;
if (!IS_ERR(vbus->edev)) {
-   ret = extcon_register_notifier(vbus->edev, EXTCON_USB,
-  &vbus->nb);
+   ret = devm_extcon_register_notifier(ci->dev, vbus->edev,
+   EXTCON_USB, &vbus->nb);
if (ret < 0) {
-   extcon_unregister_notifier(id->edev, EXTCON_USB_HOST,
-  &id->nb);
dev_err(ci->dev, "register VBUS failed\n");
return ret;
}
@@ -795,20 +793,6 @@ static int ci_extcon_register(struct ci_hdrc *ci)
return 0;
 }
 
-static void ci_extcon_unregister(struct ci_hdrc *ci)
-{
-   struct ci_hdrc_cable *cable;
-
-   cable = &ci->platdata->id_extcon;
-   if (!IS_ERR(cable->edev))
-   extcon_unregister_notifier(cable->edev, EXTCON_USB_HOST,
-  &cable->nb);
-
-   cable = &ci->platdata->vbus_extcon;
-   if (!IS_ERR(cable->edev))
-   extcon_unregister_notifier(cable->edev, EXTCON_USB, &cable->nb);
-}
-
 static DEFINE_IDA(ci_ida);
 
 struct platform_device *ci_hdrc_add_device(struct device *dev,
@@ -1054,7 +1038,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
if (!ret)
return 0;
 
-   ci_extcon_unregister(ci);
 stop:
ci_role_destroy(ci);
 deinit_phy:
@@ -1074,7 +1057,6 @@ static int ci_hdrc_remove(struct platform_device *pdev)
}
 
dbg_remove_files(ci);
-   ci_extcon_unregister(ci);
ci_role_destroy(ci);
ci_hdrc_enter_lpm(ci, true);
ci_usb_phy_exit(ci);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/6] usb: Replace the deprecated extcon API

2016-12-29 Thread Chanwoo Choi
This patches just replace the deprecated extcon API without any change
of extcon operation and use the resource-managed function for
extcon_register_notifier().

The new extcon API instead of deprecated API.
- extcon_set_cable_state_() -> extcon_set_state_sync();
- extcon_get_cable_state_() -> extcon_get_state();

Changes from v1:
- Rebase these patches based on v4.10-rc1.
- Add acked-by tag from usb maintainer and reviewer.
- Drop the phy/power-supply/chipidea patches.

Chanwoo Choi (6):
  usb: dwc3: omap: Replace the extcon API
  usb: phy: msm: Replace the extcon API
  usb: phy: omap-otg: Replace the extcon API
  usb: phy: qcom-8x16-usb: Replace the extcon API
  usb: phy: tahvo: Replace the deprecated extcon API
  usb: renesas_usbhs: Replace the deprecated extcon API

 drivers/usb/dwc3/dwc3-omap.c| 20 +++-
 drivers/usb/phy/phy-msm-usb.c   | 33 +++--
 drivers/usb/phy/phy-omap-otg.c  | 24 ++--
 drivers/usb/phy/phy-qcom-8x16-usb.c | 13 -
 drivers/usb/phy/phy-tahvo.c | 10 +-
 drivers/usb/renesas_usbhs/common.c  |  2 +-
 6 files changed, 34 insertions(+), 68 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 6/6] usb: renesas_usbhs: Replace the deprecated extcon API

2016-12-29 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Cc: Rob Herring 
Cc: Geert Uytterhoeven 
Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
Acked-by: Yoshihiro Shimoda 
---
 drivers/usb/renesas_usbhs/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/common.c 
b/drivers/usb/renesas_usbhs/common.c
index 012a37aa3e0d..623c51300393 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -389,7 +389,7 @@ static void usbhsc_hotplug(struct usbhs_priv *priv)
 
if (enable && !mod) {
if (priv->edev) {
-   cable = extcon_get_cable_state_(priv->edev, 
EXTCON_USB_HOST);
+   cable = extcon_get_state(priv->edev, EXTCON_USB_HOST);
if ((cable > 0 && id != USBHS_HOST) ||
(!cable && id != USBHS_GADGET)) {
dev_info(&pdev->dev,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/6] usb: dwc3: omap: Replace the extcon API

2016-12-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/dwc3/dwc3-omap.c | 20 +++-
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 29e80cc9b634..2d2e9aa1db08 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -425,20 +425,20 @@ static int dwc3_omap_extcon_register(struct dwc3_omap 
*omap)
}
 
omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier;
-   ret = extcon_register_notifier(edev, EXTCON_USB,
-   &omap->vbus_nb);
+   ret = devm_extcon_register_notifier(omap->dev, edev,
+   EXTCON_USB, &omap->vbus_nb);
if (ret < 0)
dev_vdbg(omap->dev, "failed to register notifier for 
USB\n");
 
omap->id_nb.notifier_call = dwc3_omap_id_notifier;
-   ret = extcon_register_notifier(edev, EXTCON_USB_HOST,
-   &omap->id_nb);
+   ret = devm_extcon_register_notifier(omap->dev, edev,
+   EXTCON_USB_HOST, &omap->id_nb);
if (ret < 0)
dev_vdbg(omap->dev, "failed to register notifier for 
USB-HOST\n");
 
-   if (extcon_get_cable_state_(edev, EXTCON_USB) == true)
+   if (extcon_get_state(edev, EXTCON_USB) == true)
dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
-   if (extcon_get_cable_state_(edev, EXTCON_USB_HOST) == true)
+   if (extcon_get_state(edev, EXTCON_USB_HOST) == true)
dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
 
omap->edev = edev;
@@ -527,17 +527,13 @@ static int dwc3_omap_probe(struct platform_device *pdev)
ret = of_platform_populate(node, NULL, NULL, dev);
if (ret) {
dev_err(&pdev->dev, "failed to create dwc3 core\n");
-   goto err2;
+   goto err1;
}
 
dwc3_omap_enable_irqs(omap);
 
return 0;
 
-err2:
-   extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
-   extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
-
 err1:
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
@@ -549,8 +545,6 @@ static int dwc3_omap_remove(struct platform_device *pdev)
 {
struct dwc3_omap*omap = platform_get_drvdata(pdev);
 
-   extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
-   extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
dwc3_omap_disable_irqs(omap);
of_platform_depopulate(omap->dev);
pm_runtime_put_sync(&pdev->dev);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/6] usb: phy: qcom-8x16-usb: Replace the extcon API

2016-12-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/phy/phy-qcom-8x16-usb.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/phy/phy-qcom-8x16-usb.c 
b/drivers/usb/phy/phy-qcom-8x16-usb.c
index d8593adb3621..fdf686398772 100644
--- a/drivers/usb/phy/phy-qcom-8x16-usb.c
+++ b/drivers/usb/phy/phy-qcom-8x16-usb.c
@@ -187,7 +187,7 @@ static int phy_8x16_init(struct usb_phy *phy)
val = ULPI_PWR_OTG_COMP_DISABLE;
usb_phy_io_write(phy, val, ULPI_SET(ULPI_PWR_CLK_MNG_REG));
 
-   state = extcon_get_cable_state_(qphy->vbus_edev, EXTCON_USB);
+   state = extcon_get_state(qphy->vbus_edev, EXTCON_USB);
if (state)
phy_8x16_vbus_on(qphy);
else
@@ -316,23 +316,20 @@ static int phy_8x16_probe(struct platform_device *pdev)
goto off_clks;
 
qphy->vbus_notify.notifier_call = phy_8x16_vbus_notify;
-   ret = extcon_register_notifier(qphy->vbus_edev, EXTCON_USB,
-  &qphy->vbus_notify);
+   ret = devm_extcon_register_notifier(&pdev->dev, qphy->vbus_edev,
+   EXTCON_USB, &qphy->vbus_notify);
if (ret < 0)
goto off_power;
 
ret = usb_add_phy_dev(&qphy->phy);
if (ret)
-   goto off_extcon;
+   goto off_power;
 
qphy->reboot_notify.notifier_call = phy_8x16_reboot_notify;
register_reboot_notifier(&qphy->reboot_notify);
 
return 0;
 
-off_extcon:
-   extcon_unregister_notifier(qphy->vbus_edev, EXTCON_USB,
-  &qphy->vbus_notify);
 off_power:
regulator_bulk_disable(ARRAY_SIZE(qphy->regulator), qphy->regulator);
 off_clks:
@@ -347,8 +344,6 @@ static int phy_8x16_remove(struct platform_device *pdev)
struct phy_8x16 *qphy = platform_get_drvdata(pdev);
 
unregister_reboot_notifier(&qphy->reboot_notify);
-   extcon_unregister_notifier(qphy->vbus_edev, EXTCON_USB,
-  &qphy->vbus_notify);
 
/*
 * Ensure that D+/D- lines are routed to uB connector, so
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/6] usb: phy: omap-otg: Replace the extcon API

2016-12-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/phy/phy-omap-otg.c | 24 ++--
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
index 6523af4f8f93..800d1d90753d 100644
--- a/drivers/usb/phy/phy-omap-otg.c
+++ b/drivers/usb/phy/phy-omap-otg.c
@@ -118,19 +118,19 @@ static int omap_otg_probe(struct platform_device *pdev)
otg_dev->id_nb.notifier_call = omap_otg_id_notifier;
otg_dev->vbus_nb.notifier_call = omap_otg_vbus_notifier;
 
-   ret = extcon_register_notifier(extcon, EXTCON_USB_HOST, 
&otg_dev->id_nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, extcon,
+   EXTCON_USB_HOST, &otg_dev->id_nb);
if (ret)
return ret;
 
-   ret = extcon_register_notifier(extcon, EXTCON_USB, &otg_dev->vbus_nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, extcon,
+   EXTCON_USB, &otg_dev->vbus_nb);
if (ret) {
-   extcon_unregister_notifier(extcon, EXTCON_USB_HOST,
-   &otg_dev->id_nb);
return ret;
}
 
-   otg_dev->id = extcon_get_cable_state_(extcon, EXTCON_USB_HOST);
-   otg_dev->vbus = extcon_get_cable_state_(extcon, EXTCON_USB);
+   otg_dev->id = extcon_get_state(extcon, EXTCON_USB_HOST);
+   otg_dev->vbus = extcon_get_state(extcon, EXTCON_USB);
omap_otg_set_mode(otg_dev);
 
rev = readl(otg_dev->base);
@@ -145,20 +145,8 @@ static int omap_otg_probe(struct platform_device *pdev)
return 0;
 }
 
-static int omap_otg_remove(struct platform_device *pdev)
-{
-   struct otg_device *otg_dev = platform_get_drvdata(pdev);
-   struct extcon_dev *edev = otg_dev->extcon;
-
-   extcon_unregister_notifier(edev, EXTCON_USB_HOST, &otg_dev->id_nb);
-   extcon_unregister_notifier(edev, EXTCON_USB, &otg_dev->vbus_nb);
-
-   return 0;
-}
-
 static struct platform_driver omap_otg_driver = {
.probe  = omap_otg_probe,
-   .remove = omap_otg_remove,
.driver = {
.name   = "omap_otg",
},
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 5/6] usb: phy: tahvo: Replace the deprecated extcon API

2016-12-29 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_set_cable_state_() -> extcon_set_state_sync()

Signed-off-by: Chanwoo Choi 
Acked-by: Felipe Balbi 
---
 drivers/usb/phy/phy-tahvo.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index ab5d364f6e8c..a31c8682e998 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -121,7 +121,7 @@ static void check_vbus_state(struct tahvo_usb *tu)
prev_state = tu->vbus_state;
tu->vbus_state = reg & TAHVO_STAT_VBUS;
if (prev_state != tu->vbus_state) {
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB, tu->vbus_state);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB, tu->vbus_state);
sysfs_notify(&tu->pt_dev->dev.kobj, NULL, "vbus_state");
}
 }
@@ -130,7 +130,7 @@ static void tahvo_usb_become_host(struct tahvo_usb *tu)
 {
struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent);
 
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST, true);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST, true);
 
/* Power up the transceiver in USB host mode */
retu_write(rdev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND |
@@ -149,7 +149,7 @@ static void tahvo_usb_become_peripheral(struct tahvo_usb 
*tu)
 {
struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent);
 
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST, false);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST, false);
 
/* Power up transceiver and set it in USB peripheral mode */
retu_write(rdev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT |
@@ -379,9 +379,9 @@ static int tahvo_usb_probe(struct platform_device *pdev)
}
 
/* Set the initial cable state. */
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST,
+   extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST,
   tu->tahvo_mode == TAHVO_MODE_HOST);
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB, tu->vbus_state);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB, tu->vbus_state);
 
/* Create OTG interface */
tahvo_usb_power_off(tu);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/12] usb: dwc3: omap: Replace the extcon API

2016-12-29 Thread Chanwoo Choi
Hi Felipe,

On 2016년 12월 02일 18:03, Felipe Balbi wrote:
> 
> Hi,
> 
> Chanwoo Choi  writes:
>> Hi Felipe,
>>
>> On 2016년 11월 30일 19:36, Felipe Balbi wrote:
>>>
>>> Hi,
>>>
>>> Chanwoo Choi  writes:
>>>> This patch uses the resource-managed extcon API for 
>>>> extcon_register_notifier()
>>>> and replaces the deprecated extcon API as following:
>>>> - extcon_get_cable_state_() -> extcon_get_state()
>>>>
>>>> Signed-off-by: Chanwoo Choi 
>>>
>>> Acked-by: Felipe Balbi 
>>>
>>
>> Thanks for your review.
>>
>> Each patch has no any dependency among patches.
>> So, If possible, could you pick the patch6/8/9/10/11/12 on your tree?
> 
> my tree is closed for v4.10, I can pick it up for v4.11

Could you please pick up these patches(patch6/8/9/10/11/12)?
These patches were already reviewed by you.

-- 
Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH 1/3 v2] usb: dwc2: Add extcon support to dwc2 driver

2016-12-06 Thread Chanwoo Choi
Hi John,

I give a some guide for extcon API.
This patch uses the deprecated extcon API (extcon_get_cable_state_).
So, I recommend that you better to use following extcon API:
- extcon_get_cable_state_()  -> extcon_get_state()
- extcon_register_notifier() -> devm_extcon_register_notifier()

Best Regards,
Chanwoo Choi

On 2016년 12월 06일 17:06, John Stultz wrote:
> This patch wires up extcon support to the dwc2 driver
> so that devices that use a modern generic phy driver
> and don't use the usb-phy infrastructure can still
> signal connect/disconnect events.
> 
> Cc: Wei Xu 
> Cc: Guodong Xu 
> Cc: Amit Pundir 
> Cc: Rob Herring 
> Cc: John Youn 
> Cc: Douglas Anderson 
> Cc: Chen Yu 
> Cc: Kishon Vijay Abraham I 
> Cc: Felipe Balbi 
> Cc: Greg Kroah-Hartman 
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: John Stultz 
> ---
> v2:
> * Move extcon logic from generic phy to dwc2 driver, as
>   suggested by Kishon.
> ---
>  arch/arm64/boot/dts/hisilicon/hi6220.dtsi | 11 +
>  drivers/usb/dwc2/core.h   | 16 
>  drivers/usb/dwc2/core_intr.c  | 25 +++
>  drivers/usb/dwc2/hcd.c| 23 +
>  drivers/usb/dwc2/platform.c   | 41 
> +++
>  5 files changed, 116 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi 
> b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
> index 17839db..8a86a11 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
> +++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi
> @@ -732,6 +732,16 @@
>   regulator-always-on;
>   };
>  
> + usb_vbus: usb-vbus {
> + compatible = "linux,extcon-usb-gpio";
> + id-gpio = <&gpio2 6 1>;
> + };
> +
> + usb_id: usb-id {
> + compatible = "linux,extcon-usb-gpio";
> + id-gpio = <&gpio2 5 1>;
> + };
> +
>   usb_phy: usbphy {
>   compatible = "hisilicon,hi6220-usb-phy";
>   #phy-cells = <0>;
> @@ -745,6 +755,7 @@
>   phys = <&usb_phy>;
>   phy-names = "usb2-phy";
>   clocks = <&sys_ctrl HI6220_USBOTG_HCLK>;
> + extcon = <&usb_vbus>, <&usb_id>;
>   clock-names = "otg";
>   dr_mode = "otg";
>   g-use-dma;
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index 2a21a04..4cfce62 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -623,6 +623,13 @@ struct dwc2_hregs_backup {
>   bool valid;
>  };
>  
> +struct dwc2_extcon {
> + struct notifier_block   nb;
> + struct extcon_dev   *extcon;
> + int state;
> +};
> +
> +
>  /*
>   * Constants related to high speed periodic scheduling
>   *
> @@ -996,6 +1003,10 @@ struct dwc2_hsotg {
>   u32 g_np_g_tx_fifo_sz;
>   u32 g_tx_fifo_sz[MAX_EPS_CHANNELS];
>  #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
> +
> + struct dwc2_extcon extcon_vbus;
> + struct dwc2_extcon extcon_id;
> + struct delayed_work extcon_work;
>  };
>  
>  /* Reasons for halting a host channel */
> @@ -1041,6 +1052,11 @@ extern void dwc2_flush_rx_fifo(struct dwc2_hsotg 
> *hsotg);
>  extern void dwc2_enable_global_interrupts(struct dwc2_hsotg *hcd);
>  extern void dwc2_disable_global_interrupts(struct dwc2_hsotg *hcd);
>  
> +extern int dwc2_extcon_vbus_notifier(struct notifier_block *nb,
> + unsigned long event, void *ptr);
> +extern int dwc2_extcon_id_notifier(struct notifier_block *nb,
> + unsigned long event, void *ptr);
> +
>  /* This function should be called on every hardware interrupt. */
>  extern irqreturn_t dwc2_handle_common_intr(int irq, void *dev);
>  
> diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
> index d85c5c9..d4fa938 100644
> --- a/drivers/usb/dwc2/core_intr.c
> +++ b/drivers/usb/dwc2/core_intr.c
> @@ -479,6 +479,31 @@ static void dwc2_handle_usb_suspend_intr(struct 
> dwc2_hsotg *hsotg)
>   }
>  }
>  
> +
> +
> +int dwc2_extcon_vbus_notifier(struct notifier_block *nb,
> + unsigned long event, void *ptr)
> +{
> + struct dwc2_extcon *vbus = container_of(nb, struct dwc2_extcon, nb);
> + struct dwc2_hsotg *h

Re: [PATCH 03/12] power_supply: axp288_charger: Replace the extcon API

2016-12-06 Thread Chanwoo Choi
Hi Sebastian,

On 2016년 12월 07일 12:05, Sebastian Reichel wrote:
> Hi Chanwoo,
> 
> On Tue, Dec 06, 2016 at 09:26:14AM +0900, Chanwoo Choi wrote:
>> Could you please review and pick the patch3/4 for power-supply driver?
> 
> Patches look fine. As I expect the merge window to open next week I
> would rather not queue this for 4.10 and instead do it once 4.10-rc1
> has been tagged.
> 
> -- Sebastian
> 

Thanks for your pick up.

-- 
Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/12] phy: rcar-gen3-usb2: Replace the deprecated extcon API

2016-12-05 Thread Chanwoo Choi
Hi Kishon,

Could you review and pick the patch1/2 for phy driver?

Best Regards,
Chanwoo Choi

On 2016년 11월 30일 14:57, Chanwoo Choi wrote:
> This patch replaces the deprecated extcon API as following:
> - extcon_set_cable_state_() -> extcon_set_state_sync()
> 
> Signed-off-by: Chanwoo Choi 
> ---
>  drivers/phy/phy-rcar-gen3-usb2.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/phy/phy-rcar-gen3-usb2.c 
> b/drivers/phy/phy-rcar-gen3-usb2.c
> index bd2430d7339c..7f8081f157f4 100644
> --- a/drivers/phy/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/phy-rcar-gen3-usb2.c
> @@ -93,11 +93,11 @@ static void rcar_gen3_phy_usb2_work(struct work_struct 
> *work)
>work);
>  
>   if (ch->extcon_host) {
> - extcon_set_cable_state_(ch->extcon, EXTCON_USB_HOST, true);
> - extcon_set_cable_state_(ch->extcon, EXTCON_USB, false);
> + extcon_set_state_sync(ch->extcon, EXTCON_USB_HOST, true);
> + extcon_set_state_sync(ch->extcon, EXTCON_USB, false);
>   } else {
> - extcon_set_cable_state_(ch->extcon, EXTCON_USB_HOST, false);
> - extcon_set_cable_state_(ch->extcon, EXTCON_USB, true);
> + extcon_set_state_sync(ch->extcon, EXTCON_USB_HOST, false);
> + extcon_set_state_sync(ch->extcon, EXTCON_USB, true);
>   }
>  }
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/12] power_supply: axp288_charger: Replace the extcon API

2016-12-05 Thread Chanwoo Choi
Hi Sebastian,

Could you please review and pick the patch3/4 for power-supply driver?

Best Regards,
Chanwoo Choi

On 2016년 11월 30일 14:57, Chanwoo Choi wrote:
> This patch uses the resource-managed extcon API for extcon_register_notifier()
> and replaces the deprecated extcon API as following:
> - extcon_get_cable_state_() -> extcon_get_state()
> 
> Signed-off-by: Chanwoo Choi 
> ---
>  drivers/power/supply/axp288_charger.c | 51 
> +--
>  1 file changed, 13 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/power/supply/axp288_charger.c 
> b/drivers/power/supply/axp288_charger.c
> index 75b8e0c7402b..1115052e9a69 100644
> --- a/drivers/power/supply/axp288_charger.c
> +++ b/drivers/power/supply/axp288_charger.c
> @@ -581,15 +581,15 @@ static void axp288_charger_extcon_evt_worker(struct 
> work_struct *work)
>   bool old_connected = info->cable.connected;
>  
>   /* Determine cable/charger type */
> - if (extcon_get_cable_state_(edev, EXTCON_CHG_USB_SDP) > 0) {
> + if (extcon_get_state(edev, EXTCON_CHG_USB_SDP) > 0) {
>   dev_dbg(&info->pdev->dev, "USB SDP charger  is connected");
>   info->cable.connected = true;
>   info->cable.chg_type = POWER_SUPPLY_TYPE_USB;
> - } else if (extcon_get_cable_state_(edev, EXTCON_CHG_USB_CDP) > 0) {
> + } else if (extcon_get_state(edev, EXTCON_CHG_USB_CDP) > 0) {
>   dev_dbg(&info->pdev->dev, "USB CDP charger is connected");
>   info->cable.connected = true;
>   info->cable.chg_type = POWER_SUPPLY_TYPE_USB_CDP;
> - } else if (extcon_get_cable_state_(edev, EXTCON_CHG_USB_DCP) > 0) {
> + } else if (extcon_get_state(edev, EXTCON_CHG_USB_DCP) > 0) {
>   dev_dbg(&info->pdev->dev, "USB DCP charger is connected");
>   info->cable.connected = true;
>   info->cable.chg_type = POWER_SUPPLY_TYPE_USB_DCP;
> @@ -686,7 +686,7 @@ static int axp288_charger_handle_otg_evt(struct 
> notifier_block *nb,
>   struct axp288_chrg_info *info =
>   container_of(nb, struct axp288_chrg_info, otg.id_nb);
>   struct extcon_dev *edev = info->otg.cable;
> - int usb_host = extcon_get_cable_state_(edev, EXTCON_USB_HOST);
> + int usb_host = extcon_get_state(edev, EXTCON_USB_HOST);
>  
>   dev_dbg(&info->pdev->dev, "external connector USB-Host is %s\n",
>   usb_host ? "attached" : "detached");
> @@ -841,33 +841,27 @@ static int axp288_charger_probe(struct platform_device 
> *pdev)
>   /* Register for extcon notification */
>   INIT_WORK(&info->cable.work, axp288_charger_extcon_evt_worker);
>   info->cable.nb.notifier_call = axp288_charger_handle_cable_evt;
> - ret = extcon_register_notifier(info->cable.edev, EXTCON_CHG_USB_SDP,
> - &info->cable.nb);
> + ret = devm_extcon_register_notifier(&pdev->dev, info->cable.edev,
> + EXTCON_CHG_USB_SDP, &info->cable.nb);
>   if (ret) {
>   dev_err(&info->pdev->dev,
>   "failed to register extcon notifier for SDP %d\n", ret);
>   return ret;
>   }
>  
> - ret = extcon_register_notifier(info->cable.edev, EXTCON_CHG_USB_CDP,
> - &info->cable.nb);
> + ret = devm_extcon_register_notifier(&pdev->dev, info->cable.edev,
> + EXTCON_CHG_USB_CDP, &info->cable.nb);
>   if (ret) {
>   dev_err(&info->pdev->dev,
>   "failed to register extcon notifier for CDP %d\n", ret);
> - extcon_unregister_notifier(info->cable.edev,
> - EXTCON_CHG_USB_SDP, &info->cable.nb);
>   return ret;
>   }
>  
> - ret = extcon_register_notifier(info->cable.edev, EXTCON_CHG_USB_DCP,
> - &info->cable.nb);
> + ret = devm_extcon_register_notifier(&pdev->dev, info->cable.edev,
> + EXTCON_CHG_USB_DCP, &info->cable.nb);
>   if (ret) {
>   dev_err(&info->pdev->dev,
>   "failed to register extcon notifier for DCP %d\n", ret);
> - extcon_unregister_notifier(info->cable.edev,
> - EXTCON_CHG_USB_SDP, &info->cable.nb);
> - extcon_unregister_notifier(info->cabl

Re: [PATCH 07/12] usb: sunxi: Uses the resource-managed extcon API when registering extcon notifier

2016-12-05 Thread Chanwoo Choi
On 2016년 12월 06일 01:32, Bin Liu wrote:
> On Wed, Nov 30, 2016 at 09:45:03AM +0100, Maxime Ripard wrote:
>> On Wed, Nov 30, 2016 at 02:57:35PM +0900, Chanwoo Choi wrote:
>>> This patch just uses the resource-managed extcon API when registering
>>> the extcon notifier.
>>>
>>> Signed-off-by: Chanwoo Choi 
>>
>> Acked-by: Maxime Ripard 
> 
> It would be ideal if the subject was "usb: musb: sunxi: ...".
> 
> Acked-by: Bin Liu 
> 

Thanks for the review. I'll change the subject.

-- 
Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/12] usb: dwc3: omap: Replace the extcon API

2016-12-02 Thread Chanwoo Choi
Hi Felipe,

2016-12-02 18:03 GMT+09:00 Felipe Balbi :
>
> Hi,
>
> Chanwoo Choi  writes:
>> Hi Felipe,
>>
>> On 2016년 11월 30일 19:36, Felipe Balbi wrote:
>>>
>>> Hi,
>>>
>>> Chanwoo Choi  writes:
>>>> This patch uses the resource-managed extcon API for 
>>>> extcon_register_notifier()
>>>> and replaces the deprecated extcon API as following:
>>>> - extcon_get_cable_state_() -> extcon_get_state()
>>>>
>>>> Signed-off-by: Chanwoo Choi 
>>>
>>> Acked-by: Felipe Balbi 
>>>
>>
>> Thanks for your review.
>>
>> Each patch has no any dependency among patches.
>> So, If possible, could you pick the patch6/8/9/10/11/12 on your tree?
>
> my tree is closed for v4.10, I can pick it up for v4.11

Thanks for your pickup to 4.11.

-- 
Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/12] usb: dwc3: omap: Replace the extcon API

2016-12-01 Thread Chanwoo Choi
Hi Felipe,

On 2016년 11월 30일 19:36, Felipe Balbi wrote:
> 
> Hi,
> 
> Chanwoo Choi  writes:
>> This patch uses the resource-managed extcon API for 
>> extcon_register_notifier()
>> and replaces the deprecated extcon API as following:
>> - extcon_get_cable_state_() -> extcon_get_state()
>>
>> Signed-off-by: Chanwoo Choi 
> 
> Acked-by: Felipe Balbi 
> 

Thanks for your review.

Each patch has no any dependency among patches.
So, If possible, could you pick the patch6/8/9/10/11/12 on your tree?

-- 
Best Regards,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/12] usb: dwc3: omap: Replace the extcon API

2016-11-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
---
 drivers/usb/dwc3/dwc3-omap.c | 20 +++-
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 29e80cc9b634..2d2e9aa1db08 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -425,20 +425,20 @@ static int dwc3_omap_extcon_register(struct dwc3_omap 
*omap)
}
 
omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier;
-   ret = extcon_register_notifier(edev, EXTCON_USB,
-   &omap->vbus_nb);
+   ret = devm_extcon_register_notifier(omap->dev, edev,
+   EXTCON_USB, &omap->vbus_nb);
if (ret < 0)
dev_vdbg(omap->dev, "failed to register notifier for 
USB\n");
 
omap->id_nb.notifier_call = dwc3_omap_id_notifier;
-   ret = extcon_register_notifier(edev, EXTCON_USB_HOST,
-   &omap->id_nb);
+   ret = devm_extcon_register_notifier(omap->dev, edev,
+   EXTCON_USB_HOST, &omap->id_nb);
if (ret < 0)
dev_vdbg(omap->dev, "failed to register notifier for 
USB-HOST\n");
 
-   if (extcon_get_cable_state_(edev, EXTCON_USB) == true)
+   if (extcon_get_state(edev, EXTCON_USB) == true)
dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
-   if (extcon_get_cable_state_(edev, EXTCON_USB_HOST) == true)
+   if (extcon_get_state(edev, EXTCON_USB_HOST) == true)
dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
 
omap->edev = edev;
@@ -527,17 +527,13 @@ static int dwc3_omap_probe(struct platform_device *pdev)
ret = of_platform_populate(node, NULL, NULL, dev);
if (ret) {
dev_err(&pdev->dev, "failed to create dwc3 core\n");
-   goto err2;
+   goto err1;
}
 
dwc3_omap_enable_irqs(omap);
 
return 0;
 
-err2:
-   extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
-   extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
-
 err1:
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
@@ -549,8 +545,6 @@ static int dwc3_omap_remove(struct platform_device *pdev)
 {
struct dwc3_omap*omap = platform_get_drvdata(pdev);
 
-   extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
-   extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
dwc3_omap_disable_irqs(omap);
of_platform_depopulate(omap->dev);
pm_runtime_put_sync(&pdev->dev);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/12] phy: sun4i-usb: Replace the deprecated extcon API

2016-11-29 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_set_cable_state_() -> extcon_set_state_sync()

Cc: Kishon Vijay Abraham I 
Cc: Maxime Ripard 
Cc: Chen-Yu Tsai 
Signed-off-by: Chanwoo Choi 
---
 drivers/phy/phy-sun4i-usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
index eeda5134c777..95cdb08c339f 100644
--- a/drivers/phy/phy-sun4i-usb.c
+++ b/drivers/phy/phy-sun4i-usb.c
@@ -528,7 +528,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct 
work_struct *work)
mutex_unlock(&phy0->mutex);
 
if (id_notify) {
-   extcon_set_cable_state_(data->extcon, EXTCON_USB_HOST,
+   extcon_set_state_sync(data->extcon, EXTCON_USB_HOST,
!id_det);
/* When leaving host mode force end the session here */
if (force_session_end && id_det == 1) {
@@ -541,7 +541,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct 
work_struct *work)
}
 
if (vbus_notify)
-   extcon_set_cable_state_(data->extcon, EXTCON_USB, vbus_det);
+   extcon_set_state_sync(data->extcon, EXTCON_USB, vbus_det);
 
if (sun4i_usb_phy0_poll(data))
queue_delayed_work(system_wq, &data->detect, POLL_TIME);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/12] extcon: Replace the deprecated extcon API

2016-11-29 Thread Chanwoo Choi
This patches just replace the deprecated extcon API without any change
of extcon operation and use the resource-managed function for
extcon_register_notifier().

The new extcon API instead of deprecated API.
- extcon_set_cable_state_() -> extcon_set_state_sync();
- extcon_get_cable_state_() -> extcon_get_state();

The each patch has not any dependency among patches. So, each maintainer
could pick up each patch without any problem.

Chanwoo Choi (12):
  phy: rcar-gen3-usb2: Replace the deprecated extcon API
  phy: sun4i-usb: Replace the deprecated extcon API
  power_supply: axp288_charger: Replace the extcon API
  power_supply: qcom_smbb: Replace the deprecated extcon API
  usb: chipdata: Replace the extcon API
  usb: dwc3: omap: Replace the extcon API
  usb: sunxi: Uses the resource-managed extcon API when registering extcon 
notifier
  usb: phy: msm: Replace the extcon API
  usb: phy: omap-otg: Replace the extcon API
  usb: phy: qcom-8x16-usb: Replace the extcon API
  usb: phy: tahvo: Replace the deprecated extcon API
  usb: renesas_usbhs: Replace the deprecated extcon API

 drivers/phy/phy-rcar-gen3-usb2.c  |  8 +++---
 drivers/phy/phy-sun4i-usb.c   |  4 +--
 drivers/power/supply/axp288_charger.c | 51 +--
 drivers/power/supply/qcom_smbb.c  |  2 +-
 drivers/usb/chipidea/core.c   | 30 +
 drivers/usb/dwc3/dwc3-omap.c  | 20 +-
 drivers/usb/musb/sunxi.c  | 12 +++--
 drivers/usb/phy/phy-msm-usb.c | 33 ---
 drivers/usb/phy/phy-omap-otg.c| 24 +
 drivers/usb/phy/phy-qcom-8x16-usb.c   | 13 +++--
 drivers/usb/phy/phy-tahvo.c   | 10 +++
 drivers/usb/renesas_usbhs/common.c|  2 +-
 12 files changed, 63 insertions(+), 146 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/12] usb: phy: msm: Replace the extcon API

2016-11-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
---
 drivers/usb/phy/phy-msm-usb.c | 33 +++--
 1 file changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 8a34759727bb..a15a89d4235d 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1742,14 +1742,14 @@ static int msm_otg_read_dt(struct platform_device 
*pdev, struct msm_otg *motg)
if (!IS_ERR(ext_vbus)) {
motg->vbus.extcon = ext_vbus;
motg->vbus.nb.notifier_call = msm_otg_vbus_notifier;
-   ret = extcon_register_notifier(ext_vbus, EXTCON_USB,
-   &motg->vbus.nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, ext_vbus,
+   EXTCON_USB, &motg->vbus.nb);
if (ret < 0) {
dev_err(&pdev->dev, "register VBUS notifier failed\n");
return ret;
}
 
-   ret = extcon_get_cable_state_(ext_vbus, EXTCON_USB);
+   ret = extcon_get_state(ext_vbus, EXTCON_USB);
if (ret)
set_bit(B_SESS_VLD, &motg->inputs);
else
@@ -1759,16 +1759,14 @@ static int msm_otg_read_dt(struct platform_device 
*pdev, struct msm_otg *motg)
if (!IS_ERR(ext_id)) {
motg->id.extcon = ext_id;
motg->id.nb.notifier_call = msm_otg_id_notifier;
-   ret = extcon_register_notifier(ext_id, EXTCON_USB_HOST,
-   &motg->id.nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, ext_id,
+   EXTCON_USB_HOST, &motg->id.nb);
if (ret < 0) {
dev_err(&pdev->dev, "register ID notifier failed\n");
-   extcon_unregister_notifier(motg->vbus.extcon,
-  EXTCON_USB, &motg->vbus.nb);
return ret;
}
 
-   ret = extcon_get_cable_state_(ext_id, EXTCON_USB_HOST);
+   ret = extcon_get_state(ext_id, EXTCON_USB_HOST);
if (ret)
clear_bit(ID, &motg->inputs);
else
@@ -1883,10 +1881,9 @@ static int msm_otg_probe(struct platform_device *pdev)
 */
if (motg->phy_number) {
phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4);
-   if (!phy_select) {
-   ret = -ENOMEM;
-   goto unregister_extcon;
-   }
+   if (!phy_select)
+   return -ENOMEM;
+
/* Enable second PHY with the OTG port */
writel(0x1, phy_select);
}
@@ -1897,7 +1894,7 @@ static int msm_otg_probe(struct platform_device *pdev)
if (motg->irq < 0) {
dev_err(&pdev->dev, "platform_get_irq failed\n");
ret = motg->irq;
-   goto unregister_extcon;
+   return motg->irq;
}
 
regs[0].supply = "vddcx";
@@ -1906,7 +1903,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 
ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs);
if (ret)
-   goto unregister_extcon;
+   return ret;
 
motg->vddcx = regs[0].consumer;
motg->v3p3  = regs[1].consumer;
@@ -2003,11 +2000,6 @@ static int msm_otg_probe(struct platform_device *pdev)
clk_disable_unprepare(motg->clk);
if (!IS_ERR(motg->core_clk))
clk_disable_unprepare(motg->core_clk);
-unregister_extcon:
-   extcon_unregister_notifier(motg->id.extcon,
-  EXTCON_USB_HOST, &motg->id.nb);
-   extcon_unregister_notifier(motg->vbus.extcon,
-  EXTCON_USB, &motg->vbus.nb);
 
return ret;
 }
@@ -2029,9 +2021,6 @@ static int msm_otg_remove(struct platform_device *pdev)
 */
gpiod_set_value_cansleep(motg->switch_gpio, 0);
 
-   extcon_unregister_notifier(motg->id.extcon, EXTCON_USB_HOST, 
&motg->id.nb);
-   extcon_unregister_notifier(motg->vbus.extcon, EXTCON_USB, 
&motg->vbus.nb);
-
msm_otg_debugfs_cleanup();
cancel_delayed_work_sync(&motg->chg_work);
cancel_work_sync(&motg->sm_work);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/12] usb: renesas_usbhs: Replace the deprecated extcon API

2016-11-29 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
---
 drivers/usb/renesas_usbhs/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/common.c 
b/drivers/usb/renesas_usbhs/common.c
index 012a37aa3e0d..623c51300393 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -389,7 +389,7 @@ static void usbhsc_hotplug(struct usbhs_priv *priv)
 
if (enable && !mod) {
if (priv->edev) {
-   cable = extcon_get_cable_state_(priv->edev, 
EXTCON_USB_HOST);
+   cable = extcon_get_state(priv->edev, EXTCON_USB_HOST);
if ((cable > 0 && id != USBHS_HOST) ||
(!cable && id != USBHS_GADGET)) {
dev_info(&pdev->dev,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/12] usb: phy: qcom-8x16-usb: Replace the extcon API

2016-11-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
---
 drivers/usb/phy/phy-qcom-8x16-usb.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/phy/phy-qcom-8x16-usb.c 
b/drivers/usb/phy/phy-qcom-8x16-usb.c
index d8593adb3621..fdf686398772 100644
--- a/drivers/usb/phy/phy-qcom-8x16-usb.c
+++ b/drivers/usb/phy/phy-qcom-8x16-usb.c
@@ -187,7 +187,7 @@ static int phy_8x16_init(struct usb_phy *phy)
val = ULPI_PWR_OTG_COMP_DISABLE;
usb_phy_io_write(phy, val, ULPI_SET(ULPI_PWR_CLK_MNG_REG));
 
-   state = extcon_get_cable_state_(qphy->vbus_edev, EXTCON_USB);
+   state = extcon_get_state(qphy->vbus_edev, EXTCON_USB);
if (state)
phy_8x16_vbus_on(qphy);
else
@@ -316,23 +316,20 @@ static int phy_8x16_probe(struct platform_device *pdev)
goto off_clks;
 
qphy->vbus_notify.notifier_call = phy_8x16_vbus_notify;
-   ret = extcon_register_notifier(qphy->vbus_edev, EXTCON_USB,
-  &qphy->vbus_notify);
+   ret = devm_extcon_register_notifier(&pdev->dev, qphy->vbus_edev,
+   EXTCON_USB, &qphy->vbus_notify);
if (ret < 0)
goto off_power;
 
ret = usb_add_phy_dev(&qphy->phy);
if (ret)
-   goto off_extcon;
+   goto off_power;
 
qphy->reboot_notify.notifier_call = phy_8x16_reboot_notify;
register_reboot_notifier(&qphy->reboot_notify);
 
return 0;
 
-off_extcon:
-   extcon_unregister_notifier(qphy->vbus_edev, EXTCON_USB,
-  &qphy->vbus_notify);
 off_power:
regulator_bulk_disable(ARRAY_SIZE(qphy->regulator), qphy->regulator);
 off_clks:
@@ -347,8 +344,6 @@ static int phy_8x16_remove(struct platform_device *pdev)
struct phy_8x16 *qphy = platform_get_drvdata(pdev);
 
unregister_reboot_notifier(&qphy->reboot_notify);
-   extcon_unregister_notifier(qphy->vbus_edev, EXTCON_USB,
-  &qphy->vbus_notify);
 
/*
 * Ensure that D+/D- lines are routed to uB connector, so
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/12] power_supply: qcom_smbb: Replace the deprecated extcon API

2016-11-29 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_set_cable_state_() -> extcon_set_state_sync()

Signed-off-by: Chanwoo Choi 
---
 drivers/power/supply/qcom_smbb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/qcom_smbb.c b/drivers/power/supply/qcom_smbb.c
index bb91a1c339bc..7b1991265b03 100644
--- a/drivers/power/supply/qcom_smbb.c
+++ b/drivers/power/supply/qcom_smbb.c
@@ -378,7 +378,7 @@ static irqreturn_t smbb_usb_valid_handler(int irq, void 
*_data)
struct smbb_charger *chg = _data;
 
smbb_set_line_flag(chg, irq, STATUS_USBIN_VALID);
-   extcon_set_cable_state_(chg->edev, EXTCON_USB,
+   extcon_set_state_sync(chg->edev, EXTCON_USB,
chg->status & STATUS_USBIN_VALID);
power_supply_changed(chg->usb_psy);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/12] usb: phy: tahvo: Replace the deprecated extcon API

2016-11-29 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_set_cable_state_() -> extcon_set_state_sync()

Signed-off-by: Chanwoo Choi 
---
 drivers/usb/phy/phy-tahvo.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index 1343bff004eb..9a7822e12156 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -121,7 +121,7 @@ static void check_vbus_state(struct tahvo_usb *tu)
prev_state = tu->vbus_state;
tu->vbus_state = reg & TAHVO_STAT_VBUS;
if (prev_state != tu->vbus_state) {
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB, tu->vbus_state);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB, tu->vbus_state);
sysfs_notify(&tu->pt_dev->dev.kobj, NULL, "vbus_state");
}
 }
@@ -130,7 +130,7 @@ static void tahvo_usb_become_host(struct tahvo_usb *tu)
 {
struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent);
 
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST, true);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST, true);
 
/* Power up the transceiver in USB host mode */
retu_write(rdev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND |
@@ -149,7 +149,7 @@ static void tahvo_usb_become_peripheral(struct tahvo_usb 
*tu)
 {
struct retu_dev *rdev = dev_get_drvdata(tu->pt_dev->dev.parent);
 
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST, false);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST, false);
 
/* Power up transceiver and set it in USB peripheral mode */
retu_write(rdev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT |
@@ -379,9 +379,9 @@ static int tahvo_usb_probe(struct platform_device *pdev)
}
 
/* Set the initial cable state. */
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB_HOST,
+   extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST,
   tu->tahvo_mode == TAHVO_MODE_HOST);
-   extcon_set_cable_state_(tu->extcon, EXTCON_USB, tu->vbus_state);
+   extcon_set_state_sync(tu->extcon, EXTCON_USB, tu->vbus_state);
 
/* Create OTG interface */
tahvo_usb_power_off(tu);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/12] power_supply: axp288_charger: Replace the extcon API

2016-11-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
---
 drivers/power/supply/axp288_charger.c | 51 +--
 1 file changed, 13 insertions(+), 38 deletions(-)

diff --git a/drivers/power/supply/axp288_charger.c 
b/drivers/power/supply/axp288_charger.c
index 75b8e0c7402b..1115052e9a69 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -581,15 +581,15 @@ static void axp288_charger_extcon_evt_worker(struct 
work_struct *work)
bool old_connected = info->cable.connected;
 
/* Determine cable/charger type */
-   if (extcon_get_cable_state_(edev, EXTCON_CHG_USB_SDP) > 0) {
+   if (extcon_get_state(edev, EXTCON_CHG_USB_SDP) > 0) {
dev_dbg(&info->pdev->dev, "USB SDP charger  is connected");
info->cable.connected = true;
info->cable.chg_type = POWER_SUPPLY_TYPE_USB;
-   } else if (extcon_get_cable_state_(edev, EXTCON_CHG_USB_CDP) > 0) {
+   } else if (extcon_get_state(edev, EXTCON_CHG_USB_CDP) > 0) {
dev_dbg(&info->pdev->dev, "USB CDP charger is connected");
info->cable.connected = true;
info->cable.chg_type = POWER_SUPPLY_TYPE_USB_CDP;
-   } else if (extcon_get_cable_state_(edev, EXTCON_CHG_USB_DCP) > 0) {
+   } else if (extcon_get_state(edev, EXTCON_CHG_USB_DCP) > 0) {
dev_dbg(&info->pdev->dev, "USB DCP charger is connected");
info->cable.connected = true;
info->cable.chg_type = POWER_SUPPLY_TYPE_USB_DCP;
@@ -686,7 +686,7 @@ static int axp288_charger_handle_otg_evt(struct 
notifier_block *nb,
struct axp288_chrg_info *info =
container_of(nb, struct axp288_chrg_info, otg.id_nb);
struct extcon_dev *edev = info->otg.cable;
-   int usb_host = extcon_get_cable_state_(edev, EXTCON_USB_HOST);
+   int usb_host = extcon_get_state(edev, EXTCON_USB_HOST);
 
dev_dbg(&info->pdev->dev, "external connector USB-Host is %s\n",
usb_host ? "attached" : "detached");
@@ -841,33 +841,27 @@ static int axp288_charger_probe(struct platform_device 
*pdev)
/* Register for extcon notification */
INIT_WORK(&info->cable.work, axp288_charger_extcon_evt_worker);
info->cable.nb.notifier_call = axp288_charger_handle_cable_evt;
-   ret = extcon_register_notifier(info->cable.edev, EXTCON_CHG_USB_SDP,
-   &info->cable.nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, info->cable.edev,
+   EXTCON_CHG_USB_SDP, &info->cable.nb);
if (ret) {
dev_err(&info->pdev->dev,
"failed to register extcon notifier for SDP %d\n", ret);
return ret;
}
 
-   ret = extcon_register_notifier(info->cable.edev, EXTCON_CHG_USB_CDP,
-   &info->cable.nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, info->cable.edev,
+   EXTCON_CHG_USB_CDP, &info->cable.nb);
if (ret) {
dev_err(&info->pdev->dev,
"failed to register extcon notifier for CDP %d\n", ret);
-   extcon_unregister_notifier(info->cable.edev,
-   EXTCON_CHG_USB_SDP, &info->cable.nb);
return ret;
}
 
-   ret = extcon_register_notifier(info->cable.edev, EXTCON_CHG_USB_DCP,
-   &info->cable.nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, info->cable.edev,
+   EXTCON_CHG_USB_DCP, &info->cable.nb);
if (ret) {
dev_err(&info->pdev->dev,
"failed to register extcon notifier for DCP %d\n", ret);
-   extcon_unregister_notifier(info->cable.edev,
-   EXTCON_CHG_USB_SDP, &info->cable.nb);
-   extcon_unregister_notifier(info->cable.edev,
-   EXTCON_CHG_USB_CDP, &info->cable.nb);
return ret;
}
 
@@ -887,13 +881,13 @@ static int axp288_charger_probe(struct platform_device 
*pdev)
/* Register for OTG notification */
INIT_WORK(&info->otg.work, axp288_charger_otg_evt_worker);
info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt;
-   ret = extcon_register_notifier(info->otg.ca

[PATCH 09/12] usb: phy: omap-otg: Replace the extcon API

2016-11-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
---
 drivers/usb/phy/phy-omap-otg.c | 24 ++--
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
index 6523af4f8f93..800d1d90753d 100644
--- a/drivers/usb/phy/phy-omap-otg.c
+++ b/drivers/usb/phy/phy-omap-otg.c
@@ -118,19 +118,19 @@ static int omap_otg_probe(struct platform_device *pdev)
otg_dev->id_nb.notifier_call = omap_otg_id_notifier;
otg_dev->vbus_nb.notifier_call = omap_otg_vbus_notifier;
 
-   ret = extcon_register_notifier(extcon, EXTCON_USB_HOST, 
&otg_dev->id_nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, extcon,
+   EXTCON_USB_HOST, &otg_dev->id_nb);
if (ret)
return ret;
 
-   ret = extcon_register_notifier(extcon, EXTCON_USB, &otg_dev->vbus_nb);
+   ret = devm_extcon_register_notifier(&pdev->dev, extcon,
+   EXTCON_USB, &otg_dev->vbus_nb);
if (ret) {
-   extcon_unregister_notifier(extcon, EXTCON_USB_HOST,
-   &otg_dev->id_nb);
return ret;
}
 
-   otg_dev->id = extcon_get_cable_state_(extcon, EXTCON_USB_HOST);
-   otg_dev->vbus = extcon_get_cable_state_(extcon, EXTCON_USB);
+   otg_dev->id = extcon_get_state(extcon, EXTCON_USB_HOST);
+   otg_dev->vbus = extcon_get_state(extcon, EXTCON_USB);
omap_otg_set_mode(otg_dev);
 
rev = readl(otg_dev->base);
@@ -145,20 +145,8 @@ static int omap_otg_probe(struct platform_device *pdev)
return 0;
 }
 
-static int omap_otg_remove(struct platform_device *pdev)
-{
-   struct otg_device *otg_dev = platform_get_drvdata(pdev);
-   struct extcon_dev *edev = otg_dev->extcon;
-
-   extcon_unregister_notifier(edev, EXTCON_USB_HOST, &otg_dev->id_nb);
-   extcon_unregister_notifier(edev, EXTCON_USB, &otg_dev->vbus_nb);
-
-   return 0;
-}
-
 static struct platform_driver omap_otg_driver = {
.probe  = omap_otg_probe,
-   .remove = omap_otg_remove,
.driver = {
.name   = "omap_otg",
},
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/12] usb: sunxi: Uses the resource-managed extcon API when registering extcon notifier

2016-11-29 Thread Chanwoo Choi
This patch just uses the resource-managed extcon API when registering
the extcon notifier.

Signed-off-by: Chanwoo Choi 
---
 drivers/usb/musb/sunxi.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c
index 1408245be18e..4b531551e49d 100644
--- a/drivers/usb/musb/sunxi.c
+++ b/drivers/usb/musb/sunxi.c
@@ -261,14 +261,14 @@ static int sunxi_musb_init(struct musb *musb)
writeb(SUNXI_MUSB_VEND0_PIO_MODE, musb->mregs + SUNXI_MUSB_VEND0);
 
/* Register notifier before calling phy_init() */
-   ret = extcon_register_notifier(glue->extcon, EXTCON_USB_HOST,
-  &glue->host_nb);
+   ret = devm_extcon_register_notifier(glue->dev, glue->extcon,
+   EXTCON_USB_HOST, &glue->host_nb);
if (ret)
goto error_reset_assert;
 
ret = phy_init(glue->phy);
if (ret)
-   goto error_unregister_notifier;
+   goto error_reset_assert;
 
musb->isr = sunxi_musb_interrupt;
 
@@ -277,9 +277,6 @@ static int sunxi_musb_init(struct musb *musb)
 
return 0;
 
-error_unregister_notifier:
-   extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
-  &glue->host_nb);
 error_reset_assert:
if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags))
reset_control_assert(glue->rst);
@@ -303,9 +300,6 @@ static int sunxi_musb_exit(struct musb *musb)
 
phy_exit(glue->phy);
 
-   extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
-  &glue->host_nb);
-
if (test_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags))
reset_control_assert(glue->rst);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/12] usb: chipdata: Replace the extcon API

2016-11-29 Thread Chanwoo Choi
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi 
---
 drivers/usb/chipidea/core.c | 30 ++
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 69426e644d17..a5b44963eaea 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -742,7 +742,7 @@ static int ci_get_platdata(struct device *dev,
cable->edev = ext_vbus;
 
if (!IS_ERR(ext_vbus)) {
-   ret = extcon_get_cable_state_(cable->edev, EXTCON_USB);
+   ret = extcon_get_state(cable->edev, EXTCON_USB);
if (ret)
cable->state = true;
else
@@ -754,7 +754,7 @@ static int ci_get_platdata(struct device *dev,
cable->edev = ext_id;
 
if (!IS_ERR(ext_id)) {
-   ret = extcon_get_cable_state_(cable->edev, EXTCON_USB_HOST);
+   ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
if (ret)
cable->state = false;
else
@@ -771,8 +771,8 @@ static int ci_extcon_register(struct ci_hdrc *ci)
id = &ci->platdata->id_extcon;
id->ci = ci;
if (!IS_ERR(id->edev)) {
-   ret = extcon_register_notifier(id->edev, EXTCON_USB_HOST,
-  &id->nb);
+   ret = devm_extcon_register_notifier(ci->dev, id->edev,
+   EXTCON_USB_HOST, &id->nb);
if (ret < 0) {
dev_err(ci->dev, "register ID failed\n");
return ret;
@@ -782,11 +782,9 @@ static int ci_extcon_register(struct ci_hdrc *ci)
vbus = &ci->platdata->vbus_extcon;
vbus->ci = ci;
if (!IS_ERR(vbus->edev)) {
-   ret = extcon_register_notifier(vbus->edev, EXTCON_USB,
-  &vbus->nb);
+   ret = devm_extcon_register_notifier(ci->dev, vbus->edev,
+   EXTCON_USB, &vbus->nb);
if (ret < 0) {
-   extcon_unregister_notifier(id->edev, EXTCON_USB_HOST,
-  &id->nb);
dev_err(ci->dev, "register VBUS failed\n");
return ret;
}
@@ -795,20 +793,6 @@ static int ci_extcon_register(struct ci_hdrc *ci)
return 0;
 }
 
-static void ci_extcon_unregister(struct ci_hdrc *ci)
-{
-   struct ci_hdrc_cable *cable;
-
-   cable = &ci->platdata->id_extcon;
-   if (!IS_ERR(cable->edev))
-   extcon_unregister_notifier(cable->edev, EXTCON_USB_HOST,
-  &cable->nb);
-
-   cable = &ci->platdata->vbus_extcon;
-   if (!IS_ERR(cable->edev))
-   extcon_unregister_notifier(cable->edev, EXTCON_USB, &cable->nb);
-}
-
 static DEFINE_IDA(ci_ida);
 
 struct platform_device *ci_hdrc_add_device(struct device *dev,
@@ -1053,7 +1037,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
if (!ret)
return 0;
 
-   ci_extcon_unregister(ci);
 stop:
ci_role_destroy(ci);
 deinit_phy:
@@ -1073,7 +1056,6 @@ static int ci_hdrc_remove(struct platform_device *pdev)
}
 
dbg_remove_files(ci);
-   ci_extcon_unregister(ci);
ci_role_destroy(ci);
ci_hdrc_enter_lpm(ci, true);
ci_usb_phy_exit(ci);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/12] phy: rcar-gen3-usb2: Replace the deprecated extcon API

2016-11-29 Thread Chanwoo Choi
This patch replaces the deprecated extcon API as following:
- extcon_set_cable_state_() -> extcon_set_state_sync()

Signed-off-by: Chanwoo Choi 
---
 drivers/phy/phy-rcar-gen3-usb2.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c
index bd2430d7339c..7f8081f157f4 100644
--- a/drivers/phy/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/phy-rcar-gen3-usb2.c
@@ -93,11 +93,11 @@ static void rcar_gen3_phy_usb2_work(struct work_struct 
*work)
 work);
 
if (ch->extcon_host) {
-   extcon_set_cable_state_(ch->extcon, EXTCON_USB_HOST, true);
-   extcon_set_cable_state_(ch->extcon, EXTCON_USB, false);
+   extcon_set_state_sync(ch->extcon, EXTCON_USB_HOST, true);
+   extcon_set_state_sync(ch->extcon, EXTCON_USB, false);
} else {
-   extcon_set_cable_state_(ch->extcon, EXTCON_USB_HOST, false);
-   extcon_set_cable_state_(ch->extcon, EXTCON_USB, true);
+   extcon_set_state_sync(ch->extcon, EXTCON_USB_HOST, false);
+   extcon_set_state_sync(ch->extcon, EXTCON_USB, true);
}
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] extcon: Split out the extcon APIs for extcon provider driver

2016-11-29 Thread Chanwoo Choi
This patchs split out the extcon APIs of extcon provider driver in order to
prevent the direct access of struct extcon_dev by extcon consumer driver.
The extcon consumer driver don't need to handle the extcon provider APIs.

The extcon subsystem has two type of extcon drivers as following:
- extcon provider driver
: Detect the external connector and identify the state/property of
  each external connector. And it send the notification to synchronize
  the information between provider and consumer driver.
- extcon consumer driver
: Receive the notifcation from extcon provider driver. When receving the noti,
  it can get the both state and property of specific external connector.

Cc: Myungjoo Ham 
Cc: Chen-Yu Tsai 
Cc: Krzysztof Kozlowski 
Cc: Yoshihiro Shimoda 
Cc: Kishon Vijay Abraham I 
Cc: Maxime Ripard 
Cc: Felipe Balbi 
Cc: Greg Kroah-Hartman 
Cc: Chris Zhong 
Cc: Roger Quadros 
Cc: Charles Keepax 
Cc: patc...@opensource.wolfsonmicro.com
Cc: linux-renesas-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-usb@vger.kernel.org
Signed-off-by: Chanwoo Choi 
---
 drivers/extcon/devres.c|   2 +-
 drivers/extcon/extcon-adc-jack.c   |   2 +-
 drivers/extcon/extcon-arizona.c|   2 +-
 drivers/extcon/extcon-axp288.c |   2 +-
 drivers/extcon/extcon-gpio.c   |   2 +-
 drivers/extcon/extcon-max14577.c   |   2 +-
 drivers/extcon/extcon-max3355.c|   2 +-
 drivers/extcon/extcon-max77693.c   |   2 +-
 drivers/extcon/extcon-max77843.c   |   2 +-
 drivers/extcon/extcon-max8997.c|   2 +-
 drivers/extcon/extcon-palmas.c |   1 +
 drivers/extcon/extcon-qcom-spmi-misc.c |   2 +-
 drivers/extcon/extcon-rt8973a.c|   2 +-
 drivers/extcon/extcon-sm5502.c |   2 +-
 drivers/extcon/extcon-usb-gpio.c   |   2 +-
 drivers/extcon/extcon.c|   2 +-
 drivers/phy/phy-rcar-gen3-usb2.c   |   2 +-
 drivers/phy/phy-sun4i-usb.c|   2 +-
 drivers/power/supply/qcom_smbb.c   |   2 +-
 drivers/usb/phy/phy-tahvo.c|   2 +-
 include/linux/extcon-provider.h| 262 +
 include/linux/extcon.h | 168 +
 22 files changed, 286 insertions(+), 183 deletions(-)
 create mode 100644 include/linux/extcon-provider.h

diff --git a/drivers/extcon/devres.c b/drivers/extcon/devres.c
index e686acd1c459..1b7dce13b21b 100644
--- a/drivers/extcon/devres.c
+++ b/drivers/extcon/devres.c
@@ -14,7 +14,7 @@
  * GNU General Public License for more details.
  */
 
-#include 
+#include 
 
 static int devm_extcon_dev_match(struct device *dev, void *res, void *data)
 {
diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
index bc538708c753..0882813a95f9 100644
--- a/drivers/extcon/extcon-adc-jack.c
+++ b/drivers/extcon/extcon-adc-jack.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 /**
  * struct adc_jack_data - internal data for adc_jack device driver
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index aeab47df9233..292878714ed9 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index 42f41e808292..f5b3687d29e8 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index ebed22f22d75..ab770adcca7e 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -17,7 +17,7 @@
  * GNU General Public License for more details.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 12e26c4e7763..9a7524ebf698 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #defineDELAY_MS_DEFAULT17000   /* unit: 
millisecond */
 
diff --git a/drivers/extcon/extcon-max3355.c b/drivers/extcon/extcon-max3355.c
index 533e16a952b8..0aa410836f4e 100644
--- a/drivers/extcon/extcon-max3355.c
+++ b/drivers/extcon/extcon-max3355.c
@@ -9,7 +9,7 @@
  * may be copied, distributed, and modified under those terms.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 68dbcb814b2f..d49339591cb6 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c

Re: [PATCH] extcon: usb-gpio: Add VBUS detection support

2016-10-19 Thread Chanwoo Choi
Hi Roger,

On 2016년 10월 07일 18:18, Roger Quadros wrote:
> Hi Chanwoo,
> 
> 
> On 27/09/16 08:48, Peter Chen wrote:
>> On Tue, Sep 20, 2016 at 05:53:55PM +0300, Roger Quadros wrote:
>>> Driver can now work with both ID and VBUS pins or either one of
>>> them.
>>>
>>> There can be the following 3 cases
>>>
>>> 1) Both ID and VBUS GPIOs are available:
>>>
>>> ID = LOW -> USB_HOST active, USB inactive
>>> ID = HIGH -> USB_HOST inactive, USB state is same as VBUS.
>>>
>>> 2) Only ID GPIO is available:
>>>
>>> ID = LOW -> USB_HOST active, USB inactive
>>> ID = HIGH -> USB_HOST inactive, USB active
>>>
>>> 3) Only VBUS GPIO is available:
>>>
>>> VBUS = LOW -> USB_HOST inactive, USB inactive
>>> VBUS = HIGH -> USB_HOST inactive, USB active
>>>
>>> Signed-off-by: Roger Quadros 
> 
> Can you please pick this one for v4.9? Thanks.

Applied it.

Best Regards,
Chanwoo Choi

[snip]

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] extcon: usb-gpio: Add VBUS detection support

2016-10-09 Thread Chanwoo Choi
Hi Roger,

I'm sorry for late reply due to the vacation.

2016-10-07 18:18 GMT+09:00 Roger Quadros :
> Hi Chanwoo,
>
>
> On 27/09/16 08:48, Peter Chen wrote:
>> On Tue, Sep 20, 2016 at 05:53:55PM +0300, Roger Quadros wrote:
>>> Driver can now work with both ID and VBUS pins or either one of
>>> them.
>>>
>>> There can be the following 3 cases
>>>
>>> 1) Both ID and VBUS GPIOs are available:
>>>
>>> ID = LOW -> USB_HOST active, USB inactive
>>> ID = HIGH -> USB_HOST inactive, USB state is same as VBUS.
>>>
>>> 2) Only ID GPIO is available:
>>>
>>> ID = LOW -> USB_HOST active, USB inactive
>>> ID = HIGH -> USB_HOST inactive, USB active
>>>
>>> 3) Only VBUS GPIO is available:
>>>
>>> VBUS = LOW -> USB_HOST inactive, USB inactive
>>> VBUS = HIGH -> USB_HOST inactive, USB active
>>>
>>> Signed-off-by: Roger Quadros 
>
> Can you please pick this one for v4.9? Thanks.


I already sent the pull request of v4.9. It was finished.
So, this patch might be queued to v4.10.  I'll review it
after the business trip.

Regards,
Chanwoo Choi

>
> cheers,
> -roger
>
>>> ---
>>>  .../devicetree/bindings/extcon/extcon-usb-gpio.txt |   3 +
>>>  drivers/extcon/extcon-usb-gpio.c   | 169 
>>> -
>>>  2 files changed, 132 insertions(+), 40 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt 
>>> b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
>>> index af0b903..dfc14f7 100644
>>> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
>>> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
>>> @@ -5,7 +5,10 @@ connected to a GPIO pin.
>>>
>>>  Required properties:
>>>  - compatible: Should be "linux,extcon-usb-gpio"
>>> +
>>> +Either one of id-gpio or vbus-gpio must be present. Both can be present as 
>>> well.
>>>  - id-gpio: gpio for USB ID pin. See gpio binding.
>>> +- vbus-gpio: gpio for USB VBUS pin.
>>>
>>>  Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below:
>>>  extcon_usb1 {
>>> diff --git a/drivers/extcon/extcon-usb-gpio.c 
>>> b/drivers/extcon/extcon-usb-gpio.c
>>> index a27d350..d589c5f 100644
>>> --- a/drivers/extcon/extcon-usb-gpio.c
>>> +++ b/drivers/extcon/extcon-usb-gpio.c
>>> @@ -24,7 +24,6 @@
>>>  #include 
>>>  #include 
>>>  #include 
>>> -#include 
>>>  #include 
>>>  #include 
>>>  #include 
>>> @@ -36,7 +35,9 @@ struct usb_extcon_info {
>>>  struct extcon_dev *edev;
>>>
>>>  struct gpio_desc *id_gpiod;
>>> +struct gpio_desc *vbus_gpiod;
>>>  int id_irq;
>>> +int vbus_irq;
>>>
>>>  unsigned long debounce_jiffies;
>>>  struct delayed_work wq_detcable;
>>> @@ -48,31 +49,47 @@ static const unsigned int usb_extcon_cable[] = {
>>>  EXTCON_NONE,
>>>  };
>>>
>>> +/*
>>> + * "USB" = VBUS and "USB-HOST" = !ID, so we have:
>>> + * Both "USB" and "USB-HOST" can't be set as active at the
>>> + * same time so if "USB-HOST" is active (i.e. ID is 0)  we keep "USB" 
>>> inactive
>>> + * even if VBUS is on.
>>> + *
>>> + *  State  |ID   |   VBUS
>>> + * 
>>> + *  [1] USB|H|H
>>> + *  [2] none   |H|L
>>> + *  [3] USB-HOST   |L|H
>>> + *  [4] USB-HOST   |L|L
>>> + *
>>> + * In case we have only one of these signals:
>>> + * - VBUS only - we want to distinguish between [1] and [2], so ID is 
>>> always 1.
>>> + * - ID only - we want to distinguish between [1] and [4], so VBUS = ID.
>>> +*/
>>>  static void usb_extcon_detect_cable(struct work_struct *work)
>>>  {
>>> -int id;
>>> +int id, vbus;
>>>  struct usb_extcon_info *info = container_of(to_delayed_work(work),
>>>  struct usb_extcon_info,
>>>  wq_detcable);
>>>
>>> -/* check ID and update cable state */
>>> -id = gpiod_get_value_can

[PATCH] extcon: Split out the extcon APIs for extcon provider driver

2016-08-01 Thread Chanwoo Choi
This patchs split out the extcon APIs of extcon provider driver in order to
prevent the direct access of struct extcon_dev by extcon consumer driver.
The extcon consumer driver don't need to handle the extcon provider APIs.

The extcon subsystem has two type of extcon drivers as following:
- extcon provider driver
: Detect the external connector and identify the state/property of
  each external connector. And it send the notification to synchronize
  the information between provider and consumer driver.
- extcon consumer driver
: Receive the notifcation from extcon provider driver. When receving the noti,
  it can get the both state and property of specific external connector.

Cc: Myungjoo Ham 
Cc: Chen-Yu Tsai 
Cc: Krzysztof Kozlowski 
Cc: Yoshihiro Shimoda 
Cc: Kishon Vijay Abraham I 
Cc: Maxime Ripard 
Cc: Felipe Balbi 
Cc: Greg Kroah-Hartman 
Cc: Chris Zhong 
Cc: Roger Quadros 
Cc: Charles Keepax 
Cc: patc...@opensource.wolfsonmicro.com
Cc: linux-renesas-...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-usb@vger.kernel.org
Signed-off-by: Chanwoo Choi 
---
 drivers/extcon/devres.c  |   2 +-
 drivers/extcon/extcon-adc-jack.c |   2 +-
 drivers/extcon/extcon-arizona.c  |   2 +-
 drivers/extcon/extcon-axp288.c   |   2 +-
 drivers/extcon/extcon-gpio.c |   2 +-
 drivers/extcon/extcon-max14577.c |   2 +-
 drivers/extcon/extcon-max3355.c  |   2 +-
 drivers/extcon/extcon-max77693.c |   2 +-
 drivers/extcon/extcon-max77843.c |   2 +-
 drivers/extcon/extcon-max8997.c  |   2 +-
 drivers/extcon/extcon-palmas.c   |   1 +
 drivers/extcon/extcon-rt8973a.c  |   2 +-
 drivers/extcon/extcon-sm5502.c   |   2 +-
 drivers/extcon/extcon-usb-gpio.c |   2 +-
 drivers/extcon/extcon.c  |   2 +-
 drivers/phy/phy-rcar-gen3-usb2.c |   2 +-
 drivers/phy/phy-sun4i-usb.c  |   2 +-
 drivers/usb/phy/phy-tahvo.c  |   2 +-
 include/linux/extcon-provider.h  | 262 +++
 include/linux/extcon.h   | 169 +
 20 files changed, 284 insertions(+), 182 deletions(-)
 create mode 100644 include/linux/extcon-provider.h

diff --git a/drivers/extcon/devres.c b/drivers/extcon/devres.c
index e686acd1c459..1b7dce13b21b 100644
--- a/drivers/extcon/devres.c
+++ b/drivers/extcon/devres.c
@@ -14,7 +14,7 @@
  * GNU General Public License for more details.
  */
 
-#include 
+#include 
 
 static int devm_extcon_dev_match(struct device *dev, void *res, void *data)
 {
diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
index e62e6cd7e00a..7340b03487fb 100644
--- a/drivers/extcon/extcon-adc-jack.c
+++ b/drivers/extcon/extcon-adc-jack.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 /**
  * struct adc_jack_data - internal data for adc_jack device driver
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 493bd9fe5f67..bf35697f7278 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index fd55c2f2080a..2ba1a14a51fa 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index b1b0264eb12d..835488ea7dbb 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -17,7 +17,7 @@
  * GNU General Public License for more details.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 852a7112f451..d0a01490649b 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #defineDELAY_MS_DEFAULT17000   /* unit: 
millisecond */
 
diff --git a/drivers/extcon/extcon-max3355.c b/drivers/extcon/extcon-max3355.c
index c24abec5d06c..ec94c2ff8f6f 100644
--- a/drivers/extcon/extcon-max3355.c
+++ b/drivers/extcon/extcon-max3355.c
@@ -9,7 +9,7 @@
  * may be copied, distributed, and modified under those terms.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index f17cb76b567c..9729b1fc402c 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index b188bd650efa..7b9c8aa750ea 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -11,7 +11,7 @@
  * (at your option) any later version.
  */
 
-#include 
+#in

  1   2   3   >