aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2011-07-20 08:08:18 -0400
committerKukjin Kim <kgene.kim@samsung.com>2011-07-20 10:39:12 -0400
commit67dcaec8d62ab751dbd1d5f9b3f3c1ce4205edf5 (patch)
treed291d8696c1b435bce3b20683aa01d3cdae1f440
parent64df92ea7893d1cfd714c2f6acfd2eb15fbe3279 (diff)
ARM: SAMSUNG: Revise PM for 12-bit ADC operations
- Fixed: 12bit precision is lost at suspend/resume - Updated: use pm_dev_ops Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--arch/arm/plat-samsung/adc.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 45cc7e6982c1..ee8deef19481 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -437,8 +437,10 @@ static int __devexit s3c_adc_remove(struct platform_device *pdev)
437} 437}
438 438
439#ifdef CONFIG_PM 439#ifdef CONFIG_PM
440static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state) 440static int s3c_adc_suspend(struct device *dev)
441{ 441{
442 struct platform_device *pdev = container_of(dev,
443 struct platform_device, dev);
442 struct adc_device *adc = platform_get_drvdata(pdev); 444 struct adc_device *adc = platform_get_drvdata(pdev);
443 unsigned long flags; 445 unsigned long flags;
444 u32 con; 446 u32 con;
@@ -457,10 +459,13 @@ static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state)
457 return 0; 459 return 0;
458} 460}
459 461
460static int s3c_adc_resume(struct platform_device *pdev) 462static int s3c_adc_resume(struct device *dev)
461{ 463{
464 struct platform_device *pdev = container_of(dev,
465 struct platform_device, dev);
462 struct adc_device *adc = platform_get_drvdata(pdev); 466 struct adc_device *adc = platform_get_drvdata(pdev);
463 int ret; 467 int ret;
468 unsigned long tmp;
464 469
465 ret = regulator_enable(adc->vdd); 470 ret = regulator_enable(adc->vdd);
466 if (ret) 471 if (ret)
@@ -468,8 +473,11 @@ static int s3c_adc_resume(struct platform_device *pdev)
468 clk_enable(adc->clk); 473 clk_enable(adc->clk);
469 enable_irq(adc->irq); 474 enable_irq(adc->irq);
470 475
471 writel(adc->prescale | S3C2410_ADCCON_PRSCEN, 476 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
472 adc->regs + S3C2410_ADCCON); 477 /* Enable 12-bit ADC resolution */
478 if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1)
479 tmp |= S3C64XX_ADCCON_RESSEL;
480 writel(tmp, adc->regs + S3C2410_ADCCON);
473 481
474 return 0; 482 return 0;
475} 483}
@@ -494,16 +502,20 @@ static struct platform_device_id s3c_adc_driver_ids[] = {
494}; 502};
495MODULE_DEVICE_TABLE(platform, s3c_adc_driver_ids); 503MODULE_DEVICE_TABLE(platform, s3c_adc_driver_ids);
496 504
505static const struct dev_pm_ops adc_pm_ops = {
506 .suspend = s3c_adc_suspend,
507 .resume = s3c_adc_resume,
508};
509
497static struct platform_driver s3c_adc_driver = { 510static struct platform_driver s3c_adc_driver = {
498 .id_table = s3c_adc_driver_ids, 511 .id_table = s3c_adc_driver_ids,
499 .driver = { 512 .driver = {
500 .name = "s3c-adc", 513 .name = "s3c-adc",
501 .owner = THIS_MODULE, 514 .owner = THIS_MODULE,
515 .pm = &adc_pm_ops,
502 }, 516 },
503 .probe = s3c_adc_probe, 517 .probe = s3c_adc_probe,
504 .remove = __devexit_p(s3c_adc_remove), 518 .remove = __devexit_p(s3c_adc_remove),
505 .suspend = s3c_adc_suspend,
506 .resume = s3c_adc_resume,
507}; 519};
508 520
509static int __init adc_init(void) 521static int __init adc_init(void)