>From fff5f3ef281eafe2229811eaa2661176e9582db2 Mon Sep 17 00:00:00 2001 From: Tero Kristo Date: Thu, 13 Oct 2011 14:21:09 +0300 Subject: [PATCH] HACK: omap: mux: add support for separate wakeup irq for each pad By default all registered pads will trigger mpu_irqs[0]. This patch adds an API that allows separate irqs for each pad. Usage: int irqs[nr_pads] = { 1, 2, 3 }; ... mux = omap_hwmod_mux_init(pads, nr_pads); omap_hwmod_mux_init_irqs(mux, irqs); Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/mux.c | 21 +++++++++++++++------ arch/arm/mach-omap2/mux.h | 2 ++ arch/arm/mach-omap2/omap_hwmod.c | 7 ------- arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 + 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 642fe3f..e9ac904 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -354,6 +354,14 @@ err1: return NULL; } +int omap_hwmod_mux_init_irqs(struct omap_hwmod_mux_info *mux, int *irqs) +{ + if (!mux || !irqs) + return -EINVAL; + mux->irqs = irqs; + return 0; +} + /** * omap_hwmod_mux_get_wake_status - omap hwmod check pad wakeup * @hmux: Pads for a hwmod @@ -362,11 +370,10 @@ err1: * Returns true if wakeup event is set for pad else false * if wakeup is not occured or pads are not avialable. */ -bool omap_hwmod_mux_get_wake_status(struct omap_hwmod_mux_info *hmux) +static bool omap_hwmod_mux_scan_wakeups(struct omap_hwmod_mux_info *hmux) { int i; unsigned int val; - u8 ret = false; for (i = 0; i < hmux->nr_pads; i++) { struct omap_device_pad *pad = &hmux->pads[i]; @@ -375,15 +382,17 @@ bool omap_hwmod_mux_get_wake_status(struct omap_hwmod_mux_info *hmux) val = omap_mux_read(pad->partition, pad->mux->reg_offset); if (val & OMAP_WAKEUP_EVENT) { - ret = true; pr_info("wkup detected: %04x\n", pad->mux->reg_offset); - break; + if (hmux->irqs) + generic_handle_irq(hmux->irqs[i]); + else + return true; } } } - return ret; + return false; } /** @@ -396,7 +405,7 @@ static int _omap_hwmod_mux_handle_irq(struct omap_hwmod *oh, void *data) { if (!oh->mux || !oh->mux->enabled) return 0; - if (omap_hwmod_mux_get_wake_status(oh->mux)) + if (omap_hwmod_mux_scan_wakeups(oh->mux)) generic_handle_irq(oh->mpu_irqs[0].irq); return 0; } diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 8b2150a..24e1981 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -216,6 +216,8 @@ int omap_mux_init_signal(const char *muxname, int val); extern struct omap_hwmod_mux_info * omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads); +extern int omap_hwmod_mux_init_irqs(struct omap_hwmod_mux_info *mux, int *irqs); + /** * omap_hwmod_mux - omap hwmod specific pin muxing * @hmux: Pads for a hwmod diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index a8b24d7..e751dd9 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2724,10 +2724,3 @@ int omap_hwmod_no_setup_reset(struct omap_hwmod *oh) return 0; } - -int omap_hwmod_pad_get_wakeup_status(struct omap_hwmod *oh) -{ - if (oh && oh->mux) - return omap_hwmod_mux_get_wake_status(oh->mux); - return -EINVAL; -} diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 9c70cc8..2a9ce37 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -97,6 +97,7 @@ struct omap_hwmod_mux_info { struct omap_device_pad *pads; int nr_pads_dynamic; struct omap_device_pad **pads_dynamic; + int *irqs; bool enabled; }; -- 1.7.4.1