linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers
@ 2011-06-08  9:44 Heikki Krogerus
  2011-06-08  9:44 ` [PATCH 1/3] usb: otg: add events for suspend/resume states Heikki Krogerus
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Heikki Krogerus @ 2011-06-08  9:44 UTC (permalink / raw)
  To: Greg KH, Anton Vorontsov; +Cc: linux-usb, linux-kernel

Hi,

The charging should be prevented if the bus is suspended.

These notifications will come from the udc drivers. I'll create a
separate patch set for those, as I guess the maintainers of the
controller drivers need to approve those.


Heikki Krogerus (3):
  usb: otg: add events for suspend/resume states
  isp1704_charger: Handle suspended and resumed events
  twl4030_charger:  Handle suspended and resumed events

 drivers/power/isp1704_charger.c |   13 +++++++++++++
 drivers/power/twl4030_charger.c |    4 ++++
 include/linux/usb/otg.h         |    2 ++
 3 files changed, 19 insertions(+), 0 deletions(-)

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] usb: otg: add events for suspend/resume states
  2011-06-08  9:44 [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers Heikki Krogerus
@ 2011-06-08  9:44 ` Heikki Krogerus
  2011-06-08  9:44 ` [PATCH 2/3] isp1704_charger: Handle suspended and resumed events Heikki Krogerus
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Heikki Krogerus @ 2011-06-08  9:44 UTC (permalink / raw)
  To: Greg KH, Anton Vorontsov; +Cc: linux-usb, linux-kernel

Those will be used by the charger driver to cut current
drawing when suspended and restart it when resumed.

Signed-off-by: Heikki Krogerus <krohei@gmail.com>
---
 include/linux/usb/otg.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index d87f44f..5f14caf 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -41,6 +41,8 @@ enum usb_xceiv_events {
 	USB_EVENT_ID,           /* id was grounded */
 	USB_EVENT_CHARGER,      /* usb dedicated charger */
 	USB_EVENT_ENUMERATED,   /* gadget driver enumerated */
+	USB_EVENT_SUSPENDED,	/* gadget driver suspended */
+	USB_EVENT_RESUMED,	/* gadget driver resumed */
 };
 
 struct otg_transceiver;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] isp1704_charger: Handle suspended and resumed events
  2011-06-08  9:44 [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers Heikki Krogerus
  2011-06-08  9:44 ` [PATCH 1/3] usb: otg: add events for suspend/resume states Heikki Krogerus
@ 2011-06-08  9:44 ` Heikki Krogerus
  2011-06-08  9:44 ` [PATCH 3/3] twl4030_charger: " Heikki Krogerus
  2011-06-08 20:54 ` [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers Greg KH
  3 siblings, 0 replies; 6+ messages in thread
From: Heikki Krogerus @ 2011-06-08  9:44 UTC (permalink / raw)
  To: Greg KH, Anton Vorontsov; +Cc: linux-usb, linux-kernel

To prevent charging when the bus is suspended, handling
suspended and resumed events.

Signed-off-by: Heikki Krogerus <krohei@gmail.com>
---
 drivers/power/isp1704_charger.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c
index f6d72b4..c0d4e8b 100644
--- a/drivers/power/isp1704_charger.c
+++ b/drivers/power/isp1704_charger.c
@@ -294,6 +294,19 @@ static void isp1704_charger_work(struct work_struct *data)
 		else
 			isp->current_max = power;
 		break;
+	case USB_EVENT_SUSPENDED:
+		/* Ignore SUSPEND with CDP */
+		if (isp->present)
+			goto out;
+		else
+			isp->current_max = 2;
+		break;
+	case USB_EVENT_RESUMED:
+		if (isp->present)
+			goto out;
+		else
+			isp->current_max = power;
+		break;
 	default:
 		goto out;
 	}
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] twl4030_charger:  Handle suspended and resumed events
  2011-06-08  9:44 [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers Heikki Krogerus
  2011-06-08  9:44 ` [PATCH 1/3] usb: otg: add events for suspend/resume states Heikki Krogerus
  2011-06-08  9:44 ` [PATCH 2/3] isp1704_charger: Handle suspended and resumed events Heikki Krogerus
@ 2011-06-08  9:44 ` Heikki Krogerus
  2011-06-08 20:54 ` [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers Greg KH
  3 siblings, 0 replies; 6+ messages in thread
From: Heikki Krogerus @ 2011-06-08  9:44 UTC (permalink / raw)
  To: Greg KH, Anton Vorontsov; +Cc: linux-usb, linux-kernel, Grazvydas Ignotas

To prevent charging when the bus is suspended, handling
suspended and resumed events.

Signed-off-by: Heikki Krogerus <krohei@gmail.com>
Cc: Grazvydas Ignotas <notasas@gmail.com>
---
 drivers/power/twl4030_charger.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index 92c16e1..461c389 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -268,11 +268,15 @@ static void twl4030_bci_usb_work(struct work_struct *data)
 	switch (bci->event) {
 	case USB_EVENT_VBUS:
 	case USB_EVENT_CHARGER:
+	case USB_EVENT_RESUMED:
 		twl4030_charger_enable_usb(bci, true);
 		break;
 	case USB_EVENT_NONE:
+	case USB_EVENT_SUSPENDED:
 		twl4030_charger_enable_usb(bci, false);
 		break;
+	default:
+		break;
 	}
 }
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers
  2011-06-08  9:44 [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers Heikki Krogerus
                   ` (2 preceding siblings ...)
  2011-06-08  9:44 ` [PATCH 3/3] twl4030_charger: " Heikki Krogerus
@ 2011-06-08 20:54 ` Greg KH
  2011-06-09 11:25   ` Heikki Krogerus
  3 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2011-06-08 20:54 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: Greg KH, Anton Vorontsov, linux-usb, linux-kernel

On Wed, Jun 08, 2011 at 12:44:38PM +0300, Heikki Krogerus wrote:
> Hi,
> 
> The charging should be prevented if the bus is suspended.
> 
> These notifications will come from the udc drivers. I'll create a
> separate patch set for those, as I guess the maintainers of the
> controller drivers need to approve those.

Can you send them here as well?  These patches never set this value, so
I don't see why you did it this way, instead of just getting the
"normal" suspend/resume callback and triggering off of that.

Still confused,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers
  2011-06-08 20:54 ` [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers Greg KH
@ 2011-06-09 11:25   ` Heikki Krogerus
  0 siblings, 0 replies; 6+ messages in thread
From: Heikki Krogerus @ 2011-06-09 11:25 UTC (permalink / raw)
  To: Greg KH; +Cc: Anton Vorontsov, linux-usb, linux-kernel, Grazvydas Ignotas

On Wed, Jun 08, 2011 at 01:54:05PM -0700, Greg KH wrote:
> On Wed, Jun 08, 2011 at 12:44:38PM +0300, Heikki Krogerus wrote:
> > The charging should be prevented if the bus is suspended.
> > 
> > These notifications will come from the udc drivers. I'll create a
> > separate patch set for those, as I guess the maintainers of the
> > controller drivers need to approve those.
> 
> Can you send them here as well?  These patches never set this value, so
> I don't see why you did it this way, instead of just getting the
> "normal" suspend/resume callback and triggering off of that.

I'm not completely sure what you mean with "normal" suspend/resume
callback? I want to get the information about the SUSPEND and RESUME
bus states to the charger drivers and I don't want to tie them with
any USB transceiver or controller driver. Wasn't this the reason for
having the otg notifiers in the first place?

I'll spend a bit more time with these and resend when I have
everything ready. Gražvydas noticed an issue with the
isp1704_charger.c so that patch is broken in any case.

> Still confused,

I did not think this through. Sorry about that. I should have send
everything from the beginning and I should have been more clear what
I'm after with these.

-- 
heikki

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-09 11:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08  9:44 [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers Heikki Krogerus
2011-06-08  9:44 ` [PATCH 1/3] usb: otg: add events for suspend/resume states Heikki Krogerus
2011-06-08  9:44 ` [PATCH 2/3] isp1704_charger: Handle suspended and resumed events Heikki Krogerus
2011-06-08  9:44 ` [PATCH 3/3] twl4030_charger: " Heikki Krogerus
2011-06-08 20:54 ` [PATCH 0/3] Support for SUSPEND and RESUME for USB chargers Greg KH
2011-06-09 11:25   ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).