1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00
openmptcprouter/6.12/target/linux/bcm27xx/patches-6.12/950-0665-drm-vc4-Disable-the-2pixel-clock-odd-timings-workaro.patch
Ycarus (Yannick Chabanois) bdb9b0046f Add bcm27xx 6.12 test support
2024-12-20 14:17:26 +01:00

204 lines
6.6 KiB
Diff

From 007d3c4426302a447b71aaccfe778f194a4c599d Mon Sep 17 00:00:00 2001
From: Dom Cobley <popcornmix@gmail.com>
Date: Tue, 24 Oct 2023 16:20:42 +0100
Subject: [PATCH 665/697] drm/vc4: Disable the 2pixel/clock odd timings
workaround for interlaced
Whilst BCM2712 does fix using odd horizontal timings, it doesn't
work with interlaced modes.
Drop the workaround for interlaced modes and revert to the same
behaviour as BCM2711.
https://github.com/raspberrypi/linux/issues/6281
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/vc4/vc4_crtc.c | 20 +++++++++++++++++---
drivers/gpu/drm/vc4/vc4_drv.h | 2 ++
drivers/gpu/drm/vc4/vc4_hdmi.c | 8 +++++++-
drivers/gpu/drm/vc4/vc4_hdmi.h | 4 ++++
4 files changed, 30 insertions(+), 4 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -361,7 +361,9 @@ static void vc4_crtc_config_pv(struct dr
bool is_dsi1 = vc4_encoder->type == VC4_ENCODER_TYPE_DSI1;
bool is_vec = vc4_encoder->type == VC4_ENCODER_TYPE_VEC;
u32 format = is_dsi1 ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24;
- u8 ppc = pv_data->pixels_per_clock;
+ u8 ppc = (mode->flags & DRM_MODE_FLAG_INTERLACE) ?
+ pv_data->pixels_per_clock_int :
+ pv_data->pixels_per_clock;
u16 vert_bp = mode->crtc_vtotal - mode->crtc_vsync_end;
u16 vert_sync = mode->crtc_vsync_end - mode->crtc_vsync_start;
@@ -426,7 +428,8 @@ static void vc4_crtc_config_pv(struct dr
*/
CRTC_WRITE(PV_V_CONTROL,
PV_VCONTROL_CONTINUOUS |
- (vc4->gen >= VC4_GEN_6_C ? PV_VCONTROL_ODD_TIMING : 0) |
+ (vc4->gen >= VC4_GEN_6_C && ppc == 1 ?
+ PV_VCONTROL_ODD_TIMING : 0) |
(is_dsi ? PV_VCONTROL_DSI : 0) |
PV_VCONTROL_INTERLACE |
(odd_field_first
@@ -438,7 +441,8 @@ static void vc4_crtc_config_pv(struct dr
} else {
CRTC_WRITE(PV_V_CONTROL,
PV_VCONTROL_CONTINUOUS |
- (vc4->gen >= VC4_GEN_6_C ? PV_VCONTROL_ODD_TIMING : 0) |
+ (vc4->gen >= VC4_GEN_6_C && ppc == 1 ?
+ PV_VCONTROL_ODD_TIMING : 0) |
(is_dsi ? PV_VCONTROL_DSI : 0));
CRTC_WRITE(PV_VSYNCD_EVEN, 0);
}
@@ -1208,6 +1212,7 @@ const struct vc4_pv_data bcm2835_pv0_dat
},
.fifo_depth = 64,
.pixels_per_clock = 1,
+ .pixels_per_clock_int = 1,
.encoder_types = {
[PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI0,
[PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_DPI,
@@ -1223,6 +1228,7 @@ const struct vc4_pv_data bcm2835_pv1_dat
},
.fifo_depth = 64,
.pixels_per_clock = 1,
+ .pixels_per_clock_int = 1,
.encoder_types = {
[PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI1,
[PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_SMI,
@@ -1238,6 +1244,7 @@ const struct vc4_pv_data bcm2835_pv2_dat
},
.fifo_depth = 64,
.pixels_per_clock = 1,
+ .pixels_per_clock_int = 1,
.encoder_types = {
[PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_HDMI0,
[PV_CONTROL_CLK_SELECT_VEC] = VC4_ENCODER_TYPE_VEC,
@@ -1253,6 +1260,7 @@ const struct vc4_pv_data bcm2711_pv0_dat
},
.fifo_depth = 64,
.pixels_per_clock = 1,
+ .pixels_per_clock_int = 1,
.encoder_types = {
[0] = VC4_ENCODER_TYPE_DSI0,
[1] = VC4_ENCODER_TYPE_DPI,
@@ -1268,6 +1276,7 @@ const struct vc4_pv_data bcm2711_pv1_dat
},
.fifo_depth = 64,
.pixels_per_clock = 1,
+ .pixels_per_clock_int = 1,
.encoder_types = {
[0] = VC4_ENCODER_TYPE_DSI1,
[1] = VC4_ENCODER_TYPE_SMI,
@@ -1283,6 +1292,7 @@ const struct vc4_pv_data bcm2711_pv2_dat
},
.fifo_depth = 256,
.pixels_per_clock = 2,
+ .pixels_per_clock_int = 2,
.encoder_types = {
[0] = VC4_ENCODER_TYPE_HDMI0,
},
@@ -1297,6 +1307,7 @@ const struct vc4_pv_data bcm2711_pv3_dat
},
.fifo_depth = 64,
.pixels_per_clock = 1,
+ .pixels_per_clock_int = 1,
.encoder_types = {
[PV_CONTROL_CLK_SELECT_VEC] = VC4_ENCODER_TYPE_VEC,
},
@@ -1311,6 +1322,7 @@ const struct vc4_pv_data bcm2711_pv4_dat
},
.fifo_depth = 64,
.pixels_per_clock = 2,
+ .pixels_per_clock_int = 2,
.encoder_types = {
[0] = VC4_ENCODER_TYPE_HDMI1,
},
@@ -1324,6 +1336,7 @@ const struct vc4_pv_data bcm2712_pv0_dat
},
.fifo_depth = 64,
.pixels_per_clock = 1,
+ .pixels_per_clock_int = 2,
.encoder_types = {
[0] = VC4_ENCODER_TYPE_HDMI0,
},
@@ -1337,6 +1350,7 @@ const struct vc4_pv_data bcm2712_pv1_dat
},
.fifo_depth = 64,
.pixels_per_clock = 1,
+ .pixels_per_clock_int = 2,
.encoder_types = {
[0] = VC4_ENCODER_TYPE_HDMI1,
},
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -568,6 +568,8 @@ struct vc4_pv_data {
/* Number of pixels output per clock period */
u8 pixels_per_clock;
+ /* Number of pixels output per clock period when in an interlaced mode */
+ u8 pixels_per_clock_int;
enum vc4_encoder_type encoder_types[4];
};
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1765,7 +1765,9 @@ static int vc4_hdmi_encoder_atomic_check
unsigned long long tmds_char_rate = mode->clock * 1000;
unsigned long long tmds_bit_rate;
- if (vc4_hdmi->variant->unsupported_odd_h_timings) {
+ if (vc4_hdmi->variant->unsupported_odd_h_timings ||
+ (vc4_hdmi->variant->unsupported_int_odd_h_timings &&
+ (mode->flags & DRM_MODE_FLAG_INTERLACE))) {
if (mode->flags & DRM_MODE_FLAG_DBLCLK) {
/* Only try to fixup DBLCLK modes to get 480i and 576i
* working.
@@ -3481,6 +3483,7 @@ static const struct vc4_hdmi_variant bcm
PHY_LANE_CK,
},
.unsupported_odd_h_timings = true,
+ .unsupported_int_odd_h_timings = true,
.external_irq_controller = true,
.init_resources = vc5_hdmi_init_resources,
@@ -3510,6 +3513,7 @@ static const struct vc4_hdmi_variant bcm
PHY_LANE_2,
},
.unsupported_odd_h_timings = true,
+ .unsupported_int_odd_h_timings = true,
.external_irq_controller = true,
.init_resources = vc5_hdmi_init_resources,
@@ -3539,6 +3543,7 @@ static const struct vc4_hdmi_variant bcm
PHY_LANE_CK,
},
.unsupported_odd_h_timings = false,
+ .unsupported_int_odd_h_timings = true,
.external_irq_controller = true,
.init_resources = vc5_hdmi_init_resources,
@@ -3566,6 +3571,7 @@ static const struct vc4_hdmi_variant bcm
PHY_LANE_CK,
},
.unsupported_odd_h_timings = false,
+ .unsupported_int_odd_h_timings = true,
.external_irq_controller = true,
.init_resources = vc5_hdmi_init_resources,
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -48,6 +48,10 @@ struct vc4_hdmi_variant {
/* The BCM2711 cannot deal with odd horizontal pixel timings */
bool unsupported_odd_h_timings;
+ /* The BCM2712 can handle odd horizontal pixel timings, but not in
+ * interlaced modes
+ */
+ bool unsupported_int_odd_h_timings;
/*
* The BCM2711 CEC/hotplug IRQ controller is shared between the