From 712d1de6967c79b6dc227a5a573836b799bf5386 Mon Sep 17 00:00:00 2001 From: Heechul Yun Date: Thu, 19 May 2011 17:18:56 -0700 Subject: video: tegra: dc: DC and HDMI debug info display Following files will show information of DC and hdmi /sys/kernel/debug/tegradc.[01]/{regs,mode,stats} /sys/kernel/debug/tegra_hdmi/regs /sys/devices/nvhost/tegradc.[01]/stats_enable Bug 827295 Change-Id: I60bcf4454b9ea7d0ed73a6199595b06dbfa32cd7 Reviewed-on: http://git-master/r/32454 Reviewed-by: Niket Sirsi Tested-by: Niket Sirsi --- drivers/video/tegra/dc/hdmi.c | 60 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) (limited to 'drivers/video/tegra/dc/hdmi.c') diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c index 21139cebad6f..2026c32fec09 100644 --- a/drivers/video/tegra/dc/hdmi.c +++ b/drivers/video/tegra/dc/hdmi.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -62,7 +64,6 @@ #define HDMI_ELD_PRODUCT_CODE_INDEX 18 #define HDMI_ELD_MONITOR_NAME_INDEX 20 - struct tegra_dc_hdmi_data { struct tegra_dc *dc; struct tegra_edid *edid; @@ -433,14 +434,19 @@ static inline void tegra_hdmi_clrsetbits(struct tegra_dc_hdmi_data *hdmi, tegra_hdmi_writel(hdmi, val, reg); } +#ifdef CONFIG_DEBUG_FS +static int dbg_hdmi_show(struct seq_file *s, void *unused) +{ + struct tegra_dc_hdmi_data *hdmi = s->private; + #define DUMP_REG(a) do { \ - printk("HDMI %-32s\t%03x\t%08lx\n", \ + seq_printf(s, "%-32s\t%03x\t%08lx\n", \ #a, a, tegra_hdmi_readl(hdmi, a)); \ } while (0) -#ifdef DEBUG -static void hdmi_dumpregs(struct tegra_dc_hdmi_data *hdmi) -{ + tegra_dc_io_start(hdmi->dc); + clk_enable(hdmi->clk); + DUMP_REG(HDMI_CTXSW); DUMP_REG(HDMI_NV_PDISP_SOR_STATE0); DUMP_REG(HDMI_NV_PDISP_SOR_STATE1); @@ -595,7 +601,48 @@ static void hdmi_dumpregs(struct tegra_dc_hdmi_data *hdmi) DUMP_REG(HDMI_NV_PDISP_KEY_HDCP_KEY_3); DUMP_REG(HDMI_NV_PDISP_KEY_HDCP_KEY_TRIG); DUMP_REG(HDMI_NV_PDISP_KEY_SKEY_INDEX); +#undef DUMP_REG + + clk_disable(hdmi->clk); + tegra_dc_io_end(hdmi->dc); + + return 0; +} + +static int dbg_hdmi_open(struct inode *inode, struct file *file) +{ + return single_open(file, dbg_hdmi_show, inode->i_private); +} + +static const struct file_operations dbg_fops = { + .open = dbg_hdmi_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static struct dentry *hdmidir; + +static void tegra_dc_hdmi_debug_create(struct tegra_dc_hdmi_data *hdmi) +{ + struct dentry *retval; + + hdmidir = debugfs_create_dir("tegra_hdmi", NULL); + if (!hdmidir) + return; + retval = debugfs_create_file("regs", S_IRUGO, hdmidir, hdmi, + &dbg_fops); + if (!retval) + goto free_out; + return; +free_out: + debugfs_remove_recursive(hdmidir); + hdmidir = NULL; + return; } +#else +static inline void tegra_dc_hdmi_debug_create(struct tegra_dc_hdmi_data *hdmi) +{ } #endif #define PIXCLOCK_TOLERANCE 200 @@ -891,6 +938,9 @@ static int tegra_dc_hdmi_init(struct tegra_dc *dc) tegra_nvhdcp_set_policy(hdmi->nvhdcp, TEGRA_NVHDCP_POLICY_ALWAYS_ON); } + + tegra_dc_hdmi_debug_create(hdmi); + return 0; err_edid_destroy: -- cgit v1.2.3