audio: Add HBR audio info for HDMI input [2/3]
authoryujie.wu <yujie.wu@amlogic.com>
Mon, 21 Jan 2019 09:25:19 +0000 (17:25 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Fri, 25 Jan 2019 11:39:49 +0000 (03:39 -0800)
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>
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_drv.h
drivers/amlogic/media/vin/tvin/hdmirx/hdmi_rx_hw.c
include/linux/amlogic/media/frame_provider/tvin/tvin.h
include/linux/amlogic/media/sound/misc.h
sound/soc/amlogic/auge/extn.c
sound/soc/amlogic/common/misc.c
sound/soc/amlogic/meson/tv.c

index 1c169f0..168eb52 100644 (file)
@@ -34,7 +34,7 @@
 #include "hdmi_rx_edid.h"
 
 
-#define RX_VER0 "ver.2019-01-08"
+#define RX_VER0 "ver.2019-01-22"
 /*
  *
  *
index fe26257..1745113 100644 (file)
@@ -958,8 +958,7 @@ void rx_get_audio_status(struct rx_audio_stat_s *aud_sts)
                (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_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;
index 84b5f14..5b64766 100644 (file)
@@ -485,7 +485,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*/
index 7f3edbf..e4b7bdb 100644 (file)
@@ -62,6 +62,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
index 55d3e46..65c4e8d 100644 (file)
@@ -726,6 +726,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,
index 42d7e23..8da6fd5 100644 (file)
@@ -162,6 +162,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),
@@ -170,7 +180,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(
@@ -180,7 +192,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;
 }
@@ -222,6 +235,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,
@@ -245,4 +259,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
index 6c184fd..ac46bba 100644 (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;
@@ -632,6 +640,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),