From: Martin Bergstrom <martin.bergst...@stericsson.com>

The USB charger current is limited according to information comming
from the USB driver

Signed-off-by: Martin Bergstrom <martin.bergst...@stericsson.com>
Signed-off-by: Mathieu Poirier <mathieu.poir...@linaro.org>
Reviewed-by: Jonas ABERG <jonas.ab...@stericsson.com>
---
 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 =
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to