diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-11-04 11:10:52 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2009-12-13 13:21:40 -0500 |
commit | 6a6127462eb9096419fd4b3115ec5971d83a600f (patch) | |
tree | 8d7050226d8bcdbbe98f13c3ec90d62c4969879a /drivers | |
parent | 5a65edbc12b6b34ef912114f1fc8215786f85b25 (diff) |
mfd: Mask and unmask wm8350 IRQs on request and free
Bring the WM8350 IRQ API more in line with the generic IRQ API by
masking and unmasking interrupts as they are requested and freed.
This is mostly just a case of deleting the mask and unmask calls
from the individual drivers.
The RTC driver is changed to mask the periodic IRQ after requesting
it rather than only unmasking the alarm IRQ. If the periodic IRQ
fires in the period where it is reqested then there will be a
spurious notification but there should be no serious consequences
from this.
The CODEC drive is changed to explicitly disable headphone jack
detection prior to requesting the IRQs. This will avoid the IRQ
firing with no jack set up.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/wm8350-irq.c | 4 | ||||
-rw-r--r-- | drivers/power/wm8350_power.c | 26 | ||||
-rw-r--r-- | drivers/regulator/wm8350-regulator.c | 3 | ||||
-rw-r--r-- | drivers/rtc/rtc-wm8350.c | 7 |
4 files changed, 5 insertions, 35 deletions
diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c index 2ea2b8b4c72a..c8df547c4747 100644 --- a/drivers/mfd/wm8350-irq.c +++ b/drivers/mfd/wm8350-irq.c | |||
@@ -445,6 +445,8 @@ int wm8350_register_irq(struct wm8350 *wm8350, int irq, | |||
445 | wm8350->irq[irq].data = data; | 445 | wm8350->irq[irq].data = data; |
446 | mutex_unlock(&wm8350->irq_mutex); | 446 | mutex_unlock(&wm8350->irq_mutex); |
447 | 447 | ||
448 | wm8350_unmask_irq(wm8350, irq); | ||
449 | |||
448 | return 0; | 450 | return 0; |
449 | } | 451 | } |
450 | EXPORT_SYMBOL_GPL(wm8350_register_irq); | 452 | EXPORT_SYMBOL_GPL(wm8350_register_irq); |
@@ -454,6 +456,8 @@ int wm8350_free_irq(struct wm8350 *wm8350, int irq) | |||
454 | if (irq < 0 || irq > WM8350_NUM_IRQ) | 456 | if (irq < 0 || irq > WM8350_NUM_IRQ) |
455 | return -EINVAL; | 457 | return -EINVAL; |
456 | 458 | ||
459 | wm8350_mask_irq(wm8350, irq); | ||
460 | |||
457 | mutex_lock(&wm8350->irq_mutex); | 461 | mutex_lock(&wm8350->irq_mutex); |
458 | wm8350->irq[irq].handler = NULL; | 462 | wm8350->irq[irq].handler = NULL; |
459 | mutex_unlock(&wm8350->irq_mutex); | 463 | mutex_unlock(&wm8350->irq_mutex); |
diff --git a/drivers/power/wm8350_power.c b/drivers/power/wm8350_power.c index 6e634cf7fc14..ad4f071e1287 100644 --- a/drivers/power/wm8350_power.c +++ b/drivers/power/wm8350_power.c | |||
@@ -391,80 +391,54 @@ static void wm8350_init_charger(struct wm8350 *wm8350) | |||
391 | /* register our interest in charger events */ | 391 | /* register our interest in charger events */ |
392 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, | 392 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, |
393 | wm8350_charger_handler, 0, "Battery hot", wm8350); | 393 | wm8350_charger_handler, 0, "Battery hot", wm8350); |
394 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); | ||
395 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, | 394 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, |
396 | wm8350_charger_handler, 0, "Battery cold", wm8350); | 395 | wm8350_charger_handler, 0, "Battery cold", wm8350); |
397 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); | ||
398 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, | 396 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, |
399 | wm8350_charger_handler, 0, "Battery fail", wm8350); | 397 | wm8350_charger_handler, 0, "Battery fail", wm8350); |
400 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); | ||
401 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, | 398 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, |
402 | wm8350_charger_handler, 0, | 399 | wm8350_charger_handler, 0, |
403 | "Charger timeout", wm8350); | 400 | "Charger timeout", wm8350); |
404 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO); | ||
405 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, | 401 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, |
406 | wm8350_charger_handler, 0, | 402 | wm8350_charger_handler, 0, |
407 | "Charge end", wm8350); | 403 | "Charge end", wm8350); |
408 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END); | ||
409 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, | 404 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, |
410 | wm8350_charger_handler, 0, | 405 | wm8350_charger_handler, 0, |
411 | "Charge start", wm8350); | 406 | "Charge start", wm8350); |
412 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START); | ||
413 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, | 407 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, |
414 | wm8350_charger_handler, 0, | 408 | wm8350_charger_handler, 0, |
415 | "Fast charge ready", wm8350); | 409 | "Fast charge ready", wm8350); |
416 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY); | ||
417 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, | 410 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, |
418 | wm8350_charger_handler, 0, | 411 | wm8350_charger_handler, 0, |
419 | "Battery <3.9V", wm8350); | 412 | "Battery <3.9V", wm8350); |
420 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); | ||
421 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, | 413 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, |
422 | wm8350_charger_handler, 0, | 414 | wm8350_charger_handler, 0, |
423 | "Battery <3.1V", wm8350); | 415 | "Battery <3.1V", wm8350); |
424 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); | ||
425 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, | 416 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, |
426 | wm8350_charger_handler, 0, | 417 | wm8350_charger_handler, 0, |
427 | "Battery <2.85V", wm8350); | 418 | "Battery <2.85V", wm8350); |
428 | 419 | ||
429 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); | ||
430 | |||
431 | /* and supply change events */ | 420 | /* and supply change events */ |
432 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, | 421 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, |
433 | wm8350_charger_handler, 0, "USB", wm8350); | 422 | wm8350_charger_handler, 0, "USB", wm8350); |
434 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); | ||
435 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, | 423 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, |
436 | wm8350_charger_handler, 0, "Wall", wm8350); | 424 | wm8350_charger_handler, 0, "Wall", wm8350); |
437 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); | ||
438 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, | 425 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, |
439 | wm8350_charger_handler, 0, "Battery", wm8350); | 426 | wm8350_charger_handler, 0, "Battery", wm8350); |
440 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); | ||
441 | } | 427 | } |
442 | 428 | ||
443 | static void free_charger_irq(struct wm8350 *wm8350) | 429 | static void free_charger_irq(struct wm8350 *wm8350) |
444 | { | 430 | { |
445 | wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); | ||
446 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); | 431 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); |
447 | wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); | ||
448 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); | 432 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); |
449 | wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); | ||
450 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); | 433 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); |
451 | wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_TO); | ||
452 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO); | 434 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO); |
453 | wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_END); | ||
454 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END); | 435 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END); |
455 | wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_START); | ||
456 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START); | 436 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START); |
457 | wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); | ||
458 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); | 437 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); |
459 | wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); | ||
460 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); | 438 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); |
461 | wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); | ||
462 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); | 439 | wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); |
463 | wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); | ||
464 | wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB); | 440 | wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB); |
465 | wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); | ||
466 | wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); | 441 | wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); |
467 | wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); | ||
468 | wm8350_free_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); | 442 | wm8350_free_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); |
469 | } | 443 | } |
470 | 444 | ||
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index 8c289fd4add2..1bbff099a546 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
@@ -1399,8 +1399,6 @@ static int wm8350_regulator_probe(struct platform_device *pdev) | |||
1399 | return ret; | 1399 | return ret; |
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | wm8350_unmask_irq(wm8350, wm8350_reg[pdev->id].irq); | ||
1403 | |||
1404 | return 0; | 1402 | return 0; |
1405 | } | 1403 | } |
1406 | 1404 | ||
@@ -1409,7 +1407,6 @@ static int wm8350_regulator_remove(struct platform_device *pdev) | |||
1409 | struct regulator_dev *rdev = platform_get_drvdata(pdev); | 1407 | struct regulator_dev *rdev = platform_get_drvdata(pdev); |
1410 | struct wm8350 *wm8350 = rdev_get_drvdata(rdev); | 1408 | struct wm8350 *wm8350 = rdev_get_drvdata(rdev); |
1411 | 1409 | ||
1412 | wm8350_mask_irq(wm8350, wm8350_reg[pdev->id].irq); | ||
1413 | wm8350_free_irq(wm8350, wm8350_reg[pdev->id].irq); | 1410 | wm8350_free_irq(wm8350, wm8350_reg[pdev->id].irq); |
1414 | 1411 | ||
1415 | regulator_unregister(rdev); | 1412 | regulator_unregister(rdev); |
diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c index 56e56e552813..f16486635a8e 100644 --- a/drivers/rtc/rtc-wm8350.c +++ b/drivers/rtc/rtc-wm8350.c | |||
@@ -459,17 +459,14 @@ static int wm8350_rtc_probe(struct platform_device *pdev) | |||
459 | return ret; | 459 | return ret; |
460 | } | 460 | } |
461 | 461 | ||
462 | wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC); | ||
463 | wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_PER); | ||
464 | |||
465 | wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, | 462 | wm8350_register_irq(wm8350, WM8350_IRQ_RTC_SEC, |
466 | wm8350_rtc_update_handler, 0, | 463 | wm8350_rtc_update_handler, 0, |
467 | "RTC Seconds", wm8350); | 464 | "RTC Seconds", wm8350); |
465 | wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC); | ||
468 | 466 | ||
469 | wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, | 467 | wm8350_register_irq(wm8350, WM8350_IRQ_RTC_ALM, |
470 | wm8350_rtc_alarm_handler, 0, | 468 | wm8350_rtc_alarm_handler, 0, |
471 | "RTC Alarm", wm8350); | 469 | "RTC Alarm", wm8350); |
472 | wm8350_unmask_irq(wm8350, WM8350_IRQ_RTC_ALM); | ||
473 | 470 | ||
474 | return 0; | 471 | return 0; |
475 | } | 472 | } |
@@ -479,8 +476,6 @@ static int __devexit wm8350_rtc_remove(struct platform_device *pdev) | |||
479 | struct wm8350 *wm8350 = platform_get_drvdata(pdev); | 476 | struct wm8350 *wm8350 = platform_get_drvdata(pdev); |
480 | struct wm8350_rtc *wm_rtc = &wm8350->rtc; | 477 | struct wm8350_rtc *wm_rtc = &wm8350->rtc; |
481 | 478 | ||
482 | wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC); | ||
483 | |||
484 | wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC); | 479 | wm8350_free_irq(wm8350, WM8350_IRQ_RTC_SEC); |
485 | wm8350_free_irq(wm8350, WM8350_IRQ_RTC_ALM); | 480 | wm8350_free_irq(wm8350, WM8350_IRQ_RTC_ALM); |
486 | 481 | ||