@@ -34,8 +34,11 @@ struct otgws_lock {
struct wakeup_source wsource;
};
-/* VBUS present lock */
-
+/*
+ * VBUS present lock. Also used as a timed lock on charger
+ * connect/disconnect and USB host disconnect, to allow the system
+ * to react to the change in power.
+ */
static struct otgws_lock vbus_lock;
static void otgws_handle_event(unsigned long event)
@@ -59,7 +62,8 @@ static void otgws_handle_event(unsigned long event)
case USB_EVENT_NONE:
case USB_EVENT_ID:
case USB_EVENT_CHARGER:
- __pm_relax(&vbus_lock.wsource);
+ __pm_wakeup_event(&vbus_lock.wsource,
+ msecs_to_jiffies(TEMPORARY_HOLD_TIME));
break;
default:
@@ -11,6 +11,8 @@
#include <linux/usb/phy.h>
+#define TEMPORARY_HOLD_TIME 2000
+
struct usb_otg {
u8 default_a;