Skip to content

Commit

Permalink
ARM: OMAP3: mmc-twl4030 add cover switch
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adrian Hunter authored and Tony Lindgren committed Mar 24, 2009
1 parent 034ae7b commit 8d75e98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion arch/arm/mach-omap2/mmc-twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -411,7 +419,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;

Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-omap2/mmc-twl4030.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 8d75e98

Please sign in to comment.