]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ARM: h1940: Implement mmc_power function
authorVasily Khoruzhick <anarsoul@gmail.com>
Sun, 26 Sep 2010 21:27:41 +0000 (00:27 +0300)
committerBen Dooks <ben-linux@fluff.org>
Sun, 26 Sep 2010 23:24:15 +0000 (00:24 +0100)
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>
arch/arm/mach-s3c2410/include/mach/h1940-latch.h
arch/arm/mach-s3c2410/mach-h1940.c

index 73586f20930e3cff8ef2a3df8962766ac61a896d..ef7d8cf4174dee06796d65bae078b5965ff5bfab 100644 (file)
@@ -35,7 +35,7 @@
 #define H1940_LATCH_AUDIO_POWER                H1940_LATCH_GPIO(9)
 #define H1940_LATCH_SM803_ENABLE       H1940_LATCH_GPIO(10)
 #define H1940_LATCH_LCD_P4             H1940_LATCH_GPIO(11)
-#define H1940_LATCH_CPUQ5              H1940_LATCH_GPIO(12)
+#define H1940_LATCH_SD_POWER           H1940_LATCH_GPIO(12)
 #define H1940_LATCH_BLUETOOTH_POWER    H1940_LATCH_GPIO(13)
 #define H1940_LATCH_LED_GREEN          H1940_LATCH_GPIO(14)
 #define H1940_LATCH_LED_FLASH          H1940_LATCH_GPIO(15)
index f0493bdbf0dcb8363ec3f09f42f36c945e91c207..cc8660ec88441fb0974b97a6caf223fb5909d2ad 100644 (file)
@@ -112,8 +112,7 @@ static unsigned int latch_state = H1940_LATCH_BIT(H1940_LATCH_LCD_P4) |
        H1940_LATCH_BIT(H1940_LATCH_LCD_P1)                     |
        H1940_LATCH_BIT(H1940_LATCH_LCD_P2)                     |
        H1940_LATCH_BIT(H1940_LATCH_LCD_P3)                     |
-       H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN)   |
-       H1940_LATCH_BIT(H1940_LATCH_CPUQ5);
+       H1940_LATCH_BIT(H1940_LATCH_MAX1698_nSHUTDOWN);
 
 static void h1940_latch_control(unsigned int clear, unsigned int set)
 {
@@ -247,10 +246,25 @@ static struct platform_device h1940_device_bluetooth = {
        .id               = -1,
 };
 
+static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
+{
+       switch (power_mode) {
+       case MMC_POWER_OFF:
+               gpio_set_value(H1940_LATCH_SD_POWER, 0);
+               break;
+       case MMC_POWER_UP:
+       case MMC_POWER_ON:
+               gpio_set_value(H1940_LATCH_SD_POWER, 1);
+               break;
+       default:
+               break;
+       };
+}
+
 static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
        .gpio_detect   = S3C2410_GPF(5),
        .gpio_wprotect = S3C2410_GPH(8),
-       .set_power     = NULL,
+       .set_power     = h1940_set_mmc_power,
        .ocr_avail     = MMC_VDD_32_33,
 };
 
@@ -397,6 +411,9 @@ static void __init h1940_init(void)
        gpio_request(H1940_LATCH_USB_DP, "USB pullup");
        gpio_direction_output(H1940_LATCH_USB_DP, 0);
 
+       gpio_request(H1940_LATCH_SD_POWER, "SD power");
+       gpio_direction_output(H1940_LATCH_SD_POWER, 0);
+
        platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 }