ASoC: codecs: update for AUX, ear and HPH paths

Add updates to AUX control registers and headphone
and ear path power mode registers.

Change-Id: I7a6b0f23a28a6ab9189c946a78a2f376937d7509
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
This commit is contained in:
Karthikeyan Mani
2019-05-16 15:57:53 -07:00
committed by Gerrit - the friendly Code Review server
parent 7f609a3ca0
commit 31231c306d
2 changed files with 41 additions and 11 deletions

View File

@@ -94,6 +94,7 @@ struct wcd938x_priv {
/* Entry for version info */ /* Entry for version info */
struct snd_info_entry *entry; struct snd_info_entry *entry;
struct snd_info_entry *version_entry; struct snd_info_entry *version_entry;
int flyback_cur_det_disable;
}; };
struct wcd938x_micbias_setting { struct wcd938x_micbias_setting {

View File

@@ -166,6 +166,12 @@ static int wcd938x_init_reg(struct snd_soc_component *component)
0xC0, 0x80); 0xC0, 0x80);
snd_soc_component_update_bits(component, WCD938X_DIGITAL_CDC_DMIC_CTL, snd_soc_component_update_bits(component, WCD938X_DIGITAL_CDC_DMIC_CTL,
0x02, 0x02); 0x02, 0x02);
snd_soc_component_update_bits(component,
WCD938X_TX_COM_NEW_INT_TXFE_ICTRL_STG2CASC_ULP,
0xFF, 0x14);
snd_soc_component_update_bits(component,
WCD938X_TX_COM_NEW_INT_TXFE_ICTRL_STG2MAIN_ULP,
0x1F, 0x08);
return 0; return 0;
} }
@@ -364,6 +370,8 @@ static int wcd938x_rx_clk_enable(struct snd_soc_component *component)
WCD938X_DIGITAL_CDC_RX2_CTL, 0x40, 0x00); WCD938X_DIGITAL_CDC_RX2_CTL, 0x40, 0x00);
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x02, 0x02); WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x02, 0x02);
snd_soc_component_update_bits(component,
WCD938X_AUX_AUXPA, 0x10, 0x10);
} }
wcd938x->rx_clk_cnt++; wcd938x->rx_clk_cnt++;
@@ -539,8 +547,11 @@ static int wcd938x_codec_ear_dac_event(struct snd_soc_dapm_widget *w,
WCD938X_DIGITAL_CDC_COMP_CTL_0, 0x02, 0x02); WCD938X_DIGITAL_CDC_COMP_CTL_0, 0x02, 0x02);
/* 5 msec delay as per HW requirement */ /* 5 msec delay as per HW requirement */
usleep_range(5000, 5010); usleep_range(5000, 5010);
snd_soc_component_update_bits(component, WCD938X_FLYBACK_EN, if (wcd938x->flyback_cur_det_disable == 0)
0x04, 0x00); snd_soc_component_update_bits(component,
WCD938X_FLYBACK_EN,
0x04, 0x00);
wcd938x->flyback_cur_det_disable++;
wcd_cls_h_fsm(component, &wcd938x->clsh_info, wcd_cls_h_fsm(component, &wcd938x->clsh_info,
WCD_CLSH_EVENT_PRE_DAC, WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_EAR, WCD_CLSH_STATE_EAR,
@@ -573,13 +584,17 @@ static int wcd938x_codec_aux_dac_event(struct snd_soc_dapm_widget *w,
WCD938X_DIGITAL_CDC_DIG_CLK_CTL, 0x04, 0x04); WCD938X_DIGITAL_CDC_DIG_CLK_CTL, 0x04, 0x04);
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
WCD938X_DIGITAL_CDC_AUX_GAIN_CTL, 0x01, 0x01); WCD938X_DIGITAL_CDC_AUX_GAIN_CTL, 0x01, 0x01);
if (wcd938x->flyback_cur_det_disable == 0)
snd_soc_component_update_bits(component,
WCD938X_FLYBACK_EN,
0x04, 0x00);
wcd938x->flyback_cur_det_disable++;
wcd_cls_h_fsm(component, &wcd938x->clsh_info, wcd_cls_h_fsm(component, &wcd938x->clsh_info,
WCD_CLSH_EVENT_PRE_DAC, WCD_CLSH_EVENT_PRE_DAC,
WCD_CLSH_STATE_AUX, WCD_CLSH_STATE_AUX,
wcd938x->hph_mode); wcd938x->hph_mode);
break; break;
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
wcd938x_rx_clk_disable(component);
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x04, 0x00); WCD938X_DIGITAL_CDC_ANA_CLK_CTL, 0x04, 0x00);
break; break;
@@ -630,7 +645,8 @@ static int wcd938x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w,
} }
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
WCD938X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x02); WCD938X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x02);
if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI) if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI ||
hph_mode == CLS_AB_LP || hph_mode == CLS_AB_LOHIFI)
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
WCD938X_ANA_RX_SUPPLIES, 0x02, 0x02); WCD938X_ANA_RX_SUPPLIES, 0x02, 0x02);
if (wcd938x->update_wcd_event) if (wcd938x->update_wcd_event)
@@ -706,7 +722,8 @@ static int wcd938x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w,
} }
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
WCD938X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x02); WCD938X_HPH_NEW_INT_HPH_TIMER1, 0x02, 0x02);
if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI) if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI ||
hph_mode == CLS_AB_LP || hph_mode == CLS_AB_LOHIFI)
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
WCD938X_ANA_RX_SUPPLIES, 0x02, 0x02); WCD938X_ANA_RX_SUPPLIES, 0x02, 0x02);
if (wcd938x->update_wcd_event) if (wcd938x->update_wcd_event)
@@ -762,10 +779,11 @@ static int wcd938x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
/* 1 msec delay as per HW requirement */ /* 1 msec delay as per HW requirement */
usleep_range(1000, 1010); usleep_range(1000, 1010);
if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI) if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI ||
hph_mode == CLS_AB_LP || hph_mode == CLS_AB_LOHIFI)
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
WCD938X_ANA_RX_SUPPLIES, WCD938X_ANA_RX_SUPPLIES,
0x20, 0x20); 0x02, 0x02);
if (wcd938x->update_wcd_event) if (wcd938x->update_wcd_event)
wcd938x->update_wcd_event(wcd938x->handle, wcd938x->update_wcd_event(wcd938x->handle,
WCD_BOLERO_EVT_RX_MUTE, WCD_BOLERO_EVT_RX_MUTE,
@@ -784,6 +802,12 @@ static int wcd938x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
WCD_CLSH_EVENT_POST_PA, WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_AUX, WCD_CLSH_STATE_AUX,
hph_mode); hph_mode);
wcd938x->flyback_cur_det_disable--;
if (wcd938x->flyback_cur_det_disable == 0)
snd_soc_component_update_bits(component,
WCD938X_FLYBACK_EN,
0x04, 0x04);
break; break;
}; };
return ret; return ret;
@@ -811,7 +835,8 @@ static int wcd938x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
/* 6 msec delay as per HW requirement */ /* 6 msec delay as per HW requirement */
usleep_range(6000, 6010); usleep_range(6000, 6010);
if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI) if (hph_mode == CLS_AB || hph_mode == CLS_AB_HIFI ||
hph_mode == CLS_AB_LP || hph_mode == CLS_AB_LOHIFI)
snd_soc_component_update_bits(component, snd_soc_component_update_bits(component,
WCD938X_ANA_RX_SUPPLIES, WCD938X_ANA_RX_SUPPLIES,
0x02, 0x02); 0x02, 0x02);
@@ -833,8 +858,12 @@ static int wcd938x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w,
WCD_CLSH_EVENT_POST_PA, WCD_CLSH_EVENT_POST_PA,
WCD_CLSH_STATE_EAR, WCD_CLSH_STATE_EAR,
hph_mode); hph_mode);
snd_soc_component_update_bits(component, WCD938X_FLYBACK_EN,
0x04, 0x04); wcd938x->flyback_cur_det_disable--;
if (wcd938x->flyback_cur_det_disable == 0)
snd_soc_component_update_bits(component,
WCD938X_FLYBACK_EN,
0x04, 0x04);
break; break;
}; };
return ret; return ret;
@@ -1796,7 +1825,7 @@ static const struct soc_enum tx_mode_mux_enum =
static const char * const rx_hph_mode_mux_text[] = { static const char * const rx_hph_mode_mux_text[] = {
"CLS_H_INVALID", "CLS_H_HIFI", "CLS_H_LP", "CLS_AB", "CLS_H_LOHIFI", "CLS_H_INVALID", "CLS_H_HIFI", "CLS_H_LP", "CLS_AB", "CLS_H_LOHIFI",
"CLS_H_ULP", "CLS_AB_HIFI", "CLS_H_ULP", "CLS_AB_HIFI", "CLS_AB_LP", "CLS_AB_LOHIFI",
}; };
static const struct soc_enum rx_hph_mode_mux_enum = static const struct soc_enum rx_hph_mode_mux_enum =