aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasily Khoruzhick <anarsoul@gmail.com>2010-09-26 17:27:41 -0400
committerBen Dooks <ben-linux@fluff.org>2010-09-26 19:24:15 -0400
commit48cd65a6a020292e1ab5d0f5ba96571c858964e6 (patch)
tree0f120d7ccadded8a2d204c9f36c846aa76991dcd
parent14477095abc661a9f195ca4733bb739c54794b32 (diff)
ARM: h1940: Implement mmc_power function
This patch implements h1940-specific set_power callback for s3cmci driver, so card power can be disabled when card is not inserted or before suspend. Without this patch PDA consumes power in suspend when card is inserted. Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
-rw-r--r--arch/arm/mach-s3c2410/include/mach/h1940-latch.h2
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c23
2 files changed, 21 insertions, 4 deletions
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index 73586f20930..ef7d8cf4174 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -35,7 +35,7 @@
35#define H1940_LATCH_AUDIO_POWER H1940_LATCH_GPIO(9) 35#define H1940_LATCH_AUDIO_POWER H1940_LATCH_GPIO(9)
36#define H1940_LATCH_SM803_ENABLE H1940_LATCH_GPIO(10) 36#define H1940_LATCH_SM803_ENABLE H1940_LATCH_GPIO(10)
37#define H1940_LATCH_LCD_P4 H1940_LATCH_GPIO(11) 37#define H1940_LATCH_LCD_P4 H1940_LATCH_GPIO(11)
38#define H1940_LATCH_CPUQ5 H1940_LATCH_GPIO(12) 38#define H1940_LATCH_SD_POWER H1940_LATCH_GPIO(12)
39#define H1940_LATCH_BLUETOOTH_POWER H1940_LATCH_GPIO(13) 39#define H1940_LATCH_BLUETOOTH_POWER H1940_LATCH_GPIO(13)
40#define H1940_LATCH_LED_GREEN H1940_LATCH_GPIO(14) 40#define H1940_LATCH_LED_GREEN H1940_LATCH_GPIO(14)
41#define H1940_LATCH_LED_FLASH H1940_LATCH_GPIO(15) 41#define H1940_LATCH_LED_FLASH H1940_LATCH_GPIO(15)
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index f0493bdbf0d..cc8660ec884 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -112,8 +112,7 @@ static unsigned int latch_state = H1940_LATCH_BIT(H1940_LATCH_LCD_P4) |
112 H1940_LATCH_BIT(H1940_LATCH_LCD_P1) | 112 H1940_LATCH_BIT(H1940_LATCH_LCD_P1) |
113 H1940_LATCH_BIT(H1940_LATCH_LCD_P2) | 113 H1940_LATCH_BIT(H1940_LATCH_LCD_P2) |
114 H1940_LATCH_BIT(H1940_LATCH_LCD_P3) | 114 H1940_LATCH_BIT(H1940_LATCH_LCD_P3) |
115 H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN) | 115 H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN);
116 H1940_LATCH_BIT(H1940_LATCH_CPUQ5);
117 116
118static void h1940_latch_control(unsigned int clear, unsigned int set) 117static void h1940_latch_control(unsigned int clear, unsigned int set)
119{ 118{
@@ -247,10 +246,25 @@ static struct platform_device h1940_device_bluetooth = {
247 .id = -1, 246 .id = -1,
248}; 247};
249 248
249static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
250{
251 switch (power_mode) {
252 case MMC_POWER_OFF:
253 gpio_set_value(H1940_LATCH_SD_POWER, 0);
254 break;
255 case MMC_POWER_UP:
256 case MMC_POWER_ON:
257 gpio_set_value(H1940_LATCH_SD_POWER, 1);
258 break;
259 default:
260 break;
261 };
262}
263
250static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = { 264static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
251 .gpio_detect = S3C2410_GPF(5), 265 .gpio_detect = S3C2410_GPF(5),
252 .gpio_wprotect = S3C2410_GPH(8), 266 .gpio_wprotect = S3C2410_GPH(8),
253 .set_power = NULL, 267 .set_power = h1940_set_mmc_power,
254 .ocr_avail = MMC_VDD_32_33, 268 .ocr_avail = MMC_VDD_32_33,
255}; 269};
256 270
@@ -397,6 +411,9 @@ static void __init h1940_init(void)
397 gpio_request(H1940_LATCH_USB_DP, "USB pullup"); 411 gpio_request(H1940_LATCH_USB_DP, "USB pullup");
398 gpio_direction_output(H1940_LATCH_USB_DP, 0); 412 gpio_direction_output(H1940_LATCH_USB_DP, 0);
399 413
414 gpio_request(H1940_LATCH_SD_POWER, "SD power");
415 gpio_direction_output(H1940_LATCH_SD_POWER, 0);
416
400 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); 417 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
401} 418}
402 419