ASoC: codecs: sdm660_cdc: Fix mute if compander is disabled
Compander disable sequence does not get called after headphone playback on FM. This results in mute at one channel. Compander clock should be disabled at the end to resolve the mute. CRs-Fixed: 2102126 Change-Id: Ia47fb1c393db255b52a965173a769896768f245e Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
parent
2e3e81889d
commit
523325316e
1 changed files with 41 additions and 41 deletions
|
@ -211,60 +211,60 @@ static int msm_dig_cdc_codec_config_compander(struct snd_soc_codec *codec,
|
|||
int interp_n, int event)
|
||||
{
|
||||
struct msm_dig_priv *dig_cdc = snd_soc_codec_get_drvdata(codec);
|
||||
int comp_ch_bits_set = 0x03;
|
||||
|
||||
dev_dbg(codec->dev, "%s: event %d shift %d, enabled %d\n",
|
||||
__func__, event, interp_n,
|
||||
dig_cdc->comp_enabled[interp_n]);
|
||||
|
||||
/* compander is not enabled */
|
||||
if (!dig_cdc->comp_enabled[interp_n])
|
||||
/* compander is invalid */
|
||||
if (dig_cdc->comp_enabled[interp_n] != COMPANDER_1 &&
|
||||
dig_cdc->comp_enabled[interp_n]) {
|
||||
dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__,
|
||||
dig_cdc->comp_enabled[interp_n]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (dig_cdc->comp_enabled[interp_n]) {
|
||||
case COMPANDER_1:
|
||||
if (SND_SOC_DAPM_EVENT_ON(event)) {
|
||||
/* Enable Compander Clock */
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x09);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_CLK_RX_B2_CTL, 0x01, 0x01);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B1_CTL,
|
||||
1 << interp_n, 1 << interp_n);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B3_CTL, 0xFF, 0x01);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B2_CTL, 0xF0, 0x50);
|
||||
/* add sleep for compander to settle */
|
||||
usleep_range(1000, 1100);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B3_CTL, 0xFF, 0x28);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B2_CTL, 0xF0, 0xB0);
|
||||
if (SND_SOC_DAPM_EVENT_ON(event)) {
|
||||
/* Enable Compander Clock */
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x09);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_CLK_RX_B2_CTL, 0x01, 0x01);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B1_CTL,
|
||||
1 << interp_n, 1 << interp_n);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B3_CTL, 0xFF, 0x01);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B2_CTL, 0xF0, 0x50);
|
||||
/* add sleep for compander to settle */
|
||||
usleep_range(1000, 1100);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B3_CTL, 0xFF, 0x28);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B2_CTL, 0xF0, 0xB0);
|
||||
|
||||
/* Enable Compander GPIO */
|
||||
if (dig_cdc->codec_hph_comp_gpio)
|
||||
dig_cdc->codec_hph_comp_gpio(1, codec);
|
||||
} else if (SND_SOC_DAPM_EVENT_OFF(event)) {
|
||||
/* Disable Compander GPIO */
|
||||
if (dig_cdc->codec_hph_comp_gpio)
|
||||
dig_cdc->codec_hph_comp_gpio(0, codec);
|
||||
/* Enable Compander GPIO */
|
||||
if (dig_cdc->codec_hph_comp_gpio)
|
||||
dig_cdc->codec_hph_comp_gpio(1, codec);
|
||||
} else if (SND_SOC_DAPM_EVENT_OFF(event)) {
|
||||
/* Disable Compander GPIO */
|
||||
if (dig_cdc->codec_hph_comp_gpio)
|
||||
dig_cdc->codec_hph_comp_gpio(0, codec);
|
||||
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B1_CTL,
|
||||
1 << interp_n, 0);
|
||||
comp_ch_bits_set = snd_soc_read(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B1_CTL);
|
||||
if ((comp_ch_bits_set & 0x03) == 0x00) {
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x05);
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_COMP0_B1_CTL,
|
||||
1 << interp_n, 0);
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_update_bits(codec,
|
||||
MSM89XX_CDC_CORE_CLK_RX_B2_CTL, 0x01, 0x00);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__,
|
||||
dig_cdc->comp_enabled[interp_n]);
|
||||
break;
|
||||
};
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue