diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2011-06-09 13:36:29 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-06-14 11:48:50 -0700 |
commit | 9f05b769db5760335e3641be565c967c1b756266 (patch) | |
tree | fe290086b3199435a7ab9263e6ec92f74523c106 /drivers/mmc | |
parent | 8792bbe29411bed946313e0dbed2ead600522827 (diff) | |
download | kernel_samsung_tuna-9f05b769db5760335e3641be565c967c1b756266.zip kernel_samsung_tuna-9f05b769db5760335e3641be565c967c1b756266.tar.gz kernel_samsung_tuna-9f05b769db5760335e3641be565c967c1b756266.tar.bz2 |
mmc: omap_hsmmc: Add Add explicit card-detect processing
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/omap_hsmmc.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 5a9275a..45ec45c 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -189,6 +189,30 @@ struct omap_hsmmc_host { struct omap_mmc_platform_data *pdata; }; +static void omap_hsmmc_status_notify_cb(int card_present, void *dev_id) +{ + struct omap_hsmmc_host *host = (struct omap_hsmmc_host *)dev_id; + unsigned int status, oldstat; + + pr_debug("%s: card_present %d\n", mmc_hostname(host->mmc), + card_present); + + if (!mmc_slot(host).mmc_data.status) { + mmc_detect_change(host->mmc, 0); + return; + } + + status = mmc_slot(host).mmc_data.status(mmc_dev(host->mmc)); + + oldstat = mmc_slot(host).mmc_data.card_present; + mmc_slot(host).mmc_data.card_present = status; + if (status ^ oldstat) { + pr_debug("%s: Slot status change detected (%d -> %d)\n", + mmc_hostname(host->mmc), oldstat, status); + mmc_detect_change(host->mmc, 0); + } +} + static int omap_hsmmc_card_detect(struct device *dev, int slot) { struct omap_mmc_platform_data *mmc = dev->platform_data; @@ -2241,7 +2265,12 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) } pdata->suspend = omap_hsmmc_suspend_cdirq; pdata->resume = omap_hsmmc_resume_cdirq; + } else if (mmc_slot(host).mmc_data.register_status_notify) { + mmc_slot(host).mmc_data.register_status_notify(omap_hsmmc_status_notify_cb, host); } + if (mmc_slot(host).mmc_data.status) + mmc_slot(host).mmc_data.card_present = + mmc_slot(host).mmc_data.status(mmc_dev(host->mmc)); omap_hsmmc_disable_irq(host); |