[PATCH 3/5] drm/rockchip: vop: Use the RK3126 LVDS output bits for LVDS
From: Molnár Máté via B4 Relay
Date: Sat Dec 05 2026 - 22:08:49 EST
From: Molnár Máté <matemolnar88@xxxxxxxxx>
On RK3126/RK3128 the VOP has a separate output enable and dclk polarity
bit for LVDS in AXI_BUS_CTRL (bits 26 and 27), next to the RGB ones
(bits 24 and 25). The driver currently drives an LVDS connector through
the RGB bits, so the LVDS dclk is never inverted.
The panel then latches data on the wrong clock edge. On a Denver
TAQ-10162 tablet this shows up as stray dark pixels wherever a channel
crosses 0x7f/0x80, which looks like banding or a 16-bit picture. Setting
the LVDS bits, as the vendor U-Boot does (AXI_BUS_CTRL = 0x0c000000),
gives a clean image.
Describe the two bits for RK3126 and use them for LVDS outputs when the
VOP has them. Other VOPs keep using the RGB bits.
Signed-off-by: Molnár Máté <matemolnar88@xxxxxxxxx>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 ++++++
drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 2 ++
drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 2 ++
3 files changed, 10 insertions(+)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 69e72727d..95dd7eb13 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1407,6 +1407,12 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc,
switch (s->output_type) {
case DRM_MODE_CONNECTOR_LVDS:
+ /* RK3126/RK3128 have separate LVDS output enable and dclk polarity bits */
+ if (VOP_HAS_REG(vop, output, lvds_en)) {
+ VOP_REG_SET(vop, output, lvds_dclk_pol, 1);
+ VOP_REG_SET(vop, output, lvds_en, 1);
+ break;
+ }
VOP_REG_SET(vop, output, rgb_dclk_pol, 1);
VOP_REG_SET(vop, output, rgb_pin_pol, pin_pol);
VOP_REG_SET(vop, output, rgb_en, 1);
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
index f04c9731a..4c9172e73 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
@@ -106,6 +106,8 @@ struct vop_output {
struct vop_reg mipi_en;
struct vop_reg mipi_dual_channel_en;
struct vop_reg rgb_en;
+ struct vop_reg lvds_en;
+ struct vop_reg lvds_dclk_pol;
};
struct vop_common {
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
index 72301e0a3..07f46ecec 100644
--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
+++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
@@ -233,6 +233,8 @@ static const struct vop_output rk3126_output = {
.hdmi_dclk_pol = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 23),
.rgb_en = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 24),
.rgb_dclk_pol = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 25),
+ .lvds_en = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 26),
+ .lvds_dclk_pol = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 27),
.mipi_en = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 28),
.mipi_dclk_pol = VOP_REG(RK3036_AXI_BUS_CTRL, 0x1, 29),
};
--
2.43.0