From: Tony Lindgren <tony@atomide.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Andreas Fenkart <afenkart@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Felipe Balbi <balbi@ti.com>,
Huiquan Zhong <huiquan.zhong@intel.com>,
Kevin Hilman <khilman@kernel.org>, NeilBrown <neilb@suse.de>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Nishanth Menon <nm@ti.com>,
Peter Hurley <peter@hurleysoftware.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Ulf Hansson <ulf.hansson@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
linux-omap@vger.kernel.org
Subject: [PATCH 4/4] mmc: omap_hsmmc: Change wake-up interrupt to use generic wakeirq
Date: Thu, 5 Mar 2015 16:34:09 -0800 [thread overview]
Message-ID: <1425602049-2674-5-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1425602049-2674-1-git-send-email-tony@atomide.com>
We can now use generic wakeirq handling and remove the custom handling
for the wake-up interrupts.
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/mmc/host/omap_hsmmc.c | 55 +++++++++++--------------------------------
1 file changed, 14 insertions(+), 41 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index f84cfb0..32f4559 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -43,6 +43,7 @@
#include <linux/regulator/consumer.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm_runtime.h>
+#include <linux/pm_wakeirq.h>
#include <linux/platform_data/hsmmc-omap.h>
/* OMAP HSMMC Host Controller Registers */
@@ -205,6 +206,7 @@ struct omap_hsmmc_host {
u32 capa;
int irq;
int wake_irq;
+ struct wakeirq_source *wirq;
int use_dma, dma_ch;
struct dma_chan *tx_chan;
struct dma_chan *rx_chan;
@@ -218,7 +220,6 @@ struct omap_hsmmc_host {
unsigned int flags;
#define AUTO_CMD23 (1 << 0) /* Auto CMD23 support */
#define HSMMC_SDIO_IRQ_ENABLED (1 << 1) /* SDIO irq enabled */
-#define HSMMC_WAKE_IRQ_ENABLED (1 << 2)
struct omap_hsmmc_next next_data;
struct omap_hsmmc_platform_data *pdata;
@@ -1135,22 +1136,6 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static irqreturn_t omap_hsmmc_wake_irq(int irq, void *dev_id)
-{
- struct omap_hsmmc_host *host = dev_id;
-
- /* cirq is level triggered, disable to avoid infinite loop */
- spin_lock(&host->irq_lock);
- if (host->flags & HSMMC_WAKE_IRQ_ENABLED) {
- disable_irq_nosync(host->wake_irq);
- host->flags &= ~HSMMC_WAKE_IRQ_ENABLED;
- }
- spin_unlock(&host->irq_lock);
- pm_request_resume(host->dev); /* no use counter */
-
- return IRQ_HANDLED;
-}
-
static void set_sd_bus_power(struct omap_hsmmc_host *host)
{
unsigned long i;
@@ -1695,7 +1680,6 @@ static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host)
{
- struct mmc_host *mmc = host->mmc;
int ret;
/*
@@ -1707,11 +1691,12 @@ static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host)
if (!host->dev->of_node || !host->wake_irq)
return -ENODEV;
- /* Prevent auto-enabling of IRQ */
- irq_set_status_flags(host->wake_irq, IRQ_NOAUTOEN);
- ret = devm_request_irq(host->dev, host->wake_irq, omap_hsmmc_wake_irq,
- IRQF_TRIGGER_LOW | IRQF_ONESHOT,
- mmc_hostname(mmc), host);
+ host->wirq = devm_kzalloc(host->dev, sizeof(*host->wirq),
+ GFP_KERNEL);
+ if (!host->wirq)
+ return -ENOMEM;
+ ret = dev_pm_wakeirq_request(host->dev, host->wake_irq, NULL, 0, NULL,
+ host->wirq);
if (ret) {
dev_err(mmc_dev(host->mmc), "Unable to request wake IRQ\n");
goto err;
@@ -1748,7 +1733,7 @@ static int omap_hsmmc_configure_wake_irq(struct omap_hsmmc_host *host)
return 0;
err_free_irq:
- devm_free_irq(host->dev, host->wake_irq, host);
+ dev_pm_wakeirq_free(host->wirq);
err:
dev_warn(host->dev, "no SDIO IRQ support, falling back to polling\n");
host->wake_irq = 0;
@@ -2254,10 +2239,10 @@ static int omap_hsmmc_suspend(struct device *dev)
OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
}
- /* do not wake up due to sdio irq */
if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) &&
- !(host->mmc->pm_flags & MMC_PM_WAKE_SDIO_IRQ))
- disable_irq(host->wake_irq);
+ (host->flags & HSMMC_SDIO_IRQ_ENABLED) &&
+ (host->mmc->pm_flags & MMC_PM_WAKE_SDIO_IRQ))
+ dev_pm_wakeirq_arm_for_suspend(host->wirq);
if (host->dbclk)
clk_disable_unprepare(host->dbclk);
@@ -2283,11 +2268,6 @@ static int omap_hsmmc_resume(struct device *dev)
omap_hsmmc_conf_bus_power(host);
omap_hsmmc_protect_card(host);
-
- if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) &&
- !(host->mmc->pm_flags & MMC_PM_WAKE_SDIO_IRQ))
- enable_irq(host->wake_irq);
-
pm_runtime_mark_last_busy(host->dev);
pm_runtime_put_autosuspend(host->dev);
return 0;
@@ -2331,10 +2311,7 @@ static int omap_hsmmc_runtime_suspend(struct device *dev)
}
pinctrl_pm_select_idle_state(dev);
-
- WARN_ON(host->flags & HSMMC_WAKE_IRQ_ENABLED);
- enable_irq(host->wake_irq);
- host->flags |= HSMMC_WAKE_IRQ_ENABLED;
+ dev_pm_wakeirq_enable(host->wirq);
} else {
pinctrl_pm_select_idle_state(dev);
}
@@ -2356,11 +2333,7 @@ static int omap_hsmmc_runtime_resume(struct device *dev)
spin_lock_irqsave(&host->irq_lock, flags);
if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) &&
(host->flags & HSMMC_SDIO_IRQ_ENABLED)) {
- /* sdio irq flag can't change while in runtime suspend */
- if (host->flags & HSMMC_WAKE_IRQ_ENABLED) {
- disable_irq_nosync(host->wake_irq);
- host->flags &= ~HSMMC_WAKE_IRQ_ENABLED;
- }
+ dev_pm_wakeirq_disable(host->wirq);
pinctrl_pm_select_default_state(host->dev);
--
2.1.4
prev parent reply other threads:[~2015-03-06 0:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 0:34 [PATCH 0/4] Minimal generic wakeirq helpers Tony Lindgren
2015-03-06 0:34 ` [PATCH 1/4] PM / Wakeirq: Add minimal device wakeirq helper functions Tony Lindgren
2015-03-06 2:02 ` Rafael J. Wysocki
2015-03-06 12:41 ` Rafael J. Wysocki
2015-03-06 16:19 ` Tony Lindgren
2015-03-06 19:05 ` Alan Stern
2015-03-06 23:05 ` Tony Lindgren
2015-03-07 0:43 ` Rafael J. Wysocki
2015-03-07 1:09 ` Tony Lindgren
2015-03-08 15:43 ` Alan Stern
2015-03-09 14:09 ` Rafael J. Wysocki
2015-03-08 15:41 ` Alan Stern
2015-03-09 15:09 ` Tony Lindgren
2015-03-09 15:42 ` Alan Stern
2015-03-09 16:41 ` Tony Lindgren
2015-03-06 23:30 ` Rafael J. Wysocki
2015-03-08 15:34 ` Alan Stern
2015-03-06 0:34 ` [PATCH 2/4] serial: 8250_omap: Move wake-up interrupt to generic wakeirq Tony Lindgren
2015-03-06 0:34 ` [PATCH 3/4] serial: omap: Switch " Tony Lindgren
2015-03-06 0:34 ` Tony Lindgren [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425602049-2674-5-git-send-email-tony@atomide.com \
--to=tony@atomide.com \
--cc=afenkart@gmail.com \
--cc=balbi@ti.com \
--cc=bigeasy@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=huiquan.zhong@intel.com \
--cc=khilman@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=neilb@suse.de \
--cc=nm@ti.com \
--cc=peter@hurleysoftware.com \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).