Summary: Address the following issues for port power control: 1/ Port power policy needs 'connector' awareness. 2/ Reliable port power control requires coordination with khubd. 3/ Userspace needs full control, but also help coordinating port power policy. Even with these changes port power control still defaults to disabled (ports are always on). This is 3.14 material. Details: 1/ Port power policy needs 'connector' awareness. It is a recipe for unintended device disconnects to turn off a port while leaving its peer active. The attached device, provided it is not a hub may, switch from the USB3 connection to USB2. Introduce a 'connector' object to track ports from different hcds (for example the two hcds provided by XHCI). A 'connector' is distinct from 'companion' ports which share the same data lines across multiple hcds. Port-connector membership data comes from platorm firmware. 2/ Reliable port power control requires coordination with khubd. The existing implementation makes attempts to mitigate the damage of khubd running in the middle of a port power control event, but makes no guarantees. We need to support both suspending hubs with live ports (to receive wakeup events) and fully powering down the port when userspace policy allows. 3/ Userspace needs full control, but also help coordinating port power policy. Augment the existing controls portX/power/pm_qos_no_power_off and portX/power/control with connector awareness (i.e. propagate control settings across ports in a connector), but also add policies based on the connector type ('hotplug' ports never power down as compared to 'hardwired'). Even with these changes port power control still defaults to on. When enabled (pm_qos_no_power_off=0) it tries to do the right thing for connectors and hotplug capable ports. At all times userspace can override what acpi has defined (pm_qos_no_notify_flags to stop propagating settings to 'peers', connect_type to override whether the port is hotplug capable, or usbcore.noacpi to turn it all off). --- Dan Williams (15): usb: xhci: fix memleak on module removal usbcore: introduce usb_domain for tracking port-connector relationships usbcore: add sysfs linkage for connector peers PM / Runtime: Allow drivers to intercept pm qos flag changes usbcore: port power policy / prep for usb_port as usb_device parent usbcore: make usb_port a proper parent of a usb_device usbcore: pm_runtime honor children usbcore: kill ->is_power_on and ->did_runtime_put usbcore: convert khubd to a workqueue and flush khubd on port power off usbcore: cleanup hub_port_connect_change and hub_power_on usbcore: power down peer port on endpoint connect usbcore: allow the connect_type of ports to be changed usbcore: show port power policy usbcore: add usbcore.noacpi checkpatch: allow list_for_each helper macros Documentation/ABI/testing/sysfs-devices-power | 21 + Documentation/kernel-parameters.txt | 4 Documentation/power/pm_qos_interface.txt | 15 - drivers/base/power/qos.c | 48 +++ drivers/base/power/sysfs.c | 45 ++- drivers/usb/core/Kconfig | 4 drivers/usb/core/Makefile | 1 drivers/usb/core/hcd-pci.c | 17 + drivers/usb/core/hcd.c | 2 drivers/usb/core/hub.c | 252 ++++----------- drivers/usb/core/hub.h | 29 +- drivers/usb/core/port.c | 171 +++++++--- drivers/usb/core/usb-acpi.c | 76 ++++ drivers/usb/core/usb-platform.c | 425 +++++++++++++++++++++++++ drivers/usb/core/usb-platform.h | 56 +++ drivers/usb/core/usb.c | 14 + drivers/usb/host/xhci-pci.c | 16 + drivers/usb/host/xhci.c | 6 include/linux/pm.h | 5 include/linux/pm_qos.h | 5 include/linux/usb/hcd.h | 9 + scripts/checkpatch.pl | 1 22 files changed, 931 insertions(+), 291 deletions(-) create mode 100644 drivers/usb/core/usb-platform.c create mode 100644 drivers/usb/core/usb-platform.h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html