mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 21:58:04 +00:00
2e715fb4fc
Add support for BCM2712 (Raspberry Pi 5).
3bb5880ab3
Patches were generated from the diff between linux kernel branch linux-6.1.y
and rpi-6.1.y from raspberry pi kernel source:
- git format-patch linux-6.1.y...rpi-6.1.y
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2710/RPi3B, bcm2711/RPi4B
Signed-off-by: Marty Jones <mj8263788@gmail.com>
[Remove applied and reverted patches, squash patches and config commits]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
105 lines
3.4 KiB
Diff
105 lines
3.4 KiB
Diff
From f9f480b04f1dc280bd4411477f5ee7336361367b Mon Sep 17 00:00:00 2001
|
|
From: Dom Cobley <popcornmix@gmail.com>
|
|
Date: Tue, 24 Oct 2023 16:20:42 +0100
|
|
Subject: [PATCH] drm/vc4: crtc: Support odd horizontal timings on BCM2712
|
|
|
|
BCM2711 runs pixelvalve at two pixels per clock cycle which results
|
|
in an unfortunate limitation that odd horizontal timings are not
|
|
possible. This is apparent on the standard DMT mode of 1366x768@60
|
|
which cannot be driven with correct timing.
|
|
|
|
BCM2712 defaults to the same behaviour, but has a mode to support
|
|
odd timings. While internally it still runs at two pixels per clock,
|
|
setting the PV_VCONTROL_ODD_TIMING bit makes it appear externally
|
|
to behave as it is one pixel per clock.
|
|
|
|
Switching to this mode fixes 1366x768@60 mode, and other custom
|
|
resultions with odd horizontal timings.
|
|
|
|
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
|
|
---
|
|
drivers/gpu/drm/vc4/vc4_crtc.c | 12 ++++--------
|
|
drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++--
|
|
drivers/gpu/drm/vc4/vc4_regs.h | 1 +
|
|
3 files changed, 7 insertions(+), 10 deletions(-)
|
|
|
|
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
|
|
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
|
|
@@ -398,12 +398,6 @@ static void vc4_crtc_config_pv(struct dr
|
|
|
|
vc4_crtc_pixelvalve_reset(crtc);
|
|
|
|
- /*
|
|
- * NOTE: The BCM2712 has a H_OTE (Horizontal Odd Timing Enable)
|
|
- * bit that, when set, will allow to specify the timings in
|
|
- * pixels instead of cycles, thus allowing to specify odd
|
|
- * timings.
|
|
- */
|
|
CRTC_WRITE(PV_HORZA,
|
|
VC4_SET_FIELD((mode->htotal - mode->hsync_end) * pixel_rep / ppc,
|
|
PV_HORZA_HBP) |
|
|
@@ -448,6 +442,7 @@ static void vc4_crtc_config_pv(struct dr
|
|
*/
|
|
CRTC_WRITE(PV_V_CONTROL,
|
|
PV_VCONTROL_CONTINUOUS |
|
|
+ (vc4->gen >= VC4_GEN_6 ? PV_VCONTROL_ODD_TIMING : 0) |
|
|
(is_dsi ? PV_VCONTROL_DSI : 0) |
|
|
PV_VCONTROL_INTERLACE |
|
|
(odd_field_first
|
|
@@ -459,6 +454,7 @@ static void vc4_crtc_config_pv(struct dr
|
|
} else {
|
|
CRTC_WRITE(PV_V_CONTROL,
|
|
PV_VCONTROL_CONTINUOUS |
|
|
+ (vc4->gen >= VC4_GEN_6 ? PV_VCONTROL_ODD_TIMING : 0) |
|
|
(is_dsi ? PV_VCONTROL_DSI : 0));
|
|
CRTC_WRITE(PV_VSYNCD_EVEN, 0);
|
|
}
|
|
@@ -1334,7 +1330,7 @@ const struct vc4_pv_data bcm2712_pv0_dat
|
|
.hvs_output = 0,
|
|
},
|
|
.fifo_depth = 64,
|
|
- .pixels_per_clock = 2,
|
|
+ .pixels_per_clock = 1,
|
|
.encoder_types = {
|
|
[0] = VC4_ENCODER_TYPE_HDMI0,
|
|
},
|
|
@@ -1347,7 +1343,7 @@ const struct vc4_pv_data bcm2712_pv1_dat
|
|
.hvs_output = 1,
|
|
},
|
|
.fifo_depth = 64,
|
|
- .pixels_per_clock = 2,
|
|
+ .pixels_per_clock = 1,
|
|
.encoder_types = {
|
|
[0] = VC4_ENCODER_TYPE_HDMI1,
|
|
},
|
|
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
|
|
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
|
|
@@ -3958,7 +3958,7 @@ static const struct vc4_hdmi_variant bcm
|
|
PHY_LANE_2,
|
|
PHY_LANE_CK,
|
|
},
|
|
- .unsupported_odd_h_timings = true,
|
|
+ .unsupported_odd_h_timings = false,
|
|
.external_irq_controller = true,
|
|
|
|
.init_resources = vc5_hdmi_init_resources,
|
|
@@ -3985,7 +3985,7 @@ static const struct vc4_hdmi_variant bcm
|
|
PHY_LANE_2,
|
|
PHY_LANE_CK,
|
|
},
|
|
- .unsupported_odd_h_timings = true,
|
|
+ .unsupported_odd_h_timings = false,
|
|
.external_irq_controller = true,
|
|
|
|
.init_resources = vc5_hdmi_init_resources,
|
|
--- a/drivers/gpu/drm/vc4/vc4_regs.h
|
|
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
|
|
@@ -155,6 +155,7 @@
|
|
# define PV_CONTROL_EN BIT(0)
|
|
|
|
#define PV_V_CONTROL 0x04
|
|
+# define PV_VCONTROL_ODD_TIMING BIT(29)
|
|
# define PV_VCONTROL_ODD_DELAY_MASK VC4_MASK(22, 6)
|
|
# define PV_VCONTROL_ODD_DELAY_SHIFT 6
|
|
# define PV_VCONTROL_ODD_FIRST BIT(5)
|