On Thu, 14 Oct 2010, Paul Walmsley wrote: > Enclosed below is a work-in-progress patch to illustrate the proposal. > It clearly needs some more work and should be split into at least two > patches, but it might help clarify what I am proposing. Here's one important missing piece of the patch that I wanted to illustrate... - Paul >From de3b800f9a6db027846f68de3aa4202eb713b391 Mon Sep 17 00:00:00 2001 From: Paul Walmsley <paul@xxxxxxxxx> Date: Thu, 14 Oct 2010 12:48:00 -0600 Subject: [RFC PATCH] OMAP2+ hwmod: illustrate pre-shutdown hook implementation --- arch/arm/mach-omap2/omap_hwmod.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 618e135..92dd369 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1261,6 +1261,9 @@ int _omap_hwmod_idle(struct omap_hwmod *oh) */ static int _shutdown(struct omap_hwmod *oh) { + int ret; + u8 prev_state; + if (oh->_state != _HWMOD_STATE_IDLE && oh->_state != _HWMOD_STATE_ENABLED) { WARN(1, "omap_hwmod: %s: disabled state can only be entered " @@ -1270,6 +1273,18 @@ static int _shutdown(struct omap_hwmod *oh) pr_debug("omap_hwmod: %s: disabling\n", oh->name); + if (oh->class->pre_shutdown) { + prev_state = oh->_state; + if (oh->_state == _HWMOD_STATE_IDLE) + _omap_hwmod_enable(oh); + ret = oh->class->pre_shutdown(oh); + if (ret) { + if (prev_state == _HWMOD_STATE_IDLE) + _omap_hwmod_idle(oh); + return ret; + } + } + if (oh->class->sysc) _shutdown_sysc(oh); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html