From 5e9a2cf8faefc114421678c543aa13e5226aa770 Mon Sep 17 00:00:00 2001 From: Greg Meiste Date: Mon, 7 Jun 2010 15:34:31 -0500 Subject: [PATCH] [ARM] tegra: stingray: CPCAP and charging changes for P0 and P1 For P0 hardware, SW5 is not connected. For P1 hardware, the charging GPIOs have changed. Change-Id: I9f8a95f93a1e82e636e55bd85e847f952479d636 Signed-off-by: Greg Meiste --- arch/arm/mach-tegra/board-stingray-spi.c | 11 +++++--- arch/arm/mach-tegra/board-stingray.c | 32 +++++++++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-tegra/board-stingray-spi.c b/arch/arm/mach-tegra/board-stingray-spi.c index 948c2a9d5a24..3b39cead96d4 100644 --- a/arch/arm/mach-tegra/board-stingray-spi.c +++ b/arch/arm/mach-tegra/board-stingray-spi.c @@ -33,6 +33,7 @@ #include +#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); diff --git a/arch/arm/mach-tegra/board-stingray.c b/arch/arm/mach-tegra/board-stingray.c index 52b3e74a5cac..a7300ded517c 100644 --- a/arch/arm/mach-tegra/board-stingray.c +++ b/arch/arm/mach-tegra/board-stingray.c @@ -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(); -- 2.34.1