power: bq2419x: Set DCP charging current to 2A.
Hyongbin Kim [Thu, 10 Oct 2013 03:05:54 +0000 (12:05 +0900)]
Tegratab charger is 2A-charger. And BQ24192 has DPM fuction,
it prevent charger voltage falls below input voltage limit
by reducing charging current even with lower-2A-charger is connected.

Bug 1302320
Bug 1285079
Bug 1299342

Change-Id: Ieaf0e7cc4bd3d8f475802239d3268ce40bfdfdde
Signed-off-by: Hyongbin Kim <hyongbink@nvidia.com>
Reviewed-on: http://git-master/r/289128
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gabby Lee <galee@nvidia.com>

drivers/power/bq2419x-charger.c

index 7135f84..2c33d63 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/slab.h>
 #include <linux/rtc.h>
 #include <linux/alarmtimer.h>
+#include <generated/mach-types.h>
 
 /* input current limit */
 static const unsigned int iinlim[] = {
@@ -191,7 +192,7 @@ static int bq2419x_init(struct bq2419x_chip *bq2419x)
        int floor = 0;
 
        /* Configure input voltage to 4.52 in case of NV charger */
-       if (bq2419x->in_current_limit == 2000)
+       if (machine_is_roth() && (bq2419x->in_current_limit == 2000))
                val |= BQ2419x_NVCHARGER_INPUT_VOL_SEL;
        else
                val |= BQ2419x_DEFAULT_INPUT_VOL_SEL;
@@ -204,6 +205,14 @@ static int bq2419x_init(struct bq2419x_chip *bq2419x)
                return ret;
        }
 
+       /* Set input current limit to 2A in case of DCP */
+       if (machine_is_tegratab() && (bq2419x->in_current_limit >= 1800))
+               bq2419x->in_current_limit = 2000;
+
+       dev_info(bq2419x->dev,
+               "bq2419x_init: bq2419x->in_current_limit %d\n",
+               bq2419x->in_current_limit);
+
        /* Configure input current limit */
        val = current_to_reg(iinlim, ARRAY_SIZE(iinlim),
                                bq2419x->in_current_limit);