debughdmitx21: add hdmitx sysfs node for bugreport in driver [1/2]

PD#SWPL-165255

Problem:
add hdmitx sysfs node for bugreport in hdmitx21 driver

Solution:
add /proc/amhdmitx
add clkmsr
add hdmitx_basic_config
add hdmitx_pkt_dump

Verify:
s7/s5

Test:
DRM-TX-79,DRM-TX-80,DRM-TX-81,DRM-TX-82,DRM-TX-110

Change-Id: Ib4193d3cc4af31912262af6fd2feb638897fb812
Signed-off-by: xiang.wu1 <xiang.wu1@amlogic.com>
This commit is contained in:
xiang.wu1
2024-04-15 17:59:54 +08:00
committed by gerrit autosubmit
parent 6f9634edd6
commit ba9274bd9d
8 changed files with 898 additions and 64 deletions
+17 -17
View File
@@ -611,6 +611,12 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data)
struct rx_cap *prxcap = &hdev->tx_comm.rxcap;
HDMITX_DEBUG_PACKET("%s[%d]\n", __func__, __LINE__);
if (data)
memcpy(&drm_config_data, data,
sizeof(struct master_display_info_s));
else
memset(&drm_config_data, 0,
sizeof(struct master_display_info_s));
spin_lock_irqsave(&hdev->tx_comm.edid_spinlock, flags);
/* if currently output 8bit, when csc_en is 1 and
@@ -628,12 +634,6 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data)
}
}
if (data)
memcpy(&drm_config_data, data,
sizeof(struct master_display_info_s));
else
memset(&drm_config_data, 0,
sizeof(struct master_display_info_s));
if (hsty_drm_config_loc > 7)
hsty_drm_config_loc = 0;
memcpy(&hsty_drm_config_data[hsty_drm_config_loc++],
@@ -928,17 +928,17 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type,
unsigned long flags = 0;
HDMITX_DEBUG_PACKET("%s[%d]\n", __func__, __LINE__);
spin_lock_irqsave(&hdev->tx_comm.edid_spinlock, flags);
if (hdev->bist_lock) {
spin_unlock_irqrestore(&hdev->tx_comm.edid_spinlock, flags);
return;
}
if (!data)
memcpy(&vsif_debug_info.data, &para,
sizeof(struct dv_vsif_para));
else
memcpy(&vsif_debug_info.data, data,
sizeof(struct dv_vsif_para));
spin_lock_irqsave(&hdev->tx_comm.edid_spinlock, flags);
if (hdev->bist_lock) {
spin_unlock_irqrestore(&hdev->tx_comm.edid_spinlock, flags);
return;
}
vsif_debug_info.type = type;
vsif_debug_info.tunnel_mode = tunnel_mode;
vsif_debug_info.signal_sdr = signal_sdr;
@@ -1253,6 +1253,12 @@ static void hdmitx_set_hdr10plus_pkt(unsigned int flag,
struct rx_cap *prxcap = &hdev->tx_comm.rxcap;
HDMITX_DEBUG_PACKET("%s[%d]\n", __func__, __LINE__);
if (data)
memcpy(&hdr10p_config_data, data,
sizeof(struct hdr10plus_para));
else
memset(&hdr10p_config_data, 0,
sizeof(struct hdr10plus_para));
if (hdev->bist_lock)
return;
@@ -1270,12 +1276,6 @@ static void hdmitx_set_hdr10plus_pkt(unsigned int flag,
}
}
if (data)
memcpy(&hdr10p_config_data, data,
sizeof(struct hdr10plus_para));
else
memset(&hdr10p_config_data, 0,
sizeof(struct hdr10plus_para));
if (hsty_hdr10p_config_loc > 7)
hsty_hdr10p_config_loc = 0;
memcpy(&hsty_hdr10p_config_data[hsty_hdr10p_config_loc++],
+1
View File
@@ -397,6 +397,7 @@ bool hdcptx2_ds_rptr_capability(void);
bool hdcptx1_ds_rptr_capability(void);
void hdcptx1_ds_bksv_read(u8 *p_bksv, u8 ksv_bytes);
u8 hdcptx1_ksv_v_get(void);
bool hdcp1x_ksv_valid(u8 *dat);
void hdcptx1_protection_enable(bool en);
void hdcptx1_intermed_ri_check_enable(bool en);
void hdcptx2_ds_rcv_id_read(u8 *p_rcv_id);
@@ -548,6 +548,22 @@ static void bksv_get_ds_list(struct hdcp_t *p_hdcp)
p_hdcp->p_ksv_next += KSV_SIZE;
}
/* verify ksv, 20 ones and 20 zeroes */
bool hdcp1x_ksv_valid(u8 *dat)
{
int i, j, one_num = 0;
if (!dat)
return false;
for (i = 0; i < 5; i++) {
for (j = 0; j < 8; j++) {
if ((dat[i] >> j) & 0x1)
one_num++;
}
}
return one_num == 20;
}
static void assemble_ds_ksv_lists(struct hdcp_t *p_hdcp)
{
if (p_hdcp->hdcp_type == HDCP_VER_HDCP1X) {
+266 -7
View File
@@ -50,6 +50,7 @@
#include "hdmi_tx.h"
#include "hdmi_config.h"
#include "hw/hdmi_tx_ddc.h"
#include "hw/common.h"
#include <linux/amlogic/gki_module.h>
#include <linux/component.h>
@@ -101,6 +102,7 @@ static void tee_comm_dev_unreg(struct hdmitx_dev *hdev);
const struct hdmi_timing *hdmitx_mode_match_timing_name(const char *name);
static void hdmitx_set_frl_rate_none(struct hdmitx_dev *hdev);
static void hdmitx21_vid_pll_clk_check(struct hdmitx_dev *hdev);
const char *hdmitx_mode_get_timing_name(enum hdmi_vic vic);
/*
* Normally, after the HPD in or late resume, there will reading EDID, and
* notify application to select a hdmi mode output. But during the mode
@@ -794,6 +796,7 @@ static void hdr_work_func(struct work_struct *work)
#define GET_LOW8BIT(a) ((a) & 0xff)
#define GET_HIGH8BIT(a) (((a) >> 8) & 0xff)
static struct master_display_info_s drm_config_data;
static void hdmitx_set_drm_pkt(struct master_display_info_s *data)
{
struct hdmitx_dev *hdev = get_hdmitx21_device();
@@ -806,6 +809,12 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data)
struct rx_cap *prxcap = &hdev->tx_comm.rxcap;
HDMITX_DEBUG_PACKET("%s[%d]\n", __func__, __LINE__);
if (data)
memcpy(&drm_config_data, data,
sizeof(struct master_display_info_s));
else
memset(&drm_config_data, 0,
sizeof(struct master_display_info_s));
if (!is_cur_hdmi_mode())
return;
@@ -1131,6 +1140,12 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type,
struct hdmi_format_para *fmt_para = &hdev->tx_comm.fmt_para;
HDMITX_DEBUG_PACKET("%s[%d]\n", __func__, __LINE__);
if (!data)
memcpy(&vsif_debug_info.data, &para,
sizeof(struct dv_vsif_para));
else
memcpy(&vsif_debug_info.data, data,
sizeof(struct dv_vsif_para));
if (!is_cur_hdmi_mode())
return;
spin_lock_irqsave(&hdev->tx_comm.edid_spinlock, flags);
@@ -1138,13 +1153,6 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type,
spin_unlock_irqrestore(&hdev->tx_comm.edid_spinlock, flags);
return;
}
if (!data)
memcpy(&vsif_debug_info.data, &para,
sizeof(struct dv_vsif_para));
else
memcpy(&vsif_debug_info.data, data,
sizeof(struct dv_vsif_para));
vsif_debug_info.type = type;
vsif_debug_info.tunnel_mode = tunnel_mode;
vsif_debug_info.signal_sdr = signal_sdr;
@@ -1455,6 +1463,7 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type,
spin_unlock_irqrestore(&hdev->tx_comm.edid_spinlock, flags);
}
static struct hdr10plus_para hdr10p_config_data;
static void hdmitx_set_hdr10plus_pkt(u32 flag,
struct hdr10plus_para *data)
{
@@ -1467,6 +1476,12 @@ static void hdmitx_set_hdr10plus_pkt(u32 flag,
struct rx_cap *prxcap = &hdev->tx_comm.rxcap;
HDMITX_DEBUG_PACKET("%s[%d]\n", __func__, __LINE__);
if (data)
memcpy(&hdr10p_config_data, data,
sizeof(struct hdr10plus_para));
else
memset(&hdr10p_config_data, 0,
sizeof(struct hdr10plus_para));
if (!is_cur_hdmi_mode())
return;
if (hdev->bist_lock)
@@ -3141,6 +3156,244 @@ static ssize_t hdcp_ver_show(struct device *dev,
return pos;
}
static ssize_t hdmitx_pkt_dump_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct hdmitx_dev *hdev = dev_get_drvdata(dev);
return hdmitx21_pkt_dump(hdev, buf, PAGE_SIZE);
}
static ssize_t hdmitx_basic_config_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
int pos = 0;
u8 *conf;
u8 *tmp;
u32 colormetry;
u32 hcnt, vcnt;
char bksv_buf[5];
int cs, cd, i;
enum hdmi_vic vic;
enum hdmi_hdr_transfer hdr_transfer_feature;
enum hdmi_hdr_color hdr_color_feature;
struct dv_vsif_para *data;
enum hdmi_tf_type type = HDMI_NONE;
struct hdmitx_dev *hdev = dev_get_drvdata(dev);
pos += snprintf(buf + pos, PAGE_SIZE, "************\n");
pos += snprintf(buf + pos, PAGE_SIZE, "hdmi_config_info\n");
pos += snprintf(buf + pos, PAGE_SIZE, "************\n");
pos += snprintf(buf + pos, PAGE_SIZE, "display_mode in:%s\n",
get_vout_mode_internal());
vic = hdmitx_hw_get_state(&hdev->tx_hw.base, STAT_VIDEO_VIC, 0);
pos += snprintf(buf + pos, PAGE_SIZE, "display_mode out:%s\n",
hdmitx_mode_get_timing_name(vic));
pos += snprintf(buf + pos, PAGE_SIZE, "attr in:%s\n\r", hdev->tx_comm.fmt_attr);
pos += snprintf(buf + pos, PAGE_SIZE, "attr out:");
cs = hdmitx_hw_get_state(&hdev->tx_hw.base, STAT_VIDEO_CS, 0);
switch (cs & 0x3) {
case 0:
conf = "RGB";
break;
case 1:
conf = "422";
break;
case 2:
conf = "444";
break;
case 3:
conf = "420";
break;
}
pos += snprintf(buf + pos, PAGE_SIZE, "%s,", conf);
cd = hdmitx_hw_get_state(&hdev->tx_hw.base, STAT_VIDEO_CD, 0);
switch (cd) {
case 4:
conf = "8bit";
break;
case 5:
conf = "10bit";
break;
case 6:
conf = "12bit";
break;
case 7:
conf = "16bit";
break;
default:
conf = "reserved";
}
pos += snprintf(buf + pos, PAGE_SIZE, "%s\n", conf);
pos += snprintf(buf + pos, PAGE_SIZE, "hdr_status:");
type = hdmitx_hw_get_state(&hdev->tx_hw.base, STAT_TX_HDR10P, 0);
if (type) {
if (type == HDMI_HDR10P_DV_VSIF)
pos += snprintf(buf + pos, PAGE_SIZE, "HDR10Plus-VSIF");
}
type = hdmitx_hw_get_state(&hdev->tx_hw.base, STAT_TX_DV, 0);
if (type) {
if (type == HDMI_DV_VSIF_STD)
pos += snprintf(buf + pos, PAGE_SIZE, "DolbyVision-Std");
else if (type == HDMI_DV_VSIF_LL)
pos += snprintf(buf + pos, PAGE_SIZE, "DolbyVision-Lowlatency");
}
type = hdmitx_hw_get_state(&hdev->tx_hw.base, STAT_TX_HDR, 0);
if (type) {
if (type == HDMI_HDR_SMPTE_2084)
pos += snprintf(buf + pos, PAGE_SIZE, "HDR10-GAMMA_ST2084");
else if (type == HDMI_HDR_HLG)
pos += snprintf(buf + pos, PAGE_SIZE, "HDR10-GAMMA_HLG");
else if (type == HDMI_HDR_HDR)
pos += snprintf(buf + pos, PAGE_SIZE, "HDR10-others");
}
/* default is SDR */
pos += snprintf(buf + pos, PAGE_SIZE, "SDR");
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
pos += snprintf(buf + pos, PAGE_SIZE, "******config******\n");
pos += snprintf(buf + pos, PAGE_SIZE, "cur_VIC: %d\n", hdev->tx_comm.fmt_para.vic);
pos += hdmitx_format_para_print(&hdev->tx_comm.fmt_para, buf + pos);
if (hdev->tx_comm.cur_audio_param.aud_output_en)
conf = "on";
else
conf = "off";
pos += snprintf(buf + pos, PAGE_SIZE, "audio config: %s\n", conf);
pos += hdmitx_audio_para_print(&hdev->tx_comm.cur_audio_param, buf + pos);
if (hdev->flag_3dfp)
conf = "FramePacking";
else if (hdev->flag_3dss)
conf = "SidebySide";
else if (hdev->flag_3dtb)
conf = "TopButtom";
else
conf = "off";
pos += snprintf(buf + pos, PAGE_SIZE, "3D config: %s\n", conf);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
pos += snprintf(buf + pos, PAGE_SIZE, "******hdcp******\n");
pos += snprintf(buf + pos, PAGE_SIZE, "hdcp mode:");
pos += hdcp_mode_show(dev, attr, buf + pos);
pos += snprintf(buf + pos, PAGE_SIZE, "\n hdcp_lstore:");
pos += hdcp_lstore_show(dev, attr, buf + pos);
pos += snprintf(buf + pos, PAGE_SIZE, "hdcp_ver:");
pos += hdcp_ver_show(dev, attr, buf + pos);
pos += snprintf(buf + pos, PAGE_SIZE, "hdcp ksv info:");
hdmitx_hw_cntl_ddc(&hdev->tx_hw.base, DDC_HDCP_GET_BKSV,
(unsigned long)bksv_buf);
pos += snprintf(buf + pos, PAGE_SIZE, "HDCP14 BKSV: ");
for (i = 0; i < 5; i++) {
pos += snprintf(buf + pos, PAGE_SIZE, "%02x",
bksv_buf[i]);
}
pos += snprintf(buf + pos, PAGE_SIZE, " %s\n",
hdcp1x_ksv_valid(bksv_buf) ? "Valid" : "Invalid");
pos += snprintf(buf + pos, PAGE_SIZE, "hdcp_ctl_lvl:%d\n", hdev->tx_comm.hdcp_ctl_lvl);
pos += snprintf(buf + pos, PAGE_SIZE, "******scdc******\n");
pos += snprintf(buf + pos, PAGE_SIZE, "div40:%d\n", hdev->pre_tmds_clk_div40);
pos += snprintf(buf + pos, PAGE_SIZE, "******hdmi_pll******\n");
pos += snprintf(buf + pos, PAGE_SIZE, "sspll:%d\n", hdev->sspll);
pos += snprintf(buf + pos, PAGE_SIZE, "******dv_vsif_info******\n");
data = &vsif_debug_info.data;
pos += snprintf(buf + pos, PAGE_SIZE, "type: %u, tunnel: %u, sigsdr: %u\n",
vsif_debug_info.type,
vsif_debug_info.tunnel_mode,
vsif_debug_info.signal_sdr);
pos += snprintf(buf + pos, PAGE_SIZE, "dv_vsif_para:\n");
pos += snprintf(buf + pos, PAGE_SIZE, "ver: %u len: %u\n",
data->ver, data->length);
pos += snprintf(buf + pos, PAGE_SIZE, "ll: %u dvsig: %u\n",
data->vers.ver2.low_latency,
data->vers.ver2.dobly_vision_signal);
pos += snprintf(buf + pos, PAGE_SIZE, "bcMD: %u axMD: %u\n",
data->vers.ver2.backlt_ctrl_MD_present,
data->vers.ver2.auxiliary_MD_present);
pos += snprintf(buf + pos, PAGE_SIZE, "PQhi: %u PQlow: %u\n",
data->vers.ver2.eff_tmax_PQ_hi,
data->vers.ver2.eff_tmax_PQ_low);
pos += snprintf(buf + pos, PAGE_SIZE, "axrm: %u, axrv: %u, ",
data->vers.ver2.auxiliary_runmode,
data->vers.ver2.auxiliary_runversion);
pos += snprintf(buf + pos, PAGE_SIZE, "axdbg: %u\n",
data->vers.ver2.auxiliary_debug0);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
pos += snprintf(buf + pos, PAGE_SIZE, "***drm_config_data***\n");
hdr_transfer_feature = (drm_config_data.features >> 8) & 0xff;
hdr_color_feature = (drm_config_data.features >> 16) & 0xff;
colormetry = (drm_config_data.features >> 30) & 0x1;
pos += snprintf(buf + pos, PAGE_SIZE, "tf=%u, cf=%u, colormetry=%u\n",
hdr_transfer_feature, hdr_color_feature,
colormetry);
pos += snprintf(buf + pos, PAGE_SIZE, "primaries:\n");
for (vcnt = 0; vcnt < 3; vcnt++) {
for (hcnt = 0; hcnt < 2; hcnt++)
pos += snprintf(buf + pos, PAGE_SIZE, "%u, ",
drm_config_data.primaries[vcnt][hcnt]);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
}
pos += snprintf(buf + pos, PAGE_SIZE, "white_point: ");
for (hcnt = 0; hcnt < 2; hcnt++)
pos += snprintf(buf + pos, PAGE_SIZE, "%u, ",
drm_config_data.white_point[hcnt]);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
pos += snprintf(buf + pos, PAGE_SIZE, "luminance: ");
for (hcnt = 0; hcnt < 2; hcnt++)
pos += snprintf(buf + pos, PAGE_SIZE, "%u, ", drm_config_data.luminance[hcnt]);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
pos += snprintf(buf + pos, PAGE_SIZE, "max_content: %u, ", drm_config_data.max_content);
pos += snprintf(buf + pos, PAGE_SIZE, "max_frame_average: %u\n",
drm_config_data.max_frame_average);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
pos += snprintf(buf + pos, PAGE_SIZE, "***hdr10p_config_data***\n");
pos += snprintf(buf + pos, PAGE_SIZE, "appver: %u, tlum: %u, avgrgb: %u\n",
hdr10p_config_data.application_version,
hdr10p_config_data.targeted_max_lum,
hdr10p_config_data.average_maxrgb);
tmp = hdr10p_config_data.distribution_values;
pos += snprintf(buf + pos, PAGE_SIZE, "distribution_values:\n");
for (vcnt = 0; vcnt < 3; vcnt++) {
for (hcnt = 0; hcnt < 3; hcnt++)
pos += snprintf(buf + pos, PAGE_SIZE, "%u, ", tmp[vcnt * 3 + hcnt]);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
}
pos += snprintf(buf + pos, PAGE_SIZE, "nbca: %u, knpx: %u, knpy: %u\n",
hdr10p_config_data.num_bezier_curve_anchors,
hdr10p_config_data.knee_point_x,
hdr10p_config_data.knee_point_y);
tmp = hdr10p_config_data.bezier_curve_anchors;
pos += snprintf(buf + pos, PAGE_SIZE, "bezier_curve_anchors:\n");
for (vcnt = 0; vcnt < 3; vcnt++) {
for (hcnt = 0; hcnt < 3; hcnt++)
pos += snprintf(buf + pos, PAGE_SIZE, "%u, ", tmp[vcnt * 3 + hcnt]);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
}
pos += snprintf(buf + pos, PAGE_SIZE, "gof: %u, ndf: %u\n",
hdr10p_config_data.graphics_overlay_flag,
hdr10p_config_data.no_delay_flag);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
pos += snprintf(buf + pos, PAGE_SIZE, "***hdmiaud_config_data***\n");
pos += snprintf(buf + pos, PAGE_SIZE,
"type: %u, chnum: %u, samrate: %u, samsize: %u\n",
hdmi21aud_config_data.type,
hdmi21aud_config_data.chs,
hdmi21aud_config_data.rate,
hdmi21aud_config_data.size);
return pos;
}
static ssize_t rxsense_state_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -3387,6 +3640,8 @@ static DEVICE_ATTR_RW(hdr_mute_frame);
static DEVICE_ATTR_RO(dsc_en);
static DEVICE_ATTR_RW(dsc_policy);
static DEVICE_ATTR_RO(clkmsr);
static DEVICE_ATTR_RO(hdmitx_pkt_dump);
static DEVICE_ATTR_RO(hdmitx_basic_config);
static int hdmitx21_pre_enable_mode(struct hdmitx_common *tx_comm, struct hdmi_format_para *para)
{
@@ -4540,6 +4795,8 @@ static int amhdmitx_probe(struct platform_device *pdev)
ret = device_create_file(dev, &dev_attr_not_restart_hdcp);
ret = device_create_file(dev, &dev_attr_hdr_mute_frame);
ret = device_create_file(dev, &dev_attr_clkmsr);
ret = device_create_file(dev, &dev_attr_hdmitx_pkt_dump);
ret = device_create_file(dev, &dev_attr_hdmitx_basic_config);
/*platform related functions*/
tx_event_mgr = hdmitx_event_mgr_create(pdev, hdev->hdtx_dev);
@@ -4733,6 +4990,8 @@ static int amhdmitx_remove(struct platform_device *pdev)
device_remove_file(dev, &dev_attr_not_restart_hdcp);
device_remove_file(dev, &dev_attr_hdr_mute_frame);
device_remove_file(dev, &dev_attr_clkmsr);
device_remove_file(dev, &dev_attr_hdmitx_pkt_dump);
device_remove_file(dev, &dev_attr_hdmitx_basic_config);
cdev_del(&hdev->cdev);
device_destroy(hdmitx_class, hdev->hdmitx_id);
+1 -1
View File
@@ -228,7 +228,7 @@ int hdmitx21_set_audio(struct hdmitx_dev *hdev,
int get21_hpd_state(void);
void hdmitx21_hdcp_status(int hdmi_authenticated);
struct hdmi_format_para *hdmitx21_get_vesa_paras(struct vesa_standard_timing *t);
extern struct aud_para hdmi21aud_config_data;
/***********************************************************************
* hdmitx hardware level interface
***********************************************************************/
+2
View File
@@ -207,6 +207,8 @@ enum hpd_op {
int hdmitx21_hpd_hw_op(enum hpd_op cmd);
void hdmitx_hpd_irq_top_half_process(struct hdmitx_dev *hdev, bool hpd);
void profs_hdmitx21_debugfs_init(void);
int hdmitx21_pkt_dump(struct hdmitx_dev *hdev, char *buf, int len);
#endif
+93 -14
View File
@@ -14,6 +14,9 @@
#include <linux/seq_file.h>
#include <linux/amlogic/media/vout/hdmitx_common/hdmitx_version.h>
#include "common.h"
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/types.h>
#ifdef DEVICE_NAME
#undef DEVICE_NAME
@@ -92,6 +95,12 @@ static const struct file_operations dump_busreg_fops = {
.release = single_release,
};
static const struct proc_ops dump_busreg_pops = {
.proc_open = dump_regs_open,
.proc_read = seq_read,
.proc_release = single_release,
};
static void dumptop(struct seq_file *s, u32 start, u32 end)
{
u32 value = 0;
@@ -198,6 +207,12 @@ static const struct file_operations dump_hdmireg_fops = {
.release = single_release,
};
static const struct proc_ops dump_hdmireg_pops = {
.proc_open = dump_hdmireg_open,
.proc_read = seq_read,
.proc_release = single_release,
};
#define CONNECT2REG(reg) ({ \
typeof(reg) _reg = (reg); \
(hdmitx21_rd_reg(_reg) & 0xff) + \
@@ -496,6 +511,12 @@ static const struct file_operations dump_hdmivpfdet_fops = {
.release = single_release,
};
static const struct proc_ops dump_hdmivpfdet_pops = {
.proc_open = dump_hdmivpfdet_open,
.proc_read = seq_read,
.proc_release = single_release,
};
static void hdmitx_parsing_avipkt(struct seq_file *s)
{
}
@@ -559,6 +580,12 @@ static const struct file_operations dump_hdmipkt_fops = {
.release = single_release,
};
static const struct proc_ops dump_hdmipkt_pops = {
.proc_open = dump_hdmipkt_open,
.proc_read = seq_read,
.proc_release = single_release,
};
static int dump_hdmiver_show(struct seq_file *s, void *p)
{
const char *hdmi_ver;
@@ -581,6 +608,12 @@ static const struct file_operations dump_hdmiver_fops = {
.release = single_release,
};
static const struct proc_ops dump_hdmiver_pops = {
.proc_open = dump_hdmiver_open,
.proc_read = seq_read,
.proc_release = single_release,
};
static inline unsigned int get_msr_cts(void)
{
unsigned int ret = 0;
@@ -640,6 +673,12 @@ static const struct file_operations dump_audcts_fops = {
.release = single_release,
};
static const struct proc_ops dump_audcts_pops = {
.proc_open = dump_audcts_open,
.proc_read = seq_read,
.proc_release = single_release,
};
#ifndef CONFIG_AMLOGIC_ZAPPER_CUT
static int dump_hdmivrr_show(struct seq_file *s, void *p)
{
@@ -656,6 +695,13 @@ static const struct file_operations dump_hdmivrr_fops = {
.read = seq_read,
.release = single_release,
};
static const struct proc_ops dump_hdmivrr_pops = {
.proc_open = dump_hdmivrr_open,
.proc_read = seq_read,
.proc_release = single_release,
};
#endif
static void dump_clkctrl_regs(struct seq_file *s, const u32 *val)
@@ -792,6 +838,12 @@ static const struct file_operations dump_cts_enc_clk_fops = {
.release = single_release,
};
static const struct proc_ops dump_cts_enc_clk_pops = {
.proc_open = dump_cts_enc_clk_open,
.proc_read = seq_read,
.proc_release = single_release,
};
static int dump_frl_status_show(struct seq_file *s, void *p)
{
enum scdc_addr scdc_reg;
@@ -866,33 +918,40 @@ struct hdmitx_dbg_files_s {
const char *name;
const umode_t mode;
const struct file_operations *fops;
const struct proc_ops *pops;
};
static const struct proc_ops dump_frl_status_pops = {
.proc_open = dump_frl_status_open,
.proc_read = seq_read,
.proc_release = single_release,
};
static struct hdmitx_dbg_files_s hdmitx_dbg_files[] = {
{"bus_reg", S_IFREG | 0444, &dump_busreg_fops},
{"hdmi_reg", S_IFREG | 0444, &dump_hdmireg_fops},
{"hdmi_vpfdet", S_IFREG | 0444, &dump_hdmivpfdet_fops},
{"hdmi_pkt", S_IFREG | 0444, &dump_hdmipkt_fops},
{"hdmi_ver", S_IFREG | 0444, &dump_hdmiver_fops},
{"aud_cts", S_IFREG | 0444, &dump_audcts_fops},
{"bus_reg", S_IFREG | 0444, &dump_busreg_fops, &dump_busreg_pops},
{"hdmi_reg", S_IFREG | 0444, &dump_hdmireg_fops, &dump_hdmireg_pops},
{"hdmi_vpfdet", S_IFREG | 0444, &dump_hdmivpfdet_fops, &dump_hdmivpfdet_pops},
{"hdmi_pkt", S_IFREG | 0444, &dump_hdmipkt_fops, &dump_hdmipkt_pops},
{"hdmi_ver", S_IFREG | 0444, &dump_hdmiver_fops, &dump_hdmiver_pops},
{"aud_cts", S_IFREG | 0444, &dump_audcts_fops, &dump_audcts_pops},
#ifndef CONFIG_AMLOGIC_ZAPPER_CUT
{"hdmi_vrr", S_IFREG | 0444, &dump_hdmivrr_fops},
{"hdmi_vrr", S_IFREG | 0444, &dump_hdmivrr_fops, &dump_hdmivrr_pops},
#endif
{"cts_enc_clk", S_IFREG | 0444, &dump_cts_enc_clk_fops},
{"frl_status", S_IFREG | 0444, &dump_frl_status_fops},
{"cts_enc_clk", S_IFREG | 0444, &dump_cts_enc_clk_fops, &dump_cts_enc_clk_pops},
{"frl_status", S_IFREG | 0444, &dump_frl_status_fops, &dump_frl_status_pops},
};
static struct dentry *hdmitx_dbgfs;
static struct dentry *hdmitx_file_dbgfs;
void hdmitx21_debugfs_init(void)
{
struct dentry *entry;
int i;
if (hdmitx_dbgfs)
if (hdmitx_file_dbgfs)
return;
hdmitx_dbgfs = debugfs_create_dir(DEVICE_NAME, NULL);
if (!hdmitx_dbgfs) {
hdmitx_file_dbgfs = debugfs_create_dir(DEVICE_NAME, NULL);
if (!hdmitx_file_dbgfs) {
HDMITX_ERROR("can't create %s debugfs dir\n", DEVICE_NAME);
return;
}
@@ -900,7 +959,7 @@ void hdmitx21_debugfs_init(void)
for (i = 0; i < ARRAY_SIZE(hdmitx_dbg_files); i++) {
entry = debugfs_create_file(hdmitx_dbg_files[i].name,
hdmitx_dbg_files[i].mode,
hdmitx_dbgfs, NULL,
hdmitx_file_dbgfs, NULL,
hdmitx_dbg_files[i].fops);
if (!entry)
HDMITX_ERROR("debugfs create file %s failed\n",
@@ -908,3 +967,23 @@ void hdmitx21_debugfs_init(void)
}
}
static struct proc_dir_entry *hdmitx_proc_dbgfs;
void profs_hdmitx21_debugfs_init(void)
{
struct proc_dir_entry *entry;
int i;
hdmitx_proc_dbgfs = proc_mkdir("amhdmitx", NULL);
if (!hdmitx_proc_dbgfs)
HDMITX_ERROR("Error creating proc entry");
for (i = 0; i < ARRAY_SIZE(hdmitx_dbg_files); i++) {
entry = proc_create(hdmitx_dbg_files[i].name,
hdmitx_dbg_files[i].mode,
hdmitx_proc_dbgfs,
hdmitx_dbg_files[i].pops);
if (!entry)
HDMITX_ERROR("debugfs create file %s failed\n",
hdmitx_dbg_files[i].name);
}
}
+502 -25
View File
@@ -171,6 +171,31 @@ static const struct _hdmi_clkmsr hdmiclkmsr_s5[] = {
{219, "o_tohdmitx_spdif_clk"},
};
static const struct _hdmi_clkmsr hdmiclkmsr_s7[] = {
{19, "hifi0_pll_clk"},
{21, "hifi1_pll_clk"},
{49, "hdmi_vx1_pix_clk"},
{50, "vid_pll_div_clk_out"},
{51, "cts_enci_clk"},
{52, "cts_encp_clk"},
{53, "cts_encl_clk"},
{59, "cts_hdmi_tx_pixel_clk"},
{61, "cts_vpu_clk"},
{62, "cts_vpu_clkb"},
{63, "cts_vpu_clkb_tmp"},
{64, "cts_vpu_clkc"},
{76, "hdmitx_tmds_clk"},
{77, "cts_hdmitx_sys_clk"},
{78, "cts_hdmitx_fe_clk"},
{80, "cts_hdmitx_prif_clk"},
{81, "cts_hdmitx_200m_clk"},
{82, "cts_hdmitx_aud_clk"},
{84, "audio_tohdmitx_mclk"},
{85, "audio_tohdmitx_bclk"},
{86, "audio_tohdmitx_lrclk"},
{87, "audio__tohdmitx_spdif_clk"},
};
/* only for hpd level */
int hdmitx21_hpd_hw_op(enum hpd_op cmd)
{
@@ -697,6 +722,7 @@ void hdmitx21_meson_init(struct hdmitx_dev *hdev)
global_tx_hw->base.setdispmode = hdmitx_set_dispmode;
hdmi_hwp_init(hdev, 0);
hdmitx21_debugfs_init();
profs_hdmitx21_debugfs_init();
hdmitx_hw_cntl_misc(&hdev->tx_hw.base, MISC_AVMUTE_OP, CLR_AVMUTE);
}
@@ -2100,6 +2126,7 @@ static void audio_mute_op(bool flag)
mutex_unlock(&aud_mutex);
}
struct aud_para hdmi21aud_config_data;
static int hdmitx_set_audmode(struct hdmitx_hw_common *tx_hw,
struct aud_para *audio_param)
{
@@ -2117,7 +2144,8 @@ static int hdmitx_set_audmode(struct hdmitx_hw_common *tx_hw,
aud_output_i2s_ch = audio_param->aud_output_i2s_ch;
HDMITX_INFO("set audio\n");
mutex_lock(&aud_mutex);
memcpy(&hdmi21aud_config_data,
audio_param, sizeof(struct aud_para));
hdmitx21_set_reg_bits(AIP_RST_IVCTX, 1, 0, 1);
if (audio_param->type == CT_MAT || audio_param->type == CT_DTS_HD_MA) {
hbr_audio = true;
@@ -2412,6 +2440,11 @@ ssize_t _show21_clkmsr(char *buf)
hdmiclkmsr = hdmiclkmsr_s5;
len = ARRAY_SIZE(hdmiclkmsr_s5);
break;
case MESON_CPU_ID_S7:
case MESON_CPU_ID_S7D:
hdmiclkmsr = hdmiclkmsr_s7;
len = ARRAY_SIZE(hdmiclkmsr_s7);
break;
default:
break;
}
@@ -2967,6 +3000,7 @@ static int hdmitx_cntl_ddc(struct hdmitx_hw_common *hw_comm, u32 cmd,
unsigned long argv)
{
struct hdmitx_dev *hdev = get_hdmitx21_device();
u8 *tmp_char = NULL;
if ((cmd & CMD_DDC_OFFSET) != CMD_DDC_OFFSET) {
HDMITX_ERROR(HW "ddc: invalid cmd 0x%x\n", cmd);
@@ -3013,6 +3047,10 @@ static int hdmitx_cntl_ddc(struct hdmitx_hw_common *hw_comm, u32 cmd,
case DDC_HDCP_SET_TOPO_INFO:
set_hdcp2_topo(!!argv);
break;
case DDC_HDCP_GET_BKSV:
tmp_char = (u8 *)argv;
hdcptx1_ds_bksv_read(tmp_char, 5);
break;
default:
break;
}
@@ -4021,76 +4059,76 @@ void hdmitx_dhdr_send(u8 *body, int max_size)
static void pkt_send_position_change(u32 enable_mask, u8 mov_val)
{
if (enable_mask & 0x1) {
pr_debug("enable to change AVI packet send position begin\n");
HDMITX_DEBUG("enable to change AVI packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_0_IVCTX, hdmitx21_rd_reg(PKT_AUTO_0_IVCTX) & 0xfe);
hdmitx21_wr_reg(PKT_LOC_AVI_IVCTX, mov_val);
pr_debug("enable to change AVI packet send position end\n");
HDMITX_DEBUG("enable to change AVI packet send position end\n");
}
if (enable_mask & 0x2) {
pr_debug("enable to change GAMUT packet send position begin\n");
HDMITX_DEBUG("enable to change GAMUT packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_0_IVCTX, hdmitx21_rd_reg(PKT_AUTO_0_IVCTX) & 0xfd);
hdmitx21_wr_reg(PKT_LOC_GAMUT_IVCTX, mov_val);
pr_debug("enable to change GAMUT packet send position end\n");
HDMITX_DEBUG("enable to change GAMUT packet send position end\n");
}
if (enable_mask & 0x4) {
pr_debug("enable to change AUD packet send position begin\n");
HDMITX_DEBUG("enable to change AUD packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_0_IVCTX, hdmitx21_rd_reg(PKT_AUTO_0_IVCTX) & 0xfb);
hdmitx21_wr_reg(PKT_LOC_AUD_IVCTX, mov_val);
pr_debug("enable to change AUD packet send position end\n");
HDMITX_DEBUG("enable to change AUD packet send position end\n");
}
if (enable_mask & 0x8) {
pr_debug("enable to change SPD packet send position begin\n");
HDMITX_DEBUG("enable to change SPD packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_0_IVCTX, hdmitx21_rd_reg(PKT_AUTO_0_IVCTX) & 0xf7);
hdmitx21_wr_reg(PKT_LOC_SPD_IVCTX, mov_val);
pr_debug("enable to change SPD packet send position end\n");
HDMITX_DEBUG("enable to change SPD packet send position end\n");
}
if (enable_mask & 0x10) {
pr_debug("enable to change MPEG packet send position begin\n");
HDMITX_DEBUG("enable to change MPEG packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_0_IVCTX, hdmitx21_rd_reg(PKT_AUTO_0_IVCTX) & 0xef);
hdmitx21_wr_reg(PKT_LOC_MPEG_IVCTX, mov_val);
pr_debug("enable to change MPEG packet send position end\n");
HDMITX_DEBUG("enable to change MPEG packet send position end\n");
}
if (enable_mask & 0x20) {
pr_debug("enable to change VSIF packet send position begin\n");
HDMITX_DEBUG("enable to change VSIF packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_0_IVCTX, hdmitx21_rd_reg(PKT_AUTO_0_IVCTX) & 0xdf);
hdmitx21_wr_reg(PKT_LOC_VSIF_IVCTX, mov_val);
pr_debug("enable to change VSIF packet send position end\n");
HDMITX_DEBUG("enable to change VSIF packet send position end\n");
}
if (enable_mask & 0x40) {
pr_debug("enable to change GEN packet send position begin\n");
HDMITX_DEBUG("enable to change GEN packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_0_IVCTX, hdmitx21_rd_reg(PKT_AUTO_0_IVCTX) & 0xbf);
hdmitx21_wr_reg(PKT_LOC_GEN_IVCTX, mov_val);
pr_debug("enable to change GEN packet send position end\n");
HDMITX_DEBUG("enable to change GEN packet send position end\n");
}
if (enable_mask & 0x80) {
pr_debug("enable to change GEN2 packet send position begin\n");
HDMITX_DEBUG("enable to change GEN2 packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_0_IVCTX, hdmitx21_rd_reg(PKT_AUTO_0_IVCTX) & 0x7f);
hdmitx21_wr_reg(PKT_LOC_GEN2_IVCTX, mov_val);
pr_debug("enable to change GEN2 packet send position end\n");
HDMITX_DEBUG("enable to change GEN2 packet send position end\n");
}
if (enable_mask & 0x100) {
pr_debug("enable to change GEN3 packet send position begin\n");
HDMITX_DEBUG("enable to change GEN3 packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_1_IVCTX, hdmitx21_rd_reg(PKT_AUTO_0_IVCTX) & 0xe);
hdmitx21_wr_reg(PKT_LOC_GEN3_IVCTX, mov_val);
pr_debug("enable to change GEN3 packet send position end\n");
HDMITX_DEBUG("enable to change GEN3 packet send position end\n");
}
if (enable_mask & 0x200) {
pr_debug("enable to change GEN4 packet send position begin\n");
HDMITX_DEBUG("enable to change GEN4 packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_1_IVCTX, hdmitx21_rd_reg(PKT_AUTO_1_IVCTX) & 0xd);
hdmitx21_wr_reg(PKT_LOC_GEN4_IVCTX, mov_val);
pr_debug("enable to change GEN4 packet send position end\n");
HDMITX_DEBUG("enable to change GEN4 packet send position end\n");
}
if (enable_mask & 0x400) {
pr_debug("enable to change GEN5 packet send position begin\n");
HDMITX_DEBUG("enable to change GEN5 packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_1_IVCTX, hdmitx21_rd_reg(PKT_AUTO_1_IVCTX) & 0xb);
hdmitx21_wr_reg(PKT_LOC_GEN5_IVCTX, mov_val);
pr_debug("enable to change GEN5 packet send position end\n");
HDMITX_DEBUG("enable to change GEN5 packet send position end\n");
}
if (enable_mask & 0x800) {
pr_debug("enable to change VTEM packet send position begin\n");
HDMITX_DEBUG("enable to change VTEM packet send position begin\n");
hdmitx21_wr_reg(PKT_AUTO_1_IVCTX, hdmitx21_rd_reg(PKT_AUTO_1_IVCTX) & 0x7);
hdmitx21_wr_reg(PKT_LOC_VTEM_IVCTX, mov_val);
pr_debug("enable to change VTEM packet send position end\n");
HDMITX_DEBUG("enable to change VTEM packet send position end\n");
}
}
@@ -4138,3 +4176,442 @@ void hdmitx21_read_dhdr_sram(void)
hdmitx21_wr_reg(D_HDR_MEM_READ_EN_IVCTX, 0); //close x_fifo debug path
HDMITX_DEBUG("read end\n");
}
int hdmitx21_pkt_dump(struct hdmitx_dev *hdmitx_device, char *buf, int len)
{
unsigned int reg_val;
unsigned int reg_addr;
unsigned char *conf;
int ret, i;
u8 body[32] = {0};
int pos = 0;
struct hdmitx_dev *hdev = get_hdmitx21_device();
union hdmi_infoframe *infoframe = NULL;
struct hdmi_avi_infoframe *avi = NULL;
struct hdmi_drm_infoframe *drm = NULL;
//struct hdmi_vendor_infoframe *vendor = NULL;
struct hdmi_audio_infoframe *audio = NULL;
//GCP PKT
pos += snprintf(buf + pos, len - pos, "hdmitx gcp reg config\n");
reg_addr = GCP_CUR_STAT_IVCTX;
reg_val = hdmitx21_rd_reg(reg_addr);
pos += snprintf(buf + pos, len - pos, "GCP.clear_avmute: %d\n", (reg_val & 0x2) >> 1);
pos += snprintf(buf + pos, len - pos, "GCP.set_avmute: %d\n", reg_val & 0x1);
switch ((reg_val & 0x1C) >> 2) {
case 4:
conf = "24bit";
break;
case 5:
conf = "30bit";
break;
case 6:
conf = "36bit";
break;
case 7:
conf = "48bit";
break;
default:
conf = "reserved";
}
pos += snprintf(buf + pos, len - pos, "GCP.color_depth: %s\n", conf);
pos += snprintf(buf + pos, len - pos, "GCP.dc_phase_st: %d\n", (reg_val & 0x60) >> 5);
pos += snprintf(buf + pos, len - pos, "\n");
//AVI PKT
infoframe = &hdev->infoframes.avi;
avi = &infoframe->avi;
ret = hdmi_avi_infoframe_get(body);
if (ret == -1) {
pos += snprintf(buf + pos, len - pos, "AVI body get error\n");
} else if (ret == 0) {
pos += snprintf(buf + pos, len - pos, "AVI PKT not enable\n");
} else {
ret = hdmi_avi_infoframe_unpack_renew(avi, body, sizeof(body));
if (ret < 0) {
pos += snprintf(buf + pos, len - pos,
"hdmitx21: parsing avi failed %d\n", ret);
} else {
pos += snprintf(buf + pos, len - pos, "AVI.type: 0x%x\n", avi->type);
pos += snprintf(buf + pos, len - pos, "AVI.version: %d\n", avi->version);
pos += snprintf(buf + pos, len - pos, "AVI.length: %d\n", avi->length);
switch (avi->colorspace) {
case 0:
conf = "RGB";
break;
case 1:
conf = "422";
break;
case 2:
conf = "444";
break;
case 3:
conf = "420";
break;
default:
conf = "reserved";
}
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.colorspace: %s\n", conf);
switch (avi->scan_mode) {
case 0:
conf = "none";
break;
case 1:
conf = "overscan";
break;
case 2:
conf = "underscan";
break;
default:
conf = "reserved";
}
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.scan: %s\n", conf);
switch (avi->colorimetry) {
case 0:
conf = "none";
break;
case 1:
conf = "BT.601";
break;
case 2:
conf = "BT.709";
break;
default:
conf = "Extended";
}
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.colorimetry: %s\n", conf);
if (avi->colorimetry == HDMI_COLORIMETRY_EXTENDED) {
switch (avi->extended_colorimetry) {
case 0:
conf = "xvYCC601";
break;
case 1:
conf = "xvYCC709";
break;
case 2:
conf = "sYCC601";
break;
case 3:
conf = "Adobe_YCC601";
break;
case 4:
conf = "Adobe_RGB";
break;
case 5:
case 6:
conf = "BT.2020";
break;
default:
conf = "xvYCC601";
}
pos += snprintf(buf + pos, PAGE_SIZE,
"AVI.extended_colorimetry: %s\n", conf);
}
switch (avi->picture_aspect) {
case 0:
conf = "none";
break;
case 1:
conf = "4:3";
break;
case 2:
conf = "16:9";
break;
case 3:
conf = "64:27";
break;
case 4:
conf = "256:135";
break;
default:
conf = "reserved";
}
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.picture_aspect: %s\n", conf);
switch (avi->active_aspect) {
case 8:
conf = "Same as picture_aspect";
break;
case 9:
conf = "4:3";
break;
case 10:
conf = "16:9";
break;
case 11:
conf = "14:9";
break;
default:
conf = "Same as picture_aspect";
}
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.active_aspect: %s\n", conf);
switch (avi->quantization_range) {
case 0:
conf = "default";
break;
case 1:
conf = "limited";
break;
case 2:
conf = "full";
break;
default:
conf = "reserved";
}
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.quantization_range: %s\n", conf);
if (avi->itc)
conf = "enable";
else
conf = "disable";
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.itc: %s\n", conf);
switch (avi->nups) {
case 0:
conf = "unknown";
break;
case 1:
conf = "horiz";
break;
case 2:
conf = "vert";
break;
case 3:
conf = "horiz and vert";
}
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.nups: %s\n", conf);
pos += snprintf(buf + pos,
PAGE_SIZE, "AVI.video_code: %d\n", avi->video_code);
switch (avi->ycc_quantization_range) {
case 0:
default:
conf = "limited";
break;
case 1:
conf = "full";
}
pos += snprintf(buf + pos, PAGE_SIZE,
"AVI.ycc_quantization_range: %s\n", conf);
switch (avi->content_type) {
case 0:
conf = "graphics";
break;
case 1:
conf = "photo";
break;
case 2:
conf = "cinema";
break;
case 3:
conf = "game";
}
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.content_type: %s\n", conf);
pos += snprintf(buf + pos, PAGE_SIZE,
"AVI.pixel_repetition: %d\n", avi->pixel_repeat);
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.top_bar: %d\n", avi->top_bar);
pos += snprintf(buf + pos, PAGE_SIZE,
"AVI.bottom_bar: %d\n", avi->bottom_bar);
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.left_bar: %d\n", avi->left_bar);
pos += snprintf(buf + pos, PAGE_SIZE, "AVI.right: %d\n", avi->right_bar);
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
}
}
pos += snprintf(buf + pos, len - pos, "\n");
//ACR PKT
pos += snprintf(buf + pos, len - pos, "ACR.N1=0x%x\n", hdmitx21_rd_reg(N_SVAL1_IVCTX));
pos += snprintf(buf + pos, len - pos, "ACR.N2=0x%x\n", hdmitx21_rd_reg(N_SVAL2_IVCTX));
pos += snprintf(buf + pos, len - pos, "ACR.N3=0x%x\n", hdmitx21_rd_reg(N_SVAL3_IVCTX));
pos += snprintf(buf + pos, PAGE_SIZE, "\n");
//DRM PKT
infoframe = &hdev->infoframes.drm;
drm = &infoframe->drm;
ret = hdmitx_infoframe_rawget(HDMI_INFOFRAME_TYPE_DRM, body);
if (ret == -1) {
pos += snprintf(buf + pos, len - pos, "DRM body get error\n");
} else if (ret == 0) {
pos += snprintf(buf + pos, len - pos, "DRM PKT not enable\n");
} else {
ret = hdmi_infoframe_unpack(infoframe, body, sizeof(body));
if (ret < 0) {
pos += snprintf(buf + pos, len - pos, "parsing DRM failed %d\n", ret);
} else {
pos += snprintf(buf + pos, len - pos, "DRM.type: 0x%x\n", drm->type);
pos += snprintf(buf + pos, len - pos, "DRM.version: %d\n", drm->version);
pos += snprintf(buf + pos, len - pos, "DRM.length: %d\n", drm->length);
switch (drm->eotf) {
case 0:
conf = "sdr";
break;
case 1:
conf = "hdr";
break;
case 2:
conf = "ST 2084";
break;
case 3:
conf = "HLG";
break;
default:
conf = "sdr";
}
pos += snprintf(buf + pos, len - pos, "DRM.eotf: %s\n", conf);
switch (drm->metadata_type) {
case 0:
conf = "static metadata";
break;
default:
conf = "reserved";
}
pos += snprintf(buf + pos, len - pos, "DRM.metadata_id: %s\n", conf);
pos += snprintf(buf + pos, len - pos, "display_primaries:\n");
for (i = 0; i < 3; i++) {
pos += snprintf(buf + pos, len - pos, "x:%d, y:%d\n",
drm->display_primaries[i].x, drm->display_primaries[i].y);
}
pos += snprintf(buf + pos, len - pos, "white_point: x:%d, y:%d\n",
drm->white_point.x, drm->white_point.y);
pos += snprintf(buf + pos, len - pos,
"DRM.max_lum : %d\n", drm->max_display_mastering_luminance);
pos += snprintf(buf + pos, len - pos,
"DRM.min_lum : %d\n", drm->min_display_mastering_luminance);
pos += snprintf(buf + pos, len - pos, "DRM.max_cll : %d\n", drm->max_cll);
pos += snprintf(buf + pos, len - pos, "DRM.max_fall : %d\n", drm->max_fall);
}
}
pos += snprintf(buf + pos, len - pos, "\n");
//todo
//vendor
//vendor2
//AUDIO PKT
infoframe = &hdev->infoframes.aud;
audio = &infoframe->audio;
ret = hdmitx_infoframe_rawget(HDMI_INFOFRAME_TYPE_AUDIO, body);
if (ret == -1) {
pos += snprintf(buf + pos, len - pos, "AUDIO body get error\n");
} else if (ret == 0) {
pos += snprintf(buf + pos, len - pos, "AUDIO PKT not enable\n");
} else {
ret = hdmi_infoframe_unpack(infoframe, body, sizeof(body));
if (ret < 0) {
HDMITX_ERROR("parsing AUDIO failed %d\n", ret);
} else {
pos += snprintf(buf + pos, len - pos, "AUDI.type: 0x%x\n", audio->type);
pos += snprintf(buf + pos, len - pos, "AUDI.version: %d\n", audio->version);
pos += snprintf(buf + pos, len - pos, "AUDI.length: %d\n", audio->length);
switch (audio->coding_type) {
case 0:
conf = "refer to stream header";
break;
case 1:
conf = "L-PCM";
break;
case 2:
conf = "AC-3";
break;
case 3:
conf = "MPEG1";
break;
case 4:
conf = "MP3";
break;
case 5:
conf = "MPEG2";
break;
case 6:
conf = "AAC";
break;
case 7:
conf = "DTS";
break;
case 8:
conf = "ATRAC";
break;
case 9:
conf = "One Bit Audio";
break;
case 10:
conf = "Dobly Digital+";
break;
case 11:
conf = "DTS_HD";
break;
case 12:
conf = "MAT";
break;
case 13:
conf = "DST";
break;
case 14:
conf = "WMA";
break;
default:
conf = "MAX";
}
pos += snprintf(buf + pos, len - pos, "AUDI.coding_type: %s\n", conf);
pos += snprintf(buf + pos, len - pos,
"AUDI.channel_count: %d\n", audio->channels + 1);
switch (audio->sample_frequency) {
case FS_REFER_TO_STREAM:
conf = "refer to stream header";
break;
case FS_32K:
conf = "32kHz";
break;
case FS_44K1:
conf = "44.1kHz";
break;
case FS_48K:
conf = "48kHz";
break;
case FS_88K2:
conf = "88.2kHz";
break;
case FS_96K:
conf = "96kHz";
break;
case FS_176K4:
conf = "176.4kHz";
break;
case FS_192K:
conf = "192kHz";
}
pos += snprintf(buf + pos, len - pos, "AUDI.sample_frequency: %s\n", conf);
switch (audio->sample_size) {
case SS_16BITS:
conf = "16bit";
break;
case SS_20BITS:
conf = "20bit";
break;
case SS_24BITS:
conf = "24bit";
break;
case SS_REFER_TO_STREAM:
default:
conf = "refer to stream header";
break;
}
pos += snprintf(buf + pos, len - pos, "AUDI.sample_size: %s\n", conf);
pos += snprintf(buf + pos, len - pos,
"AUDI.channel_allocation: %d\n", audio->channel_allocation);
pos += snprintf(buf + pos, len - pos,
"AUDI.level_shift_value: %d\n", audio->level_shift_value);
pos += snprintf(buf + pos, len - pos,
"AUDI.down_mix_enable: %d\n", audio->downmix_inhibit);
}
}
reg_val = hdmitx21_rd_reg(AUD_MODE_IVCTX); //AUD_MODE
if (reg_val & BIT(0))
pos += snprintf(buf + pos, len - pos, "AUDI.mode: spdif\n");
if (reg_val & BIT(0))
pos += snprintf(buf + pos, len - pos, "AUDI.mode: hbra\n");
if (reg_val & BIT(0))
pos += snprintf(buf + pos, len - pos, "AUDI.mode: dsd\n");
if (reg_val & 0xf0)
pos += snprintf(buf + pos, len - pos, "AUDI.mode: i2s\n");
//AUDIO SAMPLE
return pos;
}