[PATCH v2 2/9] drm/rockchip: vop2: Don't use uninitialised dividers on RK3588

Damon Ding damon.ding at rock-chips.com
Thu Nov 12 18:59:18 PST 2026


Hi Arun,

On 11/12/2026 4:33 PM, Arun Iyengar via B4 Relay wrote:
> From: Arun Iyengar <aiyengar1990 at gmail.com>
> 
> rk3588_calc_cru_cfg() converts all four dividers to their register
> encoding with ilog2(), but only sets the ones the interface uses:
> dclk_out_div is left uninitialised for HDMI, eDP and DPI, and
> if_pixclk_div/if_dclk_div for DP and DPI. The garbage is then written to
> RK3588_VP_CLK_CTRL; on an Orange Pi 5 the dclk_out divider of the HDMI
> video port reads back as 3 (/8) in every mode.
> 

The comments are not entirely accurate. The divider relationship is:

dclk_out_div: HDMI(dsc mode), DP and MIPI
if_pixclk_div: All interfaces
if_dclk_div: HDMI and eDP

> Start all dividers at 1. dclk_out only feeds DP and MIPI (and HDMI with
> DSC, which is not supported), so for the other interfaces keep it at the
> dclk_core rate, as the vendor kernel does for HDMI with DSC, instead of
> letting it run at the full DCLK rate.
> 
> Fixes: 5a028e8f062f ("drm/rockchip: vop2: Add support for rk3588")
> Signed-off-by: Arun Iyengar <aiyengar1990 at gmail.com>
> ---
>   drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
> index c44648e1bc0d..659fd0a3ab63 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
> @@ -1579,6 +1579,15 @@ static unsigned long rk3588_calc_cru_cfg(struct vop2_video_port *vp, int id,
>   	unsigned long if_pixclk_rate;
>   	int K = 1;
>   
> +	/*
> +	 * Not every interface uses every divider: dclk_out only feeds DP and
> +	 * MIPI, the interface dividers are unused for DP. Start from 1 so that
> +	 * no divider is left uninitialised when its value is converted below.
> +	 */
> +	*dclk_out_div = 1;
> +	*if_pixclk_div = 1;
> +	*if_dclk_div = 1;
> +
>   	if (vop2_output_if_is_hdmi(id)) {
>   		/*
>   		 * K = 2: dclk_core = if_pixclk_rate > if_dclk_rate
> @@ -1648,6 +1657,9 @@ static unsigned long rk3588_calc_cru_cfg(struct vop2_video_port *vp, int id,
>   	}
>   
>   	*dclk_core_div = dclk_rate / dclk_core_rate;
> +	/* An unused dclk_out must not run faster than dclk_core */
> +	if (!vop2_output_if_is_dp(id) && !vop2_output_if_is_mipi(id))
> +		*dclk_out_div = *dclk_core_div;
>   	*if_pixclk_div = ilog2(*if_pixclk_div);
>   	*if_dclk_div = ilog2(*if_dclk_div);
>   	*dclk_core_div = ilog2(*dclk_core_div);
> 

I think we can drop the previous divider initialization, and configure 
the correct dividers for specific interfaces.

- dclk_core_div and if_pixclk_div just remain unchanged.
- if_dclk_div is set for HDMI and eDP interfaces; all others are set to 0.
- dclk_out_div is set for DP and MIPI interfaces; the rest are set to 0.

Best regards,
Damon




More information about the Linux-rockchip mailing list