Merge "asoc: codecs: modify gnd mic swap threshold for usb-c analog"

This commit is contained in:
Linux Build Service Account 2017-12-16 03:09:24 -08:00 committed by Gerrit - the friendly Code Review server
commit 0055984340
4 changed files with 13 additions and 9 deletions

View File

@ -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;
@ -714,10 +714,10 @@ correct_plug_type:
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.
@ -735,14 +735,14 @@ correct_plug_type:
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,

View File

@ -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.
@ -599,10 +599,10 @@ correct_plug_type:
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.
@ -626,7 +626,7 @@ correct_plug_type:
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,

View File

@ -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,
@ -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__);

View File

@ -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
@ -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;