From patchwork Sat Jul 2 10:52:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Govindraj.R" X-Patchwork-Id: 940312 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p62As6mJ005748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 2 Jul 2011 10:54:27 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qcxpa-0003ap-6m; Sat, 02 Jul 2011 10:53:46 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QcxpZ-0005UO-7o; Sat, 02 Jul 2011 10:53:45 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qcxox-0005NX-Jt for linux-arm-kernel@lists.infradead.org; Sat, 02 Jul 2011 10:53:09 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id p62Ar0NC006797 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 2 Jul 2011 05:53:02 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p62AqxH2020856; Sat, 2 Jul 2011 16:22:59 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 8.3.106.1; Sat, 2 Jul 2011 16:22:59 +0530 Received: from ula0131859.india.ti.com ([172.24.190.170]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p62AqmRV004645; Sat, 2 Jul 2011 16:22:56 +0530 (IST) From: "Govindraj.R" To: Subject: [PATCH 2/2 v4] OMAP2+: hwmod: Add API to check IO PAD wakeup status Date: Sat, 2 Jul 2011 16:22:26 +0530 Message-ID: <1309603946-25395-3-git-send-email-govindraj.raja@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1309603946-25395-1-git-send-email-govindraj.raja@ti.com> References: <1309603946-25395-1-git-send-email-govindraj.raja@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110702_065307_865905_D5454CAA X-CRM114-Status: GOOD ( 14.00 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [198.47.26.152 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Kevin Hilman , Paul Walmsley , Tony Lindgren , Tero Kristo , "Govindraj.R" , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 02 Jul 2011 10:54:27 +0000 (UTC) Add API to determine IO-PAD wakeup event status for a given hwmod dynamic_mux pad. Signed-off-by: Govindraj.R --- arch/arm/mach-omap2/mux.c | 30 ++++++++++++++++++++++++++ arch/arm/mach-omap2/mux.h | 13 +++++++++++ arch/arm/mach-omap2/omap_hwmod.c | 7 ++++++ arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 + 4 files changed, 51 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index c7fb22a..50ee806 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -351,6 +351,36 @@ err1: return NULL; } +/** + * omap_hwmod_mux_get_wake_status - omap hwmod check pad wakeup + * @hmux: Pads for a hwmod + * + * Gets the wakeup status of given pad from omap-hwmod. + * 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) +{ + int i; + unsigned int val; + u8 ret = false; + + for (i = 0; i < hmux->nr_pads; i++) { + struct omap_device_pad *pad = &hmux->pads[i]; + + if (pad->flags & OMAP_DEVICE_PAD_WAKEUP) { + val = omap_mux_read(pad->partition, + pad->mux->reg_offset); + if (val & OMAP_WAKEUP_EVENT) { + ret = true; + break; + } + } + } + + return ret; +} + /* Assumes the calling function takes care of locking */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state) { diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 2132308..8b2150a 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -225,8 +225,21 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads); */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); +/** + * omap_hwmod_mux_get_wake_status - omap hwmod check pad wakeup + * @hmux: Pads for a hwmod + * + * 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 +omap_hwmod_mux_get_wake_status(struct omap_hwmod_mux_info *hmux) +{ + return 0; +} + static inline int omap_mux_init_gpio(int gpio, int val) { return 0; diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 3b28e0a..f9495fe 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2428,3 +2428,10 @@ int omap_hwmod_no_setup_reset(struct omap_hwmod *oh) return 0; } + +int omap_hmwod_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 1adea9c..da6ab5c 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -602,6 +602,7 @@ u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); int omap_hwmod_no_setup_reset(struct omap_hwmod *oh); +int omap_hmwod_pad_get_wakeup_status(struct omap_hwmod *oh); /* * Chip variant-specific hwmod init routines - XXX should be converted * to use initcalls once the initial boot ordering is straightened out