summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrikanth Shivanand <srikanth.shivanand@stericsson.com>2011-03-26 17:11:41 +0530
committerUlf Hansson <ulf.hansson@stericsson.com>2011-09-19 15:15:02 +0200
commitf13106b5c5fae60d113afd4f377860919bb029d3 (patch)
treeea5c332b6bd5a899e04b20f2f597626a5ee29424
parent1fbf1459e613899b208bd72706c173d0e5bf3cab (diff)
input: misc: ab8500-accdet: Power optimisation fix.
The detection of the accessory is made independent of GPIO35. The GPIO is used only after detection. This saves power. ST-Ericsson ID: ER 330343 Change-Id: Ifbf0028777d242a09067eb560f4476d5522e9074 Signed-off-by: Srikanth Shivanand <srikanth.shivanand@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/19312 Reviewed-by: Marcel TUNNISSEN <marcel.tuennissen@stericsson.com> Tested-by: Marcel TUNNISSEN <marcel.tuennissen@stericsson.com> Reviewed-by: Martin PERSSON <martin.persson@stericsson.com> Tested-by: Martin PERSSON <martin.persson@stericsson.com>
-rw-r--r--drivers/input/misc/ab8500-accdet.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/input/misc/ab8500-accdet.c b/drivers/input/misc/ab8500-accdet.c
index 2d5aaf3bce7..28cbc2aed42 100644
--- a/drivers/input/misc/ab8500-accdet.c
+++ b/drivers/input/misc/ab8500-accdet.c
@@ -150,10 +150,12 @@ enum accessory_irq {
* Enumerates the op. modes of the avcontrol switch
* @AUDIO_IN Audio input is selected
* @VIDEO_OUT Video output is selected
+ * @NOT_SET The av-switch control signal is disconnected.
*/
enum accessory_avcontrol_dir {
AUDIO_IN,
VIDEO_OUT,
+ NOT_SET,
};
/**
@@ -690,8 +692,6 @@ static void unplug_irq_handler_work(struct work_struct *work)
dd->btn_state = BUTTON_UNK;
config_accdetect(dd);
- set_av_switch(dd, AUDIO_IN);
-
accessory_regulator_disable(REGULATOR_ALL);
report_jack_status(dd);
@@ -749,6 +749,8 @@ static void detect_work(struct work_struct *work)
dev_dbg(&dd->pdev->dev, "%s: Enter\n", __func__);
+ set_av_switch(dd, AUDIO_IN);
+
new_type = detect(dd, &req_det_count);
dd->total_jack_det_count++;
@@ -957,8 +959,12 @@ static void set_av_switch(struct ab8500_ad *dd,
{
int ret;
- dev_dbg(&dd->pdev->dev, "%s: Enter\n", __func__);
- if (!dd->gpio35_dir_set) {
+ dev_dbg(&dd->pdev->dev, "%s: Enter (%d)\n", __func__, dir);
+ if (dir == NOT_SET) {
+ ret = gpio_direction_input(dd->pdata->video_ctrl_gpio);
+ dd->gpio35_dir_set = 0;
+ ret = gpio_direction_output(dd->pdata->video_ctrl_gpio, 0);
+ } else if (!dd->gpio35_dir_set) {
ret = gpio_direction_output(dd->pdata->video_ctrl_gpio,
dir == AUDIO_IN ? 1 : 0);
if (ret < 0) {
@@ -1090,9 +1096,11 @@ static void config_accdetect(struct ab8500_ad *dd)
release_irq(dd, UNPLUG_IRQ);
release_irq(dd, BUTTON_PRESS_IRQ);
release_irq(dd, BUTTON_RELEASE_IRQ);
+ set_av_switch(dd, NOT_SET);
break;
case JACK_TYPE_DISCONNECTED:
+ set_av_switch(dd, NOT_SET);
case JACK_TYPE_HEADPHONE:
case JACK_TYPE_CVIDEO:
config_accdetect1_hw(dd, 1);
@@ -1133,7 +1141,6 @@ static void init_work(struct work_struct *work)
dev_dbg(&dd->pdev->dev, "%s: Enter\n", __func__);
- set_av_switch(dd, AUDIO_IN);
dd->jack_type = dd->reported_jack_type = JACK_TYPE_UNSPECIFIED;
config_accdetect(dd);
queue_delayed_work(dd->irq_work_queue,