From 0bb8f1bf104462cbb1749e67013258d1c6bc2df4 Mon Sep 17 00:00:00 2001 From: Mattias Wallin Date: Thu, 5 May 2011 10:28:24 +0200 Subject: input: ab8500-accdetect suspend modification This patch disable the AccDetect comparator and pull-up in supend to save 100uA idle current. The comparator and pull-up is restored in resume. Signed-off-by: Mattias Wallin ST-Ericsson ID: 335994 ST-Ericsson FOSS-OUT ID: Trivial ST-Ericsson Linux next: na Change-Id: I81be240d06731e828f435eab9c967776c7cd00e7 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/22395 Reviewed-by: QATOOLS Tested-by: Mattias WALLIN Reviewed-by: QATEST Reviewed-by: Jonas ABERG --- drivers/input/misc/ab8500-accdet.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/input/misc/ab8500-accdet.c b/drivers/input/misc/ab8500-accdet.c index 77634d51c7a..837bb304d4d 100644 --- a/drivers/input/misc/ab8500-accdet.c +++ b/drivers/input/misc/ab8500-accdet.c @@ -1273,6 +1273,8 @@ static int __devexit ab8500_acc_detect_remove(struct platform_device *pdev) } #if defined(CONFIG_PM) +static u8 acc_det_ctrl_suspend_val; + static int ab8500_acc_detect_suspend(struct platform_device *pdev, pm_message_t state) { @@ -1284,6 +1286,17 @@ static int ab8500_acc_detect_suspend(struct platform_device *pdev, cancel_delayed_work_sync(&dd->detect_work); cancel_delayed_work_sync(&dd->init_work); + /* Turn off AccDetect comparators and pull-up */ + (void) abx500_get_register_interruptible( + &dd->pdev->dev, + AB8500_ECI_AV_ACC, + AB8500_ACC_DET_CTRL_REG, + &acc_det_ctrl_suspend_val); + (void) abx500_set_register_interruptible( + &dd->pdev->dev, + AB8500_ECI_AV_ACC, + AB8500_ACC_DET_CTRL_REG, + 0); return 0; } @@ -1293,6 +1306,13 @@ static int ab8500_acc_detect_resume(struct platform_device *pdev) dev_dbg(&dd->pdev->dev, "%s: Enter\n", __func__); + /* Turn on AccDetect comparators and pull-up */ + (void) abx500_set_register_interruptible( + &dd->pdev->dev, + AB8500_ECI_AV_ACC, + AB8500_ACC_DET_CTRL_REG, + acc_det_ctrl_suspend_val); + /* 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); -- cgit v1.2.3