Skip to content

Commit 87e9686

Browse files
superna9999robclark
authored andcommitted
drm/msm/dpu: add setup_clk_force_ctrl() op to sspp & wb
Starting from SM8550, the SSPP & WB clock controls are moved the SSPP and WB register range, as it's called "VBIF_CLK_SPLIT" downstream. Implement setup_clk_force_ctrl() only starting from major version 9 which corresponds to SM8550 MDSS. Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Neil Armstrong <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/562322/ Signed-off-by: Rob Clark <[email protected]>
1 parent 76191dc commit 87e9686

File tree

5 files changed

+54
-10
lines changed

5 files changed

+54
-10
lines changed

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#define SSPP_EXCL_REC_XY_REC1 0x188
7070
#define SSPP_EXCL_REC_SIZE 0x1B4
7171
#define SSPP_EXCL_REC_XY 0x1B8
72+
#define SSPP_CLK_CTRL 0x330
7273

7374
/* SSPP_SRC_OP_MODE & OP_MODE_REC1 */
7475
#define MDSS_MDP_OP_DEINTERLACE BIT(22)
@@ -581,8 +582,18 @@ static void dpu_hw_sspp_setup_cdp(struct dpu_sw_pipe *pipe,
581582
dpu_setup_cdp(&ctx->hw, cdp_cntl_offset, fmt, enable);
582583
}
583584

585+
static bool dpu_hw_sspp_setup_clk_force_ctrl(struct dpu_hw_sspp *ctx, bool enable)
586+
{
587+
static const struct dpu_clk_ctrl_reg sspp_clk_ctrl = {
588+
.reg_off = SSPP_CLK_CTRL,
589+
.bit_off = 0
590+
};
591+
592+
return dpu_hw_clk_force_ctrl(&ctx->hw, &sspp_clk_ctrl, enable);
593+
}
594+
584595
static void _setup_layer_ops(struct dpu_hw_sspp *c,
585-
unsigned long features)
596+
unsigned long features, const struct dpu_mdss_version *mdss_rev)
586597
{
587598
c->ops.setup_format = dpu_hw_sspp_setup_format;
588599
c->ops.setup_rects = dpu_hw_sspp_setup_rects;
@@ -612,6 +623,9 @@ static void _setup_layer_ops(struct dpu_hw_sspp *c,
612623

613624
if (test_bit(DPU_SSPP_CDP, &features))
614625
c->ops.setup_cdp = dpu_hw_sspp_setup_cdp;
626+
627+
if (mdss_rev->core_major_ver >= 9)
628+
c->ops.setup_clk_force_ctrl = dpu_hw_sspp_setup_clk_force_ctrl;
615629
}
616630

617631
#ifdef CONFIG_DEBUG_FS
@@ -672,7 +686,8 @@ int _dpu_hw_sspp_init_debugfs(struct dpu_hw_sspp *hw_pipe, struct dpu_kms *kms,
672686
#endif
673687

674688
struct dpu_hw_sspp *dpu_hw_sspp_init(const struct dpu_sspp_cfg *cfg,
675-
void __iomem *addr, const struct msm_mdss_data *mdss_data)
689+
void __iomem *addr, const struct msm_mdss_data *mdss_data,
690+
const struct dpu_mdss_version *mdss_rev)
676691
{
677692
struct dpu_hw_sspp *hw_pipe;
678693

@@ -690,7 +705,7 @@ struct dpu_hw_sspp *dpu_hw_sspp_init(const struct dpu_sspp_cfg *cfg,
690705
hw_pipe->ubwc = mdss_data;
691706
hw_pipe->idx = cfg->id;
692707
hw_pipe->cap = cfg;
693-
_setup_layer_ops(hw_pipe, hw_pipe->cap->features);
708+
_setup_layer_ops(hw_pipe, hw_pipe->cap->features, mdss_rev);
694709

695710
return hw_pipe;
696711
}

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,14 @@ struct dpu_hw_sspp_ops {
271271
void (*setup_qos_ctrl)(struct dpu_hw_sspp *ctx,
272272
bool danger_safe_en);
273273

274+
/**
275+
* setup_clk_force_ctrl - setup clock force control
276+
* @ctx: Pointer to pipe context
277+
* @enable: enable clock force if true
278+
*/
279+
bool (*setup_clk_force_ctrl)(struct dpu_hw_sspp *ctx,
280+
bool enable);
281+
274282
/**
275283
* setup_histogram - setup histograms
276284
* @ctx: Pointer to pipe context
@@ -334,9 +342,11 @@ struct dpu_kms;
334342
* @cfg: Pipe catalog entry for which driver object is required
335343
* @addr: Mapped register io address of MDP
336344
* @mdss_data: UBWC / MDSS configuration data
345+
* @mdss_rev: dpu core's major and minor versions
337346
*/
338347
struct dpu_hw_sspp *dpu_hw_sspp_init(const struct dpu_sspp_cfg *cfg,
339-
void __iomem *addr, const struct msm_mdss_data *mdss_data);
348+
void __iomem *addr, const struct msm_mdss_data *mdss_data,
349+
const struct dpu_mdss_version *mdss_rev);
340350

341351
/**
342352
* dpu_hw_sspp_destroy(): Destroys SSPP driver context

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#define WB_MUX 0x150
4444
#define WB_CROP_CTRL 0x154
4545
#define WB_CROP_OFFSET 0x158
46+
#define WB_CLK_CTRL 0x178
4647
#define WB_CSC_BASE 0x260
4748
#define WB_DST_ADDR_SW_STATUS 0x2B0
4849
#define WB_CDP_CNTL 0x2B4
@@ -175,8 +176,18 @@ static void dpu_hw_wb_bind_pingpong_blk(
175176
DPU_REG_WRITE(c, WB_MUX, mux_cfg);
176177
}
177178

179+
static bool dpu_hw_wb_setup_clk_force_ctrl(struct dpu_hw_wb *ctx, bool enable)
180+
{
181+
static const struct dpu_clk_ctrl_reg wb_clk_ctrl = {
182+
.reg_off = WB_CLK_CTRL,
183+
.bit_off = 0
184+
};
185+
186+
return dpu_hw_clk_force_ctrl(&ctx->hw, &wb_clk_ctrl, enable);
187+
}
188+
178189
static void _setup_wb_ops(struct dpu_hw_wb_ops *ops,
179-
unsigned long features)
190+
unsigned long features, const struct dpu_mdss_version *mdss_rev)
180191
{
181192
ops->setup_outaddress = dpu_hw_wb_setup_outaddress;
182193
ops->setup_outformat = dpu_hw_wb_setup_format;
@@ -192,10 +203,13 @@ static void _setup_wb_ops(struct dpu_hw_wb_ops *ops,
192203

193204
if (test_bit(DPU_WB_INPUT_CTRL, &features))
194205
ops->bind_pingpong_blk = dpu_hw_wb_bind_pingpong_blk;
206+
207+
if (mdss_rev->core_major_ver >= 9)
208+
ops->setup_clk_force_ctrl = dpu_hw_wb_setup_clk_force_ctrl;
195209
}
196210

197211
struct dpu_hw_wb *dpu_hw_wb_init(const struct dpu_wb_cfg *cfg,
198-
void __iomem *addr)
212+
void __iomem *addr, const struct dpu_mdss_version *mdss_rev)
199213
{
200214
struct dpu_hw_wb *c;
201215

@@ -212,7 +226,7 @@ struct dpu_hw_wb *dpu_hw_wb_init(const struct dpu_wb_cfg *cfg,
212226
/* Assign ops */
213227
c->idx = cfg->id;
214228
c->caps = cfg;
215-
_setup_wb_ops(&c->ops, c->caps->features);
229+
_setup_wb_ops(&c->ops, c->caps->features, mdss_rev);
216230

217231
return c;
218232
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct dpu_hw_wb_cfg {
2929
* @setup_outformat: setup output format of writeback block from writeback job
3030
* @setup_qos_lut: setup qos LUT for writeback block based on input
3131
* @setup_cdp: setup chroma down prefetch block for writeback block
32+
* @setup_clk_force_ctrl: setup clock force control
3233
* @bind_pingpong_blk: enable/disable the connection with ping-pong block
3334
*/
3435
struct dpu_hw_wb_ops {
@@ -48,6 +49,9 @@ struct dpu_hw_wb_ops {
4849
const struct dpu_format *fmt,
4950
bool enable);
5051

52+
bool (*setup_clk_force_ctrl)(struct dpu_hw_wb *ctx,
53+
bool enable);
54+
5155
void (*bind_pingpong_blk)(struct dpu_hw_wb *ctx,
5256
const enum dpu_pingpong pp);
5357
};
@@ -74,10 +78,11 @@ struct dpu_hw_wb {
7478
* dpu_hw_wb_init() - Initializes the writeback hw driver object.
7579
* @cfg: wb_path catalog entry for which driver object is required
7680
* @addr: mapped register io address of MDP
81+
* @mdss_rev: dpu core's major and minor versions
7782
* Return: Error code or allocated dpu_hw_wb context
7883
*/
7984
struct dpu_hw_wb *dpu_hw_wb_init(const struct dpu_wb_cfg *cfg,
80-
void __iomem *addr);
85+
void __iomem *addr, const struct dpu_mdss_version *mdss_rev);
8186

8287
/**
8388
* dpu_hw_wb_destroy(): Destroy writeback hw driver object.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ int dpu_rm_init(struct dpu_rm *rm,
175175
struct dpu_hw_wb *hw;
176176
const struct dpu_wb_cfg *wb = &cat->wb[i];
177177

178-
hw = dpu_hw_wb_init(wb, mmio);
178+
hw = dpu_hw_wb_init(wb, mmio, cat->mdss_ver);
179179
if (IS_ERR(hw)) {
180180
rc = PTR_ERR(hw);
181181
DPU_ERROR("failed wb object creation: err %d\n", rc);
@@ -231,7 +231,7 @@ int dpu_rm_init(struct dpu_rm *rm,
231231
struct dpu_hw_sspp *hw;
232232
const struct dpu_sspp_cfg *sspp = &cat->sspp[i];
233233

234-
hw = dpu_hw_sspp_init(sspp, mmio, mdss_data);
234+
hw = dpu_hw_sspp_init(sspp, mmio, mdss_data, cat->mdss_ver);
235235
if (IS_ERR(hw)) {
236236
rc = PTR_ERR(hw);
237237
DPU_ERROR("failed sspp object creation: err %d\n", rc);

0 commit comments

Comments
 (0)