All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy
@ 2017-03-23  5:54 Baolin Wang
  2017-03-23  5:54 ` [PATCH v2 2/2] usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregister Baolin Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Baolin Wang @ 2017-03-23  5:54 UTC (permalink / raw)
  To: balbi, gregkh
  Cc: linux-usb, linux-kernel, linaro-kernel, neilb, jun.li,
	peter.chen, broonie, baolin.wang

Usually usb phy need register one extcon device to get the connection
notifications. It will remove some duplicate code if the extcon device
is registered using common code instead of each phy driver having its
own related extcon APIs. So we add one pointer of extcon device into
usb phy structure, and some other helper functions to register extcon.

Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
Changes since v1:
 - Fix build errors with random config.
---
 drivers/usb/phy/Kconfig |    6 +++---
 drivers/usb/phy/phy.c   |   44 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/usb/phy.h |    6 ++++++
 3 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 61cef75..c9c61a8 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -4,6 +4,7 @@
 menu "USB Physical Layer drivers"
 
 config USB_PHY
+	select EXTCON
 	def_bool n
 
 #
@@ -116,7 +117,7 @@ config OMAP_OTG
 
 config TAHVO_USB
 	tristate "Tahvo USB transceiver driver"
-	depends on MFD_RETU && EXTCON
+	depends on MFD_RETU
 	depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
 	select USB_PHY
 	help
@@ -148,7 +149,6 @@ config USB_MSM_OTG
 	depends on (USB || USB_GADGET) && (ARCH_QCOM || COMPILE_TEST)
 	depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
 	depends on RESET_CONTROLLER
-	depends on EXTCON
 	select USB_PHY
 	help
 	  Enable this to support the USB OTG transceiver on Qualcomm chips. It
@@ -162,7 +162,7 @@ config USB_MSM_OTG
 config USB_QCOM_8X16_PHY
 	tristate "Qualcomm APQ8016/MSM8916 on-chip USB PHY controller support"
 	depends on ARCH_QCOM || COMPILE_TEST
-	depends on RESET_CONTROLLER && EXTCON
+	depends on RESET_CONTROLLER
 	select USB_PHY
 	select USB_ULPI_VIEWPORT
 	help
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 98f75d2..baa8b18 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -100,6 +100,41 @@ static int devm_usb_phy_match(struct device *dev, void *res, void *match_data)
 	return *phy == match_data;
 }
 
+static int usb_add_extcon(struct usb_phy *x)
+{
+	int ret;
+
+	if (of_property_read_bool(x->dev->of_node, "extcon")) {
+		x->edev = extcon_get_edev_by_phandle(x->dev, 0);
+		if (IS_ERR(x->edev))
+			return PTR_ERR(x->edev);
+
+		if (x->vbus_nb.notifier_call) {
+			ret = devm_extcon_register_notifier(x->dev, x->edev,
+							    EXTCON_USB,
+							    &x->vbus_nb);
+			if (ret < 0) {
+				dev_err(x->dev,
+					"register VBUS notifier failed\n");
+				return ret;
+			}
+		}
+
+		if (x->id_nb.notifier_call) {
+			ret = devm_extcon_register_notifier(x->dev, x->edev,
+							    EXTCON_USB_HOST,
+							    &x->id_nb);
+			if (ret < 0) {
+				dev_err(x->dev,
+					"register ID notifier failed\n");
+				return ret;
+			}
+		}
+	}
+
+	return 0;
+}
+
 /**
  * devm_usb_get_phy - find the USB PHY
  * @dev - device that requests this phy
@@ -388,6 +423,10 @@ int usb_add_phy(struct usb_phy *x, enum usb_phy_type type)
 		return -EINVAL;
 	}
 
+	ret = usb_add_extcon(x);
+	if (ret)
+		return ret;
+
 	ATOMIC_INIT_NOTIFIER_HEAD(&x->notifier);
 
 	spin_lock_irqsave(&phy_lock, flags);
@@ -422,12 +461,17 @@ int usb_add_phy_dev(struct usb_phy *x)
 {
 	struct usb_phy_bind *phy_bind;
 	unsigned long flags;
+	int ret;
 
 	if (!x->dev) {
 		dev_err(x->dev, "no device provided for PHY\n");
 		return -EINVAL;
 	}
 
+	ret = usb_add_extcon(x);
+	if (ret)
+		return ret;
+
 	ATOMIC_INIT_NOTIFIER_HEAD(&x->notifier);
 
 	spin_lock_irqsave(&phy_lock, flags);
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 31a8068..1b5269e 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -9,6 +9,7 @@
 #ifndef __LINUX_USB_PHY_H
 #define __LINUX_USB_PHY_H
 
+#include <linux/extcon.h>
 #include <linux/notifier.h>
 #include <linux/usb.h>
 
@@ -85,6 +86,11 @@ struct usb_phy {
 	struct usb_phy_io_ops	*io_ops;
 	void __iomem		*io_priv;
 
+	/* to support extcon device */
+	struct extcon_dev	*edev;
+	struct notifier_block	vbus_nb;
+	struct notifier_block	id_nb;
+
 	/* for notification of usb_phy_events */
 	struct atomic_notifier_head	notifier;
 
-- 
1.7.9.5

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

* [PATCH v2 2/2] usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregister
  2017-03-23  5:54 [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy Baolin Wang
@ 2017-03-23  5:54 ` Baolin Wang
  2017-03-28 13:42   ` Felipe Balbi
  2017-03-28 13:40 ` [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy Felipe Balbi
  2017-03-28 22:56 ` NeilBrown
  2 siblings, 1 reply; 8+ messages in thread
From: Baolin Wang @ 2017-03-23  5:54 UTC (permalink / raw)
  To: balbi, gregkh
  Cc: linux-usb, linux-kernel, linaro-kernel, neilb, jun.li,
	peter.chen, broonie, baolin.wang

Since usb phy core has added common code to register or unregister
extcon device, then phy-qcom-8x16-usb driver does not need its own
code to register/unregister extcon device, then remove them.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
Changes since v1:
 - No updates.
---
 drivers/usb/phy/phy-qcom-8x16-usb.c |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/phy/phy-qcom-8x16-usb.c b/drivers/usb/phy/phy-qcom-8x16-usb.c
index fdf6863..b6a83a5 100644
--- a/drivers/usb/phy/phy-qcom-8x16-usb.c
+++ b/drivers/usb/phy/phy-qcom-8x16-usb.c
@@ -69,9 +69,6 @@ struct phy_8x16 {
 
 	struct reset_control		*phy_reset;
 
-	struct extcon_dev		*vbus_edev;
-	struct notifier_block		vbus_notify;
-
 	struct gpio_desc		*switch_gpio;
 	struct notifier_block		reboot_notify;
 };
@@ -131,7 +128,8 @@ static int phy_8x16_vbus_off(struct phy_8x16 *qphy)
 static int phy_8x16_vbus_notify(struct notifier_block *nb, unsigned long event,
 				void *ptr)
 {
-	struct phy_8x16 *qphy = container_of(nb, struct phy_8x16, vbus_notify);
+	struct usb_phy *usb_phy = container_of(nb, struct usb_phy, vbus_nb);
+	struct phy_8x16 *qphy = container_of(usb_phy, struct phy_8x16, phy);
 
 	if (event)
 		phy_8x16_vbus_on(qphy);
@@ -187,7 +185,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_state(qphy->vbus_edev, EXTCON_USB);
+	state = extcon_get_state(qphy->phy.edev, EXTCON_USB);
 	if (state)
 		phy_8x16_vbus_on(qphy);
 	else
@@ -289,15 +287,13 @@ static int phy_8x16_probe(struct platform_device *pdev)
 	phy->io_priv		= qphy->regs + HSPHY_ULPI_VIEWPORT;
 	phy->io_ops		= &ulpi_viewport_access_ops;
 	phy->type		= USB_PHY_TYPE_USB2;
+	phy->vbus_nb.notifier_call = phy_8x16_vbus_notify;
+	phy->id_nb.notifier_call = NULL;
 
 	ret = phy_8x16_read_devicetree(qphy);
 	if (ret < 0)
 		return ret;
 
-	qphy->vbus_edev = extcon_get_edev_by_phandle(phy->dev, 0);
-	if (IS_ERR(qphy->vbus_edev))
-		return PTR_ERR(qphy->vbus_edev);
-
 	ret = clk_set_rate(qphy->core_clk, INT_MAX);
 	if (ret < 0)
 		dev_dbg(phy->dev, "Can't boost core clock\n");
@@ -315,12 +311,6 @@ static int phy_8x16_probe(struct platform_device *pdev)
 	if (WARN_ON(ret))
 		goto off_clks;
 
-	qphy->vbus_notify.notifier_call = phy_8x16_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_power;
-- 
1.7.9.5

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

* Re: [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy
  2017-03-23  5:54 [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy Baolin Wang
  2017-03-23  5:54 ` [PATCH v2 2/2] usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregister Baolin Wang
@ 2017-03-28 13:40 ` Felipe Balbi
  2017-03-30  2:56   ` Baolin Wang
  2017-03-28 22:56 ` NeilBrown
  2 siblings, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2017-03-28 13:40 UTC (permalink / raw)
  To: Baolin Wang, gregkh
  Cc: linux-usb, linux-kernel, linaro-kernel, neilb, jun.li,
	peter.chen, broonie, baolin.wang


Hi,

Baolin Wang <baolin.wang@linaro.org> writes:
> Usually usb phy need register one extcon device to get the connection
> notifications. It will remove some duplicate code if the extcon device
> is registered using common code instead of each phy driver having its
> own related extcon APIs. So we add one pointer of extcon device into
> usb phy structure, and some other helper functions to register extcon.
>
> Suggested-by: NeilBrown <neilb@suse.com>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

will this work with devices which have ID and VBUS from separate EXTCON
devices?

-- 
balbi

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

* Re: [PATCH v2 2/2] usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregister
  2017-03-23  5:54 ` [PATCH v2 2/2] usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregister Baolin Wang
@ 2017-03-28 13:42   ` Felipe Balbi
  2017-03-30  3:26     ` Baolin Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Felipe Balbi @ 2017-03-28 13:42 UTC (permalink / raw)
  To: Baolin Wang, gregkh
  Cc: linux-usb, linux-kernel, linaro-kernel, neilb, jun.li,
	peter.chen, broonie, baolin.wang


Hi,

Baolin Wang <baolin.wang@linaro.org> writes:
> Since usb phy core has added common code to register or unregister
> extcon device, then phy-qcom-8x16-usb driver does not need its own
> code to register/unregister extcon device, then remove them.
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

so previous patch helped *ONE* single user? Was it really beneficial if
it's all for a single user? Which duplicated code did it remove?

-- 
balbi

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

* Re: [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy
  2017-03-23  5:54 [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy Baolin Wang
  2017-03-23  5:54 ` [PATCH v2 2/2] usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregister Baolin Wang
  2017-03-28 13:40 ` [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy Felipe Balbi
@ 2017-03-28 22:56 ` NeilBrown
  2017-03-30  3:00   ` Baolin Wang
  2 siblings, 1 reply; 8+ messages in thread
From: NeilBrown @ 2017-03-28 22:56 UTC (permalink / raw)
  To: Baolin Wang, balbi, gregkh
  Cc: linux-usb, linux-kernel, linaro-kernel, jun.li, peter.chen,
	broonie, baolin.wang

[-- Attachment #1: Type: text/plain, Size: 3626 bytes --]

On Thu, Mar 23 2017, Baolin Wang wrote:

> Usually usb phy need register one extcon device to get the connection
> notifications. It will remove some duplicate code if the extcon device
> is registered using common code instead of each phy driver having its
> own related extcon APIs. So we add one pointer of extcon device into
> usb phy structure, and some other helper functions to register extcon.
>
> Suggested-by: NeilBrown <neilb@suse.com>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---
> Changes since v1:
>  - Fix build errors with random config.
> ---
>  drivers/usb/phy/Kconfig |    6 +++---
>  drivers/usb/phy/phy.c   |   44 ++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/usb/phy.h |    6 ++++++
>  3 files changed, 53 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
> index 61cef75..c9c61a8 100644
> --- a/drivers/usb/phy/Kconfig
> +++ b/drivers/usb/phy/Kconfig
> @@ -4,6 +4,7 @@
>  menu "USB Physical Layer drivers"
>  
>  config USB_PHY
> +	select EXTCON
>  	def_bool n
>  
>  #
> @@ -116,7 +117,7 @@ config OMAP_OTG
>  
>  config TAHVO_USB
>  	tristate "Tahvo USB transceiver driver"
> -	depends on MFD_RETU && EXTCON
> +	depends on MFD_RETU
>  	depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
>  	select USB_PHY
>  	help
> @@ -148,7 +149,6 @@ config USB_MSM_OTG
>  	depends on (USB || USB_GADGET) && (ARCH_QCOM || COMPILE_TEST)
>  	depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
>  	depends on RESET_CONTROLLER
> -	depends on EXTCON
>  	select USB_PHY
>  	help
>  	  Enable this to support the USB OTG transceiver on Qualcomm chips. It
> @@ -162,7 +162,7 @@ config USB_MSM_OTG
>  config USB_QCOM_8X16_PHY
>  	tristate "Qualcomm APQ8016/MSM8916 on-chip USB PHY controller support"
>  	depends on ARCH_QCOM || COMPILE_TEST
> -	depends on RESET_CONTROLLER && EXTCON
> +	depends on RESET_CONTROLLER
>  	select USB_PHY
>  	select USB_ULPI_VIEWPORT
>  	help
> diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
> index 98f75d2..baa8b18 100644
> --- a/drivers/usb/phy/phy.c
> +++ b/drivers/usb/phy/phy.c
> @@ -100,6 +100,41 @@ static int devm_usb_phy_match(struct device *dev, void *res, void *match_data)
>  	return *phy == match_data;
>  }
>  
> +static int usb_add_extcon(struct usb_phy *x)
> +{
> +	int ret;
> +
> +	if (of_property_read_bool(x->dev->of_node, "extcon")) {
> +		x->edev = extcon_get_edev_by_phandle(x->dev, 0);

This is not what I meant to suggest.
This provides an extcon only for some phy devices.  I meant that every
single usb_phy should always have an extcon.
So phy.c should probably call extcon_dev_allocate() and
extcon_dev_register() - or similar.

The driver then calls extcon_set_state() or similar on this extcon
device in whatever way might be appropriate.
For a phy driver like phy-qcom-8x16-usb it might just pass on
events from some separate extcon device.

For the (hypothetical?) device that Felipe suggests with separate
ID and VBUS extcons, it would pass on events from multiple different
extcons.  i.e. it would act like a multiplexer.

Other drivers would do things from interrupt handlers, based on values
read from registers.

The important point is that each usb_phy doesn't get a pointer to some
separate extcon.  Rather it has an extcon that it completely owns.  The
name of the extcon is the same of the phy.  The extcon should be seen as
a part of the phy, not a separate thing which provides service to the
phy.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy
  2017-03-28 13:40 ` [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy Felipe Balbi
@ 2017-03-30  2:56   ` Baolin Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Baolin Wang @ 2017-03-30  2:56 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Greg KH, USB, LKML, Linaro Kernel Mailman List, NeilBrown,
	Jun Li, Peter Chen, Mark Brown

Hi,

On 28 March 2017 at 21:40, Felipe Balbi <balbi@kernel.org> wrote:
>
> Hi,
>
> Baolin Wang <baolin.wang@linaro.org> writes:
>> Usually usb phy need register one extcon device to get the connection
>> notifications. It will remove some duplicate code if the extcon device
>> is registered using common code instead of each phy driver having its
>> own related extcon APIs. So we add one pointer of extcon device into
>> usb phy structure, and some other helper functions to register extcon.
>>
>> Suggested-by: NeilBrown <neilb@suse.com>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>
> will this work with devices which have ID and VBUS from separate EXTCON
> devices?

Ah, It can not work for separate EXTCON devices, now I realized some
devices have separate EXTCON devices. Thanks for pointing this.

-- 
Baolin.wang
Best Regards

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

* Re: [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy
  2017-03-28 22:56 ` NeilBrown
@ 2017-03-30  3:00   ` Baolin Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Baolin Wang @ 2017-03-30  3:00 UTC (permalink / raw)
  To: NeilBrown
  Cc: Felipe Balbi, Greg KH, USB, LKML, Linaro Kernel Mailman List,
	Jun Li, Peter Chen, Mark Brown

Hi,

On 29 March 2017 at 06:56, NeilBrown <neilb@suse.com> wrote:
> On Thu, Mar 23 2017, Baolin Wang wrote:
>
>> Usually usb phy need register one extcon device to get the connection
>> notifications. It will remove some duplicate code if the extcon device
>> is registered using common code instead of each phy driver having its
>> own related extcon APIs. So we add one pointer of extcon device into
>> usb phy structure, and some other helper functions to register extcon.
>>
>> Suggested-by: NeilBrown <neilb@suse.com>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>> ---
>> Changes since v1:
>>  - Fix build errors with random config.
>> ---
>>  drivers/usb/phy/Kconfig |    6 +++---
>>  drivers/usb/phy/phy.c   |   44 ++++++++++++++++++++++++++++++++++++++++++++
>>  include/linux/usb/phy.h |    6 ++++++
>>  3 files changed, 53 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
>> index 61cef75..c9c61a8 100644
>> --- a/drivers/usb/phy/Kconfig
>> +++ b/drivers/usb/phy/Kconfig
>> @@ -4,6 +4,7 @@
>>  menu "USB Physical Layer drivers"
>>
>>  config USB_PHY
>> +     select EXTCON
>>       def_bool n
>>
>>  #
>> @@ -116,7 +117,7 @@ config OMAP_OTG
>>
>>  config TAHVO_USB
>>       tristate "Tahvo USB transceiver driver"
>> -     depends on MFD_RETU && EXTCON
>> +     depends on MFD_RETU
>>       depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
>>       select USB_PHY
>>       help
>> @@ -148,7 +149,6 @@ config USB_MSM_OTG
>>       depends on (USB || USB_GADGET) && (ARCH_QCOM || COMPILE_TEST)
>>       depends on USB_GADGET || !USB_GADGET # if USB_GADGET=m, this can't be 'y'
>>       depends on RESET_CONTROLLER
>> -     depends on EXTCON
>>       select USB_PHY
>>       help
>>         Enable this to support the USB OTG transceiver on Qualcomm chips. It
>> @@ -162,7 +162,7 @@ config USB_MSM_OTG
>>  config USB_QCOM_8X16_PHY
>>       tristate "Qualcomm APQ8016/MSM8916 on-chip USB PHY controller support"
>>       depends on ARCH_QCOM || COMPILE_TEST
>> -     depends on RESET_CONTROLLER && EXTCON
>> +     depends on RESET_CONTROLLER
>>       select USB_PHY
>>       select USB_ULPI_VIEWPORT
>>       help
>> diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
>> index 98f75d2..baa8b18 100644
>> --- a/drivers/usb/phy/phy.c
>> +++ b/drivers/usb/phy/phy.c
>> @@ -100,6 +100,41 @@ static int devm_usb_phy_match(struct device *dev, void *res, void *match_data)
>>       return *phy == match_data;
>>  }
>>
>> +static int usb_add_extcon(struct usb_phy *x)
>> +{
>> +     int ret;
>> +
>> +     if (of_property_read_bool(x->dev->of_node, "extcon")) {
>> +             x->edev = extcon_get_edev_by_phandle(x->dev, 0);
>
> This is not what I meant to suggest.
> This provides an extcon only for some phy devices.  I meant that every
> single usb_phy should always have an extcon.
> So phy.c should probably call extcon_dev_allocate() and
> extcon_dev_register() - or similar.

That means every usb phy acts as one extcon device, but I think usb
phy device is not one extcon device, ID/VBUS GPIOs are really extcon
devices, which means usb phy extcon device is duplicate, right?

>
> The driver then calls extcon_set_state() or similar on this extcon
> device in whatever way might be appropriate.
> For a phy driver like phy-qcom-8x16-usb it might just pass on
> events from some separate extcon device.
>
> For the (hypothetical?) device that Felipe suggests with separate
> ID and VBUS extcons, it would pass on events from multiple different
> extcons.  i.e. it would act like a multiplexer.
>
> Other drivers would do things from interrupt handlers, based on values
> read from registers.
>
> The important point is that each usb_phy doesn't get a pointer to some
> separate extcon.  Rather it has an extcon that it completely owns.  The
> name of the extcon is the same of the phy.  The extcon should be seen as
> a part of the phy, not a separate thing which provides service to the
> phy.
>
> Thanks,
> NeilBrown



-- 
Baolin.wang
Best Regards

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

* Re: [PATCH v2 2/2] usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregister
  2017-03-28 13:42   ` Felipe Balbi
@ 2017-03-30  3:26     ` Baolin Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Baolin Wang @ 2017-03-30  3:26 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Greg KH, USB, LKML, Linaro Kernel Mailman List, NeilBrown,
	Jun Li, Peter Chen, Mark Brown

Hi,

On 28 March 2017 at 21:42, Felipe Balbi <balbi@kernel.org> wrote:
>
> Hi,
>
> Baolin Wang <baolin.wang@linaro.org> writes:
>> Since usb phy core has added common code to register or unregister
>> extcon device, then phy-qcom-8x16-usb driver does not need its own
>> code to register/unregister extcon device, then remove them.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>
> so previous patch helped *ONE* single user? Was it really beneficial if
> it's all for a single user? Which duplicated code did it remove?

Now only 3 USB phy drivers (phy-qcom-8x16-usb.c, phy-omap-otg.c and
phy-msm-usb.c) had registered an extcon, mostly did not.
phy-omap-otg.c did not add one usb phy, so I did not convert it.
phy-msm-usb.c had 2 separate extcon devices, but my last patch did not
support separate extcon devices which need to modify again. Moreover
in future usb phy drivers do not need to implement extcon things in
their own drivers.

-- 
Baolin.wang
Best Regards

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

end of thread, other threads:[~2017-03-30  3:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23  5:54 [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy Baolin Wang
2017-03-23  5:54 ` [PATCH v2 2/2] usb: phy: phy-qcom-8x16-usb: Remove redundant extcon register/unregister Baolin Wang
2017-03-28 13:42   ` Felipe Balbi
2017-03-30  3:26     ` Baolin Wang
2017-03-28 13:40 ` [PATCH v2 1/2] usb: phy: Introduce one extcon device into usb phy Felipe Balbi
2017-03-30  2:56   ` Baolin Wang
2017-03-28 22:56 ` NeilBrown
2017-03-30  3:00   ` Baolin Wang

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