hdmi_tx: improve display of current hdmi config

Use register info to get info about current config and display it in a more human
readable format.
This commit is contained in:
cdu13a
2019-04-06 21:04:11 -04:00
committed by Dongjin Kim
parent f77581e5cf
commit f85efc92c9

View File

@@ -58,6 +58,8 @@
#include <linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h>
#include <linux/amlogic/media/vout/hdmi_tx/hdmi_config.h>
#include "hw/tvenc_conf.h"
#include "hw/hdmi_tx_reg.h"
#include "hw/mach_reg.h"
#include "hw/common.h"
#include "hw/hw_clk.h"
#include "hdmi_tx_hdcp.h"
@@ -459,6 +461,10 @@ static int set_disp_mode_auto(void)
struct hdmi_format_para *para = NULL;
unsigned char mode[32];
enum hdmi_vic vic = HDMI_Unknown;
char* pix_fmt[] = {"RGB","YUV422","YUV444","YUV420"};
char* eotf[] = {"SDR","HDR","HDR10","HLG"};
char* range[] = {"default","limited","full"};
/* vic_ready got from IP */
enum hdmi_vic vic_ready = hdev->HWOp.GetState(
hdev, STAT_VIDEO_VIC, 0);
@@ -1822,6 +1828,11 @@ static ssize_t show_config(struct device *dev,
int pos = 0;
unsigned char *conf;
struct hdmitx_dev *hdev = &hdmitx_device;
char* pix_fmt[] = {"RGB","YUV422","YUV444","YUV420"};
char* eotf[] = {"SDR","HDR","HDR10","HLG"};
char* range[] = {"default","limited","full"};
char* colourimetry[] = {"default", "BT.601", "BT.709", "xvYCC601","xvYCC709",
"sYCC601","Adobe_YCC601","Adobe_RGB","BT.2020c","BT.2020nc","P3 D65","P3 DCI"};
pos += snprintf(buf+pos, PAGE_SIZE, "cur_VIC: %d\n", hdev->cur_VIC);
if (hdev->cur_video_param)
@@ -1829,10 +1840,26 @@ static ssize_t show_config(struct device *dev,
"cur_video_param->VIC=%d\n",
hdev->cur_video_param->VIC);
if (hdev->para) {
pos += snprintf(buf+pos, PAGE_SIZE, "cd = %d\n",
hdev->para->cd);
pos += snprintf(buf+pos, PAGE_SIZE, "cs = %d\n",
hdev->para->cs);
struct hdmi_format_para *para;
para = hdev->para;
pos += snprintf(buf+pos, PAGE_SIZE, "VIC: %d %s\n",
hdmitx_device.cur_VIC, para->name);
pos += snprintf(buf + pos, PAGE_SIZE, "Colour depth: %d-bit\nColourspace: %s\nColour range: %s\nEOTF: %s\nYCC colour range: %s\n",
(((hdmitx_rd_reg(HDMITX_DWC_TX_INVID0) & 0x6) >> 1) + 4 ) * 2,
pix_fmt[(hdmitx_rd_reg(HDMITX_DWC_FC_AVICONF0) & 0x3)],
range[(hdmitx_rd_reg(HDMITX_DWC_FC_AVICONF2) & 0xc) >> 2],
eotf[(hdmitx_rd_reg(HDMITX_DWC_FC_DRM_PB00) & 7)],
range[((hdmitx_rd_reg(HDMITX_DWC_FC_AVICONF3) & 0xc) >> 2) + 1]);
if (((hdmitx_rd_reg(HDMITX_DWC_FC_AVICONF1) & 0xc0) >> 6) < 0x3)
pos += snprintf(buf + pos, PAGE_SIZE, "Colourimetry: %s\n",
colourimetry[(hdmitx_rd_reg(HDMITX_DWC_FC_AVICONF1) & 0xc0) >> 6]);
else
pos += snprintf(buf + pos, PAGE_SIZE, "Colourimetry: %s\n",
colourimetry[((hdmitx_rd_reg(HDMITX_DWC_FC_AVICONF2) & 0x70) >> 4) + 3]);
pos += snprintf(buf + pos, PAGE_SIZE, "PLL clock: 0x%08x, Vid clock div 0x%08x\n",
hd_read_reg(P_HHI_HDMI_PLL_CNTL),
hd_read_reg(P_HHI_VID_PLL_CLK_DIV));
}
switch (hdev->tx_aud_cfg) {