]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
OMAP: mmc-twl4030 add cover switch
authorAdrian Hunter <adrian.hunter@nokia.com>
Mon, 26 Jan 2009 11:14:28 +0000 (13:14 +0200)
committerTony Lindgren <tony@atomide.com>
Tue, 10 Mar 2009 19:20:24 +0000 (12:20 -0700)
Allow a cover switch to be used to cause a rescan of the
MMC slot.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/mmc-twl4030.c
arch/arm/mach-omap2/mmc-twl4030.h

index aeaab5a8b9c49d253c6de82ede77954a08f41f70..5957d1ca9ca751193c11fc7e2f177a056ccf8503 100644 (file)
@@ -100,6 +100,14 @@ static int twl_mmc_get_ro(struct device *dev, int slot)
        return gpio_get_value_cansleep(mmc->slots[0].gpio_wp);
 }
 
+static int twl_mmc_get_cover_state(struct device *dev, int slot)
+{
+       struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+       /* NOTE: assumes card detect signal is active-low */
+       return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
+}
+
 /*
  * MMC Slot Initialization.
  */
@@ -409,7 +417,10 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 
                        mmc->slots[0].switch_pin = c->gpio_cd;
                        mmc->slots[0].card_detect_irq = gpio_to_irq(c->gpio_cd);
-                       mmc->slots[0].card_detect = twl_mmc_card_detect;
+                       if (c->cover_only)
+                               mmc->slots[0].get_cover_state = twl_mmc_get_cover_state;
+                       else
+                               mmc->slots[0].card_detect = twl_mmc_card_detect;
                } else
                        mmc->slots[0].switch_pin = -EINVAL;
 
index 21d35727f921d66157b27194dc53bb5129505b7d..0aa168690ed0f7110d019de4900513124fefd8c2 100644 (file)
@@ -11,6 +11,7 @@ struct twl4030_hsmmc_info {
        u8      wires;          /* 1/4/8 wires */
        bool    transceiver;    /* MMC-2 option */
        bool    ext_clock;      /* use external pin for input clock */
+       bool    cover_only;     /* No card detect - just cover switch */
        int     gpio_cd;        /* or -EINVAL */
        int     gpio_wp;        /* or -EINVAL */
        struct device *dev;     /* returned: pointer to mmc adapter */