Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions sound/soc/codecs/wcd9310.c
Original file line number Diff line number Diff line change
Expand Up @@ -5435,6 +5435,8 @@ static short __tabla_codec_sta_dce(struct snd_soc_codec *codec, int dce,
short bias_value;
struct tabla_priv *tabla = snd_soc_codec_get_drvdata(codec);

pr_debug("%s: enter", __func__);

wcd9xxx_disable_irq(codec->control_data, TABLA_IRQ_MBHC_POTENTIAL);
if (noreldetection)
tabla_turn_onoff_rel_detection(codec, false);
Expand Down Expand Up @@ -5472,6 +5474,7 @@ static short __tabla_codec_sta_dce(struct snd_soc_codec *codec, int dce,
if (noreldetection)
tabla_turn_onoff_rel_detection(codec, true);
wcd9xxx_enable_irq(codec->control_data, TABLA_IRQ_MBHC_POTENTIAL);
pr_debug("%s: leave", __func__);

return bias_value;
}
Expand Down Expand Up @@ -5961,6 +5964,8 @@ void tabla_mbhc_cal(struct snd_soc_codec *codec)
void *calibration;
u16 bias2_ctl;

pr_debug("%s: enter", __func__);

tabla = snd_soc_codec_get_drvdata(codec);
calibration = tabla->mbhc_cfg.calibration;

Expand Down Expand Up @@ -6076,6 +6081,8 @@ void tabla_mbhc_cal(struct snd_soc_codec *codec)

wcd9xxx_enable_irq(codec->control_data, TABLA_IRQ_MBHC_POTENTIAL);
tabla_turn_onoff_rel_detection(codec, true);

pr_debug("%s: leave", __func__);
}

void *tabla_mbhc_cal_btn_det_mp(const struct tabla_mbhc_btn_detect_cfg* btn_det,
Expand Down Expand Up @@ -6153,12 +6160,23 @@ static s16 tabla_mbhc_highest_btn_mv(struct snd_soc_codec *codec)
struct tabla_priv *tabla;
struct tabla_mbhc_btn_detect_cfg *btn_det;
u16 *btn_high;
s16 result;
int i;

tabla = snd_soc_codec_get_drvdata(codec);
btn_det = TABLA_MBHC_CAL_BTN_DET_PTR(tabla->mbhc_cfg.calibration);
btn_high = tabla_mbhc_cal_btn_det_mp(btn_det, TABLA_BTN_DET_V_BTN_HIGH);

return btn_high[btn_det->num_btn - 1];
result = btn_high[0];
for (i = 1; i < btn_det->num_btn; i++)
{
if (btn_high[i] > result)
{
result = btn_high[i];
}
}

return result;
}

static void tabla_mbhc_calc_thres(struct snd_soc_codec *codec)
Expand Down Expand Up @@ -6337,6 +6355,7 @@ static int tabla_determine_button(const struct tabla_priv *priv,
pr_debug("%s: couldn't find button number for mic mv %d\n",
__func__, micmv);

pr_debug("%s: micmv=%d, btn=%d", __func__, micmv, btn);
return btn;
}

Expand Down Expand Up @@ -6953,16 +6972,16 @@ tabla_codec_get_plug_type(struct snd_soc_codec *codec, bool highhph)
*/
if (mic_mv[i] < plug_type_ptr->v_no_mic) {
plug_type[i] = PLUG_TYPE_HEADPHONE;
pr_debug("%s: Detect attempt %d, detected Headphone\n",
__func__, i);
pr_debug("%s: Detect attempt %d, detected Headphone (mic_mv=%d)\n",
__func__, i, mic_mv[i]);
} else if (highhph && (mic_mv[i] > plug_type_ptr->v_hs_max)) {
plug_type[i] = PLUG_TYPE_HIGH_HPH;
pr_debug("%s: Detect attempt %d, detected High "
"Headphone\n", __func__, i);
"Headphone (mic_mv=%d)\n", __func__, i, mic_mv[i]);
} else {
plug_type[i] = PLUG_TYPE_HEADSET;
pr_debug("%s: Detect attempt %d, detected Headset\n",
__func__, i);
pr_debug("%s: Detect attempt %d, detected Headset (mic_mv=%d)\n",
__func__, i, mic_mv[i]);
}

if (i > 0 && (plug_type[i - 1] != plug_type[i])) {
Expand Down
16 changes: 8 additions & 8 deletions sound/soc/msm/apq8064.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ static void *def_tabla_mbhc_cal(void)
#undef S
#define S(X, Y) ((TABLA_MBHC_CAL_PLUG_TYPE_PTR(tabla_cal)->X) = (Y))
S(v_no_mic, 30);
S(v_hs_max, 2400);
S(v_hs_max, 2700);
#undef S
#define S(X, Y) ((TABLA_MBHC_CAL_BTN_DET_PTR(tabla_cal)->X) = (Y))
S(c[0], 62);
Expand All @@ -939,12 +939,12 @@ static void *def_tabla_mbhc_cal(void)
btn_cfg = TABLA_MBHC_CAL_BTN_DET_PTR(tabla_cal);
btn_low = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_V_BTN_LOW);
btn_high = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_V_BTN_HIGH);
btn_low[0] = -50;
btn_high[0] = 10;
btn_low[1] = 11;
btn_high[1] = 52;
btn_low[2] = 53;
btn_high[2] = 94;
btn_low[0] = -75;
btn_high[0] = 150;
btn_low[1] = 151;
btn_high[1] = 330;
btn_low[2] = 331;
btn_high[2] = 655;
btn_low[3] = 95;
btn_high[3] = 133;
btn_low[4] = 134;
Expand All @@ -954,7 +954,7 @@ static void *def_tabla_mbhc_cal(void)
btn_low[6] = 209;
btn_high[6] = 244;
btn_low[7] = 245;
btn_high[7] = 330;
btn_high[7] = 930;
n_ready = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_N_READY);
n_ready[0] = 80;
n_ready[1] = 68;
Expand Down