aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ab8500-gpadc.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-02-26 05:06:55 -0500
committerLee Jones <lee.jones@linaro.org>2013-03-06 23:27:14 -0500
commit734823462590335cbf5c6a1fa5cae84a881dcb43 (patch)
tree3085b4de4198728b1da9e32a4be8d5b1fdd4e0ba /drivers/mfd/ab8500-gpadc.c
parentd89cc5aad109d20d10d228ba52d86e0adca62461 (diff)
mfd: ab8500-gpadc: Add gpadc hw conversion
Add the support of gpacd hw conversion and make the number of sample configurable. Signed-off-by: M'boumba Cedric Madianga <cedric.madianga@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/ab8500-gpadc.c')
-rw-r--r--drivers/mfd/ab8500-gpadc.c282
1 files changed, 207 insertions, 75 deletions
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index 7f39479c1afc..8673bf66f7d7 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -55,13 +55,18 @@
55#define EN_VTVOUT 0x02 55#define EN_VTVOUT 0x02
56#define EN_GPADC 0x01 56#define EN_GPADC 0x01
57#define DIS_GPADC 0x00 57#define DIS_GPADC 0x00
58#define SW_AVG_16 0x60 58#define AVG_1 0x00
59#define AVG_4 0x20
60#define AVG_8 0x40
61#define AVG_16 0x60
59#define ADC_SW_CONV 0x04 62#define ADC_SW_CONV 0x04
60#define EN_ICHAR 0x80 63#define EN_ICHAR 0x80
61#define BTEMP_PULL_UP 0x08 64#define BTEMP_PULL_UP 0x08
62#define EN_BUF 0x40 65#define EN_BUF 0x40
63#define DIS_ZERO 0x00 66#define DIS_ZERO 0x00
64#define GPADC_BUSY 0x01 67#define GPADC_BUSY 0x01
68#define EN_FALLING 0x10
69#define EN_TRIG_EDGE 0x02
65 70
66/* GPADC constants from AB8500 spec, UM0836 */ 71/* GPADC constants from AB8500 spec, UM0836 */
67#define ADC_RESOLUTION 1024 72#define ADC_RESOLUTION 1024
@@ -116,7 +121,10 @@ struct adc_cal_data {
116 * the completion of gpadc conversion 121 * the completion of gpadc conversion
117 * @ab8500_gpadc_lock: structure of type mutex 122 * @ab8500_gpadc_lock: structure of type mutex
118 * @regu: pointer to the struct regulator 123 * @regu: pointer to the struct regulator
119 * @irq: interrupt number that is used by gpadc 124 * @irq_sw: interrupt number that is used by gpadc for Sw
125 * conversion
126 * @irq_hw: interrupt number that is used by gpadc for Hw
127 * conversion
120 * @cal_data array of ADC calibration data structs 128 * @cal_data array of ADC calibration data structs
121 */ 129 */
122struct ab8500_gpadc { 130struct ab8500_gpadc {
@@ -126,7 +134,8 @@ struct ab8500_gpadc {
126 struct completion ab8500_gpadc_complete; 134 struct completion ab8500_gpadc_complete;
127 struct mutex ab8500_gpadc_lock; 135 struct mutex ab8500_gpadc_lock;
128 struct regulator *regu; 136 struct regulator *regu;
129 int irq; 137 int irq_sw;
138 int irq_hw;
130 struct adc_cal_data cal_data[NBR_CAL_INPUTS]; 139 struct adc_cal_data cal_data[NBR_CAL_INPUTS];
131}; 140};
132 141
@@ -244,30 +253,35 @@ int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, u8 channel,
244EXPORT_SYMBOL(ab8500_gpadc_ad_to_voltage); 253EXPORT_SYMBOL(ab8500_gpadc_ad_to_voltage);
245 254
246/** 255/**
247 * ab8500_gpadc_convert() - gpadc conversion 256 * ab8500_gpadc_sw_hw_convert() - gpadc conversion
248 * @channel: analog channel to be converted to digital data 257 * @channel: analog channel to be converted to digital data
258 * @avg_sample: number of ADC sample to average
259 * @trig_egde: selected ADC trig edge
260 * @trig_timer: selected ADC trigger delay timer
261 * @conv_type: selected conversion type (HW or SW conversion)
249 * 262 *
250 * This function converts the selected analog i/p to digital 263 * This function converts the selected analog i/p to digital
251 * data. 264 * data.
252 */ 265 */
253int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel) 266int ab8500_gpadc_sw_hw_convert(struct ab8500_gpadc *gpadc, u8 channel,
267 u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type)
254{ 268{
255 int ad_value; 269 int ad_value;
256 int voltage; 270 int voltage;
257 271
258 ad_value = ab8500_gpadc_read_raw(gpadc, channel); 272 ad_value = ab8500_gpadc_read_raw(gpadc, channel, avg_sample,
259 273 trig_edge, trig_timer, conv_type);
260 /* On failure retry a second time */ 274/* On failure retry a second time */
261 if (ad_value < 0) 275 if (ad_value < 0)
262 ad_value = ab8500_gpadc_read_raw(gpadc, channel); 276 ad_value = ab8500_gpadc_read_raw(gpadc, channel, avg_sample,
263 277 trig_edge, trig_timer, conv_type);
264 if (ad_value < 0) { 278if (ad_value < 0) {
265 dev_err(gpadc->dev, "GPADC raw value failed ch: %d\n", channel); 279 dev_err(gpadc->dev, "GPADC raw value failed ch: %d\n",
280 channel);
266 return ad_value; 281 return ad_value;
267 } 282 }
268 283
269 voltage = ab8500_gpadc_ad_to_voltage(gpadc, channel, ad_value); 284 voltage = ab8500_gpadc_ad_to_voltage(gpadc, channel, ad_value);
270
271 if (voltage < 0) 285 if (voltage < 0)
272 dev_err(gpadc->dev, "GPADC to voltage conversion failed ch:" 286 dev_err(gpadc->dev, "GPADC to voltage conversion failed ch:"
273 " %d AD: 0x%x\n", channel, ad_value); 287 " %d AD: 0x%x\n", channel, ad_value);
@@ -279,11 +293,16 @@ EXPORT_SYMBOL(ab8500_gpadc_convert);
279/** 293/**
280 * ab8500_gpadc_read_raw() - gpadc read 294 * ab8500_gpadc_read_raw() - gpadc read
281 * @channel: analog channel to be read 295 * @channel: analog channel to be read
296 * @avg_sample: number of ADC sample to average
297 * @trig_edge: selected trig edge
298 * @trig_timer: selected ADC trigger delay timer
299 * @conv_type: selected conversion type (HW or SW conversion)
282 * 300 *
283 * This function obtains the raw ADC value, this then needs 301 * This function obtains the raw ADC value for an hardware conversion,
284 * to be converted by calling ab8500_gpadc_ad_to_voltage() 302 * this then needs to be converted by calling ab8500_gpadc_ad_to_voltage()
285 */ 303 */
286int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel) 304int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel,
305 u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type)
287{ 306{
288 int ret; 307 int ret;
289 int looplimit = 0; 308 int looplimit = 0;
@@ -293,7 +312,6 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel)
293 return -ENODEV; 312 return -ENODEV;
294 313
295 mutex_lock(&gpadc->ab8500_gpadc_lock); 314 mutex_lock(&gpadc->ab8500_gpadc_lock);
296
297 /* Enable VTVout LDO this is required for GPADC */ 315 /* Enable VTVout LDO this is required for GPADC */
298 pm_runtime_get_sync(gpadc->dev); 316 pm_runtime_get_sync(gpadc->dev);
299 317
@@ -321,9 +339,29 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel)
321 goto out; 339 goto out;
322 } 340 }
323 341
324 /* Select the channel source and set average samples to 16 */ 342 /* Select the channel source and set average samples */
325 ret = abx500_set_register_interruptible(gpadc->dev, AB8500_GPADC, 343 switch (avg_sample) {
326 AB8500_GPADC_CTRL2_REG, (channel | SW_AVG_16)); 344 case SAMPLE_1:
345 val = channel | AVG_1;
346 break;
347 case SAMPLE_4:
348 val = channel | AVG_4;
349 break;
350 case SAMPLE_8:
351 val = channel | AVG_8;
352 break;
353 default:
354 val = channel | AVG_16;
355 break;
356
357 }
358
359 if (conv_type == ADC_HW)
360 ret = abx500_set_register_interruptible(gpadc->dev,
361 AB8500_GPADC, AB8500_GPADC_CTRL3_REG, val);
362 else
363 ret = abx500_set_register_interruptible(gpadc->dev,
364 AB8500_GPADC, AB8500_GPADC_CTRL2_REG, val);
327 if (ret < 0) { 365 if (ret < 0) {
328 dev_err(gpadc->dev, 366 dev_err(gpadc->dev,
329 "gpadc_conversion: set avg samples failed\n"); 367 "gpadc_conversion: set avg samples failed\n");
@@ -335,22 +373,43 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel)
335 * charging current sense if it needed, ABB 3.0 needs some special 373 * charging current sense if it needed, ABB 3.0 needs some special
336 * treatment too. 374 * treatment too.
337 */ 375 */
376 if ((conv_type == ADC_HW) && (trig_edge)) {
377 ret = abx500_mask_and_set_register_interruptible(gpadc->dev,
378 AB8500_GPADC, AB8500_GPADC_CTRL1_REG,
379 EN_FALLING, EN_FALLING);
380
381 }
338 switch (channel) { 382 switch (channel) {
339 case MAIN_CHARGER_C: 383 case MAIN_CHARGER_C:
340 case USB_CHARGER_C: 384 case USB_CHARGER_C:
341 ret = abx500_mask_and_set_register_interruptible(gpadc->dev, 385 if (conv_type == ADC_HW)
342 AB8500_GPADC, AB8500_GPADC_CTRL1_REG,
343 EN_BUF | EN_ICHAR,
344 EN_BUF | EN_ICHAR);
345 break;
346 case BTEMP_BALL:
347 if (!is_ab8500_2p0_or_earlier(gpadc->parent)) {
348 /* Turn on btemp pull-up on ABB 3.0 */
349 ret = abx500_mask_and_set_register_interruptible( 386 ret = abx500_mask_and_set_register_interruptible(
350 gpadc->dev, 387 gpadc->dev,
351 AB8500_GPADC, AB8500_GPADC_CTRL1_REG, 388 AB8500_GPADC, AB8500_GPADC_CTRL1_REG,
352 EN_BUF | BTEMP_PULL_UP, 389 EN_BUF | EN_ICHAR | EN_TRIG_EDGE,
353 EN_BUF | BTEMP_PULL_UP); 390 EN_BUF | EN_ICHAR | EN_TRIG_EDGE);
391 else
392 ret = abx500_mask_and_set_register_interruptible(
393 gpadc->dev,
394 AB8500_GPADC, AB8500_GPADC_CTRL1_REG,
395 EN_BUF | EN_ICHAR,
396 EN_BUF | EN_ICHAR);
397 break;
398 case BTEMP_BALL:
399 if (!is_ab8500_2p0_or_earlier(gpadc->parent)) {
400 if (conv_type == ADC_HW)
401 /* Turn on btemp pull-up on ABB 3.0 */
402 ret = abx500_mask_and_set_register_interruptible
403 (gpadc->dev,
404 AB8500_GPADC, AB8500_GPADC_CTRL1_REG,
405 EN_BUF | BTEMP_PULL_UP | EN_TRIG_EDGE,
406 EN_BUF | BTEMP_PULL_UP | EN_TRIG_EDGE);
407 else
408 ret = abx500_mask_and_set_register_interruptible
409 (gpadc->dev,
410 AB8500_GPADC, AB8500_GPADC_CTRL1_REG,
411 EN_BUF | BTEMP_PULL_UP,
412 EN_BUF | BTEMP_PULL_UP);
354 413
355 /* 414 /*
356 * Delay might be needed for ABB8500 cut 3.0, if not, remove 415 * Delay might be needed for ABB8500 cut 3.0, if not, remove
@@ -361,8 +420,17 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel)
361 } 420 }
362 /* Intentional fallthrough */ 421 /* Intentional fallthrough */
363 default: 422 default:
364 ret = abx500_mask_and_set_register_interruptible(gpadc->dev, 423 if (conv_type == ADC_HW)
365 AB8500_GPADC, AB8500_GPADC_CTRL1_REG, EN_BUF, EN_BUF); 424 ret = abx500_mask_and_set_register_interruptible(
425 gpadc->dev,
426 AB8500_GPADC, AB8500_GPADC_CTRL1_REG,
427 EN_BUF | EN_TRIG_EDGE,
428 EN_BUF | EN_TRIG_EDGE);
429 else
430 ret = abx500_mask_and_set_register_interruptible(
431 gpadc->dev,
432 AB8500_GPADC,
433 AB8500_GPADC_CTRL1_REG, EN_BUF, EN_BUF);
366 break; 434 break;
367 } 435 }
368 if (ret < 0) { 436 if (ret < 0) {
@@ -371,36 +439,83 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel)
371 goto out; 439 goto out;
372 } 440 }
373 441
374 ret = abx500_mask_and_set_register_interruptible(gpadc->dev, 442 /* Set trigger delay timer */
375 AB8500_GPADC, AB8500_GPADC_CTRL1_REG, ADC_SW_CONV, ADC_SW_CONV); 443 if (conv_type == ADC_HW) {
376 if (ret < 0) { 444 ret = abx500_set_register_interruptible(gpadc->dev,
377 dev_err(gpadc->dev, 445 AB8500_GPADC, AB8500_GPADC_AUTO_TIMER_REG, trig_timer);
378 "gpadc_conversion: start s/w conversion failed\n"); 446 if (ret < 0) {
379 goto out; 447 dev_err(gpadc->dev,
448 "gpadc_conversion: trig timer failed\n");
449 goto out;
450 }
451 }
452
453 /* Start SW conversion */
454 if (conv_type == ADC_SW) {
455 ret = abx500_mask_and_set_register_interruptible(gpadc->dev,
456 AB8500_GPADC, AB8500_GPADC_CTRL1_REG,
457 ADC_SW_CONV, ADC_SW_CONV);
458 if (ret < 0) {
459 dev_err(gpadc->dev,
460 "gpadc_conversion: start s/w conv failed\n");
461 goto out;
462 }
380 } 463 }
464
381 /* wait for completion of conversion */ 465 /* wait for completion of conversion */
382 if (!wait_for_completion_timeout(&gpadc->ab8500_gpadc_complete, 466 if (conv_type == ADC_HW) {
383 msecs_to_jiffies(CONVERSION_TIME))) { 467 if (!wait_for_completion_timeout(&gpadc->ab8500_gpadc_complete,
384 dev_err(gpadc->dev, 468 2*HZ)) {
385 "timeout: didn't receive GPADC conversion interrupt\n"); 469 dev_err(gpadc->dev,
386 ret = -EINVAL; 470 "timeout didn't receive"
387 goto out; 471 " hw GPADC conv interrupt\n");
472 ret = -EINVAL;
473 goto out;
474 }
475 } else {
476 if (!wait_for_completion_timeout(&gpadc->ab8500_gpadc_complete,
477 msecs_to_jiffies(CONVERSION_TIME))) {
478 dev_err(gpadc->dev,
479 "timeout didn't receive"
480 " sw GPADC conv interrupt\n");
481 ret = -EINVAL;
482 goto out;
483 }
388 } 484 }
389 485
390 /* Read the converted RAW data */ 486 /* Read the converted RAW data */
391 ret = abx500_get_register_interruptible(gpadc->dev, AB8500_GPADC, 487 if (conv_type == ADC_HW) {
392 AB8500_GPADC_MANDATAL_REG, &low_data); 488 ret = abx500_get_register_interruptible(gpadc->dev,
393 if (ret < 0) { 489 AB8500_GPADC, AB8500_GPADC_AUTODATAL_REG, &low_data);
394 dev_err(gpadc->dev, "gpadc_conversion: read low data failed\n"); 490 if (ret < 0) {
395 goto out; 491 dev_err(gpadc->dev,
396 } 492 "gpadc_conversion: read hw low data failed\n");
493 goto out;
494 }
397 495
398 ret = abx500_get_register_interruptible(gpadc->dev, AB8500_GPADC, 496 ret = abx500_get_register_interruptible(gpadc->dev,
399 AB8500_GPADC_MANDATAH_REG, &high_data); 497 AB8500_GPADC, AB8500_GPADC_AUTODATAH_REG, &high_data);
400 if (ret < 0) { 498 if (ret < 0) {
401 dev_err(gpadc->dev, 499 dev_err(gpadc->dev,
402 "gpadc_conversion: read high data failed\n"); 500 "gpadc_conversion: read hw high data failed\n");
403 goto out; 501 goto out;
502 }
503 } else {
504 ret = abx500_get_register_interruptible(gpadc->dev,
505 AB8500_GPADC, AB8500_GPADC_MANDATAL_REG, &low_data);
506 if (ret < 0) {
507 dev_err(gpadc->dev,
508 "gpadc_conversion: read sw low data failed\n");
509 goto out;
510 }
511
512 ret = abx500_get_register_interruptible(gpadc->dev,
513 AB8500_GPADC, AB8500_GPADC_MANDATAH_REG, &high_data);
514 if (ret < 0) {
515 dev_err(gpadc->dev,
516 "gpadc_conversion: read sw high data failed\n");
517 goto out;
518 }
404 } 519 }
405 520
406 /* Disable GPADC */ 521 /* Disable GPADC */
@@ -411,6 +526,7 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel)
411 goto out; 526 goto out;
412 } 527 }
413 528
529 /* Disable VTVout LDO this is required for GPADC */
414 pm_runtime_mark_last_busy(gpadc->dev); 530 pm_runtime_mark_last_busy(gpadc->dev);
415 pm_runtime_put_autosuspend(gpadc->dev); 531 pm_runtime_put_autosuspend(gpadc->dev);
416 532
@@ -427,9 +543,7 @@ out:
427 */ 543 */
428 (void) abx500_set_register_interruptible(gpadc->dev, AB8500_GPADC, 544 (void) abx500_set_register_interruptible(gpadc->dev, AB8500_GPADC,
429 AB8500_GPADC_CTRL1_REG, DIS_GPADC); 545 AB8500_GPADC_CTRL1_REG, DIS_GPADC);
430
431 pm_runtime_put(gpadc->dev); 546 pm_runtime_put(gpadc->dev);
432
433 mutex_unlock(&gpadc->ab8500_gpadc_lock); 547 mutex_unlock(&gpadc->ab8500_gpadc_lock);
434 dev_err(gpadc->dev, 548 dev_err(gpadc->dev,
435 "gpadc_conversion: Failed to AD convert channel %d\n", channel); 549 "gpadc_conversion: Failed to AD convert channel %d\n", channel);
@@ -438,16 +552,16 @@ out:
438EXPORT_SYMBOL(ab8500_gpadc_read_raw); 552EXPORT_SYMBOL(ab8500_gpadc_read_raw);
439 553
440/** 554/**
441 * ab8500_bm_gpswadcconvend_handler() - isr for s/w gpadc conversion completion 555 * ab8500_bm_gpadcconvend_handler() - isr for gpadc conversion completion
442 * @irq: irq number 556 * @irq: irq number
443 * @data: pointer to the data passed during request irq 557 * @data: pointer to the data passed during request irq
444 * 558 *
445 * This is a interrupt service routine for s/w gpadc conversion completion. 559 * This is a interrupt service routine for gpadc conversion completion.
446 * Notifies the gpadc completion is completed and the converted raw value 560 * Notifies the gpadc completion is completed and the converted raw value
447 * can be read from the registers. 561 * can be read from the registers.
448 * Returns IRQ status(IRQ_HANDLED) 562 * Returns IRQ status(IRQ_HANDLED)
449 */ 563 */
450static irqreturn_t ab8500_bm_gpswadcconvend_handler(int irq, void *_gpadc) 564static irqreturn_t ab8500_bm_gpadcconvend_handler(int irq, void *_gpadc)
451{ 565{
452 struct ab8500_gpadc *gpadc = _gpadc; 566 struct ab8500_gpadc *gpadc = _gpadc;
453 567
@@ -646,11 +760,19 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
646 return -ENOMEM; 760 return -ENOMEM;
647 } 761 }
648 762
649 gpadc->irq = platform_get_irq_byname(pdev, "SW_CONV_END"); 763 gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
650 if (gpadc->irq < 0) { 764 if (gpadc->irq_sw < 0) {
651 dev_err(&pdev->dev, "failed to get platform irq-%d\n", 765 dev_err(gpadc->dev, "failed to get platform irq-%d\n",
652 gpadc->irq); 766 gpadc->irq_sw);
653 ret = gpadc->irq; 767 ret = gpadc->irq_sw;
768 goto fail;
769 }
770
771 gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
772 if (gpadc->irq_hw < 0) {
773 dev_err(gpadc->dev, "failed to get platform irq-%d\n",
774 gpadc->irq_hw);
775 ret = gpadc->irq_hw;
654 goto fail; 776 goto fail;
655 } 777 }
656 778
@@ -661,14 +783,21 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
661 /* Initialize completion used to notify completion of conversion */ 783 /* Initialize completion used to notify completion of conversion */
662 init_completion(&gpadc->ab8500_gpadc_complete); 784 init_completion(&gpadc->ab8500_gpadc_complete);
663 785
664 /* Register interrupt - SwAdcComplete */ 786 /* Register interrupts */
665 ret = request_threaded_irq(gpadc->irq, NULL, 787 ret = request_threaded_irq(gpadc->irq_sw, NULL,
666 ab8500_bm_gpswadcconvend_handler, 788 ab8500_bm_gpadcconvend_handler,
667 IRQF_ONESHOT | IRQF_NO_SUSPEND | IRQF_SHARED, 789 IRQF_NO_SUSPEND | IRQF_SHARED, "ab8500-gpadc-sw", gpadc);
668 "ab8500-gpadc", gpadc); 790 if (ret < 0) {
791 dev_err(gpadc->dev, "Failed to register interrupt, irq: %d\n",
792 gpadc->irq_sw);
793 goto fail;
794 }
795 ret = request_threaded_irq(gpadc->irq_hw, NULL,
796 ab8500_bm_gpadcconvend_handler,
797 IRQF_NO_SUSPEND | IRQF_SHARED, "ab8500-gpadc-hw", gpadc);
669 if (ret < 0) { 798 if (ret < 0) {
670 dev_err(gpadc->dev, "Failed to register interrupt, irq: %d\n", 799 dev_err(gpadc->dev, "Failed to register interrupt, irq: %d\n",
671 gpadc->irq); 800 gpadc->irq_hw);
672 goto fail; 801 goto fail;
673 } 802 }
674 803
@@ -694,7 +823,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
694 dev_dbg(gpadc->dev, "probe success\n"); 823 dev_dbg(gpadc->dev, "probe success\n");
695 return 0; 824 return 0;
696fail_irq: 825fail_irq:
697 free_irq(gpadc->irq, gpadc); 826 free_irq(gpadc->irq_sw, gpadc);
827 free_irq(gpadc->irq_hw, gpadc);
698fail: 828fail:
699 kfree(gpadc); 829 kfree(gpadc);
700 gpadc = NULL; 830 gpadc = NULL;
@@ -708,7 +838,8 @@ static int ab8500_gpadc_remove(struct platform_device *pdev)
708 /* remove this gpadc entry from the list */ 838 /* remove this gpadc entry from the list */
709 list_del(&gpadc->node); 839 list_del(&gpadc->node);
710 /* remove interrupt - completion of Sw ADC conversion */ 840 /* remove interrupt - completion of Sw ADC conversion */
711 free_irq(gpadc->irq, gpadc); 841 free_irq(gpadc->irq_sw, gpadc);
842 free_irq(gpadc->irq_hw, gpadc);
712 843
713 pm_runtime_get_sync(gpadc->dev); 844 pm_runtime_get_sync(gpadc->dev);
714 pm_runtime_disable(gpadc->dev); 845 pm_runtime_disable(gpadc->dev);
@@ -757,6 +888,7 @@ subsys_initcall_sync(ab8500_gpadc_init);
757module_exit(ab8500_gpadc_exit); 888module_exit(ab8500_gpadc_exit);
758 889
759MODULE_LICENSE("GPL v2"); 890MODULE_LICENSE("GPL v2");
760MODULE_AUTHOR("Arun R Murthy, Daniel Willerud, Johan Palsson"); 891MODULE_AUTHOR("Arun R Murthy, Daniel Willerud, Johan Palsson,"
892 "M'boumba Cedric Madianga");
761MODULE_ALIAS("platform:ab8500_gpadc"); 893MODULE_ALIAS("platform:ab8500_gpadc");
762MODULE_DESCRIPTION("AB8500 GPADC driver"); 894MODULE_DESCRIPTION("AB8500 GPADC driver");