aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung
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:04 -0400
commit64df92ea7893d1cfd714c2f6acfd2eb15fbe3279 (patch)
treed33d9610679acae349f06679f24e377896146393 /arch/arm/plat-samsung
parentf462904ef1508c0a2cc22c65478a7be0cd89f47a (diff)
ARM: SAMSUNG: ADC Channel selection
In S5PV210/S5PC110/EXYNOS4, ADCMUX channel selection uses ADCMUX register, not ADCCON register. This patch corrects the behavior of SAMSUNG-ADC for such CPUs. 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>
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/adc.c29
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-adc.h1
2 files changed, 20 insertions, 10 deletions
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 2224128cc603..45cc7e6982c1 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -40,8 +40,9 @@
40 */ 40 */
41 41
42enum s3c_cpu_type { 42enum s3c_cpu_type {
43 TYPE_S3C24XX, 43 TYPE_ADCV1, /* S3C24XX */
44 TYPE_S3C64XX 44 TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */
45 TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */
45}; 46};
46 47
47struct s3c_adc_client { 48struct s3c_adc_client {
@@ -93,6 +94,7 @@ static inline void s3c_adc_select(struct adc_device *adc,
93 struct s3c_adc_client *client) 94 struct s3c_adc_client *client)
94{ 95{
95 unsigned con = readl(adc->regs + S3C2410_ADCCON); 96 unsigned con = readl(adc->regs + S3C2410_ADCCON);
97 enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data;
96 98
97 client->select_cb(client, 1); 99 client->select_cb(client, 1);
98 100
@@ -100,8 +102,12 @@ static inline void s3c_adc_select(struct adc_device *adc,
100 con &= ~S3C2410_ADCCON_STDBM; 102 con &= ~S3C2410_ADCCON_STDBM;
101 con &= ~S3C2410_ADCCON_STARTMASK; 103 con &= ~S3C2410_ADCCON_STARTMASK;
102 104
103 if (!client->is_ts) 105 if (!client->is_ts) {
104 con |= S3C2410_ADCCON_SELMUX(client->channel); 106 if (cpu == TYPE_ADCV3)
107 writel(client->channel & 0xf, adc->regs + S5P_ADCMUX);
108 else
109 con |= S3C2410_ADCCON_SELMUX(client->channel);
110 }
105 111
106 writel(con, adc->regs + S3C2410_ADCCON); 112 writel(con, adc->regs + S3C2410_ADCCON);
107} 113}
@@ -287,8 +293,8 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
287 293
288 client->nr_samples--; 294 client->nr_samples--;
289 295
290 if (cpu == TYPE_S3C64XX) { 296 if (cpu != TYPE_ADCV1) {
291 /* S3C64XX ADC resolution is 12-bit */ 297 /* S3C64XX/S5P ADC resolution is 12-bit */
292 data0 &= 0xfff; 298 data0 &= 0xfff;
293 data1 &= 0xfff; 299 data1 &= 0xfff;
294 } else { 300 } else {
@@ -314,7 +320,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
314 } 320 }
315 321
316exit: 322exit:
317 if (cpu == TYPE_S3C64XX) { 323 if (cpu != TYPE_ADCV1) {
318 /* Clear ADC interrupt */ 324 /* Clear ADC interrupt */
319 writel(0, adc->regs + S3C64XX_ADCCLRINT); 325 writel(0, adc->regs + S3C64XX_ADCCLRINT);
320 } 326 }
@@ -388,7 +394,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
388 clk_enable(adc->clk); 394 clk_enable(adc->clk);
389 395
390 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; 396 tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
391 if (platform_get_device_id(pdev)->driver_data == TYPE_S3C64XX) { 397 if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) {
392 /* Enable 12-bit ADC resolution */ 398 /* Enable 12-bit ADC resolution */
393 tmp |= S3C64XX_ADCCON_RESSEL; 399 tmp |= S3C64XX_ADCCON_RESSEL;
394 } 400 }
@@ -476,10 +482,13 @@ static int s3c_adc_resume(struct platform_device *pdev)
476static struct platform_device_id s3c_adc_driver_ids[] = { 482static struct platform_device_id s3c_adc_driver_ids[] = {
477 { 483 {
478 .name = "s3c24xx-adc", 484 .name = "s3c24xx-adc",
479 .driver_data = TYPE_S3C24XX, 485 .driver_data = TYPE_ADCV1,
480 }, { 486 }, {
481 .name = "s3c64xx-adc", 487 .name = "s3c64xx-adc",
482 .driver_data = TYPE_S3C64XX, 488 .driver_data = TYPE_ADCV2,
489 }, {
490 .name = "samsung-adc-v3",
491 .driver_data = TYPE_ADCV3,
483 }, 492 },
484 { } 493 { }
485}; 494};
diff --git a/arch/arm/plat-samsung/include/plat/regs-adc.h b/arch/arm/plat-samsung/include/plat/regs-adc.h
index 7554c4fcddb9..035e8c38d69c 100644
--- a/arch/arm/plat-samsung/include/plat/regs-adc.h
+++ b/arch/arm/plat-samsung/include/plat/regs-adc.h
@@ -21,6 +21,7 @@
21#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10) 21#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10)
22#define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14) 22#define S3C64XX_ADCUPDN S3C2410_ADCREG(0x14)
23#define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18) 23#define S3C64XX_ADCCLRINT S3C2410_ADCREG(0x18)
24#define S5P_ADCMUX S3C2410_ADCREG(0x1C)
24#define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20) 25#define S3C64XX_ADCCLRINTPNDNUP S3C2410_ADCREG(0x20)
25 26
26 27