On 20-01-29 12:59, Alan Stern wrote: > On Wed, 29 Jan 2020, Marco Felsch wrote: > > > Hi Alan, Rafael, Greg, > > > > long story short: I want to disable a usb-port completely during suspend > > You're talking about what happens during a full system suspend, right? Yes. > > because it isn't needed and we need to save energy, because is a 32bit ARM > > (OF-based) handheld device. I use the port to connect a usb-ethernet > > dongle (all needed drivers are builtin no modules) which is needed for > > the NFS. The usb-ethernet dongle supports the persist setting because it > > does a hw-reset during resume anyway. > > > > So what I did is: > > 1) Set the persist bit for the usb device > > 2) Set the control to auto for the usb device > > 3) Unset the pm_qos_no_power_off flag for the usb-port > > > > But the port gets not disabled. I debugged it and found a problem in > > usb_port_suspend() logic [1] and the generic PM-framework more precisely > > the dpm mechanism. The usbcore does the correct pm_runtime counting but > > the call [2] don't trigger the usb_port_runtime_suspend() [3] because > > the dpm enables all runtime-pm device before the shutdown is executed. > > That's right; it's supposed to work that way. We don't want runtime > suspend kicking in and messing things up during a system suspend. I'm absolutly fine with that behaviour. > > IMHO both subsystem behaviours are correct and I don't know the > > _correct_ fix, therefore I wrote this email. > > The correct fix is to add support for system suspend to the USB port > driver. Currently it only supports runtime suspend, as you can see > from the definition of usb_port_pm_ops in port.c. I tought that this was intentionally to support only the runtime-pm ops. Okay so this means that we need to check the: - persist - do_wakeup - pm_qos_power_off bits again for the suspend case. I tought I miss something and we can reuse the current checks. Regards, Marco > Alan Stern > > > As far as I understood it all non-ACPI platforms are affected. > > > > Regards, > > Marco > > > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/core/hub.c?h=v5.5#n3238 > > [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/core/hub.c?h=v5.5#n3328 > > [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/core/port.c?h=v5.5#n247 > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |