Loading asoc/codecs/wcd-mbhc-adc.c +5 −5 Original line number Diff line number Diff line Loading @@ -622,7 +622,7 @@ static void wcd_correct_swch_plug(struct work_struct *work) do { cross_conn = wcd_check_cross_conn(mbhc); try++; } while (try < GND_MIC_SWAP_THRESHOLD); } while (try < mbhc->swap_thr); if (cross_conn > 0) { plug_type = MBHC_PLUG_TYPE_GND_MIC_SWAP; Loading Loading @@ -714,10 +714,10 @@ static void wcd_correct_swch_plug(struct work_struct *work) pt_gnd_mic_swap_cnt++; no_gnd_mic_swap_cnt = 0; if (pt_gnd_mic_swap_cnt < GND_MIC_SWAP_THRESHOLD) { mbhc->swap_thr) { continue; } else if (pt_gnd_mic_swap_cnt > GND_MIC_SWAP_THRESHOLD) { mbhc->swap_thr) { /* * This is due to GND/MIC switch didn't * work, Report unsupported plug. Loading @@ -735,14 +735,14 @@ static void wcd_correct_swch_plug(struct work_struct *work) plug_type = wcd_mbhc_get_plug_from_adc( mbhc, output_mv); if ((no_gnd_mic_swap_cnt < GND_MIC_SWAP_THRESHOLD) && mbhc->swap_thr) && (spl_hs_count != WCD_MBHC_SPL_HS_CNT)) { continue; } else { no_gnd_mic_swap_cnt = 0; } } if ((pt_gnd_mic_swap_cnt == GND_MIC_SWAP_THRESHOLD) && if ((pt_gnd_mic_swap_cnt == mbhc->swap_thr) && (plug_type == MBHC_PLUG_TYPE_GND_MIC_SWAP)) { /* * if switch is toggled, check again, Loading asoc/codecs/wcd-mbhc-legacy.c +4 −4 Original line number Diff line number Diff line Loading @@ -498,7 +498,7 @@ static void wcd_correct_swch_plug(struct work_struct *work) do { cross_conn = wcd_check_cross_conn(mbhc); try++; } while (try < GND_MIC_SWAP_THRESHOLD); } while (try < mbhc->swap_thr); /* * Check for cross connection 4 times. Loading Loading @@ -599,10 +599,10 @@ static void wcd_correct_swch_plug(struct work_struct *work) pt_gnd_mic_swap_cnt++; no_gnd_mic_swap_cnt = 0; if (pt_gnd_mic_swap_cnt < GND_MIC_SWAP_THRESHOLD) { mbhc->swap_thr) { continue; } else if (pt_gnd_mic_swap_cnt > GND_MIC_SWAP_THRESHOLD) { mbhc->swap_thr) { /* * This is due to GND/MIC switch didn't * work, Report unsupported plug. Loading @@ -626,7 +626,7 @@ static void wcd_correct_swch_plug(struct work_struct *work) no_gnd_mic_swap_cnt = 0; } } if ((pt_gnd_mic_swap_cnt == GND_MIC_SWAP_THRESHOLD) && if ((pt_gnd_mic_swap_cnt == mbhc->swap_thr) && (plug_type == MBHC_PLUG_TYPE_GND_MIC_SWAP)) { /* * if switch is toggled, check again, Loading asoc/codecs/wcd-mbhc-v2.c +2 −0 Original line number Diff line number Diff line Loading @@ -1707,6 +1707,7 @@ int wcd_mbhc_start(struct wcd_mbhc *mbhc, struct wcd_mbhc_config *mbhc_cfg) if (mbhc_cfg->enable_usbc_analog) { dev_dbg(mbhc->codec->dev, "%s: usbc analog enabled\n", __func__); mbhc->swap_thr = GND_MIC_USBC_SWAP_THRESHOLD; rc = wcd_mbhc_init_gpio(mbhc, mbhc_cfg, "qcom,usbc-analog-en1-gpio", &config->usbc_en1_gpio, Loading Loading @@ -1901,6 +1902,7 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, mbhc->extn_cable_hph_rem = false; mbhc->hph_type = WCD_MBHC_HPH_NONE; mbhc->wcd_mbhc_regs = wcd_mbhc_regs; mbhc->swap_thr = GND_MIC_SWAP_THRESHOLD; if (mbhc->intr_ids == NULL) { pr_err("%s: Interrupt mapping not provided\n", __func__); Loading asoc/codecs/wcd-mbhc-v2.h +2 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ do { \ #define SPECIAL_HS_DETECT_TIME_MS (2 * 1000) #define MBHC_BUTTON_PRESS_THRESHOLD_MIN 250 #define GND_MIC_SWAP_THRESHOLD 4 #define GND_MIC_USBC_SWAP_THRESHOLD 2 #define WCD_FAKE_REMOVAL_MIN_PERIOD_MS 100 #define HS_VREF_MIN_VAL 1400 #define FW_READ_ATTEMPTS 15 Loading Loading @@ -524,6 +525,7 @@ struct wcd_mbhc { bool gnd_swh; /*track GND switch NC / NO */ u32 hs_thr; u32 hph_thr; u32 swap_thr; u32 moist_vref; u32 moist_iref; u32 moist_rref; Loading Loading
asoc/codecs/wcd-mbhc-adc.c +5 −5 Original line number Diff line number Diff line Loading @@ -622,7 +622,7 @@ static void wcd_correct_swch_plug(struct work_struct *work) do { cross_conn = wcd_check_cross_conn(mbhc); try++; } while (try < GND_MIC_SWAP_THRESHOLD); } while (try < mbhc->swap_thr); if (cross_conn > 0) { plug_type = MBHC_PLUG_TYPE_GND_MIC_SWAP; Loading Loading @@ -714,10 +714,10 @@ static void wcd_correct_swch_plug(struct work_struct *work) pt_gnd_mic_swap_cnt++; no_gnd_mic_swap_cnt = 0; if (pt_gnd_mic_swap_cnt < GND_MIC_SWAP_THRESHOLD) { mbhc->swap_thr) { continue; } else if (pt_gnd_mic_swap_cnt > GND_MIC_SWAP_THRESHOLD) { mbhc->swap_thr) { /* * This is due to GND/MIC switch didn't * work, Report unsupported plug. Loading @@ -735,14 +735,14 @@ static void wcd_correct_swch_plug(struct work_struct *work) plug_type = wcd_mbhc_get_plug_from_adc( mbhc, output_mv); if ((no_gnd_mic_swap_cnt < GND_MIC_SWAP_THRESHOLD) && mbhc->swap_thr) && (spl_hs_count != WCD_MBHC_SPL_HS_CNT)) { continue; } else { no_gnd_mic_swap_cnt = 0; } } if ((pt_gnd_mic_swap_cnt == GND_MIC_SWAP_THRESHOLD) && if ((pt_gnd_mic_swap_cnt == mbhc->swap_thr) && (plug_type == MBHC_PLUG_TYPE_GND_MIC_SWAP)) { /* * if switch is toggled, check again, Loading
asoc/codecs/wcd-mbhc-legacy.c +4 −4 Original line number Diff line number Diff line Loading @@ -498,7 +498,7 @@ static void wcd_correct_swch_plug(struct work_struct *work) do { cross_conn = wcd_check_cross_conn(mbhc); try++; } while (try < GND_MIC_SWAP_THRESHOLD); } while (try < mbhc->swap_thr); /* * Check for cross connection 4 times. Loading Loading @@ -599,10 +599,10 @@ static void wcd_correct_swch_plug(struct work_struct *work) pt_gnd_mic_swap_cnt++; no_gnd_mic_swap_cnt = 0; if (pt_gnd_mic_swap_cnt < GND_MIC_SWAP_THRESHOLD) { mbhc->swap_thr) { continue; } else if (pt_gnd_mic_swap_cnt > GND_MIC_SWAP_THRESHOLD) { mbhc->swap_thr) { /* * This is due to GND/MIC switch didn't * work, Report unsupported plug. Loading @@ -626,7 +626,7 @@ static void wcd_correct_swch_plug(struct work_struct *work) no_gnd_mic_swap_cnt = 0; } } if ((pt_gnd_mic_swap_cnt == GND_MIC_SWAP_THRESHOLD) && if ((pt_gnd_mic_swap_cnt == mbhc->swap_thr) && (plug_type == MBHC_PLUG_TYPE_GND_MIC_SWAP)) { /* * if switch is toggled, check again, Loading
asoc/codecs/wcd-mbhc-v2.c +2 −0 Original line number Diff line number Diff line Loading @@ -1707,6 +1707,7 @@ int wcd_mbhc_start(struct wcd_mbhc *mbhc, struct wcd_mbhc_config *mbhc_cfg) if (mbhc_cfg->enable_usbc_analog) { dev_dbg(mbhc->codec->dev, "%s: usbc analog enabled\n", __func__); mbhc->swap_thr = GND_MIC_USBC_SWAP_THRESHOLD; rc = wcd_mbhc_init_gpio(mbhc, mbhc_cfg, "qcom,usbc-analog-en1-gpio", &config->usbc_en1_gpio, Loading Loading @@ -1901,6 +1902,7 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, mbhc->extn_cable_hph_rem = false; mbhc->hph_type = WCD_MBHC_HPH_NONE; mbhc->wcd_mbhc_regs = wcd_mbhc_regs; mbhc->swap_thr = GND_MIC_SWAP_THRESHOLD; if (mbhc->intr_ids == NULL) { pr_err("%s: Interrupt mapping not provided\n", __func__); Loading
asoc/codecs/wcd-mbhc-v2.h +2 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ do { \ #define SPECIAL_HS_DETECT_TIME_MS (2 * 1000) #define MBHC_BUTTON_PRESS_THRESHOLD_MIN 250 #define GND_MIC_SWAP_THRESHOLD 4 #define GND_MIC_USBC_SWAP_THRESHOLD 2 #define WCD_FAKE_REMOVAL_MIN_PERIOD_MS 100 #define HS_VREF_MIN_VAL 1400 #define FW_READ_ATTEMPTS 15 Loading Loading @@ -524,6 +525,7 @@ struct wcd_mbhc { bool gnd_swh; /*track GND switch NC / NO */ u32 hs_thr; u32 hph_thr; u32 swap_thr; u32 moist_vref; u32 moist_iref; u32 moist_rref; Loading