diff options
Diffstat (limited to 'arch/arm/plat-samsung/adc.c')
-rw-r--r-- | arch/arm/plat-samsung/adc.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c index c7659b7378b1..81caf2135721 100644 --- a/arch/arm/plat-samsung/adc.c +++ b/arch/arm/plat-samsung/adc.c | |||
@@ -262,6 +262,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) | |||
262 | { | 262 | { |
263 | struct adc_device *adc = pw; | 263 | struct adc_device *adc = pw; |
264 | struct s3c_adc_client *client = adc->cur; | 264 | struct s3c_adc_client *client = adc->cur; |
265 | enum s3c_cpu_type cpu = platform_get_device_id(adc->pdev)->driver_data; | ||
265 | unsigned long flags; | 266 | unsigned long flags; |
266 | unsigned data0, data1; | 267 | unsigned data0, data1; |
267 | 268 | ||
@@ -276,9 +277,17 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) | |||
276 | 277 | ||
277 | client->nr_samples--; | 278 | client->nr_samples--; |
278 | 279 | ||
280 | if (cpu == TYPE_S3C64XX) { | ||
281 | /* S3C64XX ADC resolution is 12-bit */ | ||
282 | data0 &= 0xfff; | ||
283 | data1 &= 0xfff; | ||
284 | } else { | ||
285 | data0 &= 0x3ff; | ||
286 | data1 &= 0x3ff; | ||
287 | } | ||
288 | |||
279 | if (client->convert_cb) | 289 | if (client->convert_cb) |
280 | (client->convert_cb)(client, data0 & 0x3ff, data1 & 0x3ff, | 290 | (client->convert_cb)(client, data0, data1, &client->nr_samples); |
281 | &client->nr_samples); | ||
282 | 291 | ||
283 | if (client->nr_samples > 0) { | 292 | if (client->nr_samples > 0) { |
284 | /* fire another conversion for this */ | 293 | /* fire another conversion for this */ |
@@ -295,7 +304,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) | |||
295 | } | 304 | } |
296 | 305 | ||
297 | exit: | 306 | exit: |
298 | if (platform_get_device_id(adc->pdev)->driver_data == TYPE_S3C64XX) { | 307 | if (cpu == TYPE_S3C64XX) { |
299 | /* Clear ADC interrupt */ | 308 | /* Clear ADC interrupt */ |
300 | writel(0, adc->regs + S3C64XX_ADCCLRINT); | 309 | writel(0, adc->regs + S3C64XX_ADCCLRINT); |
301 | } | 310 | } |
@@ -308,6 +317,7 @@ static int s3c_adc_probe(struct platform_device *pdev) | |||
308 | struct adc_device *adc; | 317 | struct adc_device *adc; |
309 | struct resource *regs; | 318 | struct resource *regs; |
310 | int ret; | 319 | int ret; |
320 | unsigned tmp; | ||
311 | 321 | ||
312 | adc = kzalloc(sizeof(struct adc_device), GFP_KERNEL); | 322 | adc = kzalloc(sizeof(struct adc_device), GFP_KERNEL); |
313 | if (adc == NULL) { | 323 | if (adc == NULL) { |
@@ -354,8 +364,12 @@ static int s3c_adc_probe(struct platform_device *pdev) | |||
354 | 364 | ||
355 | clk_enable(adc->clk); | 365 | clk_enable(adc->clk); |
356 | 366 | ||
357 | writel(adc->prescale | S3C2410_ADCCON_PRSCEN, | 367 | tmp = adc->prescale | S3C2410_ADCCON_PRSCEN; |
358 | adc->regs + S3C2410_ADCCON); | 368 | if (platform_get_device_id(pdev)->driver_data == TYPE_S3C64XX) { |
369 | /* Enable 12-bit ADC resolution */ | ||
370 | tmp |= S3C64XX_ADCCON_RESSEL; | ||
371 | } | ||
372 | writel(tmp, adc->regs + S3C2410_ADCCON); | ||
359 | 373 | ||
360 | dev_info(dev, "attached adc driver\n"); | 374 | dev_info(dev, "attached adc driver\n"); |
361 | 375 | ||