Re: [RFC v1 2/2] usb: otg: Temporarily hold wakeupsource on charger

2014-08-29 Thread Felipe Balbi
On Thu, Aug 28, 2014 at 03:36:39PM +0530, Kiran Kumar Raparthy wrote:
 From: Todd Poynor toddpoy...@google.com
 
 usb: otg: Temporarily hold wakeupsource on charger connect and disconnect
 events
 
 Allow other parts of the system to react to the charger connect/disconnect
 event without allowing the system to suspend before the other parts can 
 process
 the event. This wakeup_source times out after 2 seconds; if nobody else holds 
 a
 wakeup_source by that time then the device can sleep.
 
 Cc: Felipe Balbi ba...@ti.com
 Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
 Cc: linux-ker...@vger.kernel.org
 Cc: linux-usb@vger.kernel.org
 Cc: Android Kernel Team kernel-t...@android.com
 Cc: John Stultz john.stu...@linaro.org
 Signed-off-by: Todd Poynor toddpoy...@google.com
 [kiran: Added context to commit message]
 Signed-off-by: Kiran Raparthy kiran.ku...@linaro.org
 ---
  drivers/usb/phy/otg-wakeupsource.c | 10 +++---
  include/linux/usb/otg.h|  2 ++
  2 files changed, 9 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/usb/phy/otg-wakeupsource.c 
 b/drivers/usb/phy/otg-wakeupsource.c
 index 7c838d1..9f3c5c1 100644
 --- a/drivers/usb/phy/otg-wakeupsource.c
 +++ b/drivers/usb/phy/otg-wakeupsource.c
 @@ -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));

indentation here is wrong. Also, I have gotten three patches from you
with very similar contents and subject. Please make sure to read
Documentation/SubmittingPatches, Documentation/CodingStyle and
Documentation/SubmitChecklist

cheers

-- 
balbi


signature.asc
Description: Digital signature


[RFC v1 2/2] usb: otg: Temporarily hold wakeupsource on charger and disconnect events

2014-08-28 Thread Kiran Kumar Raparthy
From: Todd Poynor toddpoy...@google.com

usb: otg: Temporarily hold wakeupsource on charger and disconnect events

Allow other parts of the system to react to the charger connect/disconnect
event without allowing the system to suspend before the other parts can process
the event. This wakeup_source times out after 2 seconds; if nobody else holds a
wakeup_source by that time then the device can sleep.

Cc: Felipe Balbi ba...@ti.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: linux-ker...@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Android Kernel Team kernel-t...@android.com
Cc: John Stultz john.stu...@linaro.org
Signed-off-by: Todd Poynor toddpoy...@google.com
[kiran: Added context to commit message]
Signed-off-by: Kiran Raparthy kiran.ku...@linaro.org
---
 drivers/usb/phy/otg-wakeupsource.c | 10 +++---
 include/linux/usb/otg.h|  2 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/otg-wakeupsource.c 
b/drivers/usb/phy/otg-wakeupsource.c
index 7c838d1..9f3c5c1 100644
--- a/drivers/usb/phy/otg-wakeupsource.c
+++ b/drivers/usb/phy/otg-wakeupsource.c
@@ -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:
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 154332b..4243747 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -11,6 +11,8 @@
 
 #include linux/usb/phy.h
 
+#define TEMPORARY_HOLD_TIME2000
+
 struct usb_otg {
u8  default_a;
 
-- 
1.8.2.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC v1 2/2] usb: otg: Temporarily hold wakeupsource on charger and disconnect events

2014-08-28 Thread Kiran Kumar Raparthy
From: Todd Poynor toddpoy...@google.com

usb: otg: Temporarily hold wakeupsource on charger and disconnect events

Allow other parts of the system to react to the charger connect/disconnect
event without allowing the system to suspend before the other parts can process
the event. This wakeup_source times out after 2 seconds; if nobody else holds a
wakeup_source by that time then the device can sleep.

Cc: Felipe Balbi ba...@ti.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: linux-ker...@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Android Kernel Team kernel-t...@android.com
Cc: John Stultz john.stu...@linaro.org
Signed-off-by: Todd Poynor toddpoy...@google.com
[kiran: Added context to commit message]
Signed-off-by: Kiran Raparthy kiran.ku...@linaro.org
---
 drivers/usb/phy/otg-wakeupsource.c | 10 +++---
 include/linux/usb/otg.h|  2 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/otg-wakeupsource.c 
b/drivers/usb/phy/otg-wakeupsource.c
index 7c838d1..9f3c5c1 100644
--- a/drivers/usb/phy/otg-wakeupsource.c
+++ b/drivers/usb/phy/otg-wakeupsource.c
@@ -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:
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 154332b..4243747 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -11,6 +11,8 @@
 
 #include linux/usb/phy.h
 
+#define TEMPORARY_HOLD_TIME2000
+
 struct usb_otg {
u8  default_a;
 
-- 
1.8.2.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC v1 2/2] usb: otg: Temporarily hold wakeupsource on charger

2014-08-28 Thread Kiran Kumar Raparthy
From: Todd Poynor toddpoy...@google.com

usb: otg: Temporarily hold wakeupsource on charger connect and disconnect
events

Allow other parts of the system to react to the charger connect/disconnect
event without allowing the system to suspend before the other parts can process
the event. This wakeup_source times out after 2 seconds; if nobody else holds a
wakeup_source by that time then the device can sleep.

Cc: Felipe Balbi ba...@ti.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: linux-ker...@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Android Kernel Team kernel-t...@android.com
Cc: John Stultz john.stu...@linaro.org
Signed-off-by: Todd Poynor toddpoy...@google.com
[kiran: Added context to commit message]
Signed-off-by: Kiran Raparthy kiran.ku...@linaro.org
---
 drivers/usb/phy/otg-wakeupsource.c | 10 +++---
 include/linux/usb/otg.h|  2 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/phy/otg-wakeupsource.c 
b/drivers/usb/phy/otg-wakeupsource.c
index 7c838d1..9f3c5c1 100644
--- a/drivers/usb/phy/otg-wakeupsource.c
+++ b/drivers/usb/phy/otg-wakeupsource.c
@@ -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:
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 154332b..4243747 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -11,6 +11,8 @@
 
 #include linux/usb/phy.h
 
+#define TEMPORARY_HOLD_TIME2000
+
 struct usb_otg {
u8  default_a;
 
-- 
1.8.2.1

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html