summaryrefslogtreecommitdiff
path: root/drivers/extcon
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.cirrus.com>2019-12-09 11:09:11 +0000
committerChanwoo Choi <cw00.choi@samsung.com>2019-12-09 20:18:14 +0900
commitd5aa46ddf9ed7cf0d7ea0b86bec20412733ac870 (patch)
tree747271f6689c42ddd190b630bae3f6316f057348 /drivers/extcon
parentac7614fab9dd1054ec6bd082f02a436bb5cb082f (diff)
downloadlwn-d5aa46ddf9ed7cf0d7ea0b86bec20412733ac870.tar.gz
lwn-d5aa46ddf9ed7cf0d7ea0b86bec20412733ac870.zip
extcon: arizona: Tidy up transition from mic to headphone detect
Moving from microphone detection to headphone detection is done fairly haphazardly at the moment, sometimes calling arizona_stop_mic at the call site sometimes relying on a call inside arizona_identify_headphone. Simplify all this and always call arizona_stop_mic at the top of arizona_identify_headphone. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-arizona.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 11f1d753aa10..5ae111ee3d63 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -705,8 +705,7 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info)
info->hpdet_active = true;
- if (info->mic)
- arizona_stop_mic(info);
+ arizona_stop_mic(info);
arizona_extcon_hp_clamp(info, true);
@@ -815,8 +814,6 @@ static void arizona_micd_timeout_work(struct work_struct *work)
arizona_identify_headphone(info);
- arizona_stop_mic(info);
-
mutex_unlock(&info->lock);
}
@@ -906,7 +903,6 @@ static void arizona_micd_detect(struct work_struct *work)
if (!(val & ARIZONA_MICD_STS)) {
dev_warn(arizona->dev, "Detected open circuit\n");
info->mic = false;
- arizona_stop_mic(info);
info->detecting = false;
arizona_identify_headphone(info);
goto handled;
@@ -948,8 +944,6 @@ static void arizona_micd_detect(struct work_struct *work)
info->detecting = false;
arizona_identify_headphone(info);
-
- arizona_stop_mic(info);
} else {
info->micd_mode++;
if (info->micd_mode == info->micd_num_modes)
@@ -988,7 +982,6 @@ static void arizona_micd_detect(struct work_struct *work)
} else if (info->detecting) {
dev_dbg(arizona->dev, "Headphone detected\n");
info->detecting = false;
- arizona_stop_mic(info);
arizona_identify_headphone(info);
} else {