audio: Add HBR audio info for HDMI input [2/3]

PD#SWPL-3435

Problem:
  P321 doesn't support DTS HD decoding

Solution:
  In HDMI RX module, we add a new field to
  indicate whether the input audio is HBR.
  With this info, hal can enable the PAO
  mode  to decode the HBR audio.

Verify:
  P321

Change-Id: I6fd180e6636905f5119fe1d313214d4b56d07d5e
Signed-off-by: yujie.wu <yujie.wu@amlogic.com>

Conflicts:
	drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h
	drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c
This commit is contained in:
yujie.wu
2019-01-21 17:25:19 +08:00
committed by Luke Go
parent 44f7a81ee0
commit 2247e37c4b
7 changed files with 96 additions and 23 deletions

View File

@@ -34,7 +34,7 @@
#include "hdmi_rx_edid.h"
#define RX_VER0 "ver.2018-11-8"
#define RX_VER0 "ver.2019-01-22"
/*
*
*

View File

@@ -913,23 +913,22 @@ if (audio_info->cts != 0) {
*/
void rx_get_audio_status(struct rx_audio_stat_s *aud_sts)
{
if ((rx.state == FSM_SIG_READY) &&
(rx.pre.sw_vic != HDMI_UNKNOWN) &&
(rx.pre.sw_vic != HDMI_UNSUPPORT) &&
(rx.avmute_skip == 0)) {
aud_sts->aud_rcv_flag =
(rx.aud_info.aud_packet_received == 0) ? false : true;
aud_sts->aud_stb_flag = true;
aud_sts->aud_sr = rx.aud_info.real_sr;
aud_sts->aud_channel_cnt = rx.aud_info.channel_count;
aud_sts->aud_type = rx.aud_info.coding_type;
aud_sts->afifo_thres_pass =
((hdmirx_rd_dwc(DWC_AUD_FIFO_STS) &
THS_PASS_STS) == 0) ? false : true;
} else {
memset(aud_sts, 0,
sizeof(struct rx_audio_stat_s));
}
if ((rx.state == FSM_SIG_READY) &&
(rx.pre.sw_vic != HDMI_UNKNOWN) &&
(rx.pre.sw_vic != HDMI_UNSUPPORT) &&
(rx.avmute_skip == 0)) {
aud_sts->aud_rcv_packet = rx.aud_info.aud_packet_received;
aud_sts->aud_stb_flag = true;
aud_sts->aud_sr = rx.aud_info.real_sr;
aud_sts->aud_channel_cnt = rx.aud_info.channel_count;
aud_sts->aud_type = rx.aud_info.coding_type;
aud_sts->afifo_thres_pass =
((hdmirx_rd_dwc(DWC_AUD_FIFO_STS) &
THS_PASS_STS) == 0) ? false : true;
} else {
memset(aud_sts, 0,
sizeof(struct rx_audio_stat_s));
}
}
EXPORT_SYMBOL(rx_get_audio_status);

View File

@@ -464,7 +464,7 @@ struct dfe_adcpll_para {
struct rx_audio_stat_s {
/*audio packets received*/
bool aud_rcv_flag;
int aud_rcv_packet;
/*audio stable status*/
bool aud_stb_flag;
/*audio sample rate*/

View File

@@ -71,6 +71,10 @@ extern int aml_get_atmos_audio_edid(
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
extern int aml_get_hdmiin_audio_packet(
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
#endif
#endif

View File

@@ -800,6 +800,11 @@ static const struct snd_kcontrol_new extn_controls[] = {
aml_get_hdmiin_audio_format,
NULL),
SOC_ENUM_EXT("HDMIIN Audio Packet",
hdmi_in_status_enum[4],
aml_get_hdmiin_audio_packet,
NULL),
SOC_SINGLE_BOOL_EXT("HDMI ATMOS EDID Switch",
0,
aml_get_atmos_audio_edid,

View File

@@ -176,6 +176,16 @@ static const char * const hdmi_in_format[] = {
"WMA_PRO"
};
static const char * const hdmi_in_audio_packet[] = {
"None",
"AUDS",
"OBA",
"DST",
"HBR",
"OBM",
"MAS"
};
const struct soc_enum hdmi_in_status_enum[] = {
SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(audio_is_stable),
audio_is_stable),
@@ -184,7 +194,9 @@ const struct soc_enum hdmi_in_status_enum[] = {
SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(hdmi_in_channels),
hdmi_in_channels),
SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(hdmi_in_format),
hdmi_in_format)
hdmi_in_format),
SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, ARRAY_SIZE(hdmi_in_audio_packet),
hdmi_in_audio_packet)
};
int aml_get_hdmiin_audio_stable(
@@ -194,7 +206,8 @@ int aml_get_hdmiin_audio_stable(
struct rx_audio_stat_s aud_sts;
rx_get_audio_status(&aud_sts);
ucontrol->value.integer.value[0] = aud_sts.aud_rcv_flag;
ucontrol->value.integer.value[0] =
(aud_sts.aud_rcv_packet == 0) ? 0 : 1;
return 0;
}
@@ -236,6 +249,7 @@ int aml_get_hdmiin_audio_format(
return 0;
}
/* call HDMI CEC API to enable arc audio */
int aml_set_atmos_audio_edid(
struct snd_kcontrol *kcontrol,
@@ -259,4 +273,44 @@ int aml_get_atmos_audio_edid(
return 0;
}
int aml_get_hdmiin_audio_packet(
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct rx_audio_stat_s aud_sts;
int val;
rx_get_audio_status(&aud_sts);
switch (aud_sts.aud_rcv_packet) {
case 0:
val = 0;
break;
case 1:
val = 1;
break;
case 2:
val = 2;
break;
case 4:
val = 3;
break;
case 8:
val = 4;
break;
case 16:
val = 5;
break;
case 32:
val = 6;
break;
default:
val = 0;
break;
}
ucontrol->value.integer.value[0] = val;
return 0;
}
#endif

View File

@@ -285,9 +285,17 @@ static int aml_get_spdif_audio_type(
int audio_type = 0;
int i;
int total_num = sizeof(type_texts)/sizeof(struct spdif_audio_info);
int pc = aml_audin_read(AUDIN_SPDIF_NPCM_PCPD)>>16;
int pc_ori = aml_audin_read(AUDIN_SPDIF_NPCM_PCPD)>>16;
int pc = 0;
pc = pc&0xfff;
/* data type is 0~4 bit*/
pc = pc_ori&0x1f;
/* check whether it has stop bit
* refer to IEC61937-1 table 9
*/
if (pc == 0) {
pc = pc_ori&0xfff;
}
for (i = 0; i < total_num; i++) {
if (pc == type_texts[i].pc) {
audio_type = type_texts[i].aud_type;
@@ -616,6 +624,9 @@ static const struct snd_kcontrol_new aml_tv_controls[] = {
SOC_ENUM_EXT("HDMIIN audio format", hdmi_in_status_enum[3],
aml_get_hdmiin_audio_format,
NULL),
SOC_ENUM_EXT("HDMIIN Audio Packet", hdmi_in_status_enum[4],
aml_get_hdmiin_audio_packet,
NULL),
SOC_SINGLE_BOOL_EXT("HDMI ATMOS EDID Switch", 0,
aml_get_atmos_audio_edid,
aml_set_atmos_audio_edid),