aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/arm/display/komeda/d71/d71_component.c205
-rw-r--r--drivers/gpu/drm/arm/display/komeda/komeda_dev.c52
-rw-r--r--drivers/gpu/drm/arm/display/komeda/komeda_dev.h5
-rw-r--r--drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c20
-rw-r--r--drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h3
5 files changed, 285 insertions, 0 deletions
diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
index 006fe8fb4153..c56cfc2de147 100644
--- a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
+++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
@@ -71,6 +71,42 @@ static u32 get_valid_inputs(struct block_header *blk)
71 return valid_inputs; 71 return valid_inputs;
72} 72}
73 73
74static void get_values_from_reg(void __iomem *reg, u32 offset,
75 u32 count, u32 *val)
76{
77 u32 i, addr;
78
79 for (i = 0; i < count; i++) {
80 addr = offset + (i << 2);
81 /* 0xA4 is WO register */
82 if (addr != 0xA4)
83 val[i] = malidp_read32(reg, addr);
84 else
85 val[i] = 0xDEADDEAD;
86 }
87}
88
89static void dump_block_header(struct seq_file *sf, void __iomem *reg)
90{
91 struct block_header hdr;
92 u32 i, n_input, n_output;
93
94 d71_read_block_header(reg, &hdr);
95 seq_printf(sf, "BLOCK_INFO:\t\t0x%X\n", hdr.block_info);
96 seq_printf(sf, "PIPELINE_INFO:\t\t0x%X\n", hdr.pipeline_info);
97
98 n_output = PIPELINE_INFO_N_OUTPUTS(hdr.pipeline_info);
99 n_input = PIPELINE_INFO_N_VALID_INPUTS(hdr.pipeline_info);
100
101 for (i = 0; i < n_input; i++)
102 seq_printf(sf, "VALID_INPUT_ID%u:\t0x%X\n",
103 i, hdr.input_ids[i]);
104
105 for (i = 0; i < n_output; i++)
106 seq_printf(sf, "OUTPUT_ID%u:\t\t0x%X\n",
107 i, hdr.output_ids[i]);
108}
109
74static u32 to_rot_ctrl(u32 rot) 110static u32 to_rot_ctrl(u32 rot)
75{ 111{
76 u32 lr_ctrl = 0; 112 u32 lr_ctrl = 0;
@@ -143,9 +179,76 @@ static void d71_layer_update(struct komeda_component *c,
143 malidp_write32_mask(reg, BLK_CONTROL, ctrl_mask, ctrl); 179 malidp_write32_mask(reg, BLK_CONTROL, ctrl_mask, ctrl);
144} 180}
145 181
182static void d71_layer_dump(struct komeda_component *c, struct seq_file *sf)
183{
184 u32 v[15], i;
185 bool rich, rgb2rgb;
186 char *prefix;
187
188 get_values_from_reg(c->reg, LAYER_INFO, 1, &v[14]);
189 if (v[14] & 0x1) {
190 rich = true;
191 prefix = "LR_";
192 } else {
193 rich = false;
194 prefix = "LS_";
195 }
196
197 rgb2rgb = !!(v[14] & L_INFO_CM);
198
199 dump_block_header(sf, c->reg);
200
201 seq_printf(sf, "%sLAYER_INFO:\t\t0x%X\n", prefix, v[14]);
202
203 get_values_from_reg(c->reg, 0xD0, 1, v);
204 seq_printf(sf, "%sCONTROL:\t\t0x%X\n", prefix, v[0]);
205 if (rich) {
206 get_values_from_reg(c->reg, 0xD4, 1, v);
207 seq_printf(sf, "LR_RICH_CONTROL:\t0x%X\n", v[0]);
208 }
209 get_values_from_reg(c->reg, 0xD8, 4, v);
210 seq_printf(sf, "%sFORMAT:\t\t0x%X\n", prefix, v[0]);
211 seq_printf(sf, "%sIT_COEFFTAB:\t\t0x%X\n", prefix, v[1]);
212 seq_printf(sf, "%sIN_SIZE:\t\t0x%X\n", prefix, v[2]);
213 seq_printf(sf, "%sPALPHA:\t\t0x%X\n", prefix, v[3]);
214
215 get_values_from_reg(c->reg, 0x100, 3, v);
216 seq_printf(sf, "%sP0_PTR_LOW:\t\t0x%X\n", prefix, v[0]);
217 seq_printf(sf, "%sP0_PTR_HIGH:\t\t0x%X\n", prefix, v[1]);
218 seq_printf(sf, "%sP0_STRIDE:\t\t0x%X\n", prefix, v[2]);
219
220 get_values_from_reg(c->reg, 0x110, 2, v);
221 seq_printf(sf, "%sP1_PTR_LOW:\t\t0x%X\n", prefix, v[0]);
222 seq_printf(sf, "%sP1_PTR_HIGH:\t\t0x%X\n", prefix, v[1]);
223 if (rich) {
224 get_values_from_reg(c->reg, 0x118, 1, v);
225 seq_printf(sf, "LR_P1_STRIDE:\t\t0x%X\n", v[0]);
226
227 get_values_from_reg(c->reg, 0x120, 2, v);
228 seq_printf(sf, "LR_P2_PTR_LOW:\t\t0x%X\n", v[0]);
229 seq_printf(sf, "LR_P2_PTR_HIGH:\t\t0x%X\n", v[1]);
230
231 get_values_from_reg(c->reg, 0x130, 12, v);
232 for (i = 0; i < 12; i++)
233 seq_printf(sf, "LR_YUV_RGB_COEFF%u:\t0x%X\n", i, v[i]);
234 }
235
236 if (rgb2rgb) {
237 get_values_from_reg(c->reg, LAYER_RGB_RGB_COEFF0, 12, v);
238 for (i = 0; i < 12; i++)
239 seq_printf(sf, "LS_RGB_RGB_COEFF%u:\t0x%X\n", i, v[i]);
240 }
241
242 get_values_from_reg(c->reg, 0x160, 3, v);
243 seq_printf(sf, "%sAD_CONTROL:\t\t0x%X\n", prefix, v[0]);
244 seq_printf(sf, "%sAD_H_CROP:\t\t0x%X\n", prefix, v[1]);
245 seq_printf(sf, "%sAD_V_CROP:\t\t0x%X\n", prefix, v[2]);
246}
247
146static struct komeda_component_funcs d71_layer_funcs = { 248static struct komeda_component_funcs d71_layer_funcs = {
147 .update = d71_layer_update, 249 .update = d71_layer_update,
148 .disable = d71_layer_disable, 250 .disable = d71_layer_disable,
251 .dump_register = d71_layer_dump,
149}; 252};
150 253
151static int d71_layer_init(struct d71_dev *d71, 254static int d71_layer_init(struct d71_dev *d71,
@@ -252,9 +355,46 @@ static void d71_compiz_update(struct komeda_component *c,
252 malidp_write32(reg, BLK_SIZE, HV_SIZE(st->hsize, st->vsize)); 355 malidp_write32(reg, BLK_SIZE, HV_SIZE(st->hsize, st->vsize));
253} 356}
254 357
358static void d71_compiz_dump(struct komeda_component *c, struct seq_file *sf)
359{
360 u32 v[8], i;
361
362 dump_block_header(sf, c->reg);
363
364 get_values_from_reg(c->reg, 0x80, 5, v);
365 for (i = 0; i < 5; i++)
366 seq_printf(sf, "CU_INPUT_ID%u:\t\t0x%X\n", i, v[i]);
367
368 get_values_from_reg(c->reg, 0xA0, 5, v);
369 seq_printf(sf, "CU_IRQ_RAW_STATUS:\t0x%X\n", v[0]);
370 seq_printf(sf, "CU_IRQ_CLEAR:\t\t0x%X\n", v[1]);
371 seq_printf(sf, "CU_IRQ_MASK:\t\t0x%X\n", v[2]);
372 seq_printf(sf, "CU_IRQ_STATUS:\t\t0x%X\n", v[3]);
373 seq_printf(sf, "CU_STATUS:\t\t0x%X\n", v[4]);
374
375 get_values_from_reg(c->reg, 0xD0, 2, v);
376 seq_printf(sf, "CU_CONTROL:\t\t0x%X\n", v[0]);
377 seq_printf(sf, "CU_SIZE:\t\t0x%X\n", v[1]);
378
379 get_values_from_reg(c->reg, 0xDC, 1, v);
380 seq_printf(sf, "CU_BG_COLOR:\t\t0x%X\n", v[0]);
381
382 for (i = 0, v[4] = 0xE0; i < 5; i++, v[4] += 0x10) {
383 get_values_from_reg(c->reg, v[4], 3, v);
384 seq_printf(sf, "CU_INPUT%u_SIZE:\t\t0x%X\n", i, v[0]);
385 seq_printf(sf, "CU_INPUT%u_OFFSET:\t0x%X\n", i, v[1]);
386 seq_printf(sf, "CU_INPUT%u_CONTROL:\t0x%X\n", i, v[2]);
387 }
388
389 get_values_from_reg(c->reg, 0x130, 2, v);
390 seq_printf(sf, "CU_USER_LOW:\t\t0x%X\n", v[0]);
391 seq_printf(sf, "CU_USER_HIGH:\t\t0x%X\n", v[1]);
392}
393
255struct komeda_component_funcs d71_compiz_funcs = { 394struct komeda_component_funcs d71_compiz_funcs = {
256 .update = d71_compiz_update, 395 .update = d71_compiz_update,
257 .disable = d71_component_disable, 396 .disable = d71_component_disable,
397 .dump_register = d71_compiz_dump,
258}; 398};
259 399
260static int d71_compiz_init(struct d71_dev *d71, 400static int d71_compiz_init(struct d71_dev *d71,
@@ -300,9 +440,37 @@ static void d71_improc_update(struct komeda_component *c,
300 malidp_write32(reg, BLK_SIZE, HV_SIZE(st->hsize, st->vsize)); 440 malidp_write32(reg, BLK_SIZE, HV_SIZE(st->hsize, st->vsize));
301} 441}
302 442
443static void d71_improc_dump(struct komeda_component *c, struct seq_file *sf)
444{
445 u32 v[12], i;
446
447 dump_block_header(sf, c->reg);
448
449 get_values_from_reg(c->reg, 0x80, 2, v);
450 seq_printf(sf, "IPS_INPUT_ID0:\t\t0x%X\n", v[0]);
451 seq_printf(sf, "IPS_INPUT_ID1:\t\t0x%X\n", v[1]);
452
453 get_values_from_reg(c->reg, 0xC0, 1, v);
454 seq_printf(sf, "IPS_INFO:\t\t0x%X\n", v[0]);
455
456 get_values_from_reg(c->reg, 0xD0, 3, v);
457 seq_printf(sf, "IPS_CONTROL:\t\t0x%X\n", v[0]);
458 seq_printf(sf, "IPS_SIZE:\t\t0x%X\n", v[1]);
459 seq_printf(sf, "IPS_DEPTH:\t\t0x%X\n", v[2]);
460
461 get_values_from_reg(c->reg, 0x130, 12, v);
462 for (i = 0; i < 12; i++)
463 seq_printf(sf, "IPS_RGB_RGB_COEFF%u:\t0x%X\n", i, v[i]);
464
465 get_values_from_reg(c->reg, 0x170, 12, v);
466 for (i = 0; i < 12; i++)
467 seq_printf(sf, "IPS_RGB_YUV_COEFF%u:\t0x%X\n", i, v[i]);
468}
469
303struct komeda_component_funcs d71_improc_funcs = { 470struct komeda_component_funcs d71_improc_funcs = {
304 .update = d71_improc_update, 471 .update = d71_improc_update,
305 .disable = d71_component_disable, 472 .disable = d71_component_disable,
473 .dump_register = d71_improc_dump,
306}; 474};
307 475
308static int d71_improc_init(struct d71_dev *d71, 476static int d71_improc_init(struct d71_dev *d71,
@@ -375,9 +543,46 @@ static void d71_timing_ctrlr_update(struct komeda_component *c,
375 malidp_write32(reg, BLK_CONTROL, value); 543 malidp_write32(reg, BLK_CONTROL, value);
376} 544}
377 545
546void d71_timing_ctrlr_dump(struct komeda_component *c, struct seq_file *sf)
547{
548 u32 v[8], i;
549
550 dump_block_header(sf, c->reg);
551
552 get_values_from_reg(c->reg, 0xC0, 1, v);
553 seq_printf(sf, "BS_INFO:\t\t0x%X\n", v[0]);
554
555 get_values_from_reg(c->reg, 0xD0, 8, v);
556 seq_printf(sf, "BS_CONTROL:\t\t0x%X\n", v[0]);
557 seq_printf(sf, "BS_PROG_LINE:\t\t0x%X\n", v[1]);
558 seq_printf(sf, "BS_PREFETCH_LINE:\t0x%X\n", v[2]);
559 seq_printf(sf, "BS_BG_COLOR:\t\t0x%X\n", v[3]);
560 seq_printf(sf, "BS_ACTIVESIZE:\t\t0x%X\n", v[4]);
561 seq_printf(sf, "BS_HINTERVALS:\t\t0x%X\n", v[5]);
562 seq_printf(sf, "BS_VINTERVALS:\t\t0x%X\n", v[6]);
563 seq_printf(sf, "BS_SYNC:\t\t0x%X\n", v[7]);
564
565 get_values_from_reg(c->reg, 0x100, 3, v);
566 seq_printf(sf, "BS_DRIFT_TO:\t\t0x%X\n", v[0]);
567 seq_printf(sf, "BS_FRAME_TO:\t\t0x%X\n", v[1]);
568 seq_printf(sf, "BS_TE_TO:\t\t0x%X\n", v[2]);
569
570 get_values_from_reg(c->reg, 0x110, 3, v);
571 for (i = 0; i < 3; i++)
572 seq_printf(sf, "BS_T%u_INTERVAL:\t\t0x%X\n", i, v[i]);
573
574 get_values_from_reg(c->reg, 0x120, 5, v);
575 for (i = 0; i < 2; i++) {
576 seq_printf(sf, "BS_CRC%u_LOW:\t\t0x%X\n", i, v[i << 1]);
577 seq_printf(sf, "BS_CRC%u_HIGH:\t\t0x%X\n", i, v[(i << 1) + 1]);
578 }
579 seq_printf(sf, "BS_USER:\t\t0x%X\n", v[4]);
580}
581
378struct komeda_component_funcs d71_timing_ctrlr_funcs = { 582struct komeda_component_funcs d71_timing_ctrlr_funcs = {
379 .update = d71_timing_ctrlr_update, 583 .update = d71_timing_ctrlr_update,
380 .disable = d71_timing_ctrlr_disable, 584 .disable = d71_timing_ctrlr_disable,
585 .dump_register = d71_timing_ctrlr_dump,
381}; 586};
382 587
383static int d71_timing_ctrlr_init(struct d71_dev *d71, 588static int d71_timing_ctrlr_init(struct d71_dev *d71,
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
index cf65bf5331d9..b420c6205d6b 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
@@ -8,11 +8,55 @@
8#include <linux/of_device.h> 8#include <linux/of_device.h>
9#include <linux/of_graph.h> 9#include <linux/of_graph.h>
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#ifdef CONFIG_DEBUG_FS
12#include <linux/debugfs.h>
13#include <linux/seq_file.h>
14#endif
11 15
12#include <drm/drm_print.h> 16#include <drm/drm_print.h>
13 17
14#include "komeda_dev.h" 18#include "komeda_dev.h"
15 19
20static int komeda_register_show(struct seq_file *sf, void *x)
21{
22 struct komeda_dev *mdev = sf->private;
23 int i;
24
25 if (mdev->funcs->dump_register)
26 mdev->funcs->dump_register(mdev, sf);
27
28 for (i = 0; i < mdev->n_pipelines; i++)
29 komeda_pipeline_dump_register(mdev->pipelines[i], sf);
30
31 return 0;
32}
33
34static int komeda_register_open(struct inode *inode, struct file *filp)
35{
36 return single_open(filp, komeda_register_show, inode->i_private);
37}
38
39static const struct file_operations komeda_register_fops = {
40 .owner = THIS_MODULE,
41 .open = komeda_register_open,
42 .read = seq_read,
43 .llseek = seq_lseek,
44 .release = single_release,
45};
46
47static void komeda_debugfs_init(struct komeda_dev *mdev)
48{
49 if (!debugfs_initialized())
50 return;
51
52 mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
53 if (IS_ERR_OR_NULL(mdev->debugfs_root))
54 return;
55
56 debugfs_create_file("register", 0444, mdev->debugfs_root,
57 mdev, &komeda_register_fops);
58}
59
16static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np) 60static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np)
17{ 61{
18 struct komeda_pipeline *pipe; 62 struct komeda_pipeline *pipe;
@@ -159,6 +203,10 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
159 goto err_cleanup; 203 goto err_cleanup;
160 } 204 }
161 205
206#ifdef CONFIG_DEBUG_FS
207 komeda_debugfs_init(mdev);
208#endif
209
162 return mdev; 210 return mdev;
163 211
164err_cleanup: 212err_cleanup:
@@ -172,6 +220,10 @@ void komeda_dev_destroy(struct komeda_dev *mdev)
172 struct komeda_dev_funcs *funcs = mdev->funcs; 220 struct komeda_dev_funcs *funcs = mdev->funcs;
173 int i; 221 int i;
174 222
223#ifdef CONFIG_DEBUG_FS
224 debugfs_remove_recursive(mdev->debugfs_root);
225#endif
226
175 for (i = 0; i < mdev->n_pipelines; i++) { 227 for (i = 0; i < mdev->n_pipelines; i++) {
176 komeda_pipeline_destroy(mdev, mdev->pipelines[i]); 228 komeda_pipeline_destroy(mdev, mdev->pipelines[i]);
177 mdev->pipelines[i] = NULL; 229 mdev->pipelines[i] = NULL;
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
index 681fe022bd22..8eae2620ce77 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
@@ -103,6 +103,9 @@ struct komeda_dev_funcs {
103 int (*enable_irq)(struct komeda_dev *mdev); 103 int (*enable_irq)(struct komeda_dev *mdev);
104 /** @disable_irq: disable irq */ 104 /** @disable_irq: disable irq */
105 int (*disable_irq)(struct komeda_dev *mdev); 105 int (*disable_irq)(struct komeda_dev *mdev);
106
107 /** @dump_register: Optional, dump registers to seq_file */
108 void (*dump_register)(struct komeda_dev *mdev, struct seq_file *seq);
106}; 109};
107 110
108/** 111/**
@@ -139,6 +142,8 @@ struct komeda_dev {
139 * destroyed by &komeda_dev_funcs.cleanup() 142 * destroyed by &komeda_dev_funcs.cleanup()
140 */ 143 */
141 void *chip_data; 144 void *chip_data;
145
146 struct dentry *debugfs_root;
142}; 147};
143 148
144static inline bool 149static inline bool
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
index ca85e12312a3..07398efc40f5 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
@@ -275,3 +275,23 @@ int komeda_assemble_pipelines(struct komeda_dev *mdev)
275 275
276 return 0; 276 return 0;
277} 277}
278
279void komeda_pipeline_dump_register(struct komeda_pipeline *pipe,
280 struct seq_file *sf)
281{
282 struct komeda_component *c;
283 u32 id;
284
285 seq_printf(sf, "\n======== Pipeline-%d ==========\n", pipe->id);
286
287 if (pipe->funcs && pipe->funcs->dump_register)
288 pipe->funcs->dump_register(pipe, sf);
289
290 dp_for_each_set_bit(id, pipe->avail_comps) {
291 c = komeda_pipeline_get_component(pipe, id);
292
293 seq_printf(sf, "\n------%s------\n", c->name);
294 if (c->funcs->dump_register)
295 c->funcs->dump_register(c, sf);
296 }
297}
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
index f9b7f517a484..c30a790d0712 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
@@ -367,6 +367,9 @@ int komeda_assemble_pipelines(struct komeda_dev *mdev);
367struct komeda_component * 367struct komeda_component *
368komeda_pipeline_get_component(struct komeda_pipeline *pipe, int id); 368komeda_pipeline_get_component(struct komeda_pipeline *pipe, int id);
369 369
370void komeda_pipeline_dump_register(struct komeda_pipeline *pipe,
371 struct seq_file *sf);
372
370/* component APIs */ 373/* component APIs */
371struct komeda_component * 374struct komeda_component *
372komeda_component_add(struct komeda_pipeline *pipe, 375komeda_component_add(struct komeda_pipeline *pipe,