From patchwork Thu Sep 27 20:09:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11830 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 12B2B24140 for ; Thu, 27 Sep 2012 20:10:44 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 9F01DA18B18 for ; Thu, 27 Sep 2012 20:10:43 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5234855iej.11 for ; Thu, 27 Sep 2012 13:10:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=aCu4j48wrrrMrWrpxVBsDuMcZnYaeK3y/uQ0CSOXgBY=; b=Su22I0KiebG0mzZu4twKlHHGN0dD5wId311bk2RYi2aWNwbVuvyKR47kln3NDRcSSL GRfaGOu78SKHc+3BsJCJB79myhXE2n8xTpw9kiR+/OIb7FRVMjJ0hWc3ZcxTuyVQU1nF XSwJ6wOOjErPBiipp9Rh8haE9bgxS5cXTKOZIkgTCzPY9xHSnKQWcnSIeDuumLPW9L1p Tw2Ht2DMWvknw/pJxJxLJ4ATk1j4lpItotbVuLLM/IrbBfZfmkGu2gDjyT3BA+uuHc2p wlu5oh60hqAYU98xOMw9VPhi7w2PgBZiZ7M405gwZ2mURqTqR+NZKNbB381RYLz2hO2v FPYA== Received: by 10.50.0.193 with SMTP id 1mr4749650igg.0.1348776639432; Thu, 27 Sep 2012 13:10:39 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp436422igc; Thu, 27 Sep 2012 13:10:36 -0700 (PDT) Received: by 10.50.202.71 with SMTP id kg7mr4666203igc.55.1348776636948; Thu, 27 Sep 2012 13:10:36 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id pi9si5467641pbb.12.2012.09.27.13.10.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of mathieu.poirier@linaro.org) smtp.mail=mathieu.poirier@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md4so1686045pbc.37 for ; Thu, 27 Sep 2012 13:10:36 -0700 (PDT) Received: by 10.68.228.98 with SMTP id sh2mr14528719pbc.95.1348776636676; Thu, 27 Sep 2012 13:10:36 -0700 (PDT) Received: from localhost.localdomain (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPS id sa2sm1587890pbc.4.2012.09.27.13.10.35 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Sep 2012 13:10:36 -0700 (PDT) From: mathieu.poirier@linaro.org To: patches@linaro.org Subject: [PATCH 57/57] power: ab8500_charger: Limit USB charger current Date: Thu, 27 Sep 2012 14:09:14 -0600 Message-Id: <1348776554-10019-58-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> References: <1348776554-10019-1-git-send-email-mathieu.poirier@linaro.org> X-Gm-Message-State: ALoCoQnICltv5t0eQus04AvYlWVC89Toawa033vEBajHms6chxxtZCdE0eTwtLG/Fmfp11Yu7joL From: Martin Bergstrom The USB charger current is limited according to information comming from the USB driver Signed-off-by: Martin Bergstrom Signed-off-by: Mathieu Poirier Reviewed-by: Jonas ABERG --- drivers/power/ab8500_charger.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index afb4fda..3c6f11c 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -1248,6 +1248,9 @@ static int ab8500_charger_set_vbus_in_curr(struct ab8500_charger *di, if (di->max_usb_in_curr.set_max > 0) min_value = min(di->max_usb_in_curr.set_max, min_value); + if (di->usb_state.usb_current >= 0) + min_value = min(di->usb_state.usb_current, min_value); + switch (min_value) { case 100: if (di->vbat < VBAT_TRESH_IP_CUR_RED) @@ -3413,6 +3416,7 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev) di->usb_chg.wdt_refresh = CHG_WD_INTERVAL; di->usb_chg.enabled = di->pdata->usb_enabled; di->usb_chg.external = false; + di->usb_state.usb_current = -1; /* Create a work queue for the charger */ di->charger_wq =