From 380233809ee96af74040ceb60a6471fa26f0f460 Mon Sep 17 00:00:00 2001 From: lbt Date: Tue, 5 Jul 2011 14:42:31 +0800 Subject: [PATCH] mmc: wifi sdio card ignore pm notify. otherwise wifi may work abnormally when resume from suspend. --- drivers/mmc/core/host.c | 6 ++++-- drivers/mmc/host/rk29_sdmmc.c | 3 +++ include/linux/mmc/host.h | 3 +++ include/linux/mmc/pm.h | 31 +++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 include/linux/mmc/pm.h diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index bc875cda66ff..94f35ca5c413 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -136,7 +136,8 @@ int mmc_add_host(struct mmc_host *host) #endif mmc_start_host(host); - register_pm_notifier(&host->pm_notify); + if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY)) + register_pm_notifier(&host->pm_notify); return 0; } @@ -153,7 +154,8 @@ EXPORT_SYMBOL(mmc_add_host); */ void mmc_remove_host(struct mmc_host *host) { - unregister_pm_notifier(&host->pm_notify); + if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY)) + unregister_pm_notifier(&host->pm_notify); mmc_stop_host(host); #ifdef CONFIG_DEBUG_FS diff --git a/drivers/mmc/host/rk29_sdmmc.c b/drivers/mmc/host/rk29_sdmmc.c index 8696c6c640e2..b33d69c2300b 100755 --- a/drivers/mmc/host/rk29_sdmmc.c +++ b/drivers/mmc/host/rk29_sdmmc.c @@ -1378,6 +1378,9 @@ static int rk29_sdmmc_probe(struct platform_device *pdev) mmc->ops = &rk29_sdmmc_ops[1]; else mmc->ops = &rk29_sdmmc_ops[0]; + + if (host->is_sdio) + mmc->pm_flags = MMC_PM_IGNORE_PM_NOTIFY; //ignore pm notify mmc->f_min = DIV_ROUND_UP(host->bus_hz, 510); mmc->f_max = host->bus_hz; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 1ba648eb868e..01f21a50a2bf 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -14,6 +14,7 @@ #include #include +#include struct mmc_ios { unsigned int clock; /* clock rate */ @@ -206,6 +207,8 @@ struct mmc_host { struct task_struct *sdio_irq_thread; atomic_t sdio_irq_thread_abort; + mmc_pm_flag_t pm_flags; /* requested pm features */ + #ifdef CONFIG_LEDS_TRIGGERS struct led_trigger *led; /* activity led */ #endif diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h new file mode 100644 index 000000000000..390382367acb --- /dev/null +++ b/include/linux/mmc/pm.h @@ -0,0 +1,31 @@ +/* + * linux/include/linux/mmc/pm.h + * + * Author: Nicolas Pitre + * Copyright: (C) 2009 Marvell Technology Group Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef LINUX_MMC_PM_H +#define LINUX_MMC_PM_H + +/* + * These flags are used to describe power management features that + * some cards (typically SDIO cards) might wish to benefit from when + * the host system is being suspended. There are several layers of + * abstractions involved, from the host controller driver, to the MMC core + * code, to the SDIO core code, to finally get to the actual SDIO function + * driver. This file is therefore used for common definitions shared across + * all those layers. + */ + +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 -- 2.34.1