Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/debugfs: add top-level 'bridges' file showing all added bridges

The global bridges_list holding all the bridges between drm_bridge_add()
and drm_bridge_remove() cannot be inspected via debugfs. Add a file showing
it.

To avoid code duplication, move the code printing a bridge info to a common
function.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250226-drm-debugfs-show-all-bridges-v8-2-bb511cc49d83@bootlin.com
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>

authored by

Luca Ceresoli and committed by
Louis Chauvet
eff0347e 9497c5a0

+53 -22
+50 -22
drivers/gpu/drm/drm_bridge.c
··· 1301 1301 EXPORT_SYMBOL(of_drm_find_bridge); 1302 1302 #endif 1303 1303 1304 + static void drm_bridge_debugfs_show_bridge(struct drm_printer *p, 1305 + struct drm_bridge *bridge, 1306 + unsigned int idx) 1307 + { 1308 + drm_printf(p, "bridge[%u]: %ps\n", idx, bridge->funcs); 1309 + drm_printf(p, "\ttype: [%d] %s\n", 1310 + bridge->type, 1311 + drm_get_connector_type_name(bridge->type)); 1312 + 1313 + if (bridge->of_node) 1314 + drm_printf(p, "\tOF: %pOFfc\n", bridge->of_node); 1315 + 1316 + drm_printf(p, "\tops: [0x%x]", bridge->ops); 1317 + if (bridge->ops & DRM_BRIDGE_OP_DETECT) 1318 + drm_puts(p, " detect"); 1319 + if (bridge->ops & DRM_BRIDGE_OP_EDID) 1320 + drm_puts(p, " edid"); 1321 + if (bridge->ops & DRM_BRIDGE_OP_HPD) 1322 + drm_puts(p, " hpd"); 1323 + if (bridge->ops & DRM_BRIDGE_OP_MODES) 1324 + drm_puts(p, " modes"); 1325 + if (bridge->ops & DRM_BRIDGE_OP_HDMI) 1326 + drm_puts(p, " hdmi"); 1327 + drm_puts(p, "\n"); 1328 + } 1329 + 1330 + static int allbridges_show(struct seq_file *m, void *data) 1331 + { 1332 + struct drm_printer p = drm_seq_file_printer(m); 1333 + struct drm_bridge *bridge; 1334 + unsigned int idx = 0; 1335 + 1336 + mutex_lock(&bridge_lock); 1337 + 1338 + list_for_each_entry(bridge, &bridge_list, list) 1339 + drm_bridge_debugfs_show_bridge(&p, bridge, idx++); 1340 + 1341 + mutex_unlock(&bridge_lock); 1342 + 1343 + return 0; 1344 + } 1345 + DEFINE_SHOW_ATTRIBUTE(allbridges); 1346 + 1304 1347 static int encoder_bridges_show(struct seq_file *m, void *data) 1305 1348 { 1306 1349 struct drm_encoder *encoder = m->private; ··· 1351 1308 struct drm_bridge *bridge; 1352 1309 unsigned int idx = 0; 1353 1310 1354 - drm_for_each_bridge_in_chain(encoder, bridge) { 1355 - drm_printf(&p, "bridge[%u]: %ps\n", idx++, bridge->funcs); 1356 - drm_printf(&p, "\ttype: [%d] %s\n", 1357 - bridge->type, 1358 - drm_get_connector_type_name(bridge->type)); 1359 - 1360 - if (bridge->of_node) 1361 - drm_printf(&p, "\tOF: %pOFfc\n", bridge->of_node); 1362 - 1363 - drm_printf(&p, "\tops: [0x%x]", bridge->ops); 1364 - if (bridge->ops & DRM_BRIDGE_OP_DETECT) 1365 - drm_puts(&p, " detect"); 1366 - if (bridge->ops & DRM_BRIDGE_OP_EDID) 1367 - drm_puts(&p, " edid"); 1368 - if (bridge->ops & DRM_BRIDGE_OP_HPD) 1369 - drm_puts(&p, " hpd"); 1370 - if (bridge->ops & DRM_BRIDGE_OP_MODES) 1371 - drm_puts(&p, " modes"); 1372 - if (bridge->ops & DRM_BRIDGE_OP_HDMI) 1373 - drm_puts(&p, " hdmi"); 1374 - drm_puts(&p, "\n"); 1375 - } 1311 + drm_for_each_bridge_in_chain(encoder, bridge) 1312 + drm_bridge_debugfs_show_bridge(&p, bridge, idx++); 1376 1313 1377 1314 return 0; 1378 1315 } 1379 1316 DEFINE_SHOW_ATTRIBUTE(encoder_bridges); 1317 + 1318 + void drm_bridge_debugfs_params(struct dentry *root) 1319 + { 1320 + debugfs_create_file("bridges", 0444, root, NULL, &allbridges_fops); 1321 + } 1380 1322 1381 1323 void drm_bridge_debugfs_encoder_params(struct dentry *root, 1382 1324 struct drm_encoder *encoder)
+2
drivers/gpu/drm/drm_drv.c
··· 40 40 #include <linux/xarray.h> 41 41 42 42 #include <drm/drm_accel.h> 43 + #include <drm/drm_bridge.h> 43 44 #include <drm/drm_cache.h> 44 45 #include <drm/drm_client_event.h> 45 46 #include <drm/drm_color_mgmt.h> ··· 1210 1209 } 1211 1210 1212 1211 drm_debugfs_root = debugfs_create_dir("dri", NULL); 1212 + drm_bridge_debugfs_params(drm_debugfs_root); 1213 1213 1214 1214 ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops); 1215 1215 if (ret < 0)
+1
include/drm/drm_bridge.h
··· 1108 1108 } 1109 1109 #endif 1110 1110 1111 + void drm_bridge_debugfs_params(struct dentry *root); 1111 1112 void drm_bridge_debugfs_encoder_params(struct dentry *root, struct drm_encoder *encoder); 1112 1113 1113 1114 #endif