audio: Add supporting of DTS HD for HDMI input[2/2]

PD#172835

Add dynamic PAO mode for HDMI input

Change-Id: I91849eaef1b225fb8734ea128a092e1c2fece6b3
Signed-off-by: yujie.wu <yujie.wu@amlogic.com>
This commit is contained in:
yujie.wu
2018-08-30 17:17:40 +08:00
committed by Jianxin Pan
parent fcfd9cc47f
commit c45bca5d42
3 changed files with 53 additions and 5 deletions

View File

@@ -36,6 +36,7 @@
unsigned int IEC958_MODE = AIU_958_MODE_PCM16;
unsigned int I2S_MODE = AIU_I2S_MODE_PCM16;
unsigned int audio_in_source;
unsigned int bSpdifIN_PAO;
unsigned int IEC958_bpf = 0x7dd;
EXPORT_SYMBOL(IEC958_bpf);
@@ -521,8 +522,16 @@ static void spdifin_fifo1_set_buf(u32 addr, u32 size, u32 src)
*/
spdifin_reg_set();
/* only HDMI case use PAO mode */
if (audio_in_source == 2) {
if (bSpdifIN_PAO == 1)
src = PAO_IN;
}
/*3 byte mode, (23:0)*/
if (src == PAO_IN) {
aml_audin_update_bits(AUDIN_FIFO1_CTRL,
(0x7 << AUDIN_FIFO_DIN_SEL),
(PAO_IN << AUDIN_FIFO_DIN_SEL));
aml_audin_write(AUDIN_FIFO1_CTRL1, 0x08);
if (is_spdif_pao_support())
chipset_set_spdif_pao();

View File

@@ -138,6 +138,7 @@ enum {
extern unsigned int IEC958_MODE;
extern unsigned int I2S_MODE;
extern unsigned int audio_in_source;
extern unsigned int bSpdifIN_PAO;
void audio_set_aiubuf(u32 addr, u32 size, unsigned int channel,
snd_pcm_format_t format);

View File

@@ -266,6 +266,20 @@ static int aml_audio_set_in_source(struct snd_kcontrol *kcontrol,
return 0;
}
static int aml_audio_get_spdifin_pao(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.integer.value[0] = bSpdifIN_PAO;
return 0;
}
static int aml_audio_set_spdifin_pao(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
bSpdifIN_PAO = ucontrol->value.integer.value[0];
return 0;
}
/* i2s audio format detect: LPCM or NONE-LPCM */
static const char *const i2s_audio_type_texts[] = {
"LPCM", "NONE-LPCM", "UN-KNOWN"
@@ -803,6 +817,10 @@ static const struct snd_kcontrol_new av_controls[] = {
};
static const struct snd_kcontrol_new aml_tv_controls[] = {
SOC_SINGLE_BOOL_EXT("SPDIFIN PAO",
0,
aml_audio_get_spdifin_pao,
aml_audio_set_spdifin_pao),
SOC_ENUM_EXT("Audio In Source",
audio_in_source_enum,
aml_audio_get_in_source,
@@ -1590,7 +1608,11 @@ static void parse_dac_channel_mask(struct snd_soc_card *card)
}
/*Acodec DAC0 selects i2s source*/
of_property_read_string(np, "DAC0_Channel_Mask", &str);
ret = of_property_read_string(np, "DAC0_Channel_Mask", &str);
if (ret) {
pr_err("error:read DAC0_Channel_Mask\n");
return;
}
ret = check_channel_mask(str);
if (ret >= 0) {
p_aml_audio->DAC0_Channel_Mask = ret;
@@ -1598,7 +1620,11 @@ static void parse_dac_channel_mask(struct snd_soc_card *card)
p_aml_audio->DAC0_Channel_Mask);
}
/*Acodec DAC1 selects i2s source*/
of_property_read_string(np, "DAC1_Channel_Mask", &str);
ret = of_property_read_string(np, "DAC1_Channel_Mask", &str);
if (ret) {
pr_err("error:read DAC1_Channel_Mask\n");
return;
}
ret = check_channel_mask(str);
if (ret >= 0) {
p_aml_audio->DAC1_Channel_Mask = ret;
@@ -1627,7 +1653,11 @@ static void parse_eqdrc_channel_mask(struct snd_soc_card *card)
}
/*Hardware EQ and DRC can be muxed to i2s 2 channels*/
of_property_read_string(np, "EQ_DRC_Channel_Mask", &str);
ret = of_property_read_string(np, "EQ_DRC_Channel_Mask", &str);
if (ret) {
pr_err("error:read EQ_DRC_Channel_Mask\n");
return;
}
ret = check_channel_mask(str);
if (ret >= 0) {
p_aml_audio->EQ_DRC_Channel_Mask = ret;
@@ -1643,8 +1673,12 @@ static void parse_eqdrc_channel_mask(struct snd_soc_card *card)
/* If spdif is same source to i2s,
* it can be muxed to i2s 2 channels
*/
of_property_read_string(np,
ret = of_property_read_string(np,
"Spdif_samesource_Channel_Mask", &str);
if (ret) {
pr_err("error:read Spdif_samesource_Channel_Mask\n");
return;
}
ret = check_channel_mask(str);
if (ret >= 0) {
p_aml_audio->Spdif_samesource_Channel_Mask = ret;
@@ -1677,8 +1711,12 @@ static void parse_samesource_channel_mask(struct snd_soc_card *card)
/* If spdif is same source to i2s,
* it can be muxed to i2s 2 channels
*/
of_property_read_string(np,
ret = of_property_read_string(np,
"Spdif_samesource_Channel_Mask", &str);
if (ret) {
pr_err("error:read Spdif_samesource_Channel_Mask\n");
return;
}
ret = check_channel_mask(str);
if (ret >= 0) {
p_aml_audio->Spdif_samesource_Channel_Mask = ret;