diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index b32d625a790d..5ba50d469e4d 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -133,6 +134,50 @@ static void rockchip_iommu_cleanup(struct drm_device *drm_dev) iommu_domain_free(private->domain); } +#ifdef CONFIG_DEBUG_FS +static int rockchip_drm_summary_show(struct seq_file *s, void *data) +{ + struct drm_info_node *node = s->private; + struct drm_minor *minor = node->minor; + struct drm_device *drm_dev = minor->dev; + struct rockchip_drm_private *priv = drm_dev->dev_private; + struct drm_crtc *crtc; + + drm_for_each_crtc(crtc, drm_dev) { + int pipe = drm_crtc_index(crtc); + + if (priv->crtc_funcs[pipe] && + priv->crtc_funcs[pipe]->debugfs_dump) + priv->crtc_funcs[pipe]->debugfs_dump(crtc, s); + } + + return 0; +} + +static struct drm_info_list rockchip_debugfs_files[] = { + { "summary", rockchip_drm_summary_show, 0, NULL }, +}; + +static void rockchip_drm_debugfs_init(struct drm_minor *minor) +{ + struct drm_device *dev = minor->dev; + struct rockchip_drm_private *priv = dev->dev_private; + struct drm_crtc *crtc; + + drm_debugfs_create_files(rockchip_debugfs_files, + ARRAY_SIZE(rockchip_debugfs_files), + minor->debugfs_root, minor); + + drm_for_each_crtc(crtc, dev) { + int pipe = drm_crtc_index(crtc); + + if (priv->crtc_funcs[pipe] && + priv->crtc_funcs[pipe]->debugfs_init) + priv->crtc_funcs[pipe]->debugfs_init(minor, crtc); + } +} +#endif + static int rockchip_drm_bind(struct device *dev) { struct drm_device *drm_dev; @@ -247,6 +292,9 @@ static struct drm_driver rockchip_drm_driver = { .gem_prime_vmap = rockchip_gem_prime_vmap, .gem_prime_vunmap = rockchip_gem_prime_vunmap, .gem_prime_mmap = rockchip_gem_mmap_buf, +#ifdef CONFIG_DEBUG_FS + .debugfs_init = rockchip_drm_debugfs_init, +#endif .fops = &rockchip_drm_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC,