summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0006-USB-gadget-composite-device-level-suspend-resume-h.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0006-USB-gadget-composite-device-level-suspend-resume-h.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0006-USB-gadget-composite-device-level-suspend-resume-h.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0006-USB-gadget-composite-device-level-suspend-resume-h.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0006-USB-gadget-composite-device-level-suspend-resume-h.patch
new file mode 100644
index 0000000000..3f49a4d636
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0006-USB-gadget-composite-device-level-suspend-resume-h.patch
@@ -0,0 +1,84 @@
1From 7eef82d231578140c6000d04846a48bdaf341a65 Mon Sep 17 00:00:00 2001
2From: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
3Date: Tue, 24 Mar 2009 17:23:19 -0700
4Subject: [PATCH] USB: gadget: composite device-level suspend/resume hooks
5
6Address one open question in the composite gadget framework:
7Yes, we should have device-level suspend/resume callbacks
8in addition to the function-level ones. We have at least one
9scenario (with gadget zero in OTG test mode) that's awkward
10to handle without it.
11
12Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
13Cc: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
14Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
15---
16 drivers/usb/gadget/composite.c | 8 ++++++--
17 include/linux/usb/composite.h | 8 ++++++++
18 2 files changed, 14 insertions(+), 2 deletions(-)
19
20diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
21index 40f1da7..59e8523 100644
22--- a/drivers/usb/gadget/composite.c
23+++ b/drivers/usb/gadget/composite.c
24@@ -1014,7 +1014,7 @@ composite_suspend(struct usb_gadget *gadget)
25 struct usb_composite_dev *cdev = get_gadget_data(gadget);
26 struct usb_function *f;
27
28- /* REVISIT: should we have config and device level
29+ /* REVISIT: should we have config level
30 * suspend/resume callbacks?
31 */
32 DBG(cdev, "suspend\n");
33@@ -1024,6 +1024,8 @@ composite_suspend(struct usb_gadget *gadget)
34 f->suspend(f);
35 }
36 }
37+ if (composite->suspend)
38+ composite->suspend(cdev);
39 }
40
41 static void
42@@ -1032,10 +1034,12 @@ composite_resume(struct usb_gadget *gadget)
43 struct usb_composite_dev *cdev = get_gadget_data(gadget);
44 struct usb_function *f;
45
46- /* REVISIT: should we have config and device level
47+ /* REVISIT: should we have config level
48 * suspend/resume callbacks?
49 */
50 DBG(cdev, "resume\n");
51+ if (composite->resume)
52+ composite->resume(cdev);
53 if (cdev->config) {
54 list_for_each_entry(f, &cdev->config->functions, list) {
55 if (f->resume)
56diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
57index 935c380..acd7b0f 100644
58--- a/include/linux/usb/composite.h
59+++ b/include/linux/usb/composite.h
60@@ -244,6 +244,10 @@ int usb_add_config(struct usb_composite_dev *,
61 * value; it should return zero on successful initialization.
62 * @unbind: Reverses @bind(); called as a side effect of unregistering
63 * this driver.
64+ * @suspend: Notifies when the host stops sending USB traffic,
65+ * after function notifications
66+ * @resume: Notifies configuration when the host restarts USB traffic,
67+ * before function notifications
68 *
69 * Devices default to reporting self powered operation. Devices which rely
70 * on bus powered operation should report this in their @bind() method.
71@@ -268,6 +272,10 @@ struct usb_composite_driver {
72
73 int (*bind)(struct usb_composite_dev *);
74 int (*unbind)(struct usb_composite_dev *);
75+
76+ /* global suspend hooks */
77+ void (*suspend)(struct usb_composite_dev *);
78+ void (*resume)(struct usb_composite_dev *);
79 };
80
81 extern int usb_composite_register(struct usb_composite_driver *);
82--
831.6.0.4
84