Skip to content

Commit 2672e4e

Browse files
lumagrobclark
authored andcommitted
drm/msm/dpu: move SSPP debugfs support from plane to SSPP code
We are preparing to change DPU plane implementation. Move SSPP debugfs code from dpu_plane.c to dpu_hw_sspp.c, where it belongs. Signed-off-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent 7620bdf commit 2672e4e

File tree

4 files changed

+84
-70
lines changed

4 files changed

+84
-70
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "dpu_hw_sspp.h"
99
#include "dpu_kms.h"
1010

11+
#include <drm/drm_file.h>
12+
1113
#define DPU_FETCH_CONFIG_RESET_VALUE 0x00000087
1214

1315
/* DPU_SSPP_SRC */
@@ -692,6 +694,71 @@ static void _setup_layer_ops(struct dpu_hw_pipe *c,
692694
c->ops.setup_cdp = dpu_hw_sspp_setup_cdp;
693695
}
694696

697+
#ifdef CONFIG_DEBUG_FS
698+
int _dpu_hw_sspp_init_debugfs(struct dpu_hw_pipe *hw_pipe, struct dpu_kms *kms, struct dentry *entry)
699+
{
700+
const struct dpu_sspp_cfg *cfg = hw_pipe->cap;
701+
const struct dpu_sspp_sub_blks *sblk = cfg->sblk;
702+
struct dentry *debugfs_root;
703+
char sspp_name[32];
704+
705+
snprintf(sspp_name, sizeof(sspp_name), "%d", hw_pipe->idx);
706+
707+
/* create overall sub-directory for the pipe */
708+
debugfs_root =
709+
debugfs_create_dir(sspp_name, entry);
710+
711+
/* don't error check these */
712+
debugfs_create_xul("features", 0600,
713+
debugfs_root, (unsigned long *)&hw_pipe->cap->features);
714+
715+
/* add register dump support */
716+
dpu_debugfs_create_regset32("src_blk", 0400,
717+
debugfs_root,
718+
sblk->src_blk.base + cfg->base,
719+
sblk->src_blk.len,
720+
kms);
721+
722+
if (cfg->features & BIT(DPU_SSPP_SCALER_QSEED3) ||
723+
cfg->features & BIT(DPU_SSPP_SCALER_QSEED3LITE) ||
724+
cfg->features & BIT(DPU_SSPP_SCALER_QSEED2) ||
725+
cfg->features & BIT(DPU_SSPP_SCALER_QSEED4))
726+
dpu_debugfs_create_regset32("scaler_blk", 0400,
727+
debugfs_root,
728+
sblk->scaler_blk.base + cfg->base,
729+
sblk->scaler_blk.len,
730+
kms);
731+
732+
if (cfg->features & BIT(DPU_SSPP_CSC) ||
733+
cfg->features & BIT(DPU_SSPP_CSC_10BIT))
734+
dpu_debugfs_create_regset32("csc_blk", 0400,
735+
debugfs_root,
736+
sblk->csc_blk.base + cfg->base,
737+
sblk->csc_blk.len,
738+
kms);
739+
740+
debugfs_create_u32("xin_id",
741+
0400,
742+
debugfs_root,
743+
(u32 *) &cfg->xin_id);
744+
debugfs_create_u32("clk_ctrl",
745+
0400,
746+
debugfs_root,
747+
(u32 *) &cfg->clk_ctrl);
748+
debugfs_create_x32("creq_vblank",
749+
0600,
750+
debugfs_root,
751+
(u32 *) &sblk->creq_vblank);
752+
debugfs_create_x32("danger_vblank",
753+
0600,
754+
debugfs_root,
755+
(u32 *) &sblk->danger_vblank);
756+
757+
return 0;
758+
}
759+
#endif
760+
761+
695762
static const struct dpu_sspp_cfg *_sspp_offset(enum dpu_sspp sspp,
696763
void __iomem *addr,
697764
struct dpu_mdss_cfg *catalog,

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ struct dpu_hw_pipe {
387387
struct dpu_hw_sspp_ops ops;
388388
};
389389

390+
struct dpu_kms;
390391
/**
391392
* dpu_hw_sspp_init - initializes the sspp hw driver object.
392393
* Should be called once before accessing every pipe.
@@ -406,5 +407,8 @@ struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,
406407
*/
407408
void dpu_hw_sspp_destroy(struct dpu_hw_pipe *ctx);
408409

410+
void dpu_debugfs_sspp_init(struct dpu_kms *dpu_kms, struct dentry *debugfs_root);
411+
int _dpu_hw_sspp_init_debugfs(struct dpu_hw_pipe *hw_pipe, struct dpu_kms *kms, struct dentry *entry);
412+
409413
#endif /*_DPU_HW_SSPP_H */
410414

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
281281
dpu_debugfs_danger_init(dpu_kms, entry);
282282
dpu_debugfs_vbif_init(dpu_kms, entry);
283283
dpu_debugfs_core_irq_init(dpu_kms, entry);
284+
dpu_debugfs_sspp_init(dpu_kms, entry);
284285

285286
for (i = 0; i < ARRAY_SIZE(priv->dp); i++) {
286287
if (priv->dp[i])

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c

Lines changed: 12 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <drm/drm_atomic.h>
1414
#include <drm/drm_atomic_uapi.h>
1515
#include <drm/drm_damage_helper.h>
16-
#include <drm/drm_file.h>
1716
#include <drm/drm_gem_atomic_helper.h>
1817

1918
#include "msm_drv.h"
@@ -1388,78 +1387,22 @@ void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable)
13881387
pm_runtime_put_sync(&dpu_kms->pdev->dev);
13891388
}
13901389

1391-
static int _dpu_plane_init_debugfs(struct drm_plane *plane)
1390+
/* SSPP live inside dpu_plane private data only. Enumerate them here. */
1391+
void dpu_debugfs_sspp_init(struct dpu_kms *dpu_kms, struct dentry *debugfs_root)
13921392
{
1393-
struct dpu_plane *pdpu = to_dpu_plane(plane);
1394-
struct dpu_kms *kms = _dpu_plane_get_kms(plane);
1395-
const struct dpu_sspp_cfg *cfg = pdpu->pipe_hw->cap;
1396-
const struct dpu_sspp_sub_blks *sblk = cfg->sblk;
1397-
struct dentry *debugfs_root;
1398-
1399-
/* create overall sub-directory for the pipe */
1400-
debugfs_root =
1401-
debugfs_create_dir(plane->name,
1402-
plane->dev->primary->debugfs_root);
1403-
1404-
/* don't error check these */
1405-
debugfs_create_xul("features", 0600,
1406-
debugfs_root, (unsigned long *)&pdpu->pipe_hw->cap->features);
1407-
1408-
/* add register dump support */
1409-
dpu_debugfs_create_regset32("src_blk", 0400,
1410-
debugfs_root,
1411-
sblk->src_blk.base + cfg->base,
1412-
sblk->src_blk.len,
1413-
kms);
1414-
1415-
if (cfg->features & BIT(DPU_SSPP_SCALER_QSEED3) ||
1416-
cfg->features & BIT(DPU_SSPP_SCALER_QSEED3LITE) ||
1417-
cfg->features & BIT(DPU_SSPP_SCALER_QSEED2) ||
1418-
cfg->features & BIT(DPU_SSPP_SCALER_QSEED4))
1419-
dpu_debugfs_create_regset32("scaler_blk", 0400,
1420-
debugfs_root,
1421-
sblk->scaler_blk.base + cfg->base,
1422-
sblk->scaler_blk.len,
1423-
kms);
1424-
1425-
if (cfg->features & BIT(DPU_SSPP_CSC) ||
1426-
cfg->features & BIT(DPU_SSPP_CSC_10BIT))
1427-
dpu_debugfs_create_regset32("csc_blk", 0400,
1428-
debugfs_root,
1429-
sblk->csc_blk.base + cfg->base,
1430-
sblk->csc_blk.len,
1431-
kms);
1432-
1433-
debugfs_create_u32("xin_id",
1434-
0400,
1435-
debugfs_root,
1436-
(u32 *) &cfg->xin_id);
1437-
debugfs_create_u32("clk_ctrl",
1438-
0400,
1439-
debugfs_root,
1440-
(u32 *) &cfg->clk_ctrl);
1441-
debugfs_create_x32("creq_vblank",
1442-
0600,
1443-
debugfs_root,
1444-
(u32 *) &sblk->creq_vblank);
1445-
debugfs_create_x32("danger_vblank",
1446-
0600,
1447-
debugfs_root,
1448-
(u32 *) &sblk->danger_vblank);
1393+
struct drm_plane *plane;
1394+
struct dentry *entry = debugfs_create_dir("sspp", debugfs_root);
14491395

1450-
return 0;
1451-
}
1452-
#else
1453-
static int _dpu_plane_init_debugfs(struct drm_plane *plane)
1454-
{
1455-
return 0;
1456-
}
1457-
#endif
1396+
if (IS_ERR(entry))
1397+
return;
14581398

1459-
static int dpu_plane_late_register(struct drm_plane *plane)
1460-
{
1461-
return _dpu_plane_init_debugfs(plane);
1399+
drm_for_each_plane(plane, dpu_kms->dev) {
1400+
struct dpu_plane *pdpu = to_dpu_plane(plane);
1401+
1402+
_dpu_hw_sspp_init_debugfs(pdpu->pipe_hw, dpu_kms, entry);
1403+
}
14621404
}
1405+
#endif
14631406

14641407
static bool dpu_plane_format_mod_supported(struct drm_plane *plane,
14651408
uint32_t format, uint64_t modifier)
@@ -1486,7 +1429,6 @@ static const struct drm_plane_funcs dpu_plane_funcs = {
14861429
.atomic_duplicate_state = dpu_plane_duplicate_state,
14871430
.atomic_destroy_state = dpu_plane_destroy_state,
14881431
.atomic_print_state = dpu_plane_atomic_print_state,
1489-
.late_register = dpu_plane_late_register,
14901432
.format_mod_supported = dpu_plane_format_mod_supported,
14911433
};
14921434

0 commit comments

Comments
 (0)