Commit c9be804c authored by Eric Anholt's avatar Eric Anholt

drm/vc4: Use common helpers for debugfs setup by the driver components.

The global list of all debugfs entries for the driver was painful: the
list couldn't see into the components' structs, so each component had
its own debugs show function to find the component, then find the
regset and dump it.  The components also had to be careful to check
that they were actually registered in vc4 before dereferencing
themselves, in case they weren't probed on a particular platform.
They routinely failed at that.

Instead, we can have the components add their debugfs callbacks to a
little list in vc4 to be registered at drm_dev_register() time, which
gets vc4_debugfs.c out of the business of knowing the whole list of
components.

Thanks to this change, dsi0 (if it existed) would register its node.

v2: Rebase on hvs_underrun addition.
v3: whitespace fixup
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190401183559.3823-1-eric@anholt.netReviewed-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
parent fc13d710
...@@ -66,8 +66,7 @@ static void vc4_bo_stats_print(struct drm_printer *p, struct vc4_dev *vc4) ...@@ -66,8 +66,7 @@ static void vc4_bo_stats_print(struct drm_printer *p, struct vc4_dev *vc4)
mutex_unlock(&vc4->purgeable.lock); mutex_unlock(&vc4->purgeable.lock);
} }
#ifdef CONFIG_DEBUG_FS static int vc4_bo_stats_debugfs(struct seq_file *m, void *unused)
int vc4_bo_stats_debugfs(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *)m->private; struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
...@@ -78,7 +77,6 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) ...@@ -78,7 +77,6 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused)
return 0; return 0;
} }
#endif
/* Takes ownership of *name and returns the appropriate slot for it in /* Takes ownership of *name and returns the appropriate slot for it in
* the bo_labels[] array, extending it as necessary. * the bo_labels[] array, extending it as necessary.
...@@ -1005,6 +1003,8 @@ int vc4_bo_cache_init(struct drm_device *dev) ...@@ -1005,6 +1003,8 @@ int vc4_bo_cache_init(struct drm_device *dev)
mutex_init(&vc4->bo_lock); mutex_init(&vc4->bo_lock);
vc4_debugfs_add_file(dev, "bo_stats", vc4_bo_stats_debugfs, NULL);
INIT_LIST_HEAD(&vc4->bo_cache.time_list); INIT_LIST_HEAD(&vc4->bo_cache.time_list);
INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work);
......
...@@ -84,33 +84,6 @@ static const struct debugfs_reg32 crtc_regs[] = { ...@@ -84,33 +84,6 @@ static const struct debugfs_reg32 crtc_regs[] = {
VC4_REG32(PV_HACT_ACT), VC4_REG32(PV_HACT_ACT),
}; };
#ifdef CONFIG_DEBUG_FS
int vc4_crtc_debugfs_regs(struct seq_file *m, void *unused)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *dev = node->minor->dev;
int crtc_index = (uintptr_t)node->info_ent->data;
struct drm_printer p = drm_seq_file_printer(m);
struct drm_crtc *crtc;
struct vc4_crtc *vc4_crtc;
int i;
i = 0;
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
if (i == crtc_index)
break;
i++;
}
if (!crtc)
return 0;
vc4_crtc = to_vc4_crtc(crtc);
drm_print_regset32(&p, &vc4_crtc->regset);
return 0;
}
#endif
bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
bool in_vblank_irq, int *vpos, int *hpos, bool in_vblank_irq, int *vpos, int *hpos,
ktime_t *stime, ktime_t *etime, ktime_t *stime, ktime_t *etime,
...@@ -1070,6 +1043,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = { ...@@ -1070,6 +1043,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
static const struct vc4_crtc_data pv0_data = { static const struct vc4_crtc_data pv0_data = {
.hvs_channel = 0, .hvs_channel = 0,
.debugfs_name = "crtc0_regs",
.encoder_types = { .encoder_types = {
[PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI0, [PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI0,
[PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_DPI, [PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_DPI,
...@@ -1078,6 +1052,7 @@ static const struct vc4_crtc_data pv0_data = { ...@@ -1078,6 +1052,7 @@ static const struct vc4_crtc_data pv0_data = {
static const struct vc4_crtc_data pv1_data = { static const struct vc4_crtc_data pv1_data = {
.hvs_channel = 2, .hvs_channel = 2,
.debugfs_name = "crtc1_regs",
.encoder_types = { .encoder_types = {
[PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI1, [PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI1,
[PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_SMI, [PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_SMI,
...@@ -1086,6 +1061,7 @@ static const struct vc4_crtc_data pv1_data = { ...@@ -1086,6 +1061,7 @@ static const struct vc4_crtc_data pv1_data = {
static const struct vc4_crtc_data pv2_data = { static const struct vc4_crtc_data pv2_data = {
.hvs_channel = 1, .hvs_channel = 1,
.debugfs_name = "crtc2_regs",
.encoder_types = { .encoder_types = {
[PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_HDMI, [PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_HDMI,
[PV_CONTROL_CLK_SELECT_VEC] = VC4_ENCODER_TYPE_VEC, [PV_CONTROL_CLK_SELECT_VEC] = VC4_ENCODER_TYPE_VEC,
...@@ -1247,6 +1223,9 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data) ...@@ -1247,6 +1223,9 @@ static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
platform_set_drvdata(pdev, vc4_crtc); platform_set_drvdata(pdev, vc4_crtc);
vc4_debugfs_add_regset32(drm, vc4_crtc->data->debugfs_name,
&vc4_crtc->regset);
return 0; return 0;
err_destroy_planes: err_destroy_planes:
......
...@@ -15,28 +15,20 @@ ...@@ -15,28 +15,20 @@
#include "vc4_drv.h" #include "vc4_drv.h"
#include "vc4_regs.h" #include "vc4_regs.h"
static const struct drm_info_list vc4_debugfs_list[] = { struct vc4_debugfs_info_entry {
{"bo_stats", vc4_bo_stats_debugfs, 0}, struct list_head link;
{"dpi_regs", vc4_dpi_debugfs_regs, 0}, struct drm_info_list info;
{"dsi1_regs", vc4_dsi_debugfs_regs, 0, (void *)(uintptr_t)1},
{"hdmi_regs", vc4_hdmi_debugfs_regs, 0},
{"vec_regs", vc4_vec_debugfs_regs, 0},
{"txp_regs", vc4_txp_debugfs_regs, 0},
{"hvs_regs", vc4_hvs_debugfs_regs, 0},
{"hvs_underrun", vc4_hvs_debugfs_underrun, 0},
{"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0},
{"crtc1_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)1},
{"crtc2_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)2},
{"v3d_ident", vc4_v3d_debugfs_ident, 0},
{"v3d_regs", vc4_v3d_debugfs_regs, 0},
}; };
#define VC4_DEBUGFS_ENTRIES ARRAY_SIZE(vc4_debugfs_list) /**
* Called at drm_dev_register() time on each of the minors registered
* by the DRM device, to attach the debugfs files.
*/
int int
vc4_debugfs_init(struct drm_minor *minor) vc4_debugfs_init(struct drm_minor *minor)
{ {
struct vc4_dev *vc4 = to_vc4_dev(minor->dev); struct vc4_dev *vc4 = to_vc4_dev(minor->dev);
struct vc4_debugfs_info_entry *entry;
struct dentry *dentry; struct dentry *dentry;
dentry = debugfs_create_bool("hvs_load_tracker", S_IRUGO | S_IWUSR, dentry = debugfs_create_bool("hvs_load_tracker", S_IRUGO | S_IWUSR,
...@@ -45,6 +37,60 @@ vc4_debugfs_init(struct drm_minor *minor) ...@@ -45,6 +37,60 @@ vc4_debugfs_init(struct drm_minor *minor)
if (!dentry) if (!dentry)
return -ENOMEM; return -ENOMEM;
return drm_debugfs_create_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES, list_for_each_entry(entry, &vc4->debugfs_list, link) {
int ret = drm_debugfs_create_files(&entry->info, 1,
minor->debugfs_root, minor); minor->debugfs_root, minor);
if (ret)
return ret;
}
return 0;
}
int vc4_debugfs_regset32(struct seq_file *m, void *unused)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
struct debugfs_regset32 *regset = node->info_ent->data;
struct drm_printer p = drm_seq_file_printer(m);
drm_print_regset32(&p, regset);
return 0;
}
/**
* Registers a debugfs file with a callback function for a vc4 component.
*
* This is like drm_debugfs_create_files(), but that can only be
* called a given DRM minor, while the various VC4 components want to
* register their debugfs files during the component bind process. We
* track the request and delay it to be called on each minor during
* vc4_debugfs_init().
*/
void vc4_debugfs_add_file(struct drm_device *dev,
const char *name,
int (*show)(struct seq_file*, void*),
void *data)
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_debugfs_info_entry *entry =
devm_kzalloc(dev->dev, sizeof(*entry), GFP_KERNEL);
if (!entry)
return;
entry->info.name = name;
entry->info.show = show;
entry->info.data = data;
list_add(&entry->link, &vc4->debugfs_list);
}
void vc4_debugfs_add_regset32(struct drm_device *drm,
const char *name,
struct debugfs_regset32 *regset)
{
vc4_debugfs_add_file(drm, name, vc4_debugfs_regset32, regset);
} }
...@@ -125,24 +125,6 @@ static const struct debugfs_reg32 dpi_regs[] = { ...@@ -125,24 +125,6 @@ static const struct debugfs_reg32 dpi_regs[] = {
VC4_REG32(DPI_ID), VC4_REG32(DPI_ID),
}; };
#ifdef CONFIG_DEBUG_FS
int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *dev = node->minor->dev;
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_dpi *dpi = vc4->dpi;
struct drm_printer p = drm_seq_file_printer(m);
if (!dpi)
return 0;
drm_print_regset32(&p, &dpi->regset);
return 0;
}
#endif
static const struct drm_encoder_funcs vc4_dpi_encoder_funcs = { static const struct drm_encoder_funcs vc4_dpi_encoder_funcs = {
.destroy = drm_encoder_cleanup, .destroy = drm_encoder_cleanup,
}; };
...@@ -349,6 +331,8 @@ static int vc4_dpi_bind(struct device *dev, struct device *master, void *data) ...@@ -349,6 +331,8 @@ static int vc4_dpi_bind(struct device *dev, struct device *master, void *data)
vc4->dpi = dpi; vc4->dpi = dpi;
vc4_debugfs_add_regset32(drm, "dpi_regs", &dpi->regset);
return 0; return 0;
err_destroy_encoder: err_destroy_encoder:
......
...@@ -262,6 +262,7 @@ static int vc4_drm_bind(struct device *dev) ...@@ -262,6 +262,7 @@ static int vc4_drm_bind(struct device *dev)
platform_set_drvdata(pdev, drm); platform_set_drvdata(pdev, drm);
vc4->dev = drm; vc4->dev = drm;
drm->dev_private = vc4; drm->dev_private = vc4;
INIT_LIST_HEAD(&vc4->debugfs_list);
ret = vc4_bo_cache_init(drm); ret = vc4_bo_cache_init(drm);
if (ret) if (ret)
......
...@@ -211,6 +211,11 @@ struct vc4_dev { ...@@ -211,6 +211,11 @@ struct vc4_dev {
struct drm_modeset_lock ctm_state_lock; struct drm_modeset_lock ctm_state_lock;
struct drm_private_obj ctm_manager; struct drm_private_obj ctm_manager;
struct drm_private_obj load_tracker; struct drm_private_obj load_tracker;
/* List of vc4_debugfs_info_entry for adding to debugfs once
* the minor is available (after drm_dev_register()).
*/
struct list_head debugfs_list;
}; };
static inline struct vc4_dev * static inline struct vc4_dev *
...@@ -429,6 +434,7 @@ struct vc4_crtc_data { ...@@ -429,6 +434,7 @@ struct vc4_crtc_data {
int hvs_channel; int hvs_channel;
enum vc4_encoder_type encoder_types[4]; enum vc4_encoder_type encoder_types[4];
const char *debugfs_name;
}; };
struct vc4_crtc { struct vc4_crtc {
...@@ -715,7 +721,6 @@ struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev, ...@@ -715,7 +721,6 @@ struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev,
void *vc4_prime_vmap(struct drm_gem_object *obj); void *vc4_prime_vmap(struct drm_gem_object *obj);
int vc4_bo_cache_init(struct drm_device *dev); int vc4_bo_cache_init(struct drm_device *dev);
void vc4_bo_cache_destroy(struct drm_device *dev); void vc4_bo_cache_destroy(struct drm_device *dev);
int vc4_bo_stats_debugfs(struct seq_file *m, void *arg);
int vc4_bo_inc_usecnt(struct vc4_bo *bo); int vc4_bo_inc_usecnt(struct vc4_bo *bo);
void vc4_bo_dec_usecnt(struct vc4_bo *bo); void vc4_bo_dec_usecnt(struct vc4_bo *bo);
void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo); void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo);
...@@ -723,7 +728,6 @@ void vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo); ...@@ -723,7 +728,6 @@ void vc4_bo_remove_from_purgeable_pool(struct vc4_bo *bo);
/* vc4_crtc.c */ /* vc4_crtc.c */
extern struct platform_driver vc4_crtc_driver; extern struct platform_driver vc4_crtc_driver;
int vc4_crtc_debugfs_regs(struct seq_file *m, void *arg);
bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id, bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
bool in_vblank_irq, int *vpos, int *hpos, bool in_vblank_irq, int *vpos, int *hpos,
ktime_t *stime, ktime_t *etime, ktime_t *stime, ktime_t *etime,
...@@ -736,17 +740,37 @@ void vc4_crtc_get_margins(struct drm_crtc_state *state, ...@@ -736,17 +740,37 @@ void vc4_crtc_get_margins(struct drm_crtc_state *state,
/* vc4_debugfs.c */ /* vc4_debugfs.c */
int vc4_debugfs_init(struct drm_minor *minor); int vc4_debugfs_init(struct drm_minor *minor);
#ifdef CONFIG_DEBUG_FS
void vc4_debugfs_add_file(struct drm_device *drm,
const char *filename,
int (*show)(struct seq_file*, void*),
void *data);
void vc4_debugfs_add_regset32(struct drm_device *drm,
const char *filename,
struct debugfs_regset32 *regset);
#else
static inline void vc4_debugfs_add_file(struct drm_device *drm,
const char *filename,
int (*show)(struct seq_file*, void*),
void *data)
{
}
static inline void vc4_debugfs_add_regset32(struct drm_device *drm,
const char *filename,
struct debugfs_regset32 *regset)
{
}
#endif
/* vc4_drv.c */ /* vc4_drv.c */
void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index); void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);
/* vc4_dpi.c */ /* vc4_dpi.c */
extern struct platform_driver vc4_dpi_driver; extern struct platform_driver vc4_dpi_driver;
int vc4_dpi_debugfs_regs(struct seq_file *m, void *unused);
/* vc4_dsi.c */ /* vc4_dsi.c */
extern struct platform_driver vc4_dsi_driver; extern struct platform_driver vc4_dsi_driver;
int vc4_dsi_debugfs_regs(struct seq_file *m, void *unused);
/* vc4_fence.c */ /* vc4_fence.c */
extern const struct dma_fence_ops vc4_fence_ops; extern const struct dma_fence_ops vc4_fence_ops;
...@@ -774,15 +798,12 @@ int vc4_gem_madvise_ioctl(struct drm_device *dev, void *data, ...@@ -774,15 +798,12 @@ int vc4_gem_madvise_ioctl(struct drm_device *dev, void *data,
/* vc4_hdmi.c */ /* vc4_hdmi.c */
extern struct platform_driver vc4_hdmi_driver; extern struct platform_driver vc4_hdmi_driver;
int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused);
/* vc4_vec.c */ /* vc4_vec.c */
extern struct platform_driver vc4_vec_driver; extern struct platform_driver vc4_vec_driver;
int vc4_vec_debugfs_regs(struct seq_file *m, void *unused);
/* vc4_txp.c */ /* vc4_txp.c */
extern struct platform_driver vc4_txp_driver; extern struct platform_driver vc4_txp_driver;
int vc4_txp_debugfs_regs(struct seq_file *m, void *unused);
/* vc4_irq.c */ /* vc4_irq.c */
irqreturn_t vc4_irq(int irq, void *arg); irqreturn_t vc4_irq(int irq, void *arg);
...@@ -794,8 +815,6 @@ void vc4_irq_reset(struct drm_device *dev); ...@@ -794,8 +815,6 @@ void vc4_irq_reset(struct drm_device *dev);
/* vc4_hvs.c */ /* vc4_hvs.c */
extern struct platform_driver vc4_hvs_driver; extern struct platform_driver vc4_hvs_driver;
void vc4_hvs_dump_state(struct drm_device *dev); void vc4_hvs_dump_state(struct drm_device *dev);
int vc4_hvs_debugfs_regs(struct seq_file *m, void *unused);
int vc4_hvs_debugfs_underrun(struct seq_file *m, void *unused);
void vc4_hvs_unmask_underrun(struct drm_device *dev, int channel); void vc4_hvs_unmask_underrun(struct drm_device *dev, int channel);
void vc4_hvs_mask_underrun(struct drm_device *dev, int channel); void vc4_hvs_mask_underrun(struct drm_device *dev, int channel);
...@@ -812,8 +831,6 @@ void vc4_plane_async_set_fb(struct drm_plane *plane, ...@@ -812,8 +831,6 @@ void vc4_plane_async_set_fb(struct drm_plane *plane,
/* vc4_v3d.c */ /* vc4_v3d.c */
extern struct platform_driver vc4_v3d_driver; extern struct platform_driver vc4_v3d_driver;
int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused);
int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused);
int vc4_v3d_get_bin_slot(struct vc4_dev *vc4); int vc4_v3d_get_bin_slot(struct vc4_dev *vc4);
int vc4_v3d_pm_get(struct vc4_dev *vc4); int vc4_v3d_pm_get(struct vc4_dev *vc4);
void vc4_v3d_pm_put(struct vc4_dev *vc4); void vc4_v3d_pm_put(struct vc4_dev *vc4);
......
...@@ -657,25 +657,6 @@ static const struct debugfs_reg32 dsi1_regs[] = { ...@@ -657,25 +657,6 @@ static const struct debugfs_reg32 dsi1_regs[] = {
VC4_REG32(DSI1_ID), VC4_REG32(DSI1_ID),
}; };
#ifdef CONFIG_DEBUG_FS
int vc4_dsi_debugfs_regs(struct seq_file *m, void *unused)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *drm = node->minor->dev;
struct vc4_dev *vc4 = to_vc4_dev(drm);
int dsi_index = (uintptr_t)node->info_ent->data;
struct vc4_dsi *dsi = (dsi_index == 1 ? vc4->dsi1 : NULL);
struct drm_printer p = drm_seq_file_printer(m);
if (!dsi)
return 0;
drm_print_regset32(&p, &dsi->regset);
return 0;
}
#endif
static void vc4_dsi_encoder_destroy(struct drm_encoder *encoder) static void vc4_dsi_encoder_destroy(struct drm_encoder *encoder)
{ {
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
...@@ -1637,6 +1618,11 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ...@@ -1637,6 +1618,11 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data)
*/ */
dsi->encoder->bridge = NULL; dsi->encoder->bridge = NULL;
if (dsi->port == 0)
vc4_debugfs_add_regset32(drm, "dsi0_regs", &dsi->regset);
else
vc4_debugfs_add_regset32(drm, "dsi1_regs", &dsi->regset);
pm_runtime_enable(dev); pm_runtime_enable(dev);
return 0; return 0;
......
...@@ -187,8 +187,7 @@ static const struct debugfs_reg32 hd_regs[] = { ...@@ -187,8 +187,7 @@ static const struct debugfs_reg32 hd_regs[] = {
VC4_REG32(VC4_HD_FRAME_COUNT), VC4_REG32(VC4_HD_FRAME_COUNT),
}; };
#ifdef CONFIG_DEBUG_FS static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *)m->private; struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
...@@ -201,7 +200,6 @@ int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) ...@@ -201,7 +200,6 @@ int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
return 0; return 0;
} }
#endif /* CONFIG_DEBUG_FS */
static enum drm_connector_status static enum drm_connector_status
vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
...@@ -1432,6 +1430,8 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -1432,6 +1430,8 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
if (ret) if (ret)
goto err_destroy_encoder; goto err_destroy_encoder;
vc4_debugfs_add_file(drm, "hdmi_regs", vc4_hdmi_debugfs_regs, hdmi);
return 0; return 0;
#ifdef CONFIG_DRM_VC4_HDMI_CEC #ifdef CONFIG_DRM_VC4_HDMI_CEC
......
...@@ -80,20 +80,7 @@ void vc4_hvs_dump_state(struct drm_device *dev) ...@@ -80,20 +80,7 @@ void vc4_hvs_dump_state(struct drm_device *dev)
} }
} }
#ifdef CONFIG_DEBUG_FS static int vc4_hvs_debugfs_underrun(struct seq_file *m, void *data)
int vc4_hvs_debugfs_regs(struct seq_file *m, void *unused)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *dev = node->minor->dev;
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct drm_printer p = drm_seq_file_printer(m);
drm_print_regset32(&p, &vc4->hvs->regset);
return 0;
}
int vc4_hvs_debugfs_underrun(struct seq_file *m, void *data)
{ {
struct drm_info_node *node = m->private; struct drm_info_node *node = m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
...@@ -104,7 +91,6 @@ int vc4_hvs_debugfs_underrun(struct seq_file *m, void *data) ...@@ -104,7 +91,6 @@ int vc4_hvs_debugfs_underrun(struct seq_file *m, void *data)
return 0; return 0;
} }
#endif
/* The filter kernel is composed of dwords each containing 3 9-bit /* The filter kernel is composed of dwords each containing 3 9-bit
* signed integers packed next to each other. * signed integers packed next to each other.
...@@ -316,6 +302,10 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) ...@@ -316,6 +302,10 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
if (ret) if (ret)
return ret; return ret;
vc4_debugfs_add_regset32(drm, "hvs_regs", &hvs->regset);
vc4_debugfs_add_file(drm, "hvs_underrun", vc4_hvs_debugfs_underrun,
NULL);
return 0; return 0;
} }
......
...@@ -169,24 +169,6 @@ static const struct debugfs_reg32 txp_regs[] = { ...@@ -169,24 +169,6 @@ static const struct debugfs_reg32 txp_regs[] = {
VC4_REG32(TXP_PROGRESS), VC4_REG32(TXP_PROGRESS),
}; };
#ifdef CONFIG_DEBUG_FS
int vc4_txp_debugfs_regs(struct seq_file *m, void *unused)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *dev = node->minor->dev;
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_txp *txp = vc4->txp;
struct drm_printer p = drm_seq_file_printer(m);
if (!txp)
return 0;
drm_print_regset32(&p, &txp->regset);
return 0;
}
#endif
static int vc4_txp_connector_get_modes(struct drm_connector *connector) static int vc4_txp_connector_get_modes(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
...@@ -424,6 +406,8 @@ static int vc4_txp_bind(struct device *dev, struct device *master, void *data) ...@@ -424,6 +406,8 @@ static int vc4_txp_bind(struct device *dev, struct device *master, void *data)
dev_set_drvdata(dev, txp); dev_set_drvdata(dev, txp);
vc4->txp = txp; vc4->txp = txp;
vc4_debugfs_add_regset32(drm, "txp_regs", &txp->regset);
return 0; return 0;
} }
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "vc4_drv.h" #include "vc4_drv.h"
#include "vc4_regs.h" #include "vc4_regs.h"
#ifdef CONFIG_DEBUG_FS
static const struct debugfs_reg32 v3d_regs[] = { static const struct debugfs_reg32 v3d_regs[] = {
VC4_REG32(V3D_IDENT0), VC4_REG32(V3D_IDENT0),
VC4_REG32(V3D_IDENT1), VC4_REG32(V3D_IDENT1),
...@@ -104,19 +103,7 @@ static const struct debugfs_reg32 v3d_regs[] = { ...@@ -104,19 +103,7 @@ static const struct debugfs_reg32 v3d_regs[] = {
VC4_REG32(V3D_ERRSTAT), VC4_REG32(V3D_ERRSTAT),
}; };
int vc4_v3d_debugfs_regs(struct seq_file *m, void *unused) static int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *dev = node->minor->dev;
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct drm_printer p = drm_seq_file_printer(m);
drm_print_regset32(&p, &vc4->v3d->regset);
return 0;
}
int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused)
{ {
struct drm_info_node *node = (struct drm_info_node *)m->private; struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
...@@ -141,7 +128,6 @@ int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused) ...@@ -141,7 +128,6 @@ int vc4_v3d_debugfs_ident(struct seq_file *m, void *unused)
return 0; return 0;
} }
#endif /* CONFIG_DEBUG_FS */
/** /**
* Wraps pm_runtime_get_sync() in a refcount, so that we can reliably * Wraps pm_runtime_get_sync() in a refcount, so that we can reliably
...@@ -442,6 +428,9 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) ...@@ -442,6 +428,9 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */ pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */
pm_runtime_enable(dev); pm_runtime_enable(dev);
vc4_debugfs_add_file(drm, "v3d_ident", vc4_v3d_debugfs_ident, NULL);
vc4_debugfs_add_regset32(drm, "v3d_regs", &v3d->regset);
return 0; return 0;
} }
......
...@@ -252,24 +252,6 @@ static const struct debugfs_reg32 vec_regs[] = { ...@@ -252,24 +252,6 @@ static const struct debugfs_reg32 vec_regs[] = {
VC4_REG32(VEC_DAC_MISC), VC4_REG32(VEC_DAC_MISC),
}; };
#ifdef CONFIG_DEBUG_FS
int vc4_vec_debugfs_regs(struct seq_file *m, void *unused)
{
struct drm_info_node *node = (struct drm_info_node *)m->private;
struct drm_device *dev = node->minor->dev;
struct vc4_dev *vc4 = to_vc4_dev(dev);
struct vc4_vec *vec = vc4->vec;
struct drm_printer p = drm_seq_file_printer(m);
if (!vec)
return 0;
drm_print_regset32(&p, &vec->regset);
return 0;
}
#endif
static void vc4_vec_ntsc_mode_set(struct vc4_vec *vec) static void vc4_vec_ntsc_mode_set(struct vc4_vec *vec)
{ {
VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN); VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN);
...@@ -609,6 +591,8 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data) ...@@ -609,6 +591,8 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
vc4->vec = vec; vc4->vec = vec;
vc4_debugfs_add_regset32(drm, "vec_regs", &vec->regset);
return 0; return 0;
err_destroy_encoder: err_destroy_encoder:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment