[ARM] tegra: stingray: CPCAP and charging changes for P0 and P1
authorGreg Meiste <w30289@motorola.com>
Mon, 7 Jun 2010 20:34:31 +0000 (15:34 -0500)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:33:03 +0000 (16:33 -0700)
For P0 hardware, SW5 is not connected.  For P1 hardware, the charging
GPIOs have changed.

Change-Id: I9f8a95f93a1e82e636e55bd85e847f952479d636
Signed-off-by: Greg Meiste <w30289@motorola.com>
arch/arm/mach-tegra/board-stingray-spi.c
arch/arm/mach-tegra/board-stingray.c

index 948c2a9d5a24ac61df6050296868447d07390358..3b39cead96d420fa7cd2f08f94c5b347e8418cec 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <mach/irqs.h>
 
+#include "board-stingray.h"
 #include "gpio-names.h"
 
 static struct cpcap_device *cpcap_di;
@@ -215,7 +216,6 @@ static struct cpcap_led stingray_display_led = {
        .cpcap_duty_cycle = 0x2A0,
        .cpcap_current = 0x0,
        .class_name = LD_DISP_BUTTON_DEV,
-       .led_regulator = "sw5",
 };
 
 static struct platform_device cpcap_disp_button_led = {
@@ -233,7 +233,6 @@ static struct cpcap_led stingray_privacy_led ={
        .cpcap_duty_cycle = 0x41,
        .cpcap_current = 0x0,
        .class_name = LD_PRIVACY_LED_DEV,
-       .led_regulator = "sw5",
 };
 
 static struct platform_device cpcap_privacy_led = {
@@ -386,7 +385,6 @@ static struct regulator_init_data cpcap_regulator[CPCAP_NUM_REGULATORS] = {
                        .min_uV                 = 5050000,
                        .max_uV                 = 5050000,
                        .valid_ops_mask         = REGULATOR_CHANGE_STATUS,
-                       .boot_on                = 1, /* Temporary for M1 */
                        .apply_uV               = 1,
                },
                .num_consumer_supplies  = ARRAY_SIZE(cpcap_sw5_consumers),
@@ -593,6 +591,13 @@ int __init stingray_spi_init(void)
 {
        int i;
 
+       if (stingray_revision() <= STINGRAY_REVISION_M1) {
+               cpcap_regulator[CPCAP_SW5].constraints.boot_on = 1;
+
+               stingray_display_led.led_regulator = "sw5";
+               stingray_privacy_led.led_regulator = "sw5";
+       }
+
        tegra_gpio_enable(TEGRA_GPIO_PT2);
        gpio_request(TEGRA_GPIO_PT2, "usb_host_pwr_en");
        gpio_direction_output(TEGRA_GPIO_PT2, 0);
index 52b3e74a5cac7d8a58e79c8e735decd296db0868..a7300ded517c81d4698af77742dbf1bba5266849 100644 (file)
@@ -186,6 +186,27 @@ static struct platform_device androidusb_device = {
 
 /* 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_PD1),
+               .end   = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PD1),
+       },
+       [2] = {
+               .name  = "detect",
+               .flags = IORESOURCE_IRQ,
+               .start = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
+               .end   = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PV6),
+       },
+};
+
+static struct resource bq24617_resources_m1_p0[] = {
        [0] = {
                .name  = "stat1",
                .flags = IORESOURCE_IRQ,
@@ -323,9 +344,14 @@ static void __init tegra_stingray_init(void)
        /* Enable charging */
        tegra_gpio_enable(TEGRA_GPIO_PV5);
        tegra_gpio_enable(TEGRA_GPIO_PV6);
-       tegra_gpio_enable(TEGRA_GPIO_PJ0);
-       gpio_request(TEGRA_GPIO_PJ0, "chg_disable");
-       gpio_direction_output(TEGRA_GPIO_PJ0, 0);
+       if (stingray_revision() <= STINGRAY_REVISION_P0) {
+               bq24617_device.resource = bq24617_resources_m1_p0;
+
+               tegra_gpio_enable(TEGRA_GPIO_PJ0);
+               gpio_request(TEGRA_GPIO_PJ0, "chg_disable");
+               gpio_direction_output(TEGRA_GPIO_PJ0, 0);
+       } else
+               tegra_gpio_enable(TEGRA_GPIO_PD1);
 
        stingray_pinmux_init();