All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: musb: remove extra check in musb_gadget_vbus_draw
@ 2022-11-14  8:59 Ivaylo Dimitrov
  2022-11-22 16:11 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Ivaylo Dimitrov @ 2022-11-14  8:59 UTC (permalink / raw)
  To: b-liu; +Cc: gregkh, linux-usb, linux-kernel, tony, Ivaylo Dimitrov

The check for musb->xceiv->set_power duplicates the check done in
usb_phy_set_power(). Moreover, not calling usb_phy_set_power() results in
current USB config max current not being propagated through usb_charger FW

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
---
 drivers/usb/musb/musb_gadget.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 6704a62..ba20272d 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1628,8 +1628,6 @@ static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
 {
 	struct musb	*musb = gadget_to_musb(gadget);
 
-	if (!musb->xceiv->set_power)
-		return -EOPNOTSUPP;
 	return usb_phy_set_power(musb->xceiv, mA);
 }
 
-- 
1.9.1


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

* Re: [PATCH] usb: musb: remove extra check in musb_gadget_vbus_draw
  2022-11-14  8:59 [PATCH] usb: musb: remove extra check in musb_gadget_vbus_draw Ivaylo Dimitrov
@ 2022-11-22 16:11 ` Greg KH
  2022-11-23  7:12   ` Tony Lindgren
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2022-11-22 16:11 UTC (permalink / raw)
  To: Ivaylo Dimitrov; +Cc: b-liu, linux-usb, linux-kernel, tony

On Mon, Nov 14, 2022 at 10:59:47AM +0200, Ivaylo Dimitrov wrote:
> The check for musb->xceiv->set_power duplicates the check done in
> usb_phy_set_power(). Moreover, not calling usb_phy_set_power() results in
> current USB config max current not being propagated through usb_charger FW

What does "FW" mean here?

> 
> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
> ---
>  drivers/usb/musb/musb_gadget.c | 2 --
>  1 file changed, 2 deletions(-)

And is this a bugfix?  If so, what commit id does it fix?  Should it go
to stable kernels?  What hardware was this tested on that this solved a
problem for?

Please fix this and send a v2.

thanks,

greg k-h

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

* Re: [PATCH] usb: musb: remove extra check in musb_gadget_vbus_draw
  2022-11-22 16:11 ` Greg KH
@ 2022-11-23  7:12   ` Tony Lindgren
  2022-11-25 18:21     ` [PATCH v2] " Ivaylo Dimitrov
  0 siblings, 1 reply; 4+ messages in thread
From: Tony Lindgren @ 2022-11-23  7:12 UTC (permalink / raw)
  To: Greg KH; +Cc: Ivaylo Dimitrov, b-liu, linux-usb, linux-kernel

* Greg KH <gregkh@linuxfoundation.org> [221122 16:01]:
> On Mon, Nov 14, 2022 at 10:59:47AM +0200, Ivaylo Dimitrov wrote:
> > The check for musb->xceiv->set_power duplicates the check done in
> > usb_phy_set_power(). Moreover, not calling usb_phy_set_power() results in
> > current USB config max current not being propagated through usb_charger FW
> 
> What does "FW" mean here?
> 
> > 
> > Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
> > ---
> >  drivers/usb/musb/musb_gadget.c | 2 --
> >  1 file changed, 2 deletions(-)
> 
> And is this a bugfix?  If so, what commit id does it fix?  Should it go
> to stable kernels?  What hardware was this tested on that this solved a
> problem for?
> 
> Please fix this and send a v2.

Ivaylo please also test with the musb phy changes in Linux next that might
affect this patch.

Regards,

Tony

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

* [PATCH v2] usb: musb: remove extra check in musb_gadget_vbus_draw
  2022-11-23  7:12   ` Tony Lindgren
@ 2022-11-25 18:21     ` Ivaylo Dimitrov
  0 siblings, 0 replies; 4+ messages in thread
From: Ivaylo Dimitrov @ 2022-11-25 18:21 UTC (permalink / raw)
  To: b-liu, gregkh; +Cc: linux-usb, linux-kernel, tony, Ivaylo Dimitrov

The checks for musb->xceiv and musb->xceiv->set_power duplicate those in
usb_phy_set_power(), so there is no need of them. Moreover, not calling
usb_phy_set_power() results in usb_phy_set_charger_current() not being
called, so current USB config max current is not propagated through USB
charger framework and charger drivers may try to draw more current than
allowed or possible.

Fix that by removing those extra checks and calling usb_phy_set_power()
directly.

Tested on Motorola Droid4 and Nokia N900

Fixes: a9081a008f84 ("usb: phy: Add USB charger support")
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
---
 drivers/usb/musb/musb_gadget.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 6cb9514..31c4432 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1630,8 +1630,6 @@ static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
 {
 	struct musb	*musb = gadget_to_musb(gadget);
 
-	if (!musb->xceiv || !musb->xceiv->set_power)
-		return -EOPNOTSUPP;
 	return usb_phy_set_power(musb->xceiv, mA);
 }
 
-- 
1.9.1


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

end of thread, other threads:[~2022-11-25 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14  8:59 [PATCH] usb: musb: remove extra check in musb_gadget_vbus_draw Ivaylo Dimitrov
2022-11-22 16:11 ` Greg KH
2022-11-23  7:12   ` Tony Lindgren
2022-11-25 18:21     ` [PATCH v2] " Ivaylo Dimitrov

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.