aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung/pwm.c
diff options
context:
space:
mode:
authorVasily Khoruzhick <anarsoul@gmail.com>2010-03-15 10:27:08 -0400
committerBen Dooks <ben-linux@fluff.org>2010-03-15 18:43:33 -0400
commite79032aa75af76a14e2cdd973b199855e7761881 (patch)
tree0dfefe4a63ce0afafd782eda859be26250b93f20 /arch/arm/plat-samsung/pwm.c
parent664e87e47e086962a832f9a613a8fd4042a02ac1 (diff)
ARM: SAMSUNG: Add suspend/resume support for S3C PWM driver
Reset period_ns and duty_ns values in suspend handler to avoid skip of configuration if same values passed to pwm_config; Restore invertion bit in resume handler. Without this patch PWM works incorrectly after resume from suspend. Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-samsung/pwm.c')
-rw-r--r--arch/arm/plat-samsung/pwm.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/pwm.c b/arch/arm/plat-samsung/pwm.c
index ef019f27b67d..f2d11390d01c 100644
--- a/arch/arm/plat-samsung/pwm.c
+++ b/arch/arm/plat-samsung/pwm.c
@@ -379,6 +379,39 @@ static int __devexit s3c_pwm_remove(struct platform_device *pdev)
379 return 0; 379 return 0;
380} 380}
381 381
382#ifdef CONFIG_PM
383static int s3c_pwm_suspend(struct platform_device *pdev, pm_message_t state)
384{
385 struct pwm_device *pwm = platform_get_drvdata(pdev);
386
387 /* No one preserve these values during suspend so reset them
388 * Otherwise driver leaves PWM unconfigured if same values
389 * passed to pwm_config
390 */
391 pwm->period_ns = 0;
392 pwm->duty_ns = 0;
393
394 return 0;
395}
396
397static int s3c_pwm_resume(struct platform_device *pdev)
398{
399 struct pwm_device *pwm = platform_get_drvdata(pdev);
400 unsigned long tcon;
401
402 /* Restore invertion */
403 tcon = __raw_readl(S3C2410_TCON);
404 tcon |= pwm_tcon_invert(pwm);
405 __raw_writel(tcon, S3C2410_TCON);
406
407 return 0;
408}
409
410#else
411#define s3c_pwm_suspend NULL
412#define s3c_pwm_resume NULL
413#endif
414
382static struct platform_driver s3c_pwm_driver = { 415static struct platform_driver s3c_pwm_driver = {
383 .driver = { 416 .driver = {
384 .name = "s3c24xx-pwm", 417 .name = "s3c24xx-pwm",
@@ -386,6 +419,8 @@ static struct platform_driver s3c_pwm_driver = {
386 }, 419 },
387 .probe = s3c_pwm_probe, 420 .probe = s3c_pwm_probe,
388 .remove = __devexit_p(s3c_pwm_remove), 421 .remove = __devexit_p(s3c_pwm_remove),
422 .suspend = s3c_pwm_suspend,
423 .resume = s3c_pwm_resume,
389}; 424};
390 425
391static int __init pwm_init(void) 426static int __init pwm_init(void)