audio: merge eARC tx and spdif related fix to reference [1/1]

PD#SWPL-146976

Problem:
merge eARC tx and spdif related fix to reference

Solution:
TV-92533 fix earc tx clock tuning error
TV-98495 when stream start, spdif get data from frddr

Verify:
t5m

Change-Id: I434ffe1c22689a09b6b8f1f0f85b0fc1e476d244
Signed-off-by: jian zhou <jian.zhou@amlogic.com>
This commit is contained in:
jian zhou
2023-11-27 15:47:55 +08:00
committed by gerrit autosubmit
parent 2c99b9bdd0
commit dd13a73f3a
4 changed files with 26 additions and 46 deletions
+1
View File
@@ -2392,6 +2392,7 @@ static int earctx_clk_get(struct snd_kcontrol *kcontrol,
if (!IS_ERR(p_earc->clk_tx_dmac)) {
ucontrol->value.enumerated.item[0] =
clk_get_rate(p_earc->clk_tx_dmac);
p_earc->tx_dmac_freq = ucontrol->value.enumerated.item[0];
}
return 0;
}
+6 -11
View File
@@ -394,12 +394,13 @@ static void ss_mute(int samesource_sel, bool mute)
pr_debug("%s() %d, mute %d, id %d\n", __func__, __LINE__,
mute, samesource_sel - 3);
aml_spdifout_mute_without_actrl(samesource_sel - 3, mute);
ops = get_samesrc_ops(samesource_sel);
if (ops && ops->private) {
struct aml_spdif *p_spdif = ops->private;
aml_spdifout_mute_without_actrl(samesource_sel - 3, !mute, p_spdif->mute);
if (p_spdif->samesource_sel != SHAREBUFFER_NONE &&
get_samesrc_ops(p_spdif->samesource_sel) &&
get_samesrc_ops(p_spdif->samesource_sel)->mute) {
@@ -694,7 +695,8 @@ static int aml_audio_set_spdif_mute(struct snd_kcontrol *kcontrol,
pinctrl_select_state(p_spdif->pin_ctl, state);
}
} else {
aml_spdif_out_mute(p_spdif->actrl, p_spdif->id, mute);
if (aml_spdif_out_get_mute(p_spdif->actrl, p_spdif->id) != mute)
aml_spdif_out_mute(p_spdif->actrl, p_spdif->id, mute);
}
p_spdif->mute = mute;
@@ -1412,9 +1414,6 @@ static int aml_dai_spdif_prepare(struct snd_pcm_substream *substream,
if (p_spdif->samesource_sel != SHAREBUFFER_NONE)
spdif_sharebuffer_trigger(p_spdif, runtime->channels,
SNDRV_PCM_TRIGGER_STOP);
if (!p_spdif->mute)
aml_spdif_mute(p_spdif->actrl,
substream->stream, p_spdif->id, false);
}
if (get_hdmitx_audio_src(rtd->card) == p_spdif->id) {
@@ -1509,9 +1508,7 @@ static int aml_dai_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
aml_frddr_enable(p_spdif->fddr, 1);
udelay(100);
if (!p_spdif->mute)
aml_spdif_mute(p_spdif->actrl,
substream->stream, p_spdif->id, false);
aml_spdifout_mute_without_actrl(p_spdif->id, true, p_spdif->mute);
if (p_spdif->samesource_sel != SHAREBUFFER_NONE)
spdif_sharebuffer_mute(p_spdif, false);
} else {
@@ -1538,9 +1535,7 @@ static int aml_dai_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
* only mute, ensure spdif outputs zero data.
*/
if (p_spdif->clk_cont) {
if (!p_spdif->mute)
aml_spdif_mute(p_spdif->actrl,
substream->stream, p_spdif->id, true);
aml_spdifout_mute_without_actrl(p_spdif->id, false, true);
if (p_spdif->samesource_sel != SHAREBUFFER_NONE)
spdif_sharebuffer_mute(p_spdif, true);
} else {
+17 -28
View File
@@ -52,6 +52,16 @@ void aml_spdif_enable(struct aml_audio_controller *actrl,
}
}
int aml_spdif_out_get_mute(struct aml_audio_controller *actrl, int index)
{
unsigned int offset, reg;
offset = EE_AUDIO_SPDIFOUT_B_CTRL0 - EE_AUDIO_SPDIFOUT_CTRL0;
reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * index;
return !!(aml_audiobus_read(actrl, reg) & (0x3 << 21));
}
/* only mute reg, keep get data from frddr */
void aml_spdif_out_mute(struct aml_audio_controller *actrl,
int index, bool is_mute)
{
@@ -63,35 +73,14 @@ void aml_spdif_out_mute(struct aml_audio_controller *actrl,
offset = EE_AUDIO_SPDIFOUT_B_CTRL0 - EE_AUDIO_SPDIFOUT_CTRL0;
reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * index;
if (!is_mute)
aml_audiobus_update_bits(actrl, reg, 0x1 << 30, 0x0 << 30);
aml_audiobus_update_bits(actrl, reg, 0x3 << 21, mute_lr << 21);
if (is_mute) {
aml_audiobus_update_bits(actrl, reg, 0x1 << 30, 0x1 << 30);
offset = EE_AUDIO_SPDIFOUT_B_CTRL1 - EE_AUDIO_SPDIFOUT_CTRL1;
reg = EE_AUDIO_SPDIFOUT_CTRL1 + offset * index;
aml_audiobus_update_bits(actrl, reg, 0x1 << 3, 0x1 << 3);
}
}
void aml_spdif_mute(struct aml_audio_controller *actrl,
int stream, int index, bool is_mute)
{
int mute_lr = 0;
if (is_mute)
mute_lr = 0x3;
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
aml_spdif_out_mute(actrl, index, is_mute);
} else {
aml_audiobus_update_bits(actrl, EE_AUDIO_SPDIFIN_CTRL0,
0x3 << 6, mute_lr << 6);
}
}
void aml_spdifout_mute_without_actrl(int index, bool is_mute)
/* for stream trigger, need stop get data from frddr,
* otherwise, it will channel swap from tdm 8 channels.
*/
void aml_spdifout_mute_without_actrl(int index, bool start, bool is_mute)
{
unsigned int offset, reg;
int mute_lr = 0;
@@ -101,10 +90,10 @@ void aml_spdifout_mute_without_actrl(int index, bool is_mute)
offset = EE_AUDIO_SPDIFOUT_B_CTRL0 - EE_AUDIO_SPDIFOUT_CTRL0;
reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * index;
if (!is_mute)
if (start)
audiobus_update_bits(reg, 0x1 << 30, 0x0 << 30);
audiobus_update_bits(reg, 0x3 << 21, mute_lr << 21);
if (is_mute) {
if (!start) {
audiobus_update_bits(reg, 0x1 << 30, 0x1 << 30);
offset = EE_AUDIO_SPDIFOUT_B_CTRL1 - EE_AUDIO_SPDIFOUT_CTRL1;
+2 -7
View File
@@ -18,14 +18,9 @@ void aml_spdif_enable(struct aml_audio_controller *actrl,
int index,
bool is_enable);
void aml_spdif_mute(struct aml_audio_controller *actrl,
int stream,
int index,
bool is_mute);
void aml_spdifout_mute_without_actrl(int index,
bool is_mute);
void aml_spdifout_mute_without_actrl(int index, bool start, bool is_mute);
int aml_spdif_out_get_mute(struct aml_audio_controller *actrl, int index);
void aml_spdif_out_mute(struct aml_audio_controller *actrl,
int index, bool is_mute);