aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-12-04 10:51:40 -0500
committerChris Ball <cjb@laptop.org>2012-12-07 13:56:03 -0500
commit71e69211eac889898dec5a21270347591eb2d001 (patch)
tree8caf1e640f2f87c69d256e93ae6240112c8ce35f /drivers/mmc
parent451c89578eb4791b9d329eb71a79e6715e60f89e (diff)
mmc: sdhci: implement the .card_event() method
Extracting a part of the SDHCI card tasklet into a .card_event() implementation allows SDHCI hosts to use generic card-detection services, e.g. the GPIO slot function. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Reviewed-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index b2e4b1bab69d..6f0bfc0c8c9c 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1994,30 +1994,11 @@ static void sdhci_enable_preset_value(struct mmc_host *mmc, bool enable)
1994 sdhci_runtime_pm_put(host); 1994 sdhci_runtime_pm_put(host);
1995} 1995}
1996 1996
1997static const struct mmc_host_ops sdhci_ops = { 1997static void sdhci_card_event(struct mmc_host *mmc)
1998 .request = sdhci_request,
1999 .set_ios = sdhci_set_ios,
2000 .get_ro = sdhci_get_ro,
2001 .hw_reset = sdhci_hw_reset,
2002 .enable_sdio_irq = sdhci_enable_sdio_irq,
2003 .start_signal_voltage_switch = sdhci_start_signal_voltage_switch,
2004 .execute_tuning = sdhci_execute_tuning,
2005 .enable_preset_value = sdhci_enable_preset_value,
2006};
2007
2008/*****************************************************************************\
2009 * *
2010 * Tasklets *
2011 * *
2012\*****************************************************************************/
2013
2014static void sdhci_tasklet_card(unsigned long param)
2015{ 1998{
2016 struct sdhci_host *host; 1999 struct sdhci_host *host = mmc_priv(mmc);
2017 unsigned long flags; 2000 unsigned long flags;
2018 2001
2019 host = (struct sdhci_host*)param;
2020
2021 spin_lock_irqsave(&host->lock, flags); 2002 spin_lock_irqsave(&host->lock, flags);
2022 2003
2023 /* Check host->mrq first in case we are runtime suspended */ 2004 /* Check host->mrq first in case we are runtime suspended */
@@ -2036,6 +2017,31 @@ static void sdhci_tasklet_card(unsigned long param)
2036 } 2017 }
2037 2018
2038 spin_unlock_irqrestore(&host->lock, flags); 2019 spin_unlock_irqrestore(&host->lock, flags);
2020}
2021
2022static const struct mmc_host_ops sdhci_ops = {
2023 .request = sdhci_request,
2024 .set_ios = sdhci_set_ios,
2025 .get_ro = sdhci_get_ro,
2026 .hw_reset = sdhci_hw_reset,
2027 .enable_sdio_irq = sdhci_enable_sdio_irq,
2028 .start_signal_voltage_switch = sdhci_start_signal_voltage_switch,
2029 .execute_tuning = sdhci_execute_tuning,
2030 .enable_preset_value = sdhci_enable_preset_value,
2031 .card_event = sdhci_card_event,
2032};
2033
2034/*****************************************************************************\
2035 * *
2036 * Tasklets *
2037 * *
2038\*****************************************************************************/
2039
2040static void sdhci_tasklet_card(unsigned long param)
2041{
2042 struct sdhci_host *host = (struct sdhci_host*)param;
2043
2044 sdhci_card_event(host->mmc);
2039 2045
2040 mmc_detect_change(host->mmc, msecs_to_jiffies(200)); 2046 mmc_detect_change(host->mmc, msecs_to_jiffies(200));
2041} 2047}