diff options
-rw-r--r-- | drivers/mfd/ab8500-gpadc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c index b1f3561b023f..9ed3afc31d11 100644 --- a/drivers/mfd/ab8500-gpadc.c +++ b/drivers/mfd/ab8500-gpadc.c | |||
@@ -605,6 +605,31 @@ static int ab8500_gpadc_runtime_idle(struct device *dev) | |||
605 | return 0; | 605 | return 0; |
606 | } | 606 | } |
607 | 607 | ||
608 | static int ab8500_gpadc_suspend(struct device *dev) | ||
609 | { | ||
610 | struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); | ||
611 | |||
612 | mutex_lock(&gpadc->ab8500_gpadc_lock); | ||
613 | |||
614 | pm_runtime_get_sync(dev); | ||
615 | |||
616 | regulator_disable(gpadc->regu); | ||
617 | return 0; | ||
618 | } | ||
619 | |||
620 | static int ab8500_gpadc_resume(struct device *dev) | ||
621 | { | ||
622 | struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); | ||
623 | |||
624 | regulator_enable(gpadc->regu); | ||
625 | |||
626 | pm_runtime_mark_last_busy(gpadc->dev); | ||
627 | pm_runtime_put_autosuspend(gpadc->dev); | ||
628 | |||
629 | mutex_unlock(&gpadc->ab8500_gpadc_lock); | ||
630 | return 0; | ||
631 | } | ||
632 | |||
608 | static int ab8500_gpadc_probe(struct platform_device *pdev) | 633 | static int ab8500_gpadc_probe(struct platform_device *pdev) |
609 | { | 634 | { |
610 | int ret = 0; | 635 | int ret = 0; |
@@ -698,6 +723,9 @@ static const struct dev_pm_ops ab8500_gpadc_pm_ops = { | |||
698 | SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend, | 723 | SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend, |
699 | ab8500_gpadc_runtime_resume, | 724 | ab8500_gpadc_runtime_resume, |
700 | ab8500_gpadc_runtime_idle) | 725 | ab8500_gpadc_runtime_idle) |
726 | SET_SYSTEM_SLEEP_PM_OPS(ab8500_gpadc_suspend, | ||
727 | ab8500_gpadc_resume) | ||
728 | |||
701 | }; | 729 | }; |
702 | 730 | ||
703 | static struct platform_driver ab8500_gpadc_driver = { | 731 | static struct platform_driver ab8500_gpadc_driver = { |