drm/msm/dpu: move disable_danger out of plane subdir
The disable_danger debugfs file is not related to a single plane. Instead it is used by all registered planes. Move it from plane subtree to the global subtree next to danger_status and safe_status files, so that the new file supplements them. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Link: https://lore.kernel.org/r/20211201222633.2476780-2-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
parent
08c4aa3ee2
commit
96536242f1
|
@ -101,6 +101,73 @@ static int dpu_debugfs_safe_stats_show(struct seq_file *s, void *v)
|
|||
}
|
||||
DEFINE_SHOW_ATTRIBUTE(dpu_debugfs_safe_stats);
|
||||
|
||||
static ssize_t _dpu_plane_danger_read(struct file *file,
|
||||
char __user *buff, size_t count, loff_t *ppos)
|
||||
{
|
||||
struct dpu_kms *kms = file->private_data;
|
||||
int len;
|
||||
char buf[40];
|
||||
|
||||
len = scnprintf(buf, sizeof(buf), "%d\n", !kms->has_danger_ctrl);
|
||||
|
||||
return simple_read_from_buffer(buff, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static void _dpu_plane_set_danger_state(struct dpu_kms *kms, bool enable)
|
||||
{
|
||||
struct drm_plane *plane;
|
||||
|
||||
drm_for_each_plane(plane, kms->dev) {
|
||||
if (plane->fb && plane->state) {
|
||||
dpu_plane_danger_signal_ctrl(plane, enable);
|
||||
DPU_DEBUG("plane:%d img:%dx%d ",
|
||||
plane->base.id, plane->fb->width,
|
||||
plane->fb->height);
|
||||
DPU_DEBUG("src[%d,%d,%d,%d] dst[%d,%d,%d,%d]\n",
|
||||
plane->state->src_x >> 16,
|
||||
plane->state->src_y >> 16,
|
||||
plane->state->src_w >> 16,
|
||||
plane->state->src_h >> 16,
|
||||
plane->state->crtc_x, plane->state->crtc_y,
|
||||
plane->state->crtc_w, plane->state->crtc_h);
|
||||
} else {
|
||||
DPU_DEBUG("Inactive plane:%d\n", plane->base.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t _dpu_plane_danger_write(struct file *file,
|
||||
const char __user *user_buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
struct dpu_kms *kms = file->private_data;
|
||||
int disable_panic;
|
||||
int ret;
|
||||
|
||||
ret = kstrtouint_from_user(user_buf, count, 0, &disable_panic);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (disable_panic) {
|
||||
/* Disable panic signal for all active pipes */
|
||||
DPU_DEBUG("Disabling danger:\n");
|
||||
_dpu_plane_set_danger_state(kms, false);
|
||||
kms->has_danger_ctrl = false;
|
||||
} else {
|
||||
/* Enable panic signal for all active pipes */
|
||||
DPU_DEBUG("Enabling danger:\n");
|
||||
kms->has_danger_ctrl = true;
|
||||
_dpu_plane_set_danger_state(kms, true);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations dpu_plane_danger_enable = {
|
||||
.open = simple_open,
|
||||
.read = _dpu_plane_danger_read,
|
||||
.write = _dpu_plane_danger_write,
|
||||
};
|
||||
|
||||
static void dpu_debugfs_danger_init(struct dpu_kms *dpu_kms,
|
||||
struct dentry *parent)
|
||||
{
|
||||
|
@ -110,6 +177,9 @@ static void dpu_debugfs_danger_init(struct dpu_kms *dpu_kms,
|
|||
dpu_kms, &dpu_debugfs_danger_stats_fops);
|
||||
debugfs_create_file("safe_status", 0600, entry,
|
||||
dpu_kms, &dpu_debugfs_safe_stats_fops);
|
||||
debugfs_create_file("disable_danger", 0600, entry,
|
||||
dpu_kms, &dpu_plane_danger_enable);
|
||||
|
||||
}
|
||||
|
||||
static int _dpu_debugfs_show_regset32(struct seq_file *s, void *data)
|
||||
|
|
|
@ -1342,7 +1342,7 @@ static void dpu_plane_reset(struct drm_plane *plane)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
|
||||
void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
|
||||
{
|
||||
struct dpu_plane *pdpu = to_dpu_plane(plane);
|
||||
struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane);
|
||||
|
@ -1355,73 +1355,6 @@ static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
|
|||
pm_runtime_put_sync(&dpu_kms->pdev->dev);
|
||||
}
|
||||
|
||||
static ssize_t _dpu_plane_danger_read(struct file *file,
|
||||
char __user *buff, size_t count, loff_t *ppos)
|
||||
{
|
||||
struct dpu_kms *kms = file->private_data;
|
||||
int len;
|
||||
char buf[40];
|
||||
|
||||
len = scnprintf(buf, sizeof(buf), "%d\n", !kms->has_danger_ctrl);
|
||||
|
||||
return simple_read_from_buffer(buff, count, ppos, buf, len);
|
||||
}
|
||||
|
||||
static void _dpu_plane_set_danger_state(struct dpu_kms *kms, bool enable)
|
||||
{
|
||||
struct drm_plane *plane;
|
||||
|
||||
drm_for_each_plane(plane, kms->dev) {
|
||||
if (plane->fb && plane->state) {
|
||||
dpu_plane_danger_signal_ctrl(plane, enable);
|
||||
DPU_DEBUG("plane:%d img:%dx%d ",
|
||||
plane->base.id, plane->fb->width,
|
||||
plane->fb->height);
|
||||
DPU_DEBUG("src[%d,%d,%d,%d] dst[%d,%d,%d,%d]\n",
|
||||
plane->state->src_x >> 16,
|
||||
plane->state->src_y >> 16,
|
||||
plane->state->src_w >> 16,
|
||||
plane->state->src_h >> 16,
|
||||
plane->state->crtc_x, plane->state->crtc_y,
|
||||
plane->state->crtc_w, plane->state->crtc_h);
|
||||
} else {
|
||||
DPU_DEBUG("Inactive plane:%d\n", plane->base.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t _dpu_plane_danger_write(struct file *file,
|
||||
const char __user *user_buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
struct dpu_kms *kms = file->private_data;
|
||||
int disable_panic;
|
||||
int ret;
|
||||
|
||||
ret = kstrtouint_from_user(user_buf, count, 0, &disable_panic);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (disable_panic) {
|
||||
/* Disable panic signal for all active pipes */
|
||||
DPU_DEBUG("Disabling danger:\n");
|
||||
_dpu_plane_set_danger_state(kms, false);
|
||||
kms->has_danger_ctrl = false;
|
||||
} else {
|
||||
/* Enable panic signal for all active pipes */
|
||||
DPU_DEBUG("Enabling danger:\n");
|
||||
kms->has_danger_ctrl = true;
|
||||
_dpu_plane_set_danger_state(kms, true);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations dpu_plane_danger_enable = {
|
||||
.open = simple_open,
|
||||
.read = _dpu_plane_danger_read,
|
||||
.write = _dpu_plane_danger_write,
|
||||
};
|
||||
|
||||
static int _dpu_plane_init_debugfs(struct drm_plane *plane)
|
||||
{
|
||||
struct dpu_plane *pdpu = to_dpu_plane(plane);
|
||||
|
@ -1490,11 +1423,6 @@ static int _dpu_plane_init_debugfs(struct drm_plane *plane)
|
|||
pdpu->debugfs_root,
|
||||
(u32 *) &sblk->danger_vblank);
|
||||
|
||||
debugfs_create_file("disable_danger",
|
||||
0600,
|
||||
pdpu->debugfs_root,
|
||||
kms, &dpu_plane_danger_enable);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -126,4 +126,10 @@ void dpu_plane_clear_multirect(const struct drm_plane_state *drm_state);
|
|||
int dpu_plane_color_fill(struct drm_plane *plane,
|
||||
uint32_t color, uint32_t alpha);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable);
|
||||
#else
|
||||
static inline void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) {}
|
||||
#endif
|
||||
|
||||
#endif /* _DPU_PLANE_H_ */
|
||||
|
|
Loading…
Reference in New Issue