ODROID-COMMON:C4 i2s/line-out error fix

Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: I86efb023d46dbef769d548be81b7357a015dc0e2
This commit is contained in:
ckkim
2020-12-09 17:13:38 +09:00
committed by Luke go
parent cd78762894
commit 424b298e61
6 changed files with 48 additions and 41 deletions

View File

@@ -40,6 +40,10 @@
#include "resample_hw.h"
#include "spdif.h"
#ifdef CONFIG_ARCH_MESON64_ODROID_COMMON
#include <linux/platform_data/board_odroid.h>
#endif
#define DRV_NAME "snd_spdif"
/* Debug by PTM when bringup */
@@ -1082,6 +1086,9 @@ static int aml_dai_spdif_probe(struct snd_soc_dai *cpu_dai)
__func__);
}
/* config ddr arb */
aml_spdif_arb_config(p_spdif->actrl);
return 0;
}
@@ -1237,13 +1244,19 @@ static int aml_dai_spdif_prepare(
spdif_get_channel_status_info(&chsts, runtime->rate);
spdif_set_channel_status_info(&chsts, p_spdif->id);
/* TOHDMITX_CTRL0
* Both spdif_a/spdif_b would notify to hdmitx
*/
spdifout_to_hdmitx_ctrl(p_spdif->id);
/* notify to hdmitx */
spdif_notify_to_hdmitx(substream);
/* TOHDMITX_CTRL0 */
if (!board_is_odroidn2()) {
spdifout_to_hdmitx_ctrl(p_spdif->id);
/* notify to hdmitx */
spdif_notify_to_hdmitx(substream);
} else {
/* ODROID-N2 is spdif_b only would notify to hdmitx */
if (p_spdif->id == 1) {
spdifout_to_hdmitx_ctrl(p_spdif->id);
/* notify to hdmitx */
spdif_notify_to_hdmitx(substream);
}
}
} else {
struct toddr *to = p_spdif->tddr;
struct toddr_fmt fmt;

View File

@@ -23,6 +23,12 @@
#include <linux/amlogic/media/sound/aout_notify.h>
#ifdef CONFIG_ARCH_MESON64_ODROID_COMMON
#include <linux/platform_data/board_odroid.h>
#else
#define board_is_odroidn2() (0)
#endif
/*#define G12A_PTM*/
/*#define __PTM_SPDIF_INTERNAL_LB__*/
@@ -663,12 +669,15 @@ void spdifout_play_with_zerodata(unsigned int spdif_id, bool reenable)
/* spdif clk */
//spdifout_clk_ctrl(spdif_id, true);
if (!board_is_odroidn2()) {
/* spdif to hdmitx */
#if defined(CONFIG_ARCH_MESON64_ODROIDN2)
/* ODROID spdif_b only to hdmitx */
if (spdif_id == 1)
#endif
spdifout_to_hdmitx_ctrl(spdif_id);
spdifout_to_hdmitx_ctrl(spdif_id);
} else {
/* ODROID-N2 spdif_b only to hdmitx */
if (spdif_id == 1)
spdifout_to_hdmitx_ctrl(spdif_id);
}
/* spdif ctrl */
spdifout_fifo_ctrl(spdif_id,

View File

@@ -508,8 +508,6 @@ 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);
@@ -923,10 +921,17 @@ static int aml_tdm_set_clk_pad(struct aml_tdm *p_tdm)
p_tdm->clk_sel);
}
#ifdef CONFIG_ARCH_MESON64_ODROID_COMMON
aml_tdm_sclk_pad_select(p_tdm->actrl,
mpad_offset,
p_tdm->id,
p_tdm->clk_sel);
#else
aml_tdm_sclk_pad_select(p_tdm->actrl,
mpad_offset,
p_tdm->id,
p_tdm->id);
#endif
return 0;
}

View File

@@ -775,10 +775,6 @@ 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,

View File

@@ -156,7 +156,6 @@ void aml_tdm_sclk_pad_select(struct aml_audio_controller *actrl,
int mpad_offset, 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,

View File

@@ -56,7 +56,7 @@ struct aml_T9015_audio_priv {
};
static const struct reg_default t9015_init_list[] = {
{AUDIO_CONFIG_BLOCK_ENABLE, 0x00000000},
{AUDIO_CONFIG_BLOCK_ENABLE, 0x0000300F},
{ADC_VOL_CTR_PGA_IN_CONFIG, 0x00000000},
{DAC_VOL_CTR_DAC_SOFT_MUTE, 0xFEFE0000},
{LINE_OUT_CONFIG, 0x00001111},
@@ -218,15 +218,15 @@ static const struct snd_soc_dapm_widget T9015_audio_dapm_widgets[] = {
/*DAC playback stream */
SND_SOC_DAPM_DAC("Left DAC", "HIFI Playback",
SND_SOC_NOPM,
0, 0),
AUDIO_CONFIG_BLOCK_ENABLE,
DACL_EN, 0),
SND_SOC_DAPM_DAC("Right DAC", "HIFI Playback",
SND_SOC_NOPM,
0, 0),
AUDIO_CONFIG_BLOCK_ENABLE,
DACR_EN, 0),
/*DRV output */
SND_SOC_DAPM_OUT_DRV("LOLP_OUT_EN", SND_SOC_NOPM,
0, 0, NULL, 0),
SND_SOC_DAPM_OUT_DRV("LOLP_OUT_EN", AUDIO_CONFIG_BLOCK_ENABLE,
VMID_GEN_EN, 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,
@@ -348,7 +348,6 @@ 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;
}
@@ -356,20 +355,6 @@ 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: