diff --git a/sound/soc/amlogic/auge/spdif.c b/sound/soc/amlogic/auge/spdif.c index 89c58eb862c8..e021552211ba 100644 --- a/sound/soc/amlogic/auge/spdif.c +++ b/sound/soc/amlogic/auge/spdif.c @@ -1187,6 +1187,9 @@ static int aml_dai_spdif_trigger(struct snd_pcm_substream *substream, int cmd, if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { dev_info(substream->pcm->card->dev, "S/PDIF Playback enable\n"); aml_frddr_enable(p_spdif->fddr, 1); + udelay(100); + aml_spdif_mute(p_spdif->actrl, + substream->stream, p_spdif->id, false); } else { dev_info(substream->pcm->card->dev, "S/PDIF Capture enable\n"); aml_toddr_enable(p_spdif->tddr, 1); diff --git a/sound/soc/amlogic/auge/spdif_hw.c b/sound/soc/amlogic/auge/spdif_hw.c index 155060bdabc0..04172b61eb3d 100644 --- a/sound/soc/amlogic/auge/spdif_hw.c +++ b/sound/soc/amlogic/auge/spdif_hw.c @@ -117,6 +117,22 @@ void aml_spdif_mute( } } +void aml_spdifout_mute_without_actrl( + int index, + bool is_mute) +{ + unsigned int offset, reg; + int mute_lr = 0; + + if (is_mute) + mute_lr = 0x3; + + offset = EE_AUDIO_SPDIFOUT_B_CTRL0 - EE_AUDIO_SPDIFOUT_CTRL0; + reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * index; + + audiobus_update_bits(reg, 0x3 << 21, mute_lr << 21); +} + void aml_spdif_arb_config(struct aml_audio_controller *actrl) { /* config ddr arb */ @@ -248,8 +264,8 @@ void aml_spdif_fifo_ctrl( reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * index; aml_audiobus_update_bits(actrl, reg, - 0x1<<29|0x1<<28|0x3<<21|0x1<<20|0x1<<19|0xff<<4, - 1<<29|1<<28|0x0<<21|0<<20|0<<19|0x3<<4); + 0x1<<29|0x1<<28|0x1<<20|0x1<<19|0xff<<4, + 1<<29|1<<28|0<<20|0<<19|0x3<<4); offset = EE_AUDIO_SPDIFOUT_B_CTRL1 - EE_AUDIO_SPDIFOUT_CTRL1; reg = EE_AUDIO_SPDIFOUT_CTRL1 + offset * index; @@ -422,8 +438,8 @@ static void spdifout_fifo_ctrl(int spdif_id, offset = EE_AUDIO_SPDIFOUT_B_CTRL0 - EE_AUDIO_SPDIFOUT_CTRL0; reg = EE_AUDIO_SPDIFOUT_CTRL0 + offset * spdif_id; audiobus_update_bits(reg, - 0x3<<21|0x1<<20|0x1<<19|0xff<<4, - 0x0<<21|0<<20|0<<19|chmask<<4); + 0x1<<20|0x1<<19|0xff<<4, + 0<<20|0<<19|chmask<<4); offset = EE_AUDIO_SPDIFOUT_B_CTRL1 - EE_AUDIO_SPDIFOUT_CTRL1; reg = EE_AUDIO_SPDIFOUT_CTRL1 + offset * spdif_id; @@ -467,7 +483,7 @@ void spdifout_enable(int spdif_id, bool is_enable) if (!is_enable) { /* share buffer, spdif should be active, so mute it */ - audiobus_update_bits(reg, 0x3 << 21, 0x3 << 21); + /*audiobus_update_bits(reg, 0x3 << 21, 0x3 << 21);*/ return; } diff --git a/sound/soc/amlogic/auge/spdif_hw.h b/sound/soc/amlogic/auge/spdif_hw.h index 3e133f620fba..d2f6b96dfffc 100644 --- a/sound/soc/amlogic/auge/spdif_hw.h +++ b/sound/soc/amlogic/auge/spdif_hw.h @@ -40,6 +40,10 @@ extern void aml_spdif_mute( int index, bool is_mute); +extern void aml_spdifout_mute_without_actrl( + int index, + bool is_mute); + extern void aml_spdif_arb_config(struct aml_audio_controller *actrl); extern int aml_spdifin_status_check( diff --git a/sound/soc/amlogic/auge/tdm.c b/sound/soc/amlogic/auge/tdm.c index 1f610349745e..ab71d3e9d65f 100644 --- a/sound/soc/amlogic/auge/tdm.c +++ b/sound/soc/amlogic/auge/tdm.c @@ -40,7 +40,8 @@ #include "tdm_hw.h" #include "sharebuffer.h" #include "vad.h" -#include "spdif.h" +#include "spdif_hw.h" + /*#define __PTM_TDM_CLK__*/ @@ -547,13 +548,23 @@ static int aml_dai_tdm_trigger(struct snd_pcm_substream *substream, int cmd, sharebuffer_trigger(cmd, p_tdm->samesource_sel); } aml_frddr_enable(p_tdm->fddr, 1); + aml_tdm_enable(p_tdm->actrl, + substream->stream, p_tdm->id, true); + udelay(100); + aml_tdm_mute_playback(p_tdm->actrl, p_tdm->id, false); + if (p_tdm->chipinfo + && p_tdm->chipinfo->same_src_fn + && (p_tdm->samesource_sel >= 0) + && (aml_check_sharebuffer_valid(p_tdm->fddr, + p_tdm->samesource_sel))) { + aml_spdifout_mute_without_actrl(0, false); + } } else { dev_info(substream->pcm->card->dev, "tdm capture enable\n"); aml_toddr_enable(p_tdm->tddr, 1); + aml_tdm_enable(p_tdm->actrl, + substream->stream, p_tdm->id, true); } - aml_tdm_enable(p_tdm->actrl, - substream->stream, p_tdm->id, true); - break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: @@ -575,13 +586,13 @@ static int aml_dai_tdm_trigger(struct snd_pcm_substream *substream, int cmd, 0, substream->runtime->dma_bytes); mdelay(3); aml_frddr_enable(p_tdm->fddr, 0); - /* share buffer trigger */ + aml_tdm_mute_playback(p_tdm->actrl, p_tdm->id, true); if (p_tdm->chipinfo && p_tdm->chipinfo->same_src_fn && (p_tdm->samesource_sel >= 0) && (aml_check_sharebuffer_valid(p_tdm->fddr, p_tdm->samesource_sel))) { - sharebuffer_trigger(cmd, p_tdm->samesource_sel); + aml_spdifout_mute_without_actrl(0, true); } } else { dev_info(substream->pcm->card->dev, "tdm capture stop\n"); @@ -1096,7 +1107,7 @@ static int aml_dai_tdm_mute_stream(struct snd_soc_dai *cpu_dai, if (stream == SNDRV_PCM_STREAM_PLAYBACK) { pr_debug("tdm playback mute: %d\n", mute); - aml_tdm_mute_playback(p_tdm->actrl, p_tdm->id, mute); + //aml_tdm_mute_playback(p_tdm->actrl, p_tdm->id, mute); } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { pr_debug("tdm capture mute: %d\n", mute); aml_tdm_mute_capture(p_tdm->actrl, p_tdm->id, mute);