Skip to content

Commit

Permalink
MLK-12462-1 mmc: core: add MMC_PM_IGNORE_PM_NOTIFY feature
Browse files Browse the repository at this point in the history
With igore pm notify feature, MMC core will not re-detect card
after system suspend/resume. This is needed for some special cards
like Broadcom WiFi which can't work propertly on card re-detect
after system resume.

Signed-off-by: Dong Aisheng <[email protected]>
(cherry picked from commit 3a4a074)
  • Loading branch information
Dong Aisheng committed Mar 1, 2016
1 parent cc78790 commit e42f70d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Documentation/devicetree/bindings/mmc/mmc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ polarity is in effect.
Optional SDIO properties:
- keep-power-in-suspend: Preserves card power during a suspend/resume cycle
- enable-sdio-wakeup: Enables wake up of host system on SDIO IRQ assertion

- pm-ignore-notify: Ignore mmc PM notify. This will prevent MMC core automatically
to re-detect cards after sysem resume back.

MMC power sequences:
--------------------
Expand Down
8 changes: 6 additions & 2 deletions drivers/mmc/core/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ int mmc_of_parse(struct mmc_host *host)
host->pm_caps |= MMC_PM_KEEP_POWER;
if (of_property_read_bool(np, "enable-sdio-wakeup"))
host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
if (of_get_property(np, "pm-ignore-notify", NULL))
host->pm_caps |= MMC_PM_IGNORE_PM_NOTIFY;
if (of_property_read_bool(np, "mmc-ddr-1_8v"))
host->caps |= MMC_CAP_1_8V_DDR;
if (of_property_read_bool(np, "mmc-ddr-1_2v"))
Expand Down Expand Up @@ -651,7 +653,8 @@ int mmc_add_host(struct mmc_host *host)
mmc_host_clk_sysfs_init(host);

mmc_start_host(host);
register_pm_notifier(&host->pm_notify);
if (!(host->pm_caps& MMC_PM_IGNORE_PM_NOTIFY))
register_pm_notifier(&host->pm_notify);

return 0;
}
Expand All @@ -668,7 +671,8 @@ EXPORT_SYMBOL(mmc_add_host);
*/
void mmc_remove_host(struct mmc_host *host)
{
unregister_pm_notifier(&host->pm_notify);
if (!(host->pm_caps& MMC_PM_IGNORE_PM_NOTIFY))
unregister_pm_notifier(&host->pm_notify);
mmc_stop_host(host);

#ifdef CONFIG_DEBUG_FS
Expand Down
1 change: 1 addition & 0 deletions include/linux/mmc/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ typedef unsigned int mmc_pm_flag_t;

#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */
#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */
#define MMC_PM_IGNORE_PM_NOTIFY (1 << 2) /* ignore mmc pm notify */

#endif /* LINUX_MMC_PM_H */

0 comments on commit e42f70d

Please sign in to comment.