diff options
author | Vincent Abriou <vincent.abriou@st.com> | 2016-02-04 11:44:50 -0500 |
---|---|---|
committer | Vincent Abriou <vincent.abriou@st.com> | 2016-02-26 04:06:23 -0500 |
commit | a5f81078a56c6ab57b7db2402ac64c34338004c5 (patch) | |
tree | d0fc9f3c990c075ea5e6217baf9acd7ec4d85257 | |
parent | 90dffef595cfbcdd1cbceebf5b879367ad521c00 (diff) |
drm/sti: add debugfs entries for MIXER crtc
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.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/sti/sti_mixer.c | 146 | ||||
-rw-r--r-- | drivers/gpu/drm/sti/sti_mixer.h | 4 |
3 files changed, 149 insertions, 3 deletions
diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c index 5b827a9116b0..3d2fa3ab33df 100644 --- a/drivers/gpu/drm/sti/sti_compositor.c +++ b/drivers/gpu/drm/sti/sti_compositor.c | |||
@@ -81,7 +81,7 @@ static int sti_compositor_bind(struct device *dev, | |||
81 | case STI_MIXER_MAIN_SUBDEV: | 81 | case STI_MIXER_MAIN_SUBDEV: |
82 | case STI_MIXER_AUX_SUBDEV: | 82 | case STI_MIXER_AUX_SUBDEV: |
83 | compo->mixer[mixer_id++] = | 83 | compo->mixer[mixer_id++] = |
84 | sti_mixer_create(compo->dev, desc[i].id, | 84 | sti_mixer_create(compo->dev, drm_dev, desc[i].id, |
85 | compo->regs + desc[i].offset); | 85 | compo->regs + desc[i].offset); |
86 | break; | 86 | break; |
87 | case STI_GPD_SUBDEV: | 87 | case STI_GPD_SUBDEV: |
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c index 49db835dce03..e7425c38fc93 100644 --- a/drivers/gpu/drm/sti/sti_mixer.c +++ b/drivers/gpu/drm/sti/sti_mixer.c | |||
@@ -75,6 +75,145 @@ static inline void sti_mixer_reg_write(struct sti_mixer *mixer, | |||
75 | writel(val, mixer->regs + reg_id); | 75 | writel(val, mixer->regs + reg_id); |
76 | } | 76 | } |
77 | 77 | ||
78 | #define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \ | ||
79 | sti_mixer_reg_read(mixer, reg)) | ||
80 | |||
81 | static void mixer_dbg_ctl(struct seq_file *s, int val) | ||
82 | { | ||
83 | unsigned int i; | ||
84 | int count = 0; | ||
85 | char *const disp_layer[] = {"BKG", "VID0", "VID1", "GDP0", | ||
86 | "GDP1", "GDP2", "GDP3"}; | ||
87 | |||
88 | seq_puts(s, "\tEnabled: "); | ||
89 | for (i = 0; i < 7; i++) { | ||
90 | if (val & 1) { | ||
91 | seq_printf(s, "%s ", disp_layer[i]); | ||
92 | count++; | ||
93 | } | ||
94 | val = val >> 1; | ||
95 | } | ||
96 | |||
97 | val = val >> 2; | ||
98 | if (val & 1) { | ||
99 | seq_puts(s, "CURS "); | ||
100 | count++; | ||
101 | } | ||
102 | if (!count) | ||
103 | seq_puts(s, "Nothing"); | ||
104 | } | ||
105 | |||
106 | static void mixer_dbg_crb(struct seq_file *s, int val) | ||
107 | { | ||
108 | int i; | ||
109 | |||
110 | seq_puts(s, "\tDepth: "); | ||
111 | for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) { | ||
112 | switch (val & GAM_DEPTH_MASK_ID) { | ||
113 | case GAM_DEPTH_VID0_ID: | ||
114 | seq_puts(s, "VID0"); | ||
115 | break; | ||
116 | case GAM_DEPTH_VID1_ID: | ||
117 | seq_puts(s, "VID1"); | ||
118 | break; | ||
119 | case GAM_DEPTH_GDP0_ID: | ||
120 | seq_puts(s, "GDP0"); | ||
121 | break; | ||
122 | case GAM_DEPTH_GDP1_ID: | ||
123 | seq_puts(s, "GDP1"); | ||
124 | break; | ||
125 | case GAM_DEPTH_GDP2_ID: | ||
126 | seq_puts(s, "GDP2"); | ||
127 | break; | ||
128 | case GAM_DEPTH_GDP3_ID: | ||
129 | seq_puts(s, "GDP3"); | ||
130 | break; | ||
131 | default: | ||
132 | seq_puts(s, "---"); | ||
133 | } | ||
134 | |||
135 | if (i < GAM_MIXER_NB_DEPTH_LEVEL - 1) | ||
136 | seq_puts(s, " < "); | ||
137 | val = val >> 3; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | static void mixer_dbg_mxn(struct seq_file *s, void *addr) | ||
142 | { | ||
143 | int i; | ||
144 | |||
145 | for (i = 1; i < 8; i++) | ||
146 | seq_printf(s, "-0x%08X", (int)readl(addr + i * 4)); | ||
147 | } | ||
148 | |||
149 | static int mixer_dbg_show(struct seq_file *s, void *arg) | ||
150 | { | ||
151 | struct drm_info_node *node = s->private; | ||
152 | struct sti_mixer *mixer = (struct sti_mixer *)node->info_ent->data; | ||
153 | struct drm_device *dev = node->minor->dev; | ||
154 | int ret; | ||
155 | |||
156 | ret = mutex_lock_interruptible(&dev->struct_mutex); | ||
157 | if (ret) | ||
158 | return ret; | ||
159 | |||
160 | seq_printf(s, "%s: (vaddr = 0x%p)", | ||
161 | sti_mixer_to_str(mixer), mixer->regs); | ||
162 | |||
163 | DBGFS_DUMP(GAM_MIXER_CTL); | ||
164 | mixer_dbg_ctl(s, sti_mixer_reg_read(mixer, GAM_MIXER_CTL)); | ||
165 | DBGFS_DUMP(GAM_MIXER_BKC); | ||
166 | DBGFS_DUMP(GAM_MIXER_BCO); | ||
167 | DBGFS_DUMP(GAM_MIXER_BCS); | ||
168 | DBGFS_DUMP(GAM_MIXER_AVO); | ||
169 | DBGFS_DUMP(GAM_MIXER_AVS); | ||
170 | DBGFS_DUMP(GAM_MIXER_CRB); | ||
171 | mixer_dbg_crb(s, sti_mixer_reg_read(mixer, GAM_MIXER_CRB)); | ||
172 | DBGFS_DUMP(GAM_MIXER_ACT); | ||
173 | DBGFS_DUMP(GAM_MIXER_MBP); | ||
174 | DBGFS_DUMP(GAM_MIXER_MX0); | ||
175 | mixer_dbg_mxn(s, mixer->regs + GAM_MIXER_MX0); | ||
176 | seq_puts(s, "\n"); | ||
177 | |||
178 | mutex_unlock(&dev->struct_mutex); | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | static struct drm_info_list mixer0_debugfs_files[] = { | ||
183 | { "mixer_main", mixer_dbg_show, 0, NULL }, | ||
184 | }; | ||
185 | |||
186 | static struct drm_info_list mixer1_debugfs_files[] = { | ||
187 | { "mixer_aux", mixer_dbg_show, 0, NULL }, | ||
188 | }; | ||
189 | |||
190 | static int mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor) | ||
191 | { | ||
192 | unsigned int i; | ||
193 | struct drm_info_list *mixer_debugfs_files; | ||
194 | int nb_files; | ||
195 | |||
196 | switch (mixer->id) { | ||
197 | case STI_MIXER_MAIN: | ||
198 | mixer_debugfs_files = mixer0_debugfs_files; | ||
199 | nb_files = ARRAY_SIZE(mixer0_debugfs_files); | ||
200 | break; | ||
201 | case STI_MIXER_AUX: | ||
202 | mixer_debugfs_files = mixer1_debugfs_files; | ||
203 | nb_files = ARRAY_SIZE(mixer1_debugfs_files); | ||
204 | break; | ||
205 | default: | ||
206 | return -EINVAL; | ||
207 | } | ||
208 | |||
209 | for (i = 0; i < nb_files; i++) | ||
210 | mixer_debugfs_files[i].data = mixer; | ||
211 | |||
212 | return drm_debugfs_create_files(mixer_debugfs_files, | ||
213 | nb_files, | ||
214 | minor->debugfs_root, minor); | ||
215 | } | ||
216 | |||
78 | void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable) | 217 | void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable) |
79 | { | 218 | { |
80 | u32 val = sti_mixer_reg_read(mixer, GAM_MIXER_CTL); | 219 | u32 val = sti_mixer_reg_read(mixer, GAM_MIXER_CTL); |
@@ -237,7 +376,9 @@ void sti_mixer_set_matrix(struct sti_mixer *mixer) | |||
237 | mixerColorSpaceMatIdentity[i]); | 376 | mixerColorSpaceMatIdentity[i]); |
238 | } | 377 | } |
239 | 378 | ||
240 | struct sti_mixer *sti_mixer_create(struct device *dev, int id, | 379 | struct sti_mixer *sti_mixer_create(struct device *dev, |
380 | struct drm_device *drm_dev, | ||
381 | int id, | ||
241 | void __iomem *baseaddr) | 382 | void __iomem *baseaddr) |
242 | { | 383 | { |
243 | struct sti_mixer *mixer = devm_kzalloc(dev, sizeof(*mixer), GFP_KERNEL); | 384 | struct sti_mixer *mixer = devm_kzalloc(dev, sizeof(*mixer), GFP_KERNEL); |
@@ -258,5 +399,8 @@ struct sti_mixer *sti_mixer_create(struct device *dev, int id, | |||
258 | DRM_DEBUG_DRIVER("%s created. Regs=%p\n", | 399 | DRM_DEBUG_DRIVER("%s created. Regs=%p\n", |
259 | sti_mixer_to_str(mixer), mixer->regs); | 400 | sti_mixer_to_str(mixer), mixer->regs); |
260 | 401 | ||
402 | if (mixer_debugfs_init(mixer, drm_dev->primary)) | ||
403 | DRM_ERROR("MIXER debugfs setup failed\n"); | ||
404 | |||
261 | return mixer; | 405 | return mixer; |
262 | } | 406 | } |
diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h index efb1a9a5ba86..6f35fc086873 100644 --- a/drivers/gpu/drm/sti/sti_mixer.h +++ b/drivers/gpu/drm/sti/sti_mixer.h | |||
@@ -42,7 +42,9 @@ struct sti_mixer { | |||
42 | 42 | ||
43 | const char *sti_mixer_to_str(struct sti_mixer *mixer); | 43 | const char *sti_mixer_to_str(struct sti_mixer *mixer); |
44 | 44 | ||
45 | struct sti_mixer *sti_mixer_create(struct device *dev, int id, | 45 | struct sti_mixer *sti_mixer_create(struct device *dev, |
46 | struct drm_device *drm_dev, | ||
47 | int id, | ||
46 | void __iomem *baseaddr); | 48 | void __iomem *baseaddr); |
47 | 49 | ||
48 | int sti_mixer_set_plane_status(struct sti_mixer *mixer, | 50 | int sti_mixer_set_plane_status(struct sti_mixer *mixer, |