audio: meson: sdd sound card support for txl

PD#168480: audio: meson: add sound card support for txl

Change-Id: I89117e1cfee2bc99289b00f8ead4acb2f1b13a98
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
This commit is contained in:
Xing Wang
2018-07-12 22:17:24 +08:00
committed by Yixun Lan
parent 3f043af06c
commit e45014a44b
8 changed files with 49 additions and 13 deletions

View File

@@ -463,6 +463,7 @@ CONFIG_AMLOGIC_SND_CODEC_DUMMY_CODEC=y
CONFIG_AMLOGIC_SND_CODEC_PCM2BT=y
CONFIG_AMLOGIC_SND_CODEC_PDM_DUMMY_CODEC=y
CONFIG_AMLOGIC_SND_CODEC_AMLT9015=y
CONFIG_AMLOGIC_SND_CODEC_AMLT9015S=y
CONFIG_AMLOGIC_SND_CODEC_TXLX_ACODEC=y
CONFIG_AMLOGIC_SND_SOC_TAS5707=y
CONFIG_AMLOGIC_SND_SOC_TLV320ADC3101=y

View File

@@ -407,6 +407,7 @@ CONFIG_AMLOGIC_SND_CODEC_DUMMY_CODEC=y
CONFIG_AMLOGIC_SND_CODEC_PCM2BT=y
CONFIG_AMLOGIC_SND_CODEC_PDM_DUMMY_CODEC=y
CONFIG_AMLOGIC_SND_CODEC_AMLT9015=y
CONFIG_AMLOGIC_SND_CODEC_AMLT9015S=y
CONFIG_AMLOGIC_SND_CODEC_TXLX_ACODEC=y
CONFIG_AMLOGIC_SND_SOC_TAS5707=y
CONFIG_AMLOGIC_SND_SOC_TLV320ADC3101=y

View File

@@ -494,6 +494,7 @@ static struct meson_pmx_group meson_txl_periphs_groups[] = {
GROUP(uart_rts_c, 4, 22),
GROUP(spdif_out, 3, 30),
GROUP(spdif_in, 3, 31),
GROUP(i2s_aoclk_out_z, 4, 9),
GROUP(i2s_lrclk_out_z, 4, 8),
GROUP(i2s_aoclk_in_z, 4, 3),
GROUP(i2s_lrclk_in_z, 4, 2),
@@ -812,7 +813,7 @@ static const char * const hdmirx_d_groups[] = {
static const char * const i2s_groups[] = {
"i2s_lrclk_out_dv", "i2s_aoclk_in_dv", "i2s_lrclk_in_dv",
"i2s_amclk_dv", "i2s_out_ch01_dv", "i2s_in_ch01_dv",
"i2s_aoclk_out_z",
"i2s_lrclk_out_z", "i2s_aoclk_in_z", "i2s_lrclk_in_z",
"i2s_amclk_z", "i2s_out_ch01_z", "i2s_in_ch01_z",

View File

@@ -405,7 +405,7 @@ static const struct snd_soc_component_driver aml_component = {
/*
* vdac_clk should be managed in audio module for kernel4.9,
* not in vpu for kernel3.14
* aud_buf has been remove from txlx/txhd
* aud_buf has been remove from txl/txlx/txhd
*/
static const char *const gate_names[] = {
"top_glue", "aud_buf", "i2s_out", "amclk_measure",

View File

@@ -1963,6 +1963,13 @@ int txhd_set_audin_source(int audin_src)
return 0;
}
int txl_set_resample_param(int index)
{
set_hw_resample_param(index);
return 0;
}
int txlx_set_resample_param(int index)
{
set_hw_resample_param(index);
@@ -1994,6 +2001,7 @@ static struct aml_card_info tv_txl_info = {
},
.chipset_init = txl_chipset_init,
.set_audin_source = txl_set_audin_source,
.set_resample_param = txl_set_resample_param,
};
static struct aml_card_info tv_txlx_info = {

View File

@@ -48,6 +48,16 @@ config AMLOGIC_SND_CODEC_AMLT9015
AMLT9015 codec,
this codec is internal
config AMLOGIC_SND_CODEC_AMLT9015S
bool "Amlogic Audio AMLT9015S codec"
depends on AMLOGIC_SND_SOC_CODECS
default n
help
Amlogic Audio codec,
AMLT9015S codec,
AMLT9015S codec,
this codec is internal
config AMLOGIC_SND_CODEC_PMU3
bool "Amlogic Audio AML PMU3 codec"
depends on AMLOGIC_SND_SOC_CODECS

View File

@@ -6,6 +6,7 @@ snd-soc-dummy_codec-objs := dummy_codec.o
snd-soc-pdm-dummy-objs := pdm_dummy.o
snd-soc-pcm2bt-objs := pcm2bt.o
snd-soc-aml_t9015-objs := aml_codec_t9015.o
snd-soc-aml_t9015s-objs := aml_codec_t9015S.o
snd-soc-pmu3-objs := aml_pmu3.o
snd-soc-aml_codec_txlx_acodec-objs := aml_codec_txlx_acodec.o
@@ -22,6 +23,7 @@ obj-$(CONFIG_AMLOGIC_SND_CODEC_DUMMY_CODEC) += snd-soc-dummy_codec.o
obj-$(CONFIG_AMLOGIC_SND_CODEC_PDM_DUMMY_CODEC) += snd-soc-pdm-dummy.o
obj-$(CONFIG_AMLOGIC_SND_CODEC_PCM2BT) += snd-soc-pcm2bt.o
obj-$(CONFIG_AMLOGIC_SND_CODEC_AMLT9015) += snd-soc-aml_t9015.o
obj-$(CONFIG_AMLOGIC_SND_CODEC_AMLT9015S) += snd-soc-aml_t9015s.o
obj-$(CONFIG_AMLOGIC_SND_CODEC_PMU3) += snd-soc-pmu3.o
obj-$(CONFIG_AMLOGIC_SND_CODEC_TXLX_ACODEC) += snd-soc-aml_codec_txlx_acodec.o

View File

@@ -46,7 +46,7 @@ struct aml_T9015S_audio_priv {
};
static const struct reg_default t9015s_init_list[] = {
{AUDIO_CONFIG_BLOCK_ENABLE, 0x1403BCFF},
{AUDIO_CONFIG_BLOCK_ENABLE, 0x34003CFF},
{ADC_VOL_CTR_PGA_IN_CONFIG, 0x50502929},
{DAC_VOL_CTR_DAC_SOFT_MUTE, 0xFBFB0000},
{LINE_OUT_CONFIG, 0x00004444},
@@ -106,7 +106,7 @@ static int aml_DAC_Gain_set_enum(
pr_info("It has risk of distortion!\n");
}
snd_soc_write(codec, val, add);
snd_soc_write(codec, add, val);
return 0;
}
@@ -230,7 +230,7 @@ static const struct snd_soc_dapm_widget T9015S_audio_dapm_widgets[] = {
SND_SOC_DAPM_PGA("PGAL_IN_EN", AUDIO_CONFIG_BLOCK_ENABLE,
PGAL_IN_EN, 0, NULL, 0),
SND_SOC_DAPM_PGA("PGAR_IN_EN", AUDIO_CONFIG_BLOCK_ENABLE,
PGAL_IN_EN, 0, NULL, 0),
PGAR_IN_EN, 0, NULL, 0),
/*PGA input source select */
SND_SOC_DAPM_MUX("Linein left switch", SND_SOC_NOPM,
@@ -381,11 +381,8 @@ static int aml_T9015S_audio_set_bias_level(struct snd_soc_codec *codec,
break;
case SND_SOC_BIAS_STANDBY:
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
codec->cache_only = false;
codec->cache_sync = 1;
if (codec->component.dapm.bias_level == SND_SOC_BIAS_OFF)
snd_soc_cache_sync(codec);
}
break;
case SND_SOC_BIAS_OFF:
@@ -395,7 +392,7 @@ static int aml_T9015S_audio_set_bias_level(struct snd_soc_codec *codec,
default:
break;
}
codec->dapm.bias_level = level;
codec->component.dapm.bias_level = level;
return 0;
}
@@ -403,7 +400,23 @@ static int aml_T9015S_audio_set_bias_level(struct snd_soc_codec *codec,
static int aml_T9015S_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
/*struct snd_soc_codec *codec = dai->codec;*/
struct snd_soc_codec *codec = dai->codec;
u32 value = snd_soc_read(codec, AUDIO_CONFIG_BLOCK_ENABLE);
bool Vmid_eanble = (bool)((value >> VMID_GEN_EN) & 0x1);
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && !Vmid_eanble) {
pr_info("aml_T9015S_prepare caputre!\n");
value |= 0x1 << VMID_GEN_EN;
snd_soc_write(codec, AUDIO_CONFIG_BLOCK_ENABLE, value);
} else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
pr_info("aml_T9015S_prepare playback!\n");
value &= ~(0x1 << VMID_GEN_EN);
snd_soc_write(codec, AUDIO_CONFIG_BLOCK_ENABLE, value);
msleep(20);
value |= 0x1 << VMID_GEN_EN;
snd_soc_write(codec, AUDIO_CONFIG_BLOCK_ENABLE, value);
}
return 0;
}
@@ -466,7 +479,7 @@ static int aml_T9015S_audio_probe(struct snd_soc_codec *codec)
aml_audin_update_bits(AUDIN_SOURCE_SEL, 3, 3);
codec->dapm.bias_level = SND_SOC_BIAS_STANDBY;
codec->component.dapm.bias_level = SND_SOC_BIAS_STANDBY;
T9015S_audio->codec = codec;
return 0;
@@ -492,7 +505,7 @@ static int aml_T9015S_audio_resume(struct snd_soc_codec *codec)
aml_T9015S_audio_reset(codec);
aml_T9015S_audio_start_up(codec);
aml_T9015S_audio_reg_init(codec);
codec->dapm.bias_level = SND_SOC_BIAS_STANDBY;
codec->component.dapm.bias_level = SND_SOC_BIAS_STANDBY;
aml_T9015S_audio_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
}