Loading drivers/mmc/core/block.c +0 −4 Original line number Diff line number Diff line Loading @@ -4263,9 +4263,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 @@ -4313,9 +4311,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 @@ -1972,10 +1972,9 @@ EXPORT_SYMBOL(mmc_start_areq); */ 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); if (!mrq->cap_cmd_during_tfr) Loading Loading @@ -2287,10 +2286,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 @@ -3235,6 +3233,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 @@ -3245,7 +3244,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 @@ -4509,7 +4511,7 @@ static 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_HIBERNATION_PREPARE: Loading Loading @@ -4552,8 +4554,12 @@ static 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 +22 −0 Original line number Diff line number Diff line Loading @@ -1152,6 +1152,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 @@ -1177,6 +1180,16 @@ static void mmc_sd_detect(struct mmc_host *host) return; } 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 @@ -1199,6 +1212,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 @@ -1277,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 @@ -1372,6 +1391,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 @@ -35,6 +35,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 @@ -756,6 +756,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 @@ -763,6 +764,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/core/block.c +0 −4 Original line number Diff line number Diff line Loading @@ -4263,9 +4263,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 @@ -4313,9 +4311,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 @@ -1972,10 +1972,9 @@ EXPORT_SYMBOL(mmc_start_areq); */ 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); if (!mrq->cap_cmd_during_tfr) Loading Loading @@ -2287,10 +2286,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 @@ -3235,6 +3233,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 @@ -3245,7 +3244,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 @@ -4509,7 +4511,7 @@ static 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_HIBERNATION_PREPARE: Loading Loading @@ -4552,8 +4554,12 @@ static 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 +22 −0 Original line number Diff line number Diff line Loading @@ -1152,6 +1152,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 @@ -1177,6 +1180,16 @@ static void mmc_sd_detect(struct mmc_host *host) return; } 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 @@ -1199,6 +1212,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 @@ -1277,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 @@ -1372,6 +1391,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 @@ -35,6 +35,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 @@ -756,6 +756,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 @@ -763,6 +764,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