summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVirupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>2011-05-07 21:13:10 +0530
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:03:32 +0200
commitae851308d807c9c2f0170732679b6da76f7e2b60 (patch)
treef8a2a4fe1d8aa549abf6d138053f343d0e8d83ca
parent14586ab7e31c71bee3750118c283aee4fb330c52 (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.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/input/misc/ab8500-accdet.c b/drivers/input/misc/ab8500-accdet.c
index b6ddb1fa4d4..c249de60eac 100644
--- a/drivers/input/misc/ab8500-accdet.c
+++ b/drivers/input/misc/ab8500-accdet.c
@@ -1318,6 +1318,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__);
@@ -1325,6 +1326,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,
@@ -1342,6 +1358,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__);
@@ -1352,6 +1369,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);