From cc3ef6d787b21aca724056515ba0af0199e94946 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Fri, 16 Feb 2024 15:33:14 +0000 Subject: [PATCH 0924/1085] drm/vc4: Add monochrome mode to the VEC. The VEC supports not producing colour bursts for monochrome output. It also has an option for disabling the chroma input to remove chroma from the signal. Now that there is a DRM_MODE_TV_MODE_xx defined for monochrome, plumb this in. Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_vec.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -236,6 +236,7 @@ enum vc4_vec_tv_mode_id { VC4_VEC_TV_MODE_PAL_60, VC4_VEC_TV_MODE_PAL_N, VC4_VEC_TV_MODE_SECAM, + VC4_VEC_TV_MODE_MONOCHROME, }; struct vc4_vec_tv_mode { @@ -338,6 +339,22 @@ static const struct vc4_vec_tv_mode vc4_ .config1 = VEC_CONFIG1_C_CVBS_CVBS, .custom_freq = 0x29c71c72, }, + { + /* 50Hz mono */ + .mode = DRM_MODE_TV_MODE_MONOCHROME, + .expected_htotal = 864, + .config0 = VEC_CONFIG0_PAL_BDGHI_STD | VEC_CONFIG0_BURDIS | + VEC_CONFIG0_CHRDIS, + .config1 = VEC_CONFIG1_C_CVBS_CVBS, + }, + { + /* 60Hz mono */ + .mode = DRM_MODE_TV_MODE_MONOCHROME, + .expected_htotal = 858, + .config0 = VEC_CONFIG0_PAL_M_STD | VEC_CONFIG0_BURDIS | + VEC_CONFIG0_CHRDIS, + .config1 = VEC_CONFIG1_C_CVBS_CVBS, + }, }; static inline const struct vc4_vec_tv_mode * @@ -365,6 +382,7 @@ static const struct drm_prop_enum_list l { VC4_VEC_TV_MODE_PAL_M, "PAL-M", }, { VC4_VEC_TV_MODE_PAL_N, "PAL-N", }, { VC4_VEC_TV_MODE_SECAM, "SECAM", }, + { VC4_VEC_TV_MODE_MONOCHROME, "Mono", }, }; enum drm_connector_tv_mode @@ -449,6 +467,10 @@ vc4_vec_connector_set_property(struct dr state->tv.mode = DRM_MODE_TV_MODE_SECAM; break; + case VC4_VEC_TV_MODE_MONOCHROME: + state->tv.mode = DRM_MODE_TV_MODE_MONOCHROME; + break; + default: return -EINVAL; } @@ -481,6 +503,9 @@ vc4_vec_generic_tv_mode_to_legacy(enum d case DRM_MODE_TV_MODE_SECAM: return VC4_VEC_TV_MODE_SECAM; + case DRM_MODE_TV_MODE_MONOCHROME: + return VC4_VEC_TV_MODE_MONOCHROME; + default: return -EINVAL; } @@ -835,7 +860,8 @@ static int vc4_vec_bind(struct device *d BIT(DRM_MODE_TV_MODE_PAL) | BIT(DRM_MODE_TV_MODE_PAL_M) | BIT(DRM_MODE_TV_MODE_PAL_N) | - BIT(DRM_MODE_TV_MODE_SECAM)); + BIT(DRM_MODE_TV_MODE_SECAM) | + BIT(DRM_MODE_TV_MODE_MONOCHROME)); if (ret) return ret;