From 4ea7f1a00a4d7ccbf62297372716f71914c19da1 Mon Sep 17 00:00:00 2001 From: Swaminathan Sathappan Date: Wed, 29 Feb 2012 12:55:55 -0800 Subject: [PATCH] apq8064: MBHC single button detection not working Modify MBHC Button values to make MBHC button detect work Change-Id: I6eeefed49124c876946677b02902fa1fd675a40a Signed-off-by: Swaminathan Sathappan --- sound/soc/msm/apq8064.c | 55 ++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/sound/soc/msm/apq8064.c b/sound/soc/msm/apq8064.c index ae4e4038f7e..a97bf8711db 100644 --- a/sound/soc/msm/apq8064.c +++ b/sound/soc/msm/apq8064.c @@ -55,7 +55,7 @@ #define TABLA_EXT_CLK_RATE 12288000 -#define TABLA_MBHC_DEF_BUTTONS 3 +#define TABLA_MBHC_DEF_BUTTONS 8 #define TABLA_MBHC_DEF_RLOADS 5 static u32 top_spk_pamp_gpio = PM8921_GPIO_PM_TO_SYS(18); @@ -604,7 +604,7 @@ static void *def_tabla_mbhc_cal(void) void *tabla_cal; struct tabla_mbhc_btn_detect_cfg *btn_cfg; u16 *btn_low, *btn_high; - u8 *n_cic, *gain; + u8 *n_ready, *n_cic, *gain; tabla_cal = kzalloc(TABLA_MBHC_CAL_SIZE(TABLA_MBHC_DEF_BUTTONS, TABLA_MBHC_DEF_RLOADS), @@ -625,25 +625,21 @@ static void *def_tabla_mbhc_cal(void) S(mic_current, TABLA_PID_MIC_5_UA); S(hph_current, TABLA_PID_MIC_5_UA); S(t_mic_pid, 100); - S(t_ins_complete, 1000); + S(t_ins_complete, 250); S(t_ins_retry, 200); #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, 1450); + S(v_hs_max, 1550); #undef S #define S(X, Y) ((TABLA_MBHC_CAL_BTN_DET_PTR(tabla_cal)->X) = (Y)) - S(c[0], 6); - S(c[1], 10); - S(c[2], 10); - S(c[3], 14); - S(c[4], 14); - S(c[5], 16); - S(c[6], 0); - S(c[7], 0); - S(nc, 5); - S(n_meas, 11); + S(c[0], 62); + S(c[1], 124); + S(nc, 1); + S(n_meas, 3); S(mbhc_nsc, 11); + S(n_btn_meas, 1); + S(n_btn_con, 2); S(num_btn, TABLA_MBHC_DEF_BUTTONS); S(v_btn_press_delta_sta, 100); S(v_btn_press_delta_cic, 50); @@ -651,15 +647,28 @@ 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] = 0; - btn_high[0] = 40; - btn_low[1] = 60; - btn_high[1] = 140; - btn_low[2] = 160; - btn_high[2] = 240; + btn_low[0] = -50; + btn_high[0] = 10; + btn_low[1] = 11; + btn_high[1] = 38; + btn_low[2] = 39; + btn_high[2] = 64; + btn_low[3] = 65; + btn_high[3] = 91; + btn_low[4] = 92; + btn_high[4] = 115; + btn_low[5] = 116; + btn_high[5] = 141; + btn_low[6] = 142; + btn_high[6] = 163; + btn_low[7] = 164; + btn_high[7] = 250; + n_ready = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_N_READY); + n_ready[0] = 48; + n_ready[1] = 38; n_cic = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_N_CIC); - n_cic[0] = 120; - n_cic[1] = 94; + n_cic[0] = 60; + n_cic[1] = 47; gain = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_GAIN); gain[0] = 11; gain[1] = 9; @@ -777,7 +786,7 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd) } err = snd_soc_jack_new(codec, "Button Jack", - SND_JACK_BTN_0, &button_jack); + TABLA_JACK_BUTTON_MASK, &button_jack); if (err) { pr_err("failed to create new jack\n"); return err;