提交 774c50ab 编写于 作者: D Daniel WILLERUD 提交者: Lee Jones

mfd: ab8500-gpadc: Implemented suspend/resume

suspend/resume methods implemented to prevent suspend while the gpadc
driver is busy.
Signed-off-by: NDaniel WILLERUD <daniel.willerud@stericsson.com>
Signed-off-by: NLee Jones <lee.jones@linaro.org>
Reviewed-by: NJonas ABERG <jonas.aberg@stericsson.com>
Reviewed-by: NUlf HANSSON <ulf.hansson@stericsson.com>
Acked-by: NSamuel Ortiz <sameo@linux.intel.com>
上级 f04a9d8a
...@@ -605,6 +605,31 @@ static int ab8500_gpadc_runtime_idle(struct device *dev) ...@@ -605,6 +605,31 @@ static int ab8500_gpadc_runtime_idle(struct device *dev)
return 0; return 0;
} }
static int ab8500_gpadc_suspend(struct device *dev)
{
struct ab8500_gpadc *gpadc = dev_get_drvdata(dev);
mutex_lock(&gpadc->ab8500_gpadc_lock);
pm_runtime_get_sync(dev);
regulator_disable(gpadc->regu);
return 0;
}
static int ab8500_gpadc_resume(struct device *dev)
{
struct ab8500_gpadc *gpadc = dev_get_drvdata(dev);
regulator_enable(gpadc->regu);
pm_runtime_mark_last_busy(gpadc->dev);
pm_runtime_put_autosuspend(gpadc->dev);
mutex_unlock(&gpadc->ab8500_gpadc_lock);
return 0;
}
static int ab8500_gpadc_probe(struct platform_device *pdev) static int ab8500_gpadc_probe(struct platform_device *pdev)
{ {
int ret = 0; int ret = 0;
...@@ -698,6 +723,9 @@ static const struct dev_pm_ops ab8500_gpadc_pm_ops = { ...@@ -698,6 +723,9 @@ static const struct dev_pm_ops ab8500_gpadc_pm_ops = {
SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend, SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend,
ab8500_gpadc_runtime_resume, ab8500_gpadc_runtime_resume,
ab8500_gpadc_runtime_idle) ab8500_gpadc_runtime_idle)
SET_SYSTEM_SLEEP_PM_OPS(ab8500_gpadc_suspend,
ab8500_gpadc_resume)
}; };
static struct platform_driver ab8500_gpadc_driver = { static struct platform_driver ab8500_gpadc_driver = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册