diff options
author | Heechul Yun <hyun@nvidia.com> | 2011-05-19 17:18:56 -0700 |
---|---|---|
committer | Niket Sirsi <nsirsi@nvidia.com> | 2011-06-15 21:46:50 -0700 |
commit | 712d1de6967c79b6dc227a5a573836b799bf5386 (patch) | |
tree | e9ead71fc886eda4a7435b8066ca9ec804090758 /drivers/video/tegra/dc/hdmi.c | |
parent | 40c8a6e8551e81ad4d7647029e0d85f7b0a7e496 (diff) |
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 <nsirsi@nvidia.com>
Tested-by: Niket Sirsi <nsirsi@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/dc/hdmi.c')
-rw-r--r-- | drivers/video/tegra/dc/hdmi.c | 60 |
1 files changed, 55 insertions, 5 deletions
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 <linux/spinlock.h> #include <linux/switch.h> #include <linux/workqueue.h> +#include <linux/debugfs.h> +#include <linux/seq_file.h> #include <mach/clk.h> #include <mach/dc.h> @@ -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: |