arm: tegra: cardhu: add gpio charger support
Pritesh Raithatha [Tue, 27 Sep 2011 09:54:46 +0000 (14:54 +0530)]
Bug 872590

Change-Id: I7e5bfe68a4f299f771b4af7094754e4167a44f29
Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-on: http://git-master/r/54663
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

Rebase-Id: R9dce2ca60c88531d5b16ed669404b3f1a25a9e81

arch/arm/mach-tegra/board-cardhu-power.c
arch/arm/mach-tegra/board-cardhu-sensors.c
arch/arm/mach-tegra/board-cardhu.h

index 82fa583..3a1f9e7 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/regulator/gpio-switch-regulator.h>
 #include <linux/regulator/tps6591x-regulator.h>
 #include <linux/regulator/tps6236x-regulator.h>
+#include <linux/power/gpio-charger.h>
 
 #include <mach/iomap.h>
 #include <mach/irqs.h>
@@ -1063,3 +1064,32 @@ int __init cardhu_edp_init(void)
        return 0;
 }
 #endif
+
+static char *cardhu_battery[] = {
+       "battery",
+};
+
+static struct gpio_charger_platform_data cardhu_charger_pdata = {
+       .name = "ac",
+       .type = POWER_SUPPLY_TYPE_MAINS,
+       .gpio = AC_PRESENT_GPIO,
+       .gpio_active_low = 0,
+       .supplied_to = cardhu_battery,
+       .num_supplicants = ARRAY_SIZE(cardhu_battery),
+};
+
+static struct platform_device cardhu_charger_device = {
+       .name = "gpio-charger",
+       .dev = {
+               .platform_data = &cardhu_charger_pdata,
+       },
+};
+
+static int __init cardhu_charger_late_init(void)
+{
+       platform_device_register(&cardhu_charger_device);
+       return 0;
+}
+
+late_initcall(cardhu_charger_late_init);
+
index cc8f8fe..d8cb1ee 100644 (file)
@@ -558,15 +558,9 @@ static struct nct1008_platform_data cardhu_nct1008_pdata = {
        .alarm_fn = tegra_throttling_enable,
 };
 
-static struct bq27x00_platform_data cardhu_bq27510_pdata = {
-       .ac_persent_gpio = AC_PRESENT_GPIO,
-};
-
 static struct i2c_board_info cardhu_i2c4_bq27510_board_info[] = {
        {
                I2C_BOARD_INFO("bq27510", 0x55),
-               .irq = AC_PRESENT_INT,
-               .platform_data = &cardhu_bq27510_pdata,
        },
 };
 
index e8c6dcf..ff58a81 100644 (file)
 #define TPS6591X_IRQ_BASE      TEGRA_NR_IRQS
 #define TPS6591X_IRQ_END       (TPS6591X_IRQ_BASE + 18)
 
-#define AC_PRESENT_INT         (TPS6591X_INT_GPIO4 + TPS6591X_IRQ_BASE)
-
 int cardhu_charge_init(void);
 int cardhu_regulator_init(void);
 int cardhu_suspend_init(void);