From 8299d1f057439f94c6a4412e2e5c5082b82a30c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 21 Aug 2021 10:54:34 +0200 Subject: bcm27xx: add kernel 5.10 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rebased RPi foundation patches on linux 5.10.59, removed applied and reverted patches, wireless patches and defconfig patches. bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 4B v1.1 4G bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas --- ...0700-drm-vc4-Refactor-VEC-TV-mode-setting.patch | 167 +++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 target/linux/bcm27xx/patches-5.10/950-0700-drm-vc4-Refactor-VEC-TV-mode-setting.patch (limited to 'target/linux/bcm27xx/patches-5.10/950-0700-drm-vc4-Refactor-VEC-TV-mode-setting.patch') diff --git a/target/linux/bcm27xx/patches-5.10/950-0700-drm-vc4-Refactor-VEC-TV-mode-setting.patch b/target/linux/bcm27xx/patches-5.10/950-0700-drm-vc4-Refactor-VEC-TV-mode-setting.patch new file mode 100644 index 0000000000..a1ad94ccef --- /dev/null +++ b/target/linux/bcm27xx/patches-5.10/950-0700-drm-vc4-Refactor-VEC-TV-mode-setting.patch @@ -0,0 +1,167 @@ +From db797f19f66c49273ad00803756c429ed776dc01 Mon Sep 17 00:00:00 2001 +From: Mateusz Kwiatkowski +Date: Thu, 15 Jul 2021 01:07:49 +0200 +Subject: [PATCH] drm/vc4: Refactor VEC TV mode setting + +Change the mode_set function pointer logic to declarative config0, +config1 and custom_freq fields, to make TV mode setting logic more +concise and uniform. + +Additionally, remove the superfluous tv_mode field, which was redundant +with the mode field in struct drm_tv_connector_state. + +Signed-off-by: Mateusz Kwiatkowski +--- + drivers/gpu/drm/vc4/vc4_vec.c | 69 +++++++++++------------------------ + 1 file changed, 22 insertions(+), 47 deletions(-) + +--- a/drivers/gpu/drm/vc4/vc4_vec.c ++++ b/drivers/gpu/drm/vc4/vc4_vec.c +@@ -170,8 +170,6 @@ struct vc4_vec { + + struct clk *clock; + +- const struct vc4_vec_tv_mode *tv_mode; +- + struct debugfs_regset32 regset; + }; + +@@ -217,7 +215,9 @@ enum vc4_vec_tv_mode_id { + + struct vc4_vec_tv_mode { + const struct drm_display_mode *mode; +- void (*mode_set)(struct vc4_vec *vec); ++ u32 config0; ++ u32 config1; ++ u32 custom_freq; + }; + + static const struct debugfs_reg32 vec_regs[] = { +@@ -247,18 +247,6 @@ static const struct debugfs_reg32 vec_re + VC4_REG32(VEC_DAC_MISC), + }; + +-static void vc4_vec_ntsc_mode_set(struct vc4_vec *vec) +-{ +- VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN); +- VEC_WRITE(VEC_CONFIG1, VEC_CONFIG1_C_CVBS_CVBS); +-} +- +-static void vc4_vec_ntsc_j_mode_set(struct vc4_vec *vec) +-{ +- VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_NTSC_STD); +- VEC_WRITE(VEC_CONFIG1, VEC_CONFIG1_C_CVBS_CVBS); +-} +- + static const struct drm_display_mode ntsc_mode = { + DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 13500, + 720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0, +@@ -266,21 +254,6 @@ static const struct drm_display_mode nts + DRM_MODE_FLAG_INTERLACE) + }; + +-static void vc4_vec_pal_mode_set(struct vc4_vec *vec) +-{ +- VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_BDGHI_STD); +- VEC_WRITE(VEC_CONFIG1, VEC_CONFIG1_C_CVBS_CVBS); +-} +- +-static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec) +-{ +- VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_BDGHI_STD); +- VEC_WRITE(VEC_CONFIG1, +- VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ); +- VEC_WRITE(VEC_FREQ3_2, 0x223b); +- VEC_WRITE(VEC_FREQ1_0, 0x61d1); +-} +- + static const struct drm_display_mode pal_mode = { + DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500, + 720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, +@@ -291,19 +264,24 @@ static const struct drm_display_mode pal + static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { + [VC4_VEC_TV_MODE_NTSC] = { + .mode = &ntsc_mode, +- .mode_set = vc4_vec_ntsc_mode_set, ++ .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN, ++ .config1 = VEC_CONFIG1_C_CVBS_CVBS, + }, + [VC4_VEC_TV_MODE_NTSC_J] = { + .mode = &ntsc_mode, +- .mode_set = vc4_vec_ntsc_j_mode_set, ++ .config0 = VEC_CONFIG0_NTSC_STD, ++ .config1 = VEC_CONFIG1_C_CVBS_CVBS, + }, + [VC4_VEC_TV_MODE_PAL] = { + .mode = &pal_mode, +- .mode_set = vc4_vec_pal_mode_set, ++ .config0 = VEC_CONFIG0_PAL_BDGHI_STD, ++ .config1 = VEC_CONFIG1_C_CVBS_CVBS, + }, + [VC4_VEC_TV_MODE_PAL_M] = { + .mode = &pal_mode, +- .mode_set = vc4_vec_pal_m_mode_set, ++ .config0 = VEC_CONFIG0_PAL_BDGHI_STD, ++ .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ, ++ .custom_freq = 0x223b61d1, + }, + }; + +@@ -373,7 +351,6 @@ static struct drm_connector *vc4_vec_con + drm_object_attach_property(&connector->base, + dev->mode_config.tv_mode_property, + VC4_VEC_TV_MODE_NTSC); +- vec->tv_mode = &vc4_vec_tv_modes[VC4_VEC_TV_MODE_NTSC]; + + drm_connector_attach_encoder(connector, vec->encoder); + +@@ -406,6 +383,7 @@ static void vc4_vec_encoder_enable(struc + { + struct vc4_vec_encoder *vc4_vec_encoder = to_vc4_vec_encoder(encoder); + struct vc4_vec *vec = vc4_vec_encoder->vec; ++ unsigned int tv_mode = vec->connector->state->tv.mode; + int ret; + + ret = pm_runtime_get_sync(&vec->pdev->dev); +@@ -461,7 +439,15 @@ static void vc4_vec_encoder_enable(struc + /* Mask all interrupts. */ + VEC_WRITE(VEC_MASK0, 0); + +- vec->tv_mode->mode_set(vec); ++ VEC_WRITE(VEC_CONFIG0, vc4_vec_tv_modes[tv_mode].config0); ++ VEC_WRITE(VEC_CONFIG1, vc4_vec_tv_modes[tv_mode].config1); ++ if (vc4_vec_tv_modes[tv_mode].custom_freq != 0) { ++ VEC_WRITE(VEC_FREQ3_2, ++ (vc4_vec_tv_modes[tv_mode].custom_freq >> 16) & ++ 0xffff); ++ VEC_WRITE(VEC_FREQ1_0, ++ vc4_vec_tv_modes[tv_mode].custom_freq & 0xffff); ++ } + + VEC_WRITE(VEC_DAC_MISC, + VEC_DAC_MISC_VID_ACT | VEC_DAC_MISC_DAC_RST_N); +@@ -476,16 +462,6 @@ static bool vc4_vec_encoder_mode_fixup(s + return true; + } + +-static void vc4_vec_encoder_atomic_mode_set(struct drm_encoder *encoder, +- struct drm_crtc_state *crtc_state, +- struct drm_connector_state *conn_state) +-{ +- struct vc4_vec_encoder *vc4_vec_encoder = to_vc4_vec_encoder(encoder); +- struct vc4_vec *vec = vc4_vec_encoder->vec; +- +- vec->tv_mode = &vc4_vec_tv_modes[conn_state->tv.mode]; +-} +- + static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +@@ -506,7 +482,6 @@ static const struct drm_encoder_helper_f + .enable = vc4_vec_encoder_enable, + .mode_fixup = vc4_vec_encoder_mode_fixup, + .atomic_check = vc4_vec_encoder_atomic_check, +- .atomic_mode_set = vc4_vec_encoder_atomic_mode_set, + }; + + static const struct vc4_vec_variant bcm2835_vec_variant = { -- cgit v1.2.3