From ac599abc4e41a2fe1d223ea0e0c73e2408d34397 Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Tue, 12 Mar 2019 20:16:17 +0900 Subject: [PATCH] odroid-common:Matching the mixer control with alsa-util Change-Id: I276e86be72f8bd00215b540e4c312ba5a4a1706c --- sound/soc/amlogic/auge/tdm.c | 2 ++ sound/soc/amlogic/auge/tdm_hw.c | 4 +++ sound/soc/amlogic/auge/tdm_hw.h | 1 + sound/soc/codecs/amlogic/aml_codec_t9015.c | 29 ++++++++++++++++------ 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/sound/soc/amlogic/auge/tdm.c b/sound/soc/amlogic/auge/tdm.c index 6ba98dbb6dff..8c1ad18eab87 100644 --- a/sound/soc/amlogic/auge/tdm.c +++ b/sound/soc/amlogic/auge/tdm.c @@ -404,6 +404,8 @@ static int aml_dai_tdm_prepare(struct snd_pcm_substream *substream, i2s_to_hdmitx_ctrl(p_tdm->id); aout_notifier_call_chain(AOUT_EVENT_IEC_60958_PCM, substream); + } else { + i2s_to_hdmitx_disable(); } fifo_id = aml_frddr_get_fifo_id(fr); diff --git a/sound/soc/amlogic/auge/tdm_hw.c b/sound/soc/amlogic/auge/tdm_hw.c index f8f89bc40264..83874c90c79e 100644 --- a/sound/soc/amlogic/auge/tdm_hw.c +++ b/sound/soc/amlogic/auge/tdm_hw.c @@ -694,6 +694,10 @@ void i2s_to_hdmitx_ctrl(int tdm_index) ); } +void i2s_to_hdmitx_disable(void) +{ + audiobus_write(EE_AUDIO_TOHDMITX_CTRL0, 0); +} void aml_tdm_mute_playback( struct aml_audio_controller *actrl, int tdm_index, diff --git a/sound/soc/amlogic/auge/tdm_hw.h b/sound/soc/amlogic/auge/tdm_hw.h index 85fe6303434f..791ecaabbabe 100644 --- a/sound/soc/amlogic/auge/tdm_hw.h +++ b/sound/soc/amlogic/auge/tdm_hw.h @@ -142,6 +142,7 @@ extern void aml_tdm_clk_pad_select( int tdm_index, int clk_sel); extern void i2s_to_hdmitx_ctrl(int tdm_index); +extern void i2s_to_hdmitx_disable(void); void aml_tdm_mute_playback( struct aml_audio_controller *actrl, int index, diff --git a/sound/soc/codecs/amlogic/aml_codec_t9015.c b/sound/soc/codecs/amlogic/aml_codec_t9015.c index 68d0af55b0a1..1ec6891d9912 100644 --- a/sound/soc/codecs/amlogic/aml_codec_t9015.c +++ b/sound/soc/codecs/amlogic/aml_codec_t9015.c @@ -56,7 +56,7 @@ struct aml_T9015_audio_priv { }; static const struct reg_default t9015_init_list[] = { - {AUDIO_CONFIG_BLOCK_ENABLE, 0x0000300F}, + {AUDIO_CONFIG_BLOCK_ENABLE, 0x00000000}, {ADC_VOL_CTR_PGA_IN_CONFIG, 0x00000000}, {DAC_VOL_CTR_DAC_SOFT_MUTE, 0xFEFE0000}, {LINE_OUT_CONFIG, 0x00001111}, @@ -202,15 +202,15 @@ static const struct snd_soc_dapm_widget T9015_audio_dapm_widgets[] = { /*DAC playback stream */ SND_SOC_DAPM_DAC("Left DAC", "HIFI Playback", - AUDIO_CONFIG_BLOCK_ENABLE, - DACL_EN, 0), + SND_SOC_NOPM, + 0, 0), SND_SOC_DAPM_DAC("Right DAC", "HIFI Playback", - AUDIO_CONFIG_BLOCK_ENABLE, - DACR_EN, 0), + SND_SOC_NOPM, + 0, 0), /*DRV output */ - SND_SOC_DAPM_OUT_DRV("LOLP_OUT_EN", AUDIO_CONFIG_BLOCK_ENABLE, - VMID_GEN_EN, 0, NULL, 0), + SND_SOC_DAPM_OUT_DRV("LOLP_OUT_EN", SND_SOC_NOPM, + 0, 0, NULL, 0), SND_SOC_DAPM_OUT_DRV("LOLN_OUT_EN", SND_SOC_NOPM, 0, 0, NULL, 0), SND_SOC_DAPM_OUT_DRV("LORP_OUT_EN", SND_SOC_NOPM, @@ -293,6 +293,7 @@ static int aml_T9015_hw_params(struct snd_pcm_substream *substream, snd_soc_codec_get_drvdata(codec); T9015_audio->params = params; + auge_toacodec_ctrl(T9015_audio->tdmout_index); return 0; } @@ -300,6 +301,20 @@ static int aml_T9015_hw_params(struct snd_pcm_substream *substream, static int aml_T9015_audio_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { + u32 value = snd_soc_read(codec, AUDIO_CONFIG_BLOCK_ENABLE); + bool Vmid_eanble = (bool)((value >> VMID_GEN_EN) & 0x1); + + if (!Vmid_eanble) { + value &= ~(0x1 << VMID_GEN_EN); + snd_soc_write(codec, AUDIO_CONFIG_BLOCK_ENABLE, value); + msleep(20); + value |= 0x1 << VMID_GEN_EN; + value |= 0x1 << BIAS_CURRENT_EN; + value |= 0x1 << REFP_BUF_EN; + value |= 0x3F; + snd_soc_write(codec, AUDIO_CONFIG_BLOCK_ENABLE, value); + } + switch (level) { case SND_SOC_BIAS_ON: