Re: [PATCH] usb: chipidea: host: Disable port power only if previously enabled

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

 



On Fri, 27 Dec 2019, Guenter Roeck wrote:

> On Thu, Dec 26, 2019 at 02:46:15PM -0500, Alan Stern wrote:
> > On Thu, 26 Dec 2019, Guenter Roeck wrote:
> > 
> > > On shutdown, ehci_power_off() is called unconditionally to power off
> > > each port, even if it was never called to power on the port.
> > > For chipidea, this results in a call to ehci_ci_portpower() with a request
> > > to power off ports even if the port was never powered on.
> > > This results in the following warning from the regulator code.
> > 
> > That's weird -- we should always power-on every port during hub 
> > initialization.
> > 
> That is what I would have assumed, but test code shows that it doesn't
> happen.
> 
> > It looks like there's a bug in hub.c:hub_activate(): The line under
> > HUB_INIT which calls hub_power_on() should call
> > usb_hub_set_port_power() instead.  In fact, the comment near the start
> 
> usb_hub_set_port_power() operates on a port of the hub. hub_activate()
> operates on the hub itself, or at least I think it does. I don't know
> how to convert the calls. Also, there are more calls to hub_power_on()
> in the same function.  Can you provide more details on what to do,
> or even better a patch for me to test ?

Let's try a slightly different approach.  What happens with this patch?

Alan Stern


Index: usb-devel/drivers/usb/core/hub.c
===================================================================
--- usb-devel.orig/drivers/usb/core/hub.c
+++ usb-devel/drivers/usb/core/hub.c
@@ -1065,6 +1065,7 @@ static void hub_activate(struct usb_hub
 		if (type == HUB_INIT) {
 			delay = hub_power_on_good_delay(hub);
 
+			hub->power_bits[0] = ~0UL;	/* All ports on */
 			hub_power_on(hub, false);
 			INIT_DELAYED_WORK(&hub->init_work, hub_init_func2);
 			queue_delayed_work(system_power_efficient_wq,




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux