diff options
author | Roger Quadros <rogerq@ti.com> | 2012-06-21 22:04:01 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2012-06-21 22:04:01 +0800 |
commit | 44fef05d56961d0f34178e3c7ca4e362948e3107 (patch) | |
tree | 8f7dc84a8b7d1e6b077eebef30d83836643f9e98 | |
parent | 2c963fa702cb8bcc4eb3a580e05e3304df4911b2 (diff) |
OMAP: Smartreflex: Don't break suspend/resumetracking-topic-dce
This patch disables Smartreflex voltage autocompensation
(if it was enabled) while suspending and enables it back
during resume.
Now system is able to suspend and resume correctly.
Signed-off-by: Roger Quadros <rogerq@ti.com>
-rw-r--r-- | arch/arm/mach-omap2/smartreflex.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index a30b1dcfdec..bed75378e54 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -47,7 +47,8 @@ struct omap_sr { int ip_type; int nvalue_count; int lvt_nvalue_count; - bool autocomp_active; + bool autocomp_active; /* current state */ + bool autocomp_state; /*for suspend/resume*/ bool lvt_sensor; u32 clk_length; u32 err_weight; @@ -1355,11 +1356,37 @@ static void __devexit omap_sr_shutdown(struct platform_device *pdev) return; } +static int sr_suspend(struct device *dev) +{ + struct omap_sr *sr_info = dev_get_drvdata(dev); + + /* save autocomp state and disable autocomp */ + sr_info->autocomp_state = sr_info->autocomp_active; + if (sr_info->autocomp_active) + sr_stop_vddautocomp(sr_info, true, 1); + + return 0; +} + +static int sr_resume(struct device *dev) +{ + struct omap_sr *sr_info = dev_get_drvdata(dev); + + /* enable autocomp if it was enabled before suspend */ + if (sr_info->autocomp_state) + sr_start_vddautocomp(sr_info, true); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(sr_pm_ops, sr_suspend, sr_resume); + static struct platform_driver smartreflex_driver = { .remove = __devexit_p(omap_sr_remove), .shutdown = __devexit_p(omap_sr_shutdown), .driver = { .name = "smartreflex", + .pm = &sr_pm_ops, }, }; |