public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <krohei@gmail.com>
To: Greg KH <gregkh@suse.de>, Anton Vorontsov <cbouatmailru@gmail.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] isp1704_charger: Handle suspended and resumed events
Date: Wed,  8 Jun 2011 12:44:40 +0300	[thread overview]
Message-ID: <1307526281-12125-3-git-send-email-krohei@gmail.com> (raw)
In-Reply-To: <1307526281-12125-1-git-send-email-krohei@gmail.com>

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


  parent reply	other threads:[~2011-06-08  9:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-06-08  9:44 ` [PATCH 3/3] twl4030_charger: Handle suspended and resumed events 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307526281-12125-3-git-send-email-krohei@gmail.com \
    --to=krohei@gmail.com \
    --cc=cbouatmailru@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox