From patchwork Thu Sep 8 15:22:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 1130072 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p88FMb3D002601 for ; Thu, 8 Sep 2011 15:22:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754063Ab1IHPWn (ORCPT ); Thu, 8 Sep 2011 11:22:43 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:40801 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754013Ab1IHPWl convert rfc822-to-8bit (ORCPT ); Thu, 8 Sep 2011 11:22:41 -0400 Received: from dlep34.itg.ti.com ([157.170.170.115]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p88FMdmx031522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Sep 2011 10:22:39 -0500 Received: from dlep26.itg.ti.com (smtp-le.itg.ti.com [157.170.170.27]) by dlep34.itg.ti.com (8.13.7/8.13.8) with ESMTP id p88FMd0p009743; Thu, 8 Sep 2011 10:22:39 -0500 (CDT) Received: from dnce72.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id p88FMcUa022640; Thu, 8 Sep 2011 10:22:38 -0500 (CDT) thread-index: AcxuOyS+rWhtqn1uRlSaUZhAw4at1g== Content-Class: urn:content-classes:message Importance: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4657 Received: from localhost.localdomain (172.24.88.2) by dnce72.ent.ti.com (137.167.131.87) with Microsoft SMTP Server (TLS) id 8.3.106.1; Thu, 8 Sep 2011 17:22:38 +0200 From: Tero Kristo To: CC: , , Subject: [PATCHv7 7/9] OMAP2+: mux: add support for PAD wakeup interrupts Date: Thu, 8 Sep 2011 18:22:22 +0300 Message-ID: <1315495344-23133-8-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1315495344-23133-1-git-send-email-t-kristo@ti.com> References: <1315495344-23133-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 08 Sep 2011 15:22:45 +0000 (UTC) OMAP mux now provides a service routine to parse pending wakeup events and to call registered ISR whenever active wakeups are detected. This routine is called directly from PRCM interrupt handler. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/mux.c | 37 +++++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/mux.h | 5 +++++ 2 files changed, 42 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 50ee806..b6ec5de 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include @@ -381,6 +384,33 @@ bool omap_hwmod_mux_get_wake_status(struct omap_hwmod_mux_info *hmux) return ret; } +/** + * omap_hwmod_mux_handle_irq - Process wakeup events for a single hwmod + * + * Checks a single hwmod for every wakeup capable pad to see if there is an + * active wakeup event. If this is the case, call the corresponding ISR. + */ +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)) + generic_handle_irq(oh->mpu_irqs[0].irq); + return 0; +} + +/** + * omap_hwmod_mux_handle_irq - Process pad wakeup irqs. + * + * Calls a function for each registered omap_hwmod to check + * pad wakeup statuses. + */ +static irqreturn_t omap_hwmod_mux_handle_irq(int irq, void *unused) +{ + omap_hwmod_for_each(_omap_hwmod_mux_handle_irq, NULL); + return IRQ_HANDLED; +} + /* Assumes the calling function takes care of locking */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state) { @@ -745,6 +775,7 @@ static void __init omap_mux_free_names(struct omap_mux *m) static int __init omap_mux_late_init(void) { struct omap_mux_partition *partition; + int ret; list_for_each_entry(partition, &mux_partitions, node) { struct omap_mux_entry *e, *tmp; @@ -765,6 +796,12 @@ static int __init omap_mux_late_init(void) } } + ret = request_irq(omap_prcm_event_to_irq("io"), + omap_hwmod_mux_handle_irq, 0, "hwmod_io", NULL); + + if (ret) + printk(KERN_WARNING "Failed to setup hwmod io irq %d\n", ret); + omap_mux_dbg_init(); return 0; diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 8b2150a..8014de0 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -232,6 +232,7 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); * Called only from omap_hwmod.c, do not use. */ bool omap_hwmod_mux_get_wake_status(struct omap_hwmod_mux_info *hmux); + #else static inline bool @@ -259,6 +260,10 @@ static inline void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state) { } +static inline void omap_hwmod_mux_handle_irq(void) +{ +} + static struct omap_board_mux *board_mux __initdata __maybe_unused; #endif