drm/armada: redo CRTC debugfs files
Move the CRTC debugfs files into the CRTC specific directory. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
This commit is contained in:
Родитель
d880fa6627
Коммит
06734cb0ab
|
@ -774,6 +774,14 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc)
|
||||||
kfree(dcrtc);
|
kfree(dcrtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int armada_drm_crtc_late_register(struct drm_crtc *crtc)
|
||||||
|
{
|
||||||
|
if (IS_ENABLED(CONFIG_DEBUG_FS))
|
||||||
|
armada_drm_crtc_debugfs_init(drm_to_armada_crtc(crtc));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* These are called under the vbl_lock. */
|
/* These are called under the vbl_lock. */
|
||||||
static int armada_drm_crtc_enable_vblank(struct drm_crtc *crtc)
|
static int armada_drm_crtc_enable_vblank(struct drm_crtc *crtc)
|
||||||
{
|
{
|
||||||
|
@ -806,6 +814,7 @@ static const struct drm_crtc_funcs armada_crtc_funcs = {
|
||||||
.page_flip = drm_atomic_helper_page_flip,
|
.page_flip = drm_atomic_helper_page_flip,
|
||||||
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
|
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
|
||||||
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
|
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
|
||||||
|
.late_register = armada_drm_crtc_late_register,
|
||||||
.enable_vblank = armada_drm_crtc_enable_vblank,
|
.enable_vblank = armada_drm_crtc_enable_vblank,
|
||||||
.disable_vblank = armada_drm_crtc_disable_vblank,
|
.disable_vblank = armada_drm_crtc_disable_vblank,
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,50 +28,33 @@ static int armada_debugfs_gem_linear_show(struct seq_file *m, void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int armada_debugfs_reg_show(struct seq_file *m, void *data)
|
static int armada_debugfs_crtc_reg_show(struct seq_file *m, void *data)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = m->private;
|
struct armada_crtc *dcrtc = m->private;
|
||||||
struct armada_private *priv = dev->dev_private;
|
int i;
|
||||||
int n, i;
|
|
||||||
|
|
||||||
if (priv) {
|
|
||||||
for (n = 0; n < ARRAY_SIZE(priv->dcrtc); n++) {
|
|
||||||
struct armada_crtc *dcrtc = priv->dcrtc[n];
|
|
||||||
if (!dcrtc)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (i = 0x84; i <= 0x1c4; i += 4) {
|
for (i = 0x84; i <= 0x1c4; i += 4) {
|
||||||
uint32_t v = readl_relaxed(dcrtc->base + i);
|
u32 v = readl_relaxed(dcrtc->base + i);
|
||||||
seq_printf(m, "%u: 0x%04x: 0x%08x\n", n, i, v);
|
seq_printf(m, "0x%04x: 0x%08x\n", i, v);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int armada_debugfs_reg_r_open(struct inode *inode, struct file *file)
|
static int armada_debugfs_crtc_reg_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, armada_debugfs_reg_show, inode->i_private);
|
return single_open(file, armada_debugfs_crtc_reg_show,
|
||||||
|
inode->i_private);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations fops_reg_r = {
|
static int armada_debugfs_crtc_reg_write(struct file *file,
|
||||||
.owner = THIS_MODULE,
|
const char __user *ptr, size_t len, loff_t *off)
|
||||||
.open = armada_debugfs_reg_r_open,
|
|
||||||
.read = seq_read,
|
|
||||||
.llseek = seq_lseek,
|
|
||||||
.release = single_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int armada_debugfs_write(struct file *file, const char __user *ptr,
|
|
||||||
size_t len, loff_t *off)
|
|
||||||
{
|
{
|
||||||
struct drm_device *dev = file->private_data;
|
struct armada_crtc *dcrtc;
|
||||||
struct armada_private *priv = dev->dev_private;
|
unsigned long reg, mask, val;
|
||||||
struct armada_crtc *dcrtc = priv->dcrtc[0];
|
char buf[32];
|
||||||
char buf[32], *p;
|
|
||||||
uint32_t reg, val;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
u32 v;
|
||||||
|
|
||||||
if (*off != 0)
|
if (*off != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -84,24 +67,35 @@ static int armada_debugfs_write(struct file *file, const char __user *ptr,
|
||||||
return ret;
|
return ret;
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
reg = simple_strtoul(buf, &p, 16);
|
if (sscanf(buf, "%lx %lx %lx", ®, &mask, &val) != 3)
|
||||||
if (!isspace(*p))
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
val = simple_strtoul(p + 1, NULL, 16);
|
if (reg < 0x84 || reg > 0x1c4 || reg & 3)
|
||||||
|
return -ERANGE;
|
||||||
|
|
||||||
if (reg >= 0x84 && reg <= 0x1c4)
|
dcrtc = ((struct seq_file *)file->private_data)->private;
|
||||||
writel(val, dcrtc->base + reg);
|
v = readl(dcrtc->base + reg);
|
||||||
|
v &= ~mask;
|
||||||
|
v |= val & mask;
|
||||||
|
writel(v, dcrtc->base + reg);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations fops_reg_w = {
|
static const struct file_operations armada_debugfs_crtc_reg_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = simple_open,
|
.open = armada_debugfs_crtc_reg_open,
|
||||||
.write = armada_debugfs_write,
|
.read = seq_read,
|
||||||
.llseek = noop_llseek,
|
.write = armada_debugfs_crtc_reg_write,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = single_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void armada_drm_crtc_debugfs_init(struct armada_crtc *dcrtc)
|
||||||
|
{
|
||||||
|
debugfs_create_file("armada-regs", 0600, dcrtc->crtc.debugfs_entry,
|
||||||
|
dcrtc, &armada_debugfs_crtc_reg_fops);
|
||||||
|
}
|
||||||
|
|
||||||
static struct drm_info_list armada_debugfs_list[] = {
|
static struct drm_info_list armada_debugfs_list[] = {
|
||||||
{ "gem_linear", armada_debugfs_gem_linear_show, 0 },
|
{ "gem_linear", armada_debugfs_gem_linear_show, 0 },
|
||||||
};
|
};
|
||||||
|
@ -109,24 +103,8 @@ static struct drm_info_list armada_debugfs_list[] = {
|
||||||
|
|
||||||
int armada_drm_debugfs_init(struct drm_minor *minor)
|
int armada_drm_debugfs_init(struct drm_minor *minor)
|
||||||
{
|
{
|
||||||
struct dentry *de;
|
drm_debugfs_create_files(armada_debugfs_list, ARMADA_DEBUGFS_ENTRIES,
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = drm_debugfs_create_files(armada_debugfs_list,
|
|
||||||
ARMADA_DEBUGFS_ENTRIES,
|
|
||||||
minor->debugfs_root, minor);
|
minor->debugfs_root, minor);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
de = debugfs_create_file("reg", S_IFREG | S_IRUSR,
|
|
||||||
minor->debugfs_root, minor->dev, &fops_reg_r);
|
|
||||||
if (!de)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
de = debugfs_create_file("reg_wr", S_IFREG | S_IWUSR,
|
|
||||||
minor->debugfs_root, minor->dev, &fops_reg_w);
|
|
||||||
if (!de)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ void armada_fbdev_fini(struct drm_device *);
|
||||||
|
|
||||||
int armada_overlay_plane_create(struct drm_device *, unsigned long);
|
int armada_overlay_plane_create(struct drm_device *, unsigned long);
|
||||||
|
|
||||||
|
void armada_drm_crtc_debugfs_init(struct armada_crtc *dcrtc);
|
||||||
int armada_drm_debugfs_init(struct drm_minor *);
|
int armada_drm_debugfs_init(struct drm_minor *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Загрузка…
Ссылка в новой задаче