Message ID | 87397faccs.fsf@ti.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Fri, May 04, 2012 at 02:02:43PM -0700, Kevin Hilman wrote: > "Mark A. Greer" <mgreer@animalcreek.com> writes: > > > On Fri, May 04, 2012 at 07:31:30AM -0700, Kevin Hilman wrote: > > [...] > > >> Come to think of it, the right solution here is probably to use runtime > >> PM. We could then to add some custom hooks for davinci_emac in the > >> device code to use enable_hlt/disable_hlt based on activity. > > > > That was my first thought, actually, but that only works if its > > okay for the driver to call enable_hlt/disable_hlt directly (i.e., > > have runtime_suspend() call enable_hlt() and runtime_resume() call > > disable_hlt()). However, I assumed it would _not_ be acceptable for > > the driver to issue those calls directly. > > I agree. > > > Its a platform-specific issue that we shouldn't be polluting the > > driver with and there are currently no drivers that call them under > > the drivers directory. > > Using runtime PM we don't have to have any platform specific calls in > the driver. We handle it inside the platform-specific runtime PM > implementation. FYI, with some further discussion via IRC, I'm going to implement what Kevin has laid out here. There is a dependency on davinci adding support too but I'll coordinate with the people/person doing that. Please disregard this patch. Thanks for the help everyone. Mark -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index a80e093..3acd1eb 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c @@ -26,8 +26,30 @@ #include <plat/omap_device.h> #include <plat/omap-pm.h> +#include <asm/system.h> + #include "powerdomain.h" +static int omap2_gpio_deactivate_func(struct omap_device *od) +{ + enable_hlt(); + return omap_device_idle_hwmods(od); +} + +static int omap2_gpio_activate_func(struct omap_device *od) +{ + disable_hlt(); + return omap_device_enable_hwmods(od); +} + +struct omap_device_pm_latency pm_lats[] __initdata = { + { + .activate_func = omap2_gpio_activate_func, + .deactivate_func = omap2_gpio_deactivate_func, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) { struct platform_device *pdev; @@ -128,7 +150,8 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm); pdev = omap_device_build(name, id - 1, oh, pdata, - sizeof(*pdata), NULL, 0, false); + sizeof(*pdata), pm_lats, + ARRAY_SIZE(pm_lats), false); kfree(pdata); if (IS_ERR(pdev)) {