diff options
Diffstat (limited to 'arch/arm/plat-samsung/pd.c')
-rw-r--r-- | arch/arm/plat-samsung/pd.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/arch/arm/plat-samsung/pd.c b/arch/arm/plat-samsung/pd.c index efe1d56..2d40889 100644 --- a/arch/arm/plat-samsung/pd.c +++ b/arch/arm/plat-samsung/pd.c @@ -22,12 +22,22 @@ static int samsung_pd_probe(struct platform_device *pdev) { struct samsung_pd_info *pdata = pdev->dev.platform_data; struct device *dev = &pdev->dev; + int ret = 0; if (!pdata) { dev_err(dev, "no device data specified\n"); return -ENOENT; } + pdata->id = pdev->id; + if (pdata->init) { + ret = pdata->init(dev); + if (ret) { + dev_err(dev, "init fails"); + return ret; + } + } + pm_runtime_set_active(dev); pm_runtime_enable(dev); @@ -43,6 +53,32 @@ static int __devexit samsung_pd_remove(struct platform_device *pdev) return 0; } +static int samsung_pd_suspend(struct device *dev) +{ + struct samsung_pd_info *pdata = dev->platform_data; + int ret = 0; + + if (pdata->save) + ret = pdata->save(dev); + + dev_dbg(dev, "suspended\n"); + + return ret; +} + +static int samsung_pd_resume(struct device *dev) +{ + struct samsung_pd_info *pdata = dev->platform_data; + int ret = 0; + + if (pdata->restore) + ret = pdata->restore(dev); + + dev_dbg(dev, "resumed\n"); + + return ret; +} + static int samsung_pd_runtime_suspend(struct device *dev) { struct samsung_pd_info *pdata = dev->platform_data; @@ -51,7 +87,7 @@ static int samsung_pd_runtime_suspend(struct device *dev) if (pdata->disable) ret = pdata->disable(dev); - dev_dbg(dev, "suspended\n"); + dev_dbg(dev, "runtime suspended\n"); return ret; } @@ -63,11 +99,13 @@ static int samsung_pd_runtime_resume(struct device *dev) if (pdata->enable) ret = pdata->enable(dev); - dev_dbg(dev, "resumed\n"); + dev_dbg(dev, "runtime resumed\n"); return ret; } static const struct dev_pm_ops samsung_pd_pm_ops = { + .suspend = samsung_pd_suspend, + .resume = samsung_pd_resume, .runtime_suspend = samsung_pd_runtime_suspend, .runtime_resume = samsung_pd_runtime_resume, }; |