diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2011-03-10 05:50:08 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2011-03-10 05:50:08 -0500 |
commit | 9599217a06da5f5a95794ca9192c14317d441187 (patch) | |
tree | 0fb6dac21ff0175b5674cc7259990a1d53c12d3c /arch/arm/mach-omap2/omap_hwmod.c | |
parent | 43b01643355672a266b95c4719f47cd1abac4680 (diff) |
OMAP2+: hwmod: add API to handle autoidle mode
Create a new API that forms a wrapper to _set_module_autoidle()
to modify the AUTOIDLE bit.
This API is intended to be used by drivers that requires direct
manipulation of the AUTOIDLE bits in SYSCONFIG register.
McBSP driver requires autoidle bit to be enabled/disabled while
using sidetone feature.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
[paul@pwsan.com: restrict the hwmod states that the autoidle bit can be changed
in; changed function name; dropped "int" from "unsigned int long"]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 816aeb97ba28..a68a2cf1be34 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -1288,6 +1288,42 @@ static int _idle(struct omap_hwmod *oh) | |||
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | /** | 1290 | /** |
1291 | * omap_hwmod_set_ocp_autoidle - set the hwmod's OCP autoidle bit | ||
1292 | * @oh: struct omap_hwmod * | ||
1293 | * @autoidle: desired AUTOIDLE bitfield value (0 or 1) | ||
1294 | * | ||
1295 | * Sets the IP block's OCP autoidle bit in hardware, and updates our | ||
1296 | * local copy. Intended to be used by drivers that require | ||
1297 | * direct manipulation of the AUTOIDLE bits. | ||
1298 | * Returns -EINVAL if @oh is null or is not in the ENABLED state, or passes | ||
1299 | * along the return value from _set_module_autoidle(). | ||
1300 | * | ||
1301 | * Any users of this function should be scrutinized carefully. | ||
1302 | */ | ||
1303 | int omap_hwmod_set_ocp_autoidle(struct omap_hwmod *oh, u8 autoidle) | ||
1304 | { | ||
1305 | u32 v; | ||
1306 | int retval = 0; | ||
1307 | unsigned long flags; | ||
1308 | |||
1309 | if (!oh || oh->_state != _HWMOD_STATE_ENABLED) | ||
1310 | return -EINVAL; | ||
1311 | |||
1312 | spin_lock_irqsave(&oh->_lock, flags); | ||
1313 | |||
1314 | v = oh->_sysc_cache; | ||
1315 | |||
1316 | retval = _set_module_autoidle(oh, autoidle, &v); | ||
1317 | |||
1318 | if (!retval) | ||
1319 | _write_sysconfig(v, oh); | ||
1320 | |||
1321 | spin_unlock_irqrestore(&oh->_lock, flags); | ||
1322 | |||
1323 | return retval; | ||
1324 | } | ||
1325 | |||
1326 | /** | ||
1291 | * _shutdown - shutdown an omap_hwmod | 1327 | * _shutdown - shutdown an omap_hwmod |
1292 | * @oh: struct omap_hwmod * | 1328 | * @oh: struct omap_hwmod * |
1293 | * | 1329 | * |