summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wcd-mbhc-v2.c
diff options
context:
space:
mode:
authorSrinivasa Rao Mandadapu <srivasam@codeaurora.org>2021-11-18 16:50:11 +0530
committerMark Brown <broonie@kernel.org>2021-11-18 13:57:45 +0000
commitb38892b5b85ae54b7b867313996f967122ede42e (patch)
treed8219f40da2efad6bc3ccdbaff144a94a2073f73 /sound/soc/codecs/wcd-mbhc-v2.c
parentb6a5f4f05592e79cad076767c8eac2aaf04fc61e (diff)
ASoC: codecs: MBHC: Remove useless condition check
Remove redundant conditional check and clean code in special headset support functions. Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org> Co-developed-by: Venkata Prasad Potturu <potturu@codeaurora.org> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org> Link: https://lore.kernel.org/r/1637234411-554-1-git-send-email-srivasam@codeaurora.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/wcd-mbhc-v2.c')
-rw-r--r--sound/soc/codecs/wcd-mbhc-v2.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c
index 934194b155d5..7488a150a138 100644
--- a/sound/soc/codecs/wcd-mbhc-v2.c
+++ b/sound/soc/codecs/wcd-mbhc-v2.c
@@ -1055,12 +1055,8 @@ static bool wcd_mbhc_check_for_spl_headset(struct wcd_mbhc *mbhc)
hs_threshold = wcd_mbhc_get_spl_hs_thres(mbhc);
hph_threshold = wcd_mbhc_adc_get_hph_thres(mbhc);
- if (output_mv > hs_threshold || output_mv < hph_threshold) {
- if (mbhc->force_linein == true)
- is_spl_hs = false;
- } else {
+ if (!(output_mv > hs_threshold || output_mv < hph_threshold))
is_spl_hs = true;
- }
/* Back MIC_BIAS2 to 1.8v if the type is not special headset */
if (!is_spl_hs) {
@@ -1149,13 +1145,13 @@ correct_plug_type:
plug_type = wcd_mbhc_get_plug_from_adc(mbhc, output_mv);
is_pa_on = wcd_mbhc_read_field(mbhc, WCD_MBHC_HPH_PA_EN);
- if ((output_mv > hs_threshold) && (!is_spl_hs)) {
+ if (output_mv > hs_threshold && !is_spl_hs) {
is_spl_hs = wcd_mbhc_check_for_spl_headset(mbhc);
output_mv = wcd_measure_adc_once(mbhc, MUX_CTL_IN2P);
if (is_spl_hs) {
- hs_threshold = (hs_threshold * wcd_mbhc_get_micbias(mbhc)) /
- micbias_mv;
+ hs_threshold *= wcd_mbhc_get_micbias(mbhc);
+ hs_threshold /= micbias_mv;
}
}
@@ -1185,7 +1181,7 @@ correct_plug_type:
}
/* cable is extension cable */
- if (output_mv > hs_threshold || mbhc->force_linein == true)
+ if (output_mv > hs_threshold || mbhc->force_linein)
plug_type = MBHC_PLUG_TYPE_HIGH_HPH;
}