asoc: codec: update registers based on hph mode
update registers based on specific hph mode before compander config. Change-Id: Iea4f2bc5521dc701bd52ce8fe24323b1f9d96045 Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
7934eb5971
commit
334bb47082
@@ -842,10 +842,69 @@ struct wcd939x_mbhc *wcd939x_soc_get_mbhc(struct snd_soc_component *component)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(wcd939x_soc_get_mbhc);
|
EXPORT_SYMBOL(wcd939x_soc_get_mbhc);
|
||||||
|
|
||||||
|
static int wcd939x_config_power_mode(struct snd_soc_component *component,
|
||||||
|
int event, int index, int mode)
|
||||||
|
{
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case SND_SOC_DAPM_POST_PMU:
|
||||||
|
if (mode == CLS_H_ULP) {
|
||||||
|
if (index == WCD939X_HPHL) {
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL12, ZONE3_RMS, 0x21));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL13, ZONE4_RMS, 0x30));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL14, ZONE5_RMS, 0x3F));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL15, ZONE6_RMS, 0x48));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL17, PATH_GAIN, 0x0C));
|
||||||
|
} else if (index == WCD939X_HPHR) {
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL12, ZONE3_RMS, 0x21));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL13, ZONE4_RMS, 0x30));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL14, ZONE5_RMS, 0x3F));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL15, ZONE6_RMS, 0x48));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL17, PATH_GAIN, 0x0C));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (index == WCD939X_HPHL) {
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL12, ZONE3_RMS, 0x1E));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL13, ZONE4_RMS, 0x2A));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL14, ZONE5_RMS, 0x36));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL15, ZONE6_RMS, 0x3C));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(CTL17, PATH_GAIN, 0x00));
|
||||||
|
} else if (index == WCD939X_HPHR) {
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL12, ZONE3_RMS, 0x1E));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL13, ZONE4_RMS, 0x2A));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL14, ZONE5_RMS, 0x36));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL15, ZONE6_RMS, 0x2C));
|
||||||
|
snd_soc_component_update_bits(component,
|
||||||
|
REG_FIELD_VALUE(R_CTL17, PATH_GAIN, 0x00));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int wcd939x_enable_hph_pcm_index(struct snd_soc_component *component,
|
static int wcd939x_enable_hph_pcm_index(struct snd_soc_component *component,
|
||||||
int event, int hph)
|
int event, int hph)
|
||||||
{
|
{
|
||||||
struct wcd939x_priv *wcd939x;
|
struct wcd939x_priv *wcd939x = NULL;
|
||||||
|
|
||||||
if (!component) {
|
if (!component) {
|
||||||
pr_err_ratelimited("%s: Invalid params, NULL component\n", __func__);
|
pr_err_ratelimited("%s: Invalid params, NULL component\n", __func__);
|
||||||
@@ -1006,7 +1065,7 @@ static int wcd939x_config_xtalk(struct snd_soc_component *component,
|
|||||||
break;
|
break;
|
||||||
case SND_SOC_DAPM_POST_PMU:
|
case SND_SOC_DAPM_POST_PMU:
|
||||||
/* enable xtalk for L and R channels*/
|
/* enable xtalk for L and R channels*/
|
||||||
snd_soc_component_update_bits(component, WCD939X_RX_PATH_CFG2,
|
snd_soc_component_update_bits(component, WCD939X_RX_PATH_CFG2,
|
||||||
0x0F, 0x0F);
|
0x0F, 0x0F);
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAPM_POST_PMD:
|
case SND_SOC_DAPM_POST_PMD:
|
||||||
@@ -1024,10 +1083,12 @@ static int wcd939x_rx_mux(struct snd_soc_dapm_widget *w,
|
|||||||
int event)
|
int event)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct wcd939x_priv *wcd939x;
|
int hph_mode = 0;
|
||||||
|
struct wcd939x_priv *wcd939x = NULL;
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
wcd939x = snd_soc_component_get_drvdata(component);
|
wcd939x = snd_soc_component_get_drvdata(component);
|
||||||
|
hph_mode = wcd939x->hph_mode;
|
||||||
|
|
||||||
dev_dbg(component->dev, "%s event: %d wshift: %d wname: %s\n",
|
dev_dbg(component->dev, "%s event: %d wshift: %d wname: %s\n",
|
||||||
__func__, event, w->shift, w->name);
|
__func__, event, w->shift, w->name);
|
||||||
@@ -1035,6 +1096,8 @@ static int wcd939x_rx_mux(struct snd_soc_dapm_widget *w,
|
|||||||
switch (event) {
|
switch (event) {
|
||||||
case SND_SOC_DAPM_PRE_PMU:
|
case SND_SOC_DAPM_PRE_PMU:
|
||||||
wcd939x_rx_clk_enable(component);
|
wcd939x_rx_clk_enable(component);
|
||||||
|
if (wcd939x->hph_pcm_enabled[w->shift])
|
||||||
|
wcd939x_config_power_mode(component, event, w->shift, hph_mode);
|
||||||
wcd939x_config_compander(component, event, w->shift);
|
wcd939x_config_compander(component, event, w->shift);
|
||||||
wcd939x_config_xtalk(component, event, w->shift);
|
wcd939x_config_xtalk(component, event, w->shift);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user