diff options
| author | Jim Wylder <jwylder@motorola.com> | 2014-06-23 14:47:36 -0500 |
|---|---|---|
| committer | James Wylder <jwylder@motorola.com> | 2014-06-30 16:35:35 +0000 |
| commit | 7f8a4d7783f4a257349f6b199f8c13b44466705f (patch) | |
| tree | 8f76986b12284025b25f8b25738311a7eadfb754 | |
| parent | ced90b56ec3983bb9a4429272a92f15769cfe633 (diff) | |
| download | olio-linux-3.10-7f8a4d7783f4a257349f6b199f8c13b44466705f.tar.xz olio-linux-3.10-7f8a4d7783f4a257349f6b199f8c13b44466705f.zip | |
IKXCLOCK-2635 arm: omap2: conditionally register io handler
The omap mux code registers an irq handler to scan all pads
for wakeup status. The existing implementation will loop
through a large list of hw modules, even if no mux'es are
configured. Update to only register the handler if at least
one mux is configured for wakeup using the hwmod configuration.
Change-Id: I87cd2aca8d16ee30ed4b6d3a1b9fe52063a44a59
Signed-off-by: Jim Wylder <jwylder@motorola.com>
| -rw-r--r-- | arch/arm/mach-omap2/mux.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index f82cf878d6a..776ca198119 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -425,6 +425,35 @@ static irqreturn_t omap_hwmod_mux_handle_irq(int irq, void *unused) return IRQ_HANDLED; } +/** + * _omap_hwmod_mux_count + * + * Increment data if given hwmod has a mux configured + */ +static int _omap_hwmod_mux_count(struct omap_hwmod *oh, void *data) +{ + int *count = (int *)data; + + if (oh->mux) + (*count)++; + + return 0; +} + +/** + * omap_hwmod_mux_count + * + * Count the total number of muxes configured. + */ +static int omap_hwmod_mux_count(void) +{ + int count = 0; + + omap_hwmod_for_each(_omap_hwmod_mux_count, &count); + + return count; +} + /* Assumes the calling function takes care of locking */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state) { @@ -811,12 +840,17 @@ int __init omap_mux_late_init(void) } } - ret = request_irq(omap_prcm_event_to_irq("io"), - omap_hwmod_mux_handle_irq, IRQF_SHARED | IRQF_NO_SUSPEND, - "hwmod_io", omap_mux_late_init); + /* setup io interrupt handler if we have any configured mux'es */ + if (omap_hwmod_mux_count()) { + ret = request_irq(omap_prcm_event_to_irq("io"), + omap_hwmod_mux_handle_irq, + IRQF_SHARED | IRQF_NO_SUSPEND, + "hwmod_io", omap_mux_late_init); - if (ret) - pr_warning("mux: Failed to setup hwmod io irq %d\n", ret); + if (ret) + pr_warning("mux: Failed to setup hwmod io irq %d\n", + ret); + } omap_mux_dbg_init(); |