aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Abriou <vincent.abriou@st.com>2016-02-04 10:58:45 -0500
committerVincent Abriou <vincent.abriou@st.com>2016-02-26 04:06:22 -0500
commit90dffef595cfbcdd1cbceebf5b879367ad521c00 (patch)
tree84c064dbc1e1e32c53c4c812c047e9064d5b4e8f
parent670454bbf9f6e8a585fcad2d7a72d94b827f2cf5 (diff)
drm/sti: add debugfs entries for VID plane
Signed-off-by: Vincent Abriou <vincent.abriou@st.com> Reviewed-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
-rw-r--r--drivers/gpu/drm/sti/sti_compositor.c2
-rw-r--r--drivers/gpu/drm/sti/sti_vid.c94
-rw-r--r--drivers/gpu/drm/sti/sti_vid.h4
3 files changed, 95 insertions, 5 deletions
diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c
index afed2171beb9..5b827a9116b0 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -75,7 +75,7 @@ static int sti_compositor_bind(struct device *dev,
75 switch (desc[i].type) { 75 switch (desc[i].type) {
76 case STI_VID_SUBDEV: 76 case STI_VID_SUBDEV:
77 compo->vid[vid_id++] = 77 compo->vid[vid_id++] =
78 sti_vid_create(compo->dev, desc[i].id, 78 sti_vid_create(compo->dev, drm_dev, desc[i].id,
79 compo->regs + desc[i].offset); 79 compo->regs + desc[i].offset);
80 break; 80 break;
81 case STI_MIXER_MAIN_SUBDEV: 81 case STI_MIXER_MAIN_SUBDEV:
diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
index 0a1e50c540ad..5a2c5dc3687b 100644
--- a/drivers/gpu/drm/sti/sti_vid.c
+++ b/drivers/gpu/drm/sti/sti_vid.c
@@ -54,6 +54,93 @@
54 54
55#define VID_MIN_HD_HEIGHT 720 55#define VID_MIN_HD_HEIGHT 720
56 56
57#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
58 readl(vid->regs + reg))
59
60static void vid_dbg_ctl(struct seq_file *s, int val)
61{
62 val = val >> 30;
63 seq_puts(s, "\t");
64
65 if (!(val & 1))
66 seq_puts(s, "NOT ");
67 seq_puts(s, "ignored on main mixer - ");
68
69 if (!(val & 2))
70 seq_puts(s, "NOT ");
71 seq_puts(s, "ignored on aux mixer");
72}
73
74static void vid_dbg_vpo(struct seq_file *s, int val)
75{
76 seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
77}
78
79static void vid_dbg_vps(struct seq_file *s, int val)
80{
81 seq_printf(s, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
82}
83
84static void vid_dbg_mst(struct seq_file *s, int val)
85{
86 if (val & 1)
87 seq_puts(s, "\tBUFFER UNDERFLOW!");
88}
89
90static int vid_dbg_show(struct seq_file *s, void *arg)
91{
92 struct drm_info_node *node = s->private;
93 struct sti_vid *vid = (struct sti_vid *)node->info_ent->data;
94 struct drm_device *dev = node->minor->dev;
95 int ret;
96
97 ret = mutex_lock_interruptible(&dev->struct_mutex);
98 if (ret)
99 return ret;
100
101 seq_printf(s, "VID: (vaddr= 0x%p)", vid->regs);
102
103 DBGFS_DUMP(VID_CTL);
104 vid_dbg_ctl(s, readl(vid->regs + VID_CTL));
105 DBGFS_DUMP(VID_ALP);
106 DBGFS_DUMP(VID_CLF);
107 DBGFS_DUMP(VID_VPO);
108 vid_dbg_vpo(s, readl(vid->regs + VID_VPO));
109 DBGFS_DUMP(VID_VPS);
110 vid_dbg_vps(s, readl(vid->regs + VID_VPS));
111 DBGFS_DUMP(VID_KEY1);
112 DBGFS_DUMP(VID_KEY2);
113 DBGFS_DUMP(VID_MPR0);
114 DBGFS_DUMP(VID_MPR1);
115 DBGFS_DUMP(VID_MPR2);
116 DBGFS_DUMP(VID_MPR3);
117 DBGFS_DUMP(VID_MST);
118 vid_dbg_mst(s, readl(vid->regs + VID_MST));
119 DBGFS_DUMP(VID_BC);
120 DBGFS_DUMP(VID_TINT);
121 DBGFS_DUMP(VID_CSAT);
122 seq_puts(s, "\n");
123
124 mutex_unlock(&dev->struct_mutex);
125 return 0;
126}
127
128static struct drm_info_list vid_debugfs_files[] = {
129 { "vid", vid_dbg_show, 0, NULL },
130};
131
132static int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor)
133{
134 unsigned int i;
135
136 for (i = 0; i < ARRAY_SIZE(vid_debugfs_files); i++)
137 vid_debugfs_files[i].data = vid;
138
139 return drm_debugfs_create_files(vid_debugfs_files,
140 ARRAY_SIZE(vid_debugfs_files),
141 minor->debugfs_root, minor);
142}
143
57void sti_vid_commit(struct sti_vid *vid, 144void sti_vid_commit(struct sti_vid *vid,
58 struct drm_plane_state *state) 145 struct drm_plane_state *state)
59{ 146{
@@ -122,8 +209,8 @@ static void sti_vid_init(struct sti_vid *vid)
122 writel(VID_CSAT_DFLT, vid->regs + VID_CSAT); 209 writel(VID_CSAT_DFLT, vid->regs + VID_CSAT);
123} 210}
124 211
125struct sti_vid *sti_vid_create(struct device *dev, int id, 212struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev,
126 void __iomem *baseaddr) 213 int id, void __iomem *baseaddr)
127{ 214{
128 struct sti_vid *vid; 215 struct sti_vid *vid;
129 216
@@ -139,5 +226,8 @@ struct sti_vid *sti_vid_create(struct device *dev, int id,
139 226
140 sti_vid_init(vid); 227 sti_vid_init(vid);
141 228
229 if (vid_debugfs_init(vid, drm_dev->primary))
230 DRM_ERROR("VID debugfs setup failed\n");
231
142 return vid; 232 return vid;
143} 233}
diff --git a/drivers/gpu/drm/sti/sti_vid.h b/drivers/gpu/drm/sti/sti_vid.h
index 5dea4791f1d6..6c842344f3d8 100644
--- a/drivers/gpu/drm/sti/sti_vid.h
+++ b/drivers/gpu/drm/sti/sti_vid.h
@@ -23,7 +23,7 @@ struct sti_vid {
23void sti_vid_commit(struct sti_vid *vid, 23void sti_vid_commit(struct sti_vid *vid,
24 struct drm_plane_state *state); 24 struct drm_plane_state *state);
25void sti_vid_disable(struct sti_vid *vid); 25void sti_vid_disable(struct sti_vid *vid);
26struct sti_vid *sti_vid_create(struct device *dev, int id, 26struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev,
27 void __iomem *baseaddr); 27 int id, void __iomem *baseaddr);
28 28
29#endif 29#endif