1 From ff882e312a746a4a794a089e912e5e56baa8b5b4 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 3 Jul 2020 14:11:55 +0100
4 Subject: [PATCH] drm/vc4: Make FKMS max refresh rate a module
7 Some people want to use the high refresh rate modes for 1080p100
8 and 1080p120, but they're currently filtered out as generally
9 they don't add anything.
11 Make the filter threshold a module parameter so that it can be
14 https://github.com/raspberrypi/linux/issues/3677
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
18 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 12 ++++++++++--
19 1 file changed, 10 insertions(+), 2 deletions(-)
21 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
22 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
24 * Pi's firmware display stack.
27 +#include <linux/module.h>
29 #include "drm/drm_atomic_helper.h"
30 #include "drm/drm_gem_framebuffer_helper.h"
31 #include "drm/drm_plane_helper.h"
33 #include "vc_image_types.h"
34 #include <soc/bcm2835/raspberrypi-firmware.h>
36 +int fkms_max_refresh_rate = 85;
37 +module_param(fkms_max_refresh_rate, int, 0644);
38 +MODULE_PARM_DESC(fkms_max_refresh_rate, "Max supported refresh rate");
40 struct get_display_cfg {
41 u32 max_pixel_clock[2]; //Max pixel clock for each display
43 @@ -1069,8 +1075,10 @@ vc4_crtc_mode_valid(struct drm_crtc *crt
44 return MODE_NO_DBLESCAN;
47 - /* Disable refresh rates > 85Hz as limited gain from them */
48 - if (drm_mode_vrefresh(mode) > 85)
49 + /* Disable refresh rates > defined threshold (default 85Hz) as limited
52 + if (drm_mode_vrefresh(mode) > fkms_max_refresh_rate)
53 return MODE_BAD_VVALUE;
55 /* Limit the pixel clock based on the HDMI clock limits from the