diff options
author | Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com> | 2011-05-07 21:13:10 +0530 |
---|---|---|
committer | Henrik Aberg <henrik.aberg@stericsson.com> | 2011-05-18 09:40:14 +0200 |
commit | 3fa1f03baa6f07eba4eae3517442d07385368e79 (patch) | |
tree | a3e3ac0e4830caaad6a0e4ddbda7531462431bbb | |
parent | 658d8202cbfa1f1039dd1800457ec7d391f3071a (diff) |
ab8500-accdet: Handle interrupts on comparator disable/enable
Writing to the accessory control register to enable and disable
the comparator results in the accessory detection interrupts, which
results in un-intentional play of the music. Solve this by disabling
interrupts in suspend and enabling them back in resume.
ST-Ericsson ID: ER338639
Change-Id: Ie5b585b05e2ccda4fd3f0f42f94d61ecd4be2409
Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/22598
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
-rw-r--r-- | drivers/input/misc/ab8500-accdet.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/input/misc/ab8500-accdet.c b/drivers/input/misc/ab8500-accdet.c index 2e26ad0a5d3..37a6b4c3f05 100644 --- a/drivers/input/misc/ab8500-accdet.c +++ b/drivers/input/misc/ab8500-accdet.c @@ -1319,6 +1319,7 @@ static int ab8500_acc_detect_suspend(struct platform_device *pdev, pm_message_t state) { struct ab8500_ad *dd = platform_get_drvdata(pdev); + int irq_id, irq; dev_dbg(&dd->pdev->dev, "%s: Enter\n", __func__); @@ -1326,6 +1327,21 @@ static int ab8500_acc_detect_suspend(struct platform_device *pdev, cancel_delayed_work_sync(&dd->detect_work); cancel_delayed_work_sync(&dd->init_work); + if (dd->pdata->is_detection_inverted) + irq_desc = irq_desc_inverted; + else + irq_desc = irq_desc_norm; + + for (irq_id = 0; irq_id < ARRAY_SIZE(irq_desc_norm); irq_id++) { + if (irq_desc[irq_id].registered == 1) { + irq = platform_get_irq_byname( + dd->pdev, + irq_desc[irq_id].name); + + disable_irq(irq); + } + } + /* Turn off AccDetect comparators and pull-up */ (void) abx500_get_register_interruptible( &dd->pdev->dev, @@ -1344,6 +1360,7 @@ static int ab8500_acc_detect_suspend(struct platform_device *pdev, static int ab8500_acc_detect_resume(struct platform_device *pdev) { struct ab8500_ad *dd = platform_get_drvdata(pdev); + int irq_id, irq; dev_dbg(&dd->pdev->dev, "%s: Enter\n", __func__); @@ -1354,6 +1371,22 @@ static int ab8500_acc_detect_resume(struct platform_device *pdev) AB8500_ACC_DET_CTRL_REG, acc_det_ctrl_suspend_val); + if (dd->pdata->is_detection_inverted) + irq_desc = irq_desc_inverted; + else + irq_desc = irq_desc_norm; + + for (irq_id = 0; irq_id < ARRAY_SIZE(irq_desc_norm); irq_id++) { + if (irq_desc[irq_id].registered == 1) { + irq = platform_get_irq_byname( + dd->pdev, + irq_desc[irq_id].name); + + enable_irq(irq); + + } + } + /* After resume, reinitialize */ dd->gpio35_dir_set = dd->accdet1_th_set = dd->accdet2_th_set = 0; queue_delayed_work(dd->irq_work_queue, &dd->init_work, 0); |