From 971fcd492cebf544714f12d94549d2f0d2002645 Mon Sep 17 00:00:00 2001 From: Lan Tianyu Date: Wed, 23 Jan 2013 04:26:29 +0800 Subject: usb: add runtime pm support for usb port device This patch is to add runtime pm callback for usb port device. Set/clear PORT_POWER feature in the resume/suspend callback. Add portnum for struct usb_port to record port number. Do pm_rumtime_get_sync/put(portdev) when a device is plugged/unplugged to prevent it from being powered off when it is active. Acked-by: Alan Stern Acked-by: Rafael J. Wysocki Signed-off-by: Lan Tianyu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/usb/core/hub.h') diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index c472058f8f27..452e5cd7b249 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -79,12 +79,14 @@ struct usb_hub { * @dev: generic device interface * @port_owner: port's owner * @connect_type: port's connect type + * @portnum: port index num based one */ struct usb_port { struct usb_device *child; struct device dev; struct dev_state *port_owner; enum usb_port_connect_type connect_type; + u8 portnum; }; #define to_usb_port(_dev) \ @@ -94,4 +96,6 @@ extern int usb_hub_create_port_device(struct usb_hub *hub, int port1); extern void usb_hub_remove_port_device(struct usb_hub *hub, int port1); +extern int usb_hub_set_port_power(struct usb_device *hdev, + int port1, bool set); -- cgit