* [PATCH v4 0/2] drm/msm/dpu: fix vsync source programming on DPU >= 8.0
@ 2025-12-24 15:33 Dmitry Baryshkov
2025-12-24 15:33 ` [PATCH v4 1/2] drm/msm/dpu: Set vsync source irrespective of mdp top support Dmitry Baryshkov
2025-12-24 15:33 ` [PATCH v4 2/2] drm/msm/dpu: fix WD timer handling on DPU 8.x Dmitry Baryshkov
0 siblings, 2 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 15:33 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Teguh Sobirin
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel
Currently VSYNC SEL programming is performed only if there is a
corresponding callback at the top block. However, DPU >= 8.0 don't have
that callback, making the driver skip all vsync programming. Make the
driver always check both TOP and INTF callbacks.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
Changes in v3:
- Picked up the series per agreement with Teguh
- Fixed VSYNC SEL programming on DPU < 5.x (Marijn)
- Implemented WD timer support on DPU 8.x
- Link to v2: https://lore.kernel.org/r/TYUPR06MB6099C539BD2C937F8630FF8EDDD5A@TYUPR06MB6099.apcprd06.prod.outlook.com
---
Dmitry Baryshkov (1):
drm/msm/dpu: fix WD timer handling on DPU 8.x
Teguh Sobirin (1):
drm/msm/dpu: Set vsync source irrespective of mdp top support
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 17 +++++-----
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 48 +++++++++++++++++++++++++++--
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 3 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 7 -----
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 7 +++++
5 files changed, 63 insertions(+), 19 deletions(-)
---
base-commit: d2b6e710d2706c8915fe5e2f961c3365976d2ae1
change-id: 20251224-intf-fix-wd-95862f167fd7
Best regards,
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v4 1/2] drm/msm/dpu: Set vsync source irrespective of mdp top support 2025-12-24 15:33 [PATCH v4 0/2] drm/msm/dpu: fix vsync source programming on DPU >= 8.0 Dmitry Baryshkov @ 2025-12-24 15:33 ` Dmitry Baryshkov 2025-12-24 17:26 ` Marijn Suijten 2025-12-24 15:33 ` [PATCH v4 2/2] drm/msm/dpu: fix WD timer handling on DPU 8.x Dmitry Baryshkov 1 sibling, 1 reply; 6+ messages in thread From: Dmitry Baryshkov @ 2025-12-24 15:33 UTC (permalink / raw) To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter, Teguh Sobirin Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel From: Teguh Sobirin <teguh@sobir.in> Since DPU 5.x the vsync source TE setup is split between MDP TOP and INTF blocks. Currently all code to setup vsync_source is only exectued if MDP TOP implements the setup_vsync_source() callback. However on DPU >= 8.x this callback is not implemented, making DPU driver skip all vsync setup. Move the INTF part out of this condition, letting DPU driver to setup TE vsync selection on all new DPU devices. Signed-off-by: Teguh Sobirin <teguh@sobir.in> Fixes: 2f69e5458447 ("drm/msm/dpu: skip watchdog timer programming through TOP on >= SM8450") [DB: restored top->ops.setup_vsync_source call] Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index d1cfe81a3373..0482b2bb5a9e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -774,6 +774,9 @@ static void _dpu_encoder_update_vsync_source(struct dpu_encoder_virt *dpu_enc, return; } + /* Set vsync source irrespective of mdp top support */ + vsync_cfg.vsync_source = disp_info->vsync_source; + if (hw_mdptop->ops.setup_vsync_source) { for (i = 0; i < dpu_enc->num_phys_encs; i++) vsync_cfg.ppnumber[i] = dpu_enc->hw_pp[i]->idx; @@ -781,17 +784,15 @@ static void _dpu_encoder_update_vsync_source(struct dpu_encoder_virt *dpu_enc, vsync_cfg.pp_count = dpu_enc->num_phys_encs; vsync_cfg.frame_rate = drm_mode_vrefresh(&dpu_enc->base.crtc->state->adjusted_mode); - vsync_cfg.vsync_source = disp_info->vsync_source; - hw_mdptop->ops.setup_vsync_source(hw_mdptop, &vsync_cfg); + } - for (i = 0; i < dpu_enc->num_phys_encs; i++) { - phys_enc = dpu_enc->phys_encs[i]; + for (i = 0; i < dpu_enc->num_phys_encs; i++) { + phys_enc = dpu_enc->phys_encs[i]; - if (phys_enc->has_intf_te && phys_enc->hw_intf->ops.vsync_sel) - phys_enc->hw_intf->ops.vsync_sel(phys_enc->hw_intf, - vsync_cfg.vsync_source); - } + if (phys_enc->has_intf_te && phys_enc->hw_intf->ops.vsync_sel) + phys_enc->hw_intf->ops.vsync_sel(phys_enc->hw_intf, + vsync_cfg.vsync_source); } } -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] drm/msm/dpu: Set vsync source irrespective of mdp top support 2025-12-24 15:33 ` [PATCH v4 1/2] drm/msm/dpu: Set vsync source irrespective of mdp top support Dmitry Baryshkov @ 2025-12-24 17:26 ` Marijn Suijten 2025-12-28 3:48 ` Dmitry Baryshkov 0 siblings, 1 reply; 6+ messages in thread From: Marijn Suijten @ 2025-12-24 17:26 UTC (permalink / raw) To: Dmitry Baryshkov Cc: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul, David Airlie, Simona Vetter, Teguh Sobirin, linux-arm-msm, dri-devel, freedreno, linux-kernel On 2025-12-24 17:33:49, Dmitry Baryshkov wrote: > From: Teguh Sobirin <teguh@sobir.in> > > Since DPU 5.x the vsync source TE setup is split between MDP TOP and > INTF blocks. Currently all code to setup vsync_source is only exectued exectued -> executed typo remains since v2. > if MDP TOP implements the setup_vsync_source() callback. However on Double space to match the above, on two occasions: ^^ > DPU >= 8.x this callback is not implemented, making DPU driver skip all > vsync setup. Move the INTF part out of this condition, letting DPU ^^ double space too > driver to setup TE vsync selection on all new DPU devices. > > Signed-off-by: Teguh Sobirin <teguh@sobir.in> > Fixes: 2f69e5458447 ("drm/msm/dpu: skip watchdog timer programming through TOP on >= SM8450") > [DB: restored top->ops.setup_vsync_source call] > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > index d1cfe81a3373..0482b2bb5a9e 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > @@ -774,6 +774,9 @@ static void _dpu_encoder_update_vsync_source(struct dpu_encoder_virt *dpu_enc, > return; > } > > + /* Set vsync source irrespective of mdp top support */ I still think this comment is redundant, as mentioned in v2. Regardless: Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org> > + vsync_cfg.vsync_source = disp_info->vsync_source; > + > if (hw_mdptop->ops.setup_vsync_source) { > for (i = 0; i < dpu_enc->num_phys_encs; i++) > vsync_cfg.ppnumber[i] = dpu_enc->hw_pp[i]->idx; > @@ -781,17 +784,15 @@ static void _dpu_encoder_update_vsync_source(struct dpu_encoder_virt *dpu_enc, > vsync_cfg.pp_count = dpu_enc->num_phys_encs; > vsync_cfg.frame_rate = drm_mode_vrefresh(&dpu_enc->base.crtc->state->adjusted_mode); > > - vsync_cfg.vsync_source = disp_info->vsync_source; > - > hw_mdptop->ops.setup_vsync_source(hw_mdptop, &vsync_cfg); > + } > > - for (i = 0; i < dpu_enc->num_phys_encs; i++) { > - phys_enc = dpu_enc->phys_encs[i]; > + for (i = 0; i < dpu_enc->num_phys_encs; i++) { > + phys_enc = dpu_enc->phys_encs[i]; > > - if (phys_enc->has_intf_te && phys_enc->hw_intf->ops.vsync_sel) > - phys_enc->hw_intf->ops.vsync_sel(phys_enc->hw_intf, > - vsync_cfg.vsync_source); > - } > + if (phys_enc->has_intf_te && phys_enc->hw_intf->ops.vsync_sel) > + phys_enc->hw_intf->ops.vsync_sel(phys_enc->hw_intf, > + vsync_cfg.vsync_source); > } > } > > > -- > 2.47.3 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] drm/msm/dpu: Set vsync source irrespective of mdp top support 2025-12-24 17:26 ` Marijn Suijten @ 2025-12-28 3:48 ` Dmitry Baryshkov 0 siblings, 0 replies; 6+ messages in thread From: Dmitry Baryshkov @ 2025-12-28 3:48 UTC (permalink / raw) To: Marijn Suijten Cc: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul, David Airlie, Simona Vetter, Teguh Sobirin, linux-arm-msm, dri-devel, freedreno, linux-kernel On Wed, Dec 24, 2025 at 06:26:59PM +0100, Marijn Suijten wrote: > On 2025-12-24 17:33:49, Dmitry Baryshkov wrote: > > From: Teguh Sobirin <teguh@sobir.in> > > > > Since DPU 5.x the vsync source TE setup is split between MDP TOP and > > INTF blocks. Currently all code to setup vsync_source is only exectued > > exectued -> executed typo remains since v2. > > > if MDP TOP implements the setup_vsync_source() callback. However on > Double space to match the above, on two occasions: ^^ I've changed all occurences to 1 space. > > > DPU >= 8.x this callback is not implemented, making DPU driver skip all > > vsync setup. Move the INTF part out of this condition, letting DPU > ^^ double space too > > > driver to setup TE vsync selection on all new DPU devices. > > > > Signed-off-by: Teguh Sobirin <teguh@sobir.in> > > Fixes: 2f69e5458447 ("drm/msm/dpu: skip watchdog timer programming through TOP on >= SM8450") > > [DB: restored top->ops.setup_vsync_source call] > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> > > --- > > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 17 +++++++++-------- > > 1 file changed, 9 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > > index d1cfe81a3373..0482b2bb5a9e 100644 > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > > @@ -774,6 +774,9 @@ static void _dpu_encoder_update_vsync_source(struct dpu_encoder_virt *dpu_enc, > > return; > > } > > > > + /* Set vsync source irrespective of mdp top support */ > > I still think this comment is redundant, as mentioned in v2. Dropped -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 2/2] drm/msm/dpu: fix WD timer handling on DPU 8.x 2025-12-24 15:33 [PATCH v4 0/2] drm/msm/dpu: fix vsync source programming on DPU >= 8.0 Dmitry Baryshkov 2025-12-24 15:33 ` [PATCH v4 1/2] drm/msm/dpu: Set vsync source irrespective of mdp top support Dmitry Baryshkov @ 2025-12-24 15:33 ` Dmitry Baryshkov 2025-12-24 17:46 ` Marijn Suijten 1 sibling, 1 reply; 6+ messages in thread From: Dmitry Baryshkov @ 2025-12-24 15:33 UTC (permalink / raw) To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter, Teguh Sobirin Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel Since DPU 8.x Watchdog timer settings were moved from the TOP to the INTF block. Support programming the timer in the INTF block. Fixes: e955a3f0d86e ("drm/msm/dpu: Implement tearcheck support on INTF block") Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 48 +++++++++++++++++++++++++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 3 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 7 ----- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 7 +++++ 5 files changed, 55 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 0482b2bb5a9e..0e53d9869ae9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -792,7 +792,7 @@ static void _dpu_encoder_update_vsync_source(struct dpu_encoder_virt *dpu_enc, if (phys_enc->has_intf_te && phys_enc->hw_intf->ops.vsync_sel) phys_enc->hw_intf->ops.vsync_sel(phys_enc->hw_intf, - vsync_cfg.vsync_source); + &vsync_cfg); } } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c index a80ac82a9625..7967d9bd2f44 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c @@ -67,6 +67,10 @@ #define INTF_MISR_CTRL 0x180 #define INTF_MISR_SIGNATURE 0x184 +#define INTF_WD_TIMER_0_CTL 0x230 +#define INTF_WD_TIMER_0_CTL2 0x234 +#define INTF_WD_TIMER_0_LOAD_VALUE 0x238 + #define INTF_MUX 0x25C #define INTF_STATUS 0x26C #define INTF_AVR_CONTROL 0x270 @@ -475,7 +479,7 @@ static int dpu_hw_intf_get_vsync_info(struct dpu_hw_intf *intf, } static void dpu_hw_intf_vsync_sel(struct dpu_hw_intf *intf, - enum dpu_vsync_source vsync_source) + struct dpu_vsync_source_cfg *cfg) { struct dpu_hw_blk_reg_map *c; @@ -484,7 +488,42 @@ static void dpu_hw_intf_vsync_sel(struct dpu_hw_intf *intf, c = &intf->hw; - DPU_REG_WRITE(c, INTF_TEAR_MDP_VSYNC_SEL, (vsync_source & 0xf)); + DPU_REG_WRITE(c, INTF_TEAR_MDP_VSYNC_SEL, (cfg->vsync_source & 0xf)); +} + +static void dpu_hw_intf_vsync_sel_v8(struct dpu_hw_intf *intf, + struct dpu_vsync_source_cfg *cfg) +{ + struct dpu_hw_blk_reg_map *c; + + if (!intf) + return; + + c = &intf->hw; + + if (cfg->vsync_source >= DPU_VSYNC_SOURCE_WD_TIMER_4 && + cfg->vsync_source <= DPU_VSYNC_SOURCE_WD_TIMER_1) { + pr_warn_once("DPU 8.x supports only GPIOs and timer0 as TE sources\n"); + return; + } + + if (cfg->vsync_source == DPU_VSYNC_SOURCE_WD_TIMER_0) { + u32 reg; + + DPU_REG_WRITE(c, INTF_WD_TIMER_0_LOAD_VALUE, + CALCULATE_WD_LOAD_VALUE(cfg->frame_rate)); + + DPU_REG_WRITE(c, INTF_WD_TIMER_0_CTL, BIT(0)); /* clear timer */ + reg = DPU_REG_READ(c, INTF_WD_TIMER_0_CTL2); + reg |= BIT(8); /* enable heartbeat timer */ + reg |= BIT(0); /* enable WD timer */ + DPU_REG_WRITE(c, INTF_WD_TIMER_0_CTL2, reg); + + /* make sure that timers are enabled/disabled for vsync state */ + wmb(); + } + + dpu_hw_intf_vsync_sel(intf, cfg); } static void dpu_hw_intf_disable_autorefresh(struct dpu_hw_intf *intf, @@ -598,7 +637,10 @@ struct dpu_hw_intf *dpu_hw_intf_init(struct drm_device *dev, c->ops.enable_tearcheck = dpu_hw_intf_enable_te; c->ops.disable_tearcheck = dpu_hw_intf_disable_te; c->ops.connect_external_te = dpu_hw_intf_connect_external_te; - c->ops.vsync_sel = dpu_hw_intf_vsync_sel; + if (mdss_rev->core_major_ver >= 8) + c->ops.vsync_sel = dpu_hw_intf_vsync_sel_v8; + else + c->ops.vsync_sel = dpu_hw_intf_vsync_sel; c->ops.disable_autorefresh = dpu_hw_intf_disable_autorefresh; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h index f31067a9aaf1..e84ab849d71a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h @@ -12,6 +12,7 @@ #include "dpu_hw_util.h" struct dpu_hw_intf; +struct dpu_vsync_source_cfg; /* intf timing settings */ struct dpu_hw_intf_timing_params { @@ -107,7 +108,7 @@ struct dpu_hw_intf_ops { int (*connect_external_te)(struct dpu_hw_intf *intf, bool enable_external_te); - void (*vsync_sel)(struct dpu_hw_intf *intf, enum dpu_vsync_source vsync_source); + void (*vsync_sel)(struct dpu_hw_intf *intf, struct dpu_vsync_source_cfg *cfg); /** * Disable autorefresh if enabled diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c index 96dc10589bee..1ebd75d4f9be 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c @@ -22,13 +22,6 @@ #define TRAFFIC_SHAPER_WR_CLIENT(num) (0x060 + (num * 4)) #define TRAFFIC_SHAPER_FIXPOINT_FACTOR 4 -#define MDP_TICK_COUNT 16 -#define XO_CLK_RATE 19200 -#define MS_TICKS_IN_SEC 1000 - -#define CALCULATE_WD_LOAD_VALUE(fps) \ - ((uint32_t)((MS_TICKS_IN_SEC * XO_CLK_RATE)/(MDP_TICK_COUNT * fps))) - static void dpu_hw_setup_split_pipe(struct dpu_hw_mdp *mdp, struct split_pipe_cfg *cfg) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h index 67b08e99335d..6fe65bc3bff4 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h @@ -21,6 +21,13 @@ #define TO_S15D16(_x_)((_x_) << 7) +#define MDP_TICK_COUNT 16 +#define XO_CLK_RATE 19200 +#define MS_TICKS_IN_SEC 1000 + +#define CALCULATE_WD_LOAD_VALUE(fps) \ + ((uint32_t)((MS_TICKS_IN_SEC * XO_CLK_RATE)/(MDP_TICK_COUNT * fps))) + extern const struct dpu_csc_cfg dpu_csc_YUV2RGB_601L; extern const struct dpu_csc_cfg dpu_csc10_YUV2RGB_601L; extern const struct dpu_csc_cfg dpu_csc10_rgb2yuv_601l; -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 2/2] drm/msm/dpu: fix WD timer handling on DPU 8.x 2025-12-24 15:33 ` [PATCH v4 2/2] drm/msm/dpu: fix WD timer handling on DPU 8.x Dmitry Baryshkov @ 2025-12-24 17:46 ` Marijn Suijten 0 siblings, 0 replies; 6+ messages in thread From: Marijn Suijten @ 2025-12-24 17:46 UTC (permalink / raw) To: Dmitry Baryshkov Cc: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul, David Airlie, Simona Vetter, Teguh Sobirin, linux-arm-msm, dri-devel, freedreno, linux-kernel On 2025-12-24 17:33:50, Dmitry Baryshkov wrote: > Since DPU 8.x Watchdog timer settings were moved from the TOP to the > INTF block. Support programming the timer in the INTF block. > > Fixes: e955a3f0d86e ("drm/msm/dpu: Implement tearcheck support on INTF block") I was somewhat fine with keeping this tag in patch 1/2; while that doesn't necessarily trigger a bug because the condition was not reached back then, the logic was still in the wrong place (which I may have blindly inferred from downstream, and/or because the initialization of vsync_cfg was there despite not being used yet). However I don't think that patch resulted in any invalid behaviour regarding the watchdog timer. The entire setup was already wrong to begin with and my patch only made it *slightly less wrong* by at least moving the TE setup to the INTF for 5.x; it made sure to keep the WD setup in the original spot. That it was later moved for DPU 8.x was not something that patch intended to concern itself with. If anything (and in other words) my patch should have had a Fixes: on the first commit that added DPU 5.0 support - for not checking the registers properly - and this patch should have a Fixes: on the first introduction of DPU 8.x for the same reason instead? > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 48 +++++++++++++++++++++++++++-- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 3 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 7 ----- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h | 7 +++++ > 5 files changed, 55 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > index 0482b2bb5a9e..0e53d9869ae9 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > @@ -792,7 +792,7 @@ static void _dpu_encoder_update_vsync_source(struct dpu_encoder_virt *dpu_enc, > > if (phys_enc->has_intf_te && phys_enc->hw_intf->ops.vsync_sel) > phys_enc->hw_intf->ops.vsync_sel(phys_enc->hw_intf, > - vsync_cfg.vsync_source); > + &vsync_cfg); Be sure to also move the initialization of vsync_cfg, at least ->frame_rate outside of the if (hw_mdptop->ops.setup_vsync_source) above (related to the first patch). This vsync_sel function is using frame_rate now in your dpu_hw_intf_vsync_sel_v8(). > } > } > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c > index a80ac82a9625..7967d9bd2f44 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c > @@ -67,6 +67,10 @@ > #define INTF_MISR_CTRL 0x180 > #define INTF_MISR_SIGNATURE 0x184 > > +#define INTF_WD_TIMER_0_CTL 0x230 > +#define INTF_WD_TIMER_0_CTL2 0x234 > +#define INTF_WD_TIMER_0_LOAD_VALUE 0x238 All other constants use spaces for alignment, making this look odd. > + > #define INTF_MUX 0x25C > #define INTF_STATUS 0x26C > #define INTF_AVR_CONTROL 0x270 > @@ -475,7 +479,7 @@ static int dpu_hw_intf_get_vsync_info(struct dpu_hw_intf *intf, > } > > static void dpu_hw_intf_vsync_sel(struct dpu_hw_intf *intf, > - enum dpu_vsync_source vsync_source) > + struct dpu_vsync_source_cfg *cfg) > { > struct dpu_hw_blk_reg_map *c; > > @@ -484,7 +488,42 @@ static void dpu_hw_intf_vsync_sel(struct dpu_hw_intf *intf, > > c = &intf->hw; > > - DPU_REG_WRITE(c, INTF_TEAR_MDP_VSYNC_SEL, (vsync_source & 0xf)); > + DPU_REG_WRITE(c, INTF_TEAR_MDP_VSYNC_SEL, (cfg->vsync_source & 0xf)); > +} > + > +static void dpu_hw_intf_vsync_sel_v8(struct dpu_hw_intf *intf, > + struct dpu_vsync_source_cfg *cfg) > +{ > + struct dpu_hw_blk_reg_map *c; > + > + if (!intf) > + return; > + > + c = &intf->hw; > + > + if (cfg->vsync_source >= DPU_VSYNC_SOURCE_WD_TIMER_4 && > + cfg->vsync_source <= DPU_VSYNC_SOURCE_WD_TIMER_1) { It's quite nasty that those timers are defined in reverse order, otherwise one might think this wouldn't match anything at all. Does it make sense to also mention INTF sources in the warning below, and/or change the condition to explicitly check for GPIO and INTF sources? Perhaps in an ELSE to the ==TIMER0 so that it's all clearly separated? > + pr_warn_once("DPU 8.x supports only GPIOs and timer0 as TE sources\n"); > + return; > + } > + > + if (cfg->vsync_source == DPU_VSYNC_SOURCE_WD_TIMER_0) { > + u32 reg; > + > + DPU_REG_WRITE(c, INTF_WD_TIMER_0_LOAD_VALUE, > + CALCULATE_WD_LOAD_VALUE(cfg->frame_rate)); Repeat: it's used here, but you didn't assign it on the call-side because hw_mdptop->ops.setup_vsync_source is NULL. > + > + DPU_REG_WRITE(c, INTF_WD_TIMER_0_CTL, BIT(0)); /* clear timer */ > + reg = DPU_REG_READ(c, INTF_WD_TIMER_0_CTL2); > + reg |= BIT(8); /* enable heartbeat timer */ > + reg |= BIT(0); /* enable WD timer */ > + DPU_REG_WRITE(c, INTF_WD_TIMER_0_CTL2, reg); > + > + /* make sure that timers are enabled/disabled for vsync state */ > + wmb(); > + } > + > + dpu_hw_intf_vsync_sel(intf, cfg); > } > > static void dpu_hw_intf_disable_autorefresh(struct dpu_hw_intf *intf, > @@ -598,7 +637,10 @@ struct dpu_hw_intf *dpu_hw_intf_init(struct drm_device *dev, > c->ops.enable_tearcheck = dpu_hw_intf_enable_te; > c->ops.disable_tearcheck = dpu_hw_intf_disable_te; > c->ops.connect_external_te = dpu_hw_intf_connect_external_te; > - c->ops.vsync_sel = dpu_hw_intf_vsync_sel; > + if (mdss_rev->core_major_ver >= 8) > + c->ops.vsync_sel = dpu_hw_intf_vsync_sel_v8; > + else > + c->ops.vsync_sel = dpu_hw_intf_vsync_sel; > c->ops.disable_autorefresh = dpu_hw_intf_disable_autorefresh; > } > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h > index f31067a9aaf1..e84ab849d71a 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h > @@ -12,6 +12,7 @@ > #include "dpu_hw_util.h" > > struct dpu_hw_intf; > +struct dpu_vsync_source_cfg; > > /* intf timing settings */ > struct dpu_hw_intf_timing_params { > @@ -107,7 +108,7 @@ struct dpu_hw_intf_ops { > > int (*connect_external_te)(struct dpu_hw_intf *intf, bool enable_external_te); > > - void (*vsync_sel)(struct dpu_hw_intf *intf, enum dpu_vsync_source vsync_source); > + void (*vsync_sel)(struct dpu_hw_intf *intf, struct dpu_vsync_source_cfg *cfg); Should we rename it now? - Marijn > > /** > * Disable autorefresh if enabled > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c > index 96dc10589bee..1ebd75d4f9be 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c > @@ -22,13 +22,6 @@ > #define TRAFFIC_SHAPER_WR_CLIENT(num) (0x060 + (num * 4)) > #define TRAFFIC_SHAPER_FIXPOINT_FACTOR 4 > > -#define MDP_TICK_COUNT 16 > -#define XO_CLK_RATE 19200 > -#define MS_TICKS_IN_SEC 1000 > - > -#define CALCULATE_WD_LOAD_VALUE(fps) \ > - ((uint32_t)((MS_TICKS_IN_SEC * XO_CLK_RATE)/(MDP_TICK_COUNT * fps))) > - > static void dpu_hw_setup_split_pipe(struct dpu_hw_mdp *mdp, > struct split_pipe_cfg *cfg) > { > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h > index 67b08e99335d..6fe65bc3bff4 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h > @@ -21,6 +21,13 @@ > > #define TO_S15D16(_x_)((_x_) << 7) > > +#define MDP_TICK_COUNT 16 > +#define XO_CLK_RATE 19200 > +#define MS_TICKS_IN_SEC 1000 > + > +#define CALCULATE_WD_LOAD_VALUE(fps) \ > + ((uint32_t)((MS_TICKS_IN_SEC * XO_CLK_RATE)/(MDP_TICK_COUNT * fps))) > + > extern const struct dpu_csc_cfg dpu_csc_YUV2RGB_601L; > extern const struct dpu_csc_cfg dpu_csc10_YUV2RGB_601L; > extern const struct dpu_csc_cfg dpu_csc10_rgb2yuv_601l; > > -- > 2.47.3 > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-12-28 3:48 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-12-24 15:33 [PATCH v4 0/2] drm/msm/dpu: fix vsync source programming on DPU >= 8.0 Dmitry Baryshkov 2025-12-24 15:33 ` [PATCH v4 1/2] drm/msm/dpu: Set vsync source irrespective of mdp top support Dmitry Baryshkov 2025-12-24 17:26 ` Marijn Suijten 2025-12-28 3:48 ` Dmitry Baryshkov 2025-12-24 15:33 ` [PATCH v4 2/2] drm/msm/dpu: fix WD timer handling on DPU 8.x Dmitry Baryshkov 2025-12-24 17:46 ` Marijn Suijten
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox