summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2012-10-15 19:01:17 -0400
committerAnson Huang <b20788@freescale.com>2012-10-16 10:14:00 -0400
commite29ecfd09fc4d808b5dd0dc5a2d1b2d27a6063b9 (patch)
tree1d0a5f969498fc248aaf1b9d20e3b4dbacaebf22
parentf3e0a1c705ec207004c21afe7a166c2eea5f4c6a (diff)
ENGR00229630 vpu: need to manage pu regulator in suspend/resume
If VPU is working before suspend, we need to disable its regulator to make sure regulator can be off before suspend, then enable its regulator before resume to work, we check vpu's open_count to determine whether to disable/enable its regulator. Signed-off-by: Anson Huang <b20788@freescale.com>
-rw-r--r--drivers/mxc/vpu/mxc_vpu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/mxc/vpu/mxc_vpu.c b/drivers/mxc/vpu/mxc_vpu.c
index 8178824ab80a..6d77afb8a3d6 100644
--- a/drivers/mxc/vpu/mxc_vpu.c
+++ b/drivers/mxc/vpu/mxc_vpu.c
@@ -812,6 +812,13 @@ static int vpu_suspend(struct platform_device *pdev, pm_message_t state)
if (vpu_plat->pg)
vpu_plat->pg(1);
+ /* If VPU is working before suspend, disable
+ * regulator to make usecount right. */
+ if (open_count > 0) {
+ if (!IS_ERR(vpu_regulator))
+ regulator_disable(vpu_regulator);
+ }
+
if (!IS_ERR(vpu_regulator))
regulator_disable(vpu_regulator);
return 0;
@@ -836,6 +843,13 @@ static int vpu_resume(struct platform_device *pdev)
if (vpu_plat->pg)
vpu_plat->pg(0);
+ /* If VPU is working before suspend, enable
+ * regulator to make usecount right. */
+ if (open_count > 0) {
+ if (!IS_ERR(vpu_regulator))
+ regulator_enable(vpu_regulator);
+ }
+
if (bitwork_mem.cpu_addr != 0) {
u32 *p = (u32 *) bitwork_mem.cpu_addr;
u32 data, pc;