From patchwork Tue May 10 10:30:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Govindraj.R" X-Patchwork-Id: 773932 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4AAXm0m029820 for ; Tue, 10 May 2011 10:33:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661Ab1EJKdq (ORCPT ); Tue, 10 May 2011 06:33:46 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:34682 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751546Ab1EJKdp (ORCPT ); Tue, 10 May 2011 06:33:45 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4AAXcop029947 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 May 2011 05:33:40 -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 p4AAXaSU012966; Tue, 10 May 2011 16:03:37 +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; Tue, 10 May 2011 16:03:36 +0530 Received: from GLPP-machine (glpp-machine.apr.dhcp.ti.com [172.24.137.105]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4AAXWlJ000948; Tue, 10 May 2011 16:03:36 +0530 (IST) From: "Govindraj.R" To: CC: , "Govindraj.R" , Tony Lindgren , Benoit Cousson , Kevin Hilman , Paul Walmsley , Rajendra Nayak Subject: [PATCH 2/2 v3] OMAP2+: hwmod: Add API to check IO PAD wakeup status Date: Tue, 10 May 2011 16:00:05 +0530 Message-ID: <1305023405-9561-3-git-send-email-govindraj.raja@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1305023405-9561-1-git-send-email-govindraj.raja@ti.com> References: <1305023405-9561-1-git-send-email-govindraj.raja@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]); Tue, 10 May 2011 10:33:48 +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 | 28 ++++++++++++++++++++++++++ arch/arm/mach-omap2/mux.h | 13 ++++++++++++ arch/arm/mach-omap2/omap_hwmod.c | 14 +++++++++++++ arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 + 4 files changed, 56 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index a4ab1e3..b40aebe 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -348,6 +348,34 @@ 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]; + + 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 137f321..86a0051 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 72176d5..83eab67 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2429,3 +2429,17 @@ int omap_hwmod_disable_ioring_wakeup(struct omap_hwmod *oh) /* Disable pad wakeup capability */ return omap_hwmod_set_ioring_wakeup(oh, false); } + +/** + * omap_hwmod_pad_get_wakeup_status - get pad wakeup status if mux is available. + * @oh: struct omap_hwmod * + * + * Returns the wake_up status bit of available pad mux pin. + * return error if no mux pads are available. + */ +int omap_hmwod_pad_get_wakeup_status(struct omap_hwmod *oh) +{ + if (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 7ef11a6..664975c 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -605,6 +605,7 @@ int omap_hwmod_no_setup_reset(struct omap_hwmod *oh); int omap_hwmod_enable_ioring_wakeup(struct omap_hwmod *oh); int omap_hwmod_disable_ioring_wakeup(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