Skip to content

Commit f9f480b

Browse files
popcornmixpelwell
authored andcommitted
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 <[email protected]>
1 parent 23ea21e commit f9f480b

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

drivers/gpu/drm/vc4/vc4_crtc.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,6 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_encoder *encode
398398

399399
vc4_crtc_pixelvalve_reset(crtc);
400400

401-
/*
402-
* NOTE: The BCM2712 has a H_OTE (Horizontal Odd Timing Enable)
403-
* bit that, when set, will allow to specify the timings in
404-
* pixels instead of cycles, thus allowing to specify odd
405-
* timings.
406-
*/
407401
CRTC_WRITE(PV_HORZA,
408402
VC4_SET_FIELD((mode->htotal - mode->hsync_end) * pixel_rep / ppc,
409403
PV_HORZA_HBP) |
@@ -448,6 +442,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_encoder *encode
448442
*/
449443
CRTC_WRITE(PV_V_CONTROL,
450444
PV_VCONTROL_CONTINUOUS |
445+
(vc4->gen >= VC4_GEN_6 ? PV_VCONTROL_ODD_TIMING : 0) |
451446
(is_dsi ? PV_VCONTROL_DSI : 0) |
452447
PV_VCONTROL_INTERLACE |
453448
(odd_field_first
@@ -459,6 +454,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_encoder *encode
459454
} else {
460455
CRTC_WRITE(PV_V_CONTROL,
461456
PV_VCONTROL_CONTINUOUS |
457+
(vc4->gen >= VC4_GEN_6 ? PV_VCONTROL_ODD_TIMING : 0) |
462458
(is_dsi ? PV_VCONTROL_DSI : 0));
463459
CRTC_WRITE(PV_VSYNCD_EVEN, 0);
464460
}
@@ -1334,7 +1330,7 @@ const struct vc4_pv_data bcm2712_pv0_data = {
13341330
.hvs_output = 0,
13351331
},
13361332
.fifo_depth = 64,
1337-
.pixels_per_clock = 2,
1333+
.pixels_per_clock = 1,
13381334
.encoder_types = {
13391335
[0] = VC4_ENCODER_TYPE_HDMI0,
13401336
},
@@ -1347,7 +1343,7 @@ const struct vc4_pv_data bcm2712_pv1_data = {
13471343
.hvs_output = 1,
13481344
},
13491345
.fifo_depth = 64,
1350-
.pixels_per_clock = 2,
1346+
.pixels_per_clock = 1,
13511347
.encoder_types = {
13521348
[0] = VC4_ENCODER_TYPE_HDMI1,
13531349
},

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3958,7 +3958,7 @@ static const struct vc4_hdmi_variant bcm2712_hdmi0_variant = {
39583958
PHY_LANE_2,
39593959
PHY_LANE_CK,
39603960
},
3961-
.unsupported_odd_h_timings = true,
3961+
.unsupported_odd_h_timings = false,
39623962
.external_irq_controller = true,
39633963

39643964
.init_resources = vc5_hdmi_init_resources,
@@ -3985,7 +3985,7 @@ static const struct vc4_hdmi_variant bcm2712_hdmi1_variant = {
39853985
PHY_LANE_2,
39863986
PHY_LANE_CK,
39873987
},
3988-
.unsupported_odd_h_timings = true,
3988+
.unsupported_odd_h_timings = false,
39893989
.external_irq_controller = true,
39903990

39913991
.init_resources = vc5_hdmi_init_resources,

drivers/gpu/drm/vc4/vc4_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
# define PV_CONTROL_EN BIT(0)
156156

157157
#define PV_V_CONTROL 0x04
158+
# define PV_VCONTROL_ODD_TIMING BIT(29)
158159
# define PV_VCONTROL_ODD_DELAY_MASK VC4_MASK(22, 6)
159160
# define PV_VCONTROL_ODD_DELAY_SHIFT 6
160161
# define PV_VCONTROL_ODD_FIRST BIT(5)

0 commit comments

Comments
 (0)