Loading drivers/mmc/card/block.c +0 −4 Original line number Diff line number Diff line Loading @@ -4725,9 +4725,7 @@ static int mmc_blk_probe(struct mmc_card *card) dev_set_drvdata(&card->dev, md); #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME mmc_set_bus_resume_policy(card->host, 1); #endif if (mmc_add_disk(md)) goto out; Loading Loading @@ -4772,9 +4770,7 @@ static void mmc_blk_remove(struct mmc_card *card) pm_runtime_put_noidle(&card->dev); mmc_blk_remove_req(md); dev_set_drvdata(&card->dev, NULL); #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME mmc_set_bus_resume_policy(card->host, 0); #endif } static int _mmc_blk_suspend(struct mmc_card *card, bool wait) Loading drivers/mmc/core/core.c +13 −7 Original line number Diff line number Diff line Loading @@ -1883,10 +1883,9 @@ EXPORT_SYMBOL(mmc_start_req); */ void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq) { #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME if (mmc_bus_needs_resume(host)) mmc_resume_bus(host); #endif __mmc_start_req(host, mrq); mmc_wait_for_req_done(host, mrq); } Loading Loading @@ -2322,10 +2321,9 @@ void mmc_get_card(struct mmc_card *card) { pm_runtime_get_sync(&card->dev); mmc_claim_host(card->host); #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME if (mmc_bus_needs_resume(card->host)) mmc_resume_bus(card->host); #endif } EXPORT_SYMBOL(mmc_get_card); Loading Loading @@ -3277,6 +3275,7 @@ int mmc_resume_bus(struct mmc_host *host) { unsigned long flags; int err = 0; int card_present = true; if (!mmc_bus_needs_resume(host)) return -EINVAL; Loading @@ -3287,7 +3286,10 @@ int mmc_resume_bus(struct mmc_host *host) spin_unlock_irqrestore(&host->lock, flags); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead && host->card) { if (host->ops->get_cd) card_present = host->ops->get_cd(host); if (host->bus_ops && !host->bus_dead && host->card && card_present) { mmc_power_up(host, host->card->ocr); BUG_ON(!host->bus_ops->resume); err = host->bus_ops->resume(host); Loading Loading @@ -4523,7 +4525,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, struct mmc_host *host = container_of( notify_block, struct mmc_host, pm_notify); unsigned long flags; int err = 0; int err = 0, present = 0; switch (mode) { case PM_RESTORE_PREPARE: Loading Loading @@ -4570,8 +4572,12 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(&host->lock, flags); host->rescan_disable = 0; if (host->ops->get_cd) present = host->ops->get_cd(host); if (mmc_bus_manual_resume(host) && !host->ignore_bus_resume_flags) { !host->ignore_bus_resume_flags && present) { spin_unlock_irqrestore(&host->lock, flags); break; } Loading drivers/mmc/core/sd.c +21 −1 Original line number Diff line number Diff line Loading @@ -1143,6 +1143,9 @@ static void mmc_sd_remove(struct mmc_host *host) */ static int mmc_sd_alive(struct mmc_host *host) { if (host->ops->get_cd && !host->ops->get_cd(host)) return -ENOMEDIUM; return mmc_send_status(host->card, NULL); } Loading Loading @@ -1171,7 +1174,15 @@ static void mmc_sd_detect(struct mmc_host *host) return; } mmc_power_up(host, host->ocr_avail); if (mmc_bus_needs_resume(host)) mmc_resume_bus(host); if (host->ops->get_cd && !host->ops->get_cd(host)) { err = -ENOMEDIUM; mmc_card_set_removed(host->card); mmc_card_clr_suspended(host->card); goto out; } /* * Just check if our card has been removed. Loading @@ -1195,6 +1206,7 @@ static void mmc_sd_detect(struct mmc_host *host) err = _mmc_detect_card_removed(host); #endif out: mmc_put_card(host->card); if (err) { Loading Loading @@ -1279,6 +1291,11 @@ static int _mmc_sd_resume(struct mmc_host *host) if (!mmc_card_suspended(host->card)) goto out; if (host->ops->get_cd && !host->ops->get_cd(host)) { mmc_card_clr_suspended(host->card); goto out; } mmc_power_up(host, host->card->ocr); #ifdef CONFIG_MMC_PARANOID_SD_INIT retries = 5; Loading Loading @@ -1379,6 +1396,9 @@ static int mmc_sd_runtime_resume(struct mmc_host *host) static int mmc_sd_reset(struct mmc_host *host) { if (host->ops->get_cd && !host->ops->get_cd(host)) return -ENOMEDIUM; mmc_power_cycle(host, host->card->ocr); return mmc_sd_init_card(host, host->card->ocr, host->card); } Loading drivers/mmc/core/slot-gpio.c +4 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id) { /* Schedule a card detection after a debounce timeout */ struct mmc_host *host = dev_id; int present = host->ops->get_cd(host); pr_debug("%s: cd gpio irq, gpio state %d (CARD_%s)\n", mmc_hostname(host), present, present?"INSERT":"REMOVAL"); host->trigger_card_event = true; mmc_detect_change(host, msecs_to_jiffies(200)); Loading include/linux/mmc/host.h +6 −0 Original line number Diff line number Diff line Loading @@ -643,6 +643,7 @@ static inline void *mmc_cmdq_private(struct mmc_host *host) #define mmc_bus_manual_resume(host) ((host)->bus_resume_flags & \ MMC_BUSRESUME_MANUAL_RESUME) #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual) { if (manual) Loading @@ -650,6 +651,11 @@ static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual) else host->bus_resume_flags &= ~MMC_BUSRESUME_MANUAL_RESUME; } #else static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual) { } #endif extern int mmc_resume_bus(struct mmc_host *host); Loading Loading
drivers/mmc/card/block.c +0 −4 Original line number Diff line number Diff line Loading @@ -4725,9 +4725,7 @@ static int mmc_blk_probe(struct mmc_card *card) dev_set_drvdata(&card->dev, md); #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME mmc_set_bus_resume_policy(card->host, 1); #endif if (mmc_add_disk(md)) goto out; Loading Loading @@ -4772,9 +4770,7 @@ static void mmc_blk_remove(struct mmc_card *card) pm_runtime_put_noidle(&card->dev); mmc_blk_remove_req(md); dev_set_drvdata(&card->dev, NULL); #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME mmc_set_bus_resume_policy(card->host, 0); #endif } static int _mmc_blk_suspend(struct mmc_card *card, bool wait) Loading
drivers/mmc/core/core.c +13 −7 Original line number Diff line number Diff line Loading @@ -1883,10 +1883,9 @@ EXPORT_SYMBOL(mmc_start_req); */ void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq) { #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME if (mmc_bus_needs_resume(host)) mmc_resume_bus(host); #endif __mmc_start_req(host, mrq); mmc_wait_for_req_done(host, mrq); } Loading Loading @@ -2322,10 +2321,9 @@ void mmc_get_card(struct mmc_card *card) { pm_runtime_get_sync(&card->dev); mmc_claim_host(card->host); #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME if (mmc_bus_needs_resume(card->host)) mmc_resume_bus(card->host); #endif } EXPORT_SYMBOL(mmc_get_card); Loading Loading @@ -3277,6 +3275,7 @@ int mmc_resume_bus(struct mmc_host *host) { unsigned long flags; int err = 0; int card_present = true; if (!mmc_bus_needs_resume(host)) return -EINVAL; Loading @@ -3287,7 +3286,10 @@ int mmc_resume_bus(struct mmc_host *host) spin_unlock_irqrestore(&host->lock, flags); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead && host->card) { if (host->ops->get_cd) card_present = host->ops->get_cd(host); if (host->bus_ops && !host->bus_dead && host->card && card_present) { mmc_power_up(host, host->card->ocr); BUG_ON(!host->bus_ops->resume); err = host->bus_ops->resume(host); Loading Loading @@ -4523,7 +4525,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, struct mmc_host *host = container_of( notify_block, struct mmc_host, pm_notify); unsigned long flags; int err = 0; int err = 0, present = 0; switch (mode) { case PM_RESTORE_PREPARE: Loading Loading @@ -4570,8 +4572,12 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(&host->lock, flags); host->rescan_disable = 0; if (host->ops->get_cd) present = host->ops->get_cd(host); if (mmc_bus_manual_resume(host) && !host->ignore_bus_resume_flags) { !host->ignore_bus_resume_flags && present) { spin_unlock_irqrestore(&host->lock, flags); break; } Loading
drivers/mmc/core/sd.c +21 −1 Original line number Diff line number Diff line Loading @@ -1143,6 +1143,9 @@ static void mmc_sd_remove(struct mmc_host *host) */ static int mmc_sd_alive(struct mmc_host *host) { if (host->ops->get_cd && !host->ops->get_cd(host)) return -ENOMEDIUM; return mmc_send_status(host->card, NULL); } Loading Loading @@ -1171,7 +1174,15 @@ static void mmc_sd_detect(struct mmc_host *host) return; } mmc_power_up(host, host->ocr_avail); if (mmc_bus_needs_resume(host)) mmc_resume_bus(host); if (host->ops->get_cd && !host->ops->get_cd(host)) { err = -ENOMEDIUM; mmc_card_set_removed(host->card); mmc_card_clr_suspended(host->card); goto out; } /* * Just check if our card has been removed. Loading @@ -1195,6 +1206,7 @@ static void mmc_sd_detect(struct mmc_host *host) err = _mmc_detect_card_removed(host); #endif out: mmc_put_card(host->card); if (err) { Loading Loading @@ -1279,6 +1291,11 @@ static int _mmc_sd_resume(struct mmc_host *host) if (!mmc_card_suspended(host->card)) goto out; if (host->ops->get_cd && !host->ops->get_cd(host)) { mmc_card_clr_suspended(host->card); goto out; } mmc_power_up(host, host->card->ocr); #ifdef CONFIG_MMC_PARANOID_SD_INIT retries = 5; Loading Loading @@ -1379,6 +1396,9 @@ static int mmc_sd_runtime_resume(struct mmc_host *host) static int mmc_sd_reset(struct mmc_host *host) { if (host->ops->get_cd && !host->ops->get_cd(host)) return -ENOMEDIUM; mmc_power_cycle(host, host->card->ocr); return mmc_sd_init_card(host, host->card->ocr, host->card); } Loading
drivers/mmc/core/slot-gpio.c +4 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id) { /* Schedule a card detection after a debounce timeout */ struct mmc_host *host = dev_id; int present = host->ops->get_cd(host); pr_debug("%s: cd gpio irq, gpio state %d (CARD_%s)\n", mmc_hostname(host), present, present?"INSERT":"REMOVAL"); host->trigger_card_event = true; mmc_detect_change(host, msecs_to_jiffies(200)); Loading
include/linux/mmc/host.h +6 −0 Original line number Diff line number Diff line Loading @@ -643,6 +643,7 @@ static inline void *mmc_cmdq_private(struct mmc_host *host) #define mmc_bus_manual_resume(host) ((host)->bus_resume_flags & \ MMC_BUSRESUME_MANUAL_RESUME) #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual) { if (manual) Loading @@ -650,6 +651,11 @@ static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual) else host->bus_resume_flags &= ~MMC_BUSRESUME_MANUAL_RESUME; } #else static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual) { } #endif extern int mmc_resume_bus(struct mmc_host *host); Loading