arm: tegra: add bq20z45 guage support for ardbeg
Andy Park [Mon, 26 Aug 2013 21:47:17 +0000 (14:47 -0700)]
Enable BQ20Z45 Fuel Guage in Ardbeg board file.

Bug 1344257

Change-Id: I0be05142a9d14a7b71f2b4bfe232d8f7467dc292
Signed-off-by: Andy Park <andyp@nvidia.com>
Reviewed-on: http://git-master/r/268059
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

arch/arm/mach-tegra/board-ardbeg-sensors.c

index 7cceb53..fa8fa23 100644 (file)
@@ -28,6 +28,7 @@
 #include <media/dw9718.h>
 #include <media/as364x.h>
 #include <linux/pid_thermal_gov.h>
+#include <linux/power/sbs-battery.h>
 #include <mach/edp.h>
 #include <mach/tegra_fuse.h>
 
@@ -720,6 +721,18 @@ static int ardbeg_nct72_init(void)
        return ret;
 }
 
+static struct sbs_platform_data sbs_pdata = {
+       .poll_retry_count       = 100,
+       .i2c_retry_count        = 2,
+};
+
+static struct i2c_board_info __initdata bq20z45_pdata[] = {
+       {
+               I2C_BOARD_INFO("sbs-battery", 0x0B),
+               .platform_data = &sbs_pdata,
+       },
+};
+
 int __init ardbeg_sensors_init(void)
 {
        struct board_info board_info;
@@ -733,5 +746,9 @@ int __init ardbeg_sensors_init(void)
        i2c_register_board_info(0, ardbeg_i2c_board_info_cm32181,
                        ARRAY_SIZE(ardbeg_i2c_board_info_cm32181));
 
+       if (get_power_supply_type() == POWER_SUPPLY_TYPE_BATTERY)
+               i2c_register_board_info(1, bq20z45_pdata,
+                       ARRAY_SIZE(bq20z45_pdata));
+
        return 0;
 }