drm/msm/dpu: move encoder status to standard encoder debugfs dir
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Sun, 3 Dec 2023 11:53:15 +0000 (14:53 +0300)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 11 Dec 2023 16:28:22 +0000 (19:28 +0300)
Now as we have standard per-encoder debugfs directory, move DPU encoder
status file to that directory.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/570219/
Link: https://lore.kernel.org/r/20231203115315.1306124-4-dmitry.baryshkov@linaro.org
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

index 889e9bb42715f50364b003f736fb049ed5e5d178..250c21a4cfc7ee719979d694a8a818619b75f991 100644 (file)
@@ -186,7 +186,6 @@ struct dpu_encoder_virt {
        struct drm_crtc *crtc;
        struct drm_connector *connector;
 
-       struct dentry *debugfs_root;
        struct mutex enc_lock;
        DECLARE_BITMAP(frame_busy_mask, MAX_PHYS_ENCODERS_PER_VIRTUAL);
        void (*crtc_frame_event_cb)(void *, u32 event);
@@ -2078,7 +2077,8 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)
 #ifdef CONFIG_DEBUG_FS
 static int _dpu_encoder_status_show(struct seq_file *s, void *data)
 {
-       struct dpu_encoder_virt *dpu_enc = s->private;
+       struct drm_encoder *drm_enc = s->private;
+       struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
        int i;
 
        mutex_lock(&dpu_enc->enc_lock);
@@ -2101,48 +2101,16 @@ static int _dpu_encoder_status_show(struct seq_file *s, void *data)
 
 DEFINE_SHOW_ATTRIBUTE(_dpu_encoder_status);
 
-static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc)
+static void dpu_encoder_debugfs_init(struct drm_encoder *drm_enc, struct dentry *root)
 {
-       struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
-
-       char name[12];
-
-       if (!drm_enc->dev) {
-               DPU_ERROR("invalid encoder or kms\n");
-               return -EINVAL;
-       }
-
-       snprintf(name, sizeof(name), "encoder%u", drm_enc->base.id);
-
-       /* create overall sub-directory for the encoder */
-       dpu_enc->debugfs_root = debugfs_create_dir(name,
-                       drm_enc->dev->primary->debugfs_root);
-
        /* don't error check these */
        debugfs_create_file("status", 0600,
-               dpu_enc->debugfs_root, dpu_enc, &_dpu_encoder_status_fops);
-
-       return 0;
+                           root, drm_enc, &_dpu_encoder_status_fops);
 }
 #else
-static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc)
-{
-       return 0;
-}
+#define dpu_encoder_debugfs_init NULL
 #endif
 
-static int dpu_encoder_late_register(struct drm_encoder *encoder)
-{
-       return _dpu_encoder_init_debugfs(encoder);
-}
-
-static void dpu_encoder_early_unregister(struct drm_encoder *encoder)
-{
-       struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(encoder);
-
-       debugfs_remove_recursive(dpu_enc->debugfs_root);
-}
-
 static int dpu_encoder_virt_add_phys_encs(
                struct drm_device *dev,
                struct msm_display_info *disp_info,
@@ -2329,8 +2297,7 @@ static const struct drm_encoder_helper_funcs dpu_encoder_helper_funcs = {
 };
 
 static const struct drm_encoder_funcs dpu_encoder_funcs = {
-               .late_register = dpu_encoder_late_register,
-               .early_unregister = dpu_encoder_early_unregister,
+       .debugfs_init = dpu_encoder_debugfs_init,
 };
 
 struct drm_encoder *dpu_encoder_init(struct drm_device *dev,