diff options
author | Govindraj.R <govindraj.raja@ti.com> | 2011-05-05 12:08:37 +0530 |
---|---|---|
committer | Nishanth Menon <nm@ti.com> | 2011-07-10 23:20:24 -0700 |
commit | 0539136a4b3bf4a84d61adab0bed9d19b76bce42 (patch) | |
tree | 20bb903f630bb889fcf15a9e5c5f200c549419f6 /arch/arm/mach-omap2 | |
parent | 083eef7c86d1f8be0c214bf7f992454d032d8c4f (diff) | |
download | kernel_samsung_tuna-0539136a4b3bf4a84d61adab0bed9d19b76bce42.zip kernel_samsung_tuna-0539136a4b3bf4a84d61adab0bed9d19b76bce42.tar.gz kernel_samsung_tuna-0539136a4b3bf4a84d61adab0bed9d19b76bce42.tar.bz2 |
OMAP2+: hwmod: Add API to check IO PAD wakeup status
Add API to determine IO-PAD wakeup event status for a given
hwmod dynamic_mux pad.
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/mux.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-omap2/mux.h | 13 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 7 |
3 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index c7fb22a..880d1d7 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. + */ +int 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..47c47d1 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. + */ +int omap_hwmod_mux_get_wake_status(struct omap_hwmod_mux_info *hmux); #else +static inline int +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 e45ac46..303fda6 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2462,3 +2462,10 @@ 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; +} |