From ab7022facd0baf980672025dc9f84b359a0e6246 Mon Sep 17 00:00:00 2001 From: Zongdong Jiao Date: Thu, 15 Aug 2019 15:43:40 +0800 Subject: [PATCH] hdmitx: parsing basic audio [1/1] PD#SWPL-12779 Problem: For some RX, the audio block of its EDID contains other audio type(eg. DD), without PCM. Solution: Check the parsed EDID data, add default PCM type when it contains other audio type w/o PCM. Verify: G12/U212 Change-Id: Ia343149ffd4e73970fd76c08a5fde4ee1fe78656 Signed-off-by: Zongdong Jiao --- .../media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c | 34 ++++++++++++++++++++-- .../amlogic/media/vout/hdmi_tx/hdmi_tx_module.h | 2 +- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c index 8447b77..020aacc 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c @@ -1532,7 +1532,6 @@ static int hdmitx_edid_block_parse(struct hdmitx_dev *hdmitx_device, pRXCap->number_of_dtd += BlockBuf[3] & 0xf; pRXCap->native_VIC = 0xff; - pRXCap->AUD_count = 0; Edid_Y420CMDB_Reset(&(hdmitx_device->hdmi_info)); @@ -1746,7 +1745,7 @@ static void hdmitx_edid_set_default_aud(struct hdmitx_dev *hdev) pRXCap->RxAudioCap[0].audio_format_code = 1; /* PCM */ pRXCap->RxAudioCap[0].channel_num_max = 1; /* 2ch */ pRXCap->RxAudioCap[0].freq_cc = 7; /* 32/44.1/48 kHz */ - pRXCap->RxAudioCap[0].cc3 = 7; /* 16/20/24 bit */ + pRXCap->RxAudioCap[0].cc3 = 1; /* 16bit */ } /* add default VICs for DVI case */ @@ -2045,6 +2044,35 @@ next: dump_dtd_info(t); } +static void edid_check_pcm_declare(struct rx_cap *pRXCap) +{ + int idx_pcm = 0; + int i; + + if (!pRXCap->AUD_count) + return; + + /* Try to find more than 1 PCMs, RxAudioCap[0] is always basic audio */ + for (i = 1; i < pRXCap->AUD_count; i++) { + if (pRXCap->RxAudioCap[i].audio_format_code == + pRXCap->RxAudioCap[0].audio_format_code) { + idx_pcm = i; + break; + } + } + + /* Remove basic audio */ + if (idx_pcm) { + for (i = 0; i < pRXCap->AUD_count - 1; i++) + memcpy(&pRXCap->RxAudioCap[i], + &pRXCap->RxAudioCap[i + 1], + sizeof(struct rx_audiocap)); + /* Clear the last audio declaration */ + memset(&pRXCap->RxAudioCap[i], 0, sizeof(struct rx_audiocap)); + pRXCap->AUD_count--; + } +} + static void hdrinfo_to_vinfo(struct vinfo_s *info, struct rx_cap *pRXCap) { unsigned int k, l; @@ -2313,7 +2341,7 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device) hdmitx_edid_block_parse(hdmitx_device, &(EDID_buf[i*128])); } - + edid_check_pcm_declare(&hdmitx_device->RXCap); /* * Because DTDs are not able to represent some Video Formats, which can be * represented as SVDs and might be preferred by Sinks, the first DTD in the diff --git a/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h b/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h index 76ea183..cacea67 100644 --- a/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h +++ b/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h @@ -27,7 +27,7 @@ #include /* HDMITX driver version */ -#define HDMITX_VER "20190715" +#define HDMITX_VER "20190815" /* chip type */ #define MESON_CPU_ID_M8B 0 -- 2.7.4