summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);