twl4030_charger: decrease USB charging current to 550mA
[pandora-kernel.git] / drivers / power / twl4030_charger.c
index 4cd0fcd..6fa762e 100644 (file)
@@ -706,6 +706,19 @@ static ssize_t store_charge_current(struct device *dev,
        if (ret)
                return -EINVAL;
 
+       /*
+        * Previously, this sysfs parameter used a different raw-register
+        * format. All legal values in this format fall numerically into the
+        * range [0, 1023]. Since in the new format, these encode values so
+        * low as to be meaningless, reject them here so that anybody trying
+        * to use the old format will have at least a chance of figuring out
+        * why it isn't working any more. Note that in both formats, the value
+        * 0 has the same meaning, so it is allowed where values in the range
+        * [1, 1023] are not.
+        */
+       if (new_current < 1024 && new_current != 0)
+               return -EINVAL;
+
        ret = update_charge_parameters(bci, new_current, -1);
        if (ret)
                return ret;
@@ -925,7 +938,7 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
        bci->irq_chg = platform_get_irq(pdev, 0);
        bci->irq_bci = platform_get_irq(pdev, 1);
        bci->ac_current = 1200000; /* ~1.2A */
-       bci->usb_current = 560000; /* ~560mA */
+       bci->usb_current = 550000; /* ~550mA */
 
        /*
         * Make sure to set sane charging settings