diff options
| -rw-r--r-- | arch/arm/plat-samsung/pwm.c | 35 |
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 | ||
| 383 | static 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 | |||
| 397 | static 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 | |||
| 382 | static struct platform_driver s3c_pwm_driver = { | 415 | static 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 | ||
| 391 | static int __init pwm_init(void) | 426 | static int __init pwm_init(void) |
