Skip to content

Commit fe007c0

Browse files
mmindcjb
authored andcommitted
mmc: sdhci-s3c: fix missing clock for gpio card-detect
2abeb5c ("Add clk_(enable/disable) in runtime suspend/resume") added the capability to stop the clocks when the device is runtime suspended, but forgot to handle the case of the card-detect using an external gpio. Therefore in the case that runtime-pm is enabled, start the io-clock when a card is inserted and stop it again once it is removed. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent 0aa55c2 commit fe007c0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/mmc/host/sdhci-s3c.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,18 +373,25 @@ static struct sdhci_ops sdhci_s3c_ops = {
373373
static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
374374
{
375375
struct sdhci_host *host = platform_get_drvdata(dev);
376+
struct sdhci_s3c *sc = sdhci_priv(host);
376377
unsigned long flags;
377378

378379
if (host) {
379380
spin_lock_irqsave(&host->lock, flags);
380381
if (state) {
381382
dev_dbg(&dev->dev, "card inserted.\n");
383+
#ifdef CONFIG_PM_RUNTIME
384+
clk_prepare_enable(sc->clk_io);
385+
#endif
382386
host->flags &= ~SDHCI_DEVICE_DEAD;
383387
host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
384388
} else {
385389
dev_dbg(&dev->dev, "card removed.\n");
386390
host->flags |= SDHCI_DEVICE_DEAD;
387391
host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
392+
#ifdef CONFIG_PM_RUNTIME
393+
clk_disable_unprepare(sc->clk_io);
394+
#endif
388395
}
389396
tasklet_schedule(&host->card_tasklet);
390397
spin_unlock_irqrestore(&host->lock, flags);

0 commit comments

Comments
 (0)