[ARM] tegra: stingray: Add bq24617 charger support
authorGreg Meiste <w30289@motorola.com>
Fri, 21 May 2010 21:32:36 +0000 (16:32 -0500)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:32:57 +0000 (16:32 -0700)
Change-Id: I4e6975abe03b4abdb7077c438d15bf0e4e6c4dae
Signed-off-by: Greg Meiste <w30289@motorola.com>
arch/arm/mach-tegra/board-stingray.c

index 1cc4bf62d24cd19bd2c4a8985f71b447617c1513..705294d5312ec15d848f164d00b6de54d3b94b13 100644 (file)
@@ -184,23 +184,34 @@ static struct platform_device androidusb_device = {
        },
 };
 
-/* PDA power */
-static struct pda_power_pdata pda_power_pdata = {
+/* bq24617 charger */
+static struct resource bq24617_resources[] = {
+       [0] = {
+               .name  = "stat1",
+               .flags = IORESOURCE_IRQ,
+               .start = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV5),
+               .end   = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV5),
+       },
+       [1] = {
+               .name  = "stat2",
+               .flags = IORESOURCE_IRQ,
+               .start = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
+               .end   = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
+       },
 };
 
-static struct platform_device pda_power_device = {
-       .name   = "pda_power",
+static struct platform_device bq24617_device = {
+       .name   = "bq24617",
        .id     = -1,
-       .dev    = {
-               .platform_data  = &pda_power_pdata,
-       },
+       .resource      = bq24617_resources,
+       .num_resources = ARRAY_SIZE(bq24617_resources),
 };
 
 static struct platform_device *stingray_devices[] __initdata = {
        &debug_uart,
        &tegra_otg,
        &androidusb_device,
-       &pda_power_device,
+       &bq24617_device,
        &hsuart,
        &tegra_i2c_device1,
        &tegra_i2c_device2,
@@ -269,9 +280,16 @@ static void __init tegra_stingray_init(void)
           unless a factory cable is used, the factory jumper is set, or the
           usb_data_en gpio is set.
         */
+       tegra_gpio_enable(TEGRA_GPIO_PV4);
+       gpio_request(TEGRA_GPIO_PV4, "usb_data_en");
+       gpio_direction_output(TEGRA_GPIO_PV4, 1);
+
+       /* Enable charging */
+       tegra_gpio_enable(TEGRA_GPIO_PV5);
        tegra_gpio_enable(TEGRA_GPIO_PV6);
-       gpio_request(TEGRA_GPIO_PV6, "usb_data_en");
-       gpio_direction_output(TEGRA_GPIO_PV6, 1);
+       tegra_gpio_enable(TEGRA_GPIO_PJ0);
+       gpio_request(TEGRA_GPIO_PJ0, "chg_disable");
+       gpio_direction_output(TEGRA_GPIO_PJ0, 0);
 
        stingray_pinmux_init();