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>
This commit is contained in:
parent
451c89578e
commit
71e69211ea
1 changed files with 27 additions and 21 deletions
|
@ -1994,30 +1994,11 @@ static void sdhci_enable_preset_value(struct mmc_host *mmc, bool enable)
|
||||||
sdhci_runtime_pm_put(host);
|
sdhci_runtime_pm_put(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct mmc_host_ops sdhci_ops = {
|
static void sdhci_card_event(struct mmc_host *mmc)
|
||||||
.request = sdhci_request,
|
|
||||||
.set_ios = sdhci_set_ios,
|
|
||||||
.get_ro = sdhci_get_ro,
|
|
||||||
.hw_reset = sdhci_hw_reset,
|
|
||||||
.enable_sdio_irq = sdhci_enable_sdio_irq,
|
|
||||||
.start_signal_voltage_switch = sdhci_start_signal_voltage_switch,
|
|
||||||
.execute_tuning = sdhci_execute_tuning,
|
|
||||||
.enable_preset_value = sdhci_enable_preset_value,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*****************************************************************************\
|
|
||||||
* *
|
|
||||||
* Tasklets *
|
|
||||||
* *
|
|
||||||
\*****************************************************************************/
|
|
||||||
|
|
||||||
static void sdhci_tasklet_card(unsigned long param)
|
|
||||||
{
|
{
|
||||||
struct sdhci_host *host;
|
struct sdhci_host *host = mmc_priv(mmc);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
host = (struct sdhci_host*)param;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&host->lock, flags);
|
spin_lock_irqsave(&host->lock, flags);
|
||||||
|
|
||||||
/* Check host->mrq first in case we are runtime suspended */
|
/* Check host->mrq first in case we are runtime suspended */
|
||||||
|
@ -2036,6 +2017,31 @@ static void sdhci_tasklet_card(unsigned long param)
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(&host->lock, flags);
|
spin_unlock_irqrestore(&host->lock, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct mmc_host_ops sdhci_ops = {
|
||||||
|
.request = sdhci_request,
|
||||||
|
.set_ios = sdhci_set_ios,
|
||||||
|
.get_ro = sdhci_get_ro,
|
||||||
|
.hw_reset = sdhci_hw_reset,
|
||||||
|
.enable_sdio_irq = sdhci_enable_sdio_irq,
|
||||||
|
.start_signal_voltage_switch = sdhci_start_signal_voltage_switch,
|
||||||
|
.execute_tuning = sdhci_execute_tuning,
|
||||||
|
.enable_preset_value = sdhci_enable_preset_value,
|
||||||
|
.card_event = sdhci_card_event,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************\
|
||||||
|
* *
|
||||||
|
* Tasklets *
|
||||||
|
* *
|
||||||
|
\*****************************************************************************/
|
||||||
|
|
||||||
|
static void sdhci_tasklet_card(unsigned long param)
|
||||||
|
{
|
||||||
|
struct sdhci_host *host = (struct sdhci_host*)param;
|
||||||
|
|
||||||
|
sdhci_card_event(host->mmc);
|
||||||
|
|
||||||
mmc_detect_change(host->mmc, msecs_to_jiffies(200));
|
mmc_detect_change(host->mmc, msecs_to_jiffies(200));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue