aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-samsung.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-03-07 23:03:31 -0500
committerThierry Reding <thierry.reding@avionic-design.de>2013-03-08 02:30:55 -0500
commitc509a8e521939ca1fd4ba31feca4718328044230 (patch)
treeb07a85624bbe62f678172ef4f8351b532c815eb1 /drivers/pwm/pwm-samsung.c
parent482467ad97b633b28f57c347440d97c108dc4bfb (diff)
pwm: samsung: convert s3c_pwm to dev_pm_ops
Instead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Diffstat (limited to 'drivers/pwm/pwm-samsung.c')
-rw-r--r--drivers/pwm/pwm-samsung.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index 5207e6cd8648..a0ece50d70bb 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -289,10 +289,10 @@ static int s3c_pwm_remove(struct platform_device *pdev)
289 return 0; 289 return 0;
290} 290}
291 291
292#ifdef CONFIG_PM 292#ifdef CONFIG_PM_SLEEP
293static int s3c_pwm_suspend(struct platform_device *pdev, pm_message_t state) 293static int s3c_pwm_suspend(struct device *dev)
294{ 294{
295 struct s3c_chip *s3c = platform_get_drvdata(pdev); 295 struct s3c_chip *s3c = dev_get_drvdata(dev);
296 296
297 /* No one preserve these values during suspend so reset them 297 /* No one preserve these values during suspend so reset them
298 * Otherwise driver leaves PWM unconfigured if same values 298 * Otherwise driver leaves PWM unconfigured if same values
@@ -304,9 +304,9 @@ static int s3c_pwm_suspend(struct platform_device *pdev, pm_message_t state)
304 return 0; 304 return 0;
305} 305}
306 306
307static int s3c_pwm_resume(struct platform_device *pdev) 307static int s3c_pwm_resume(struct device *dev)
308{ 308{
309 struct s3c_chip *s3c = platform_get_drvdata(pdev); 309 struct s3c_chip *s3c = dev_get_drvdata(dev);
310 unsigned long tcon; 310 unsigned long tcon;
311 311
312 /* Restore invertion */ 312 /* Restore invertion */
@@ -316,21 +316,19 @@ static int s3c_pwm_resume(struct platform_device *pdev)
316 316
317 return 0; 317 return 0;
318} 318}
319
320#else
321#define s3c_pwm_suspend NULL
322#define s3c_pwm_resume NULL
323#endif 319#endif
324 320
321static SIMPLE_DEV_PM_OPS(s3c_pwm_pm_ops, s3c_pwm_suspend,
322 s3c_pwm_resume);
323
325static struct platform_driver s3c_pwm_driver = { 324static struct platform_driver s3c_pwm_driver = {
326 .driver = { 325 .driver = {
327 .name = "s3c24xx-pwm", 326 .name = "s3c24xx-pwm",
328 .owner = THIS_MODULE, 327 .owner = THIS_MODULE,
328 .pm = &s3c_pwm_pm_ops,
329 }, 329 },
330 .probe = s3c_pwm_probe, 330 .probe = s3c_pwm_probe,
331 .remove = s3c_pwm_remove, 331 .remove = s3c_pwm_remove,
332 .suspend = s3c_pwm_suspend,
333 .resume = s3c_pwm_resume,
334}; 332};
335 333
336static int __init pwm_init(void) 334static int __init pwm_init(void)