kernel: bump 5.15 to 5.15.100
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0624-drm-vc4-hdmi-Add-full-range-RGB-helper.patch
1 From 4809cf80fdd964c413045e550fb137a18dc98ba2 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Tue, 12 Jan 2021 15:55:07 +0100
4 Subject: [PATCH] drm/vc4: hdmi: Add full range RGB helper
5
6 We're going to need to tell whether we want to run with a full or
7 limited range RGB output in multiple places in the code, so let's create
8 a helper that will return whether we need with full range or not.
9
10 Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
11 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
12 ---
13 drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++++++--
14 1 file changed, 10 insertions(+), 2 deletions(-)
15
16 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
17 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
18 @@ -108,6 +108,15 @@ static bool vc4_hdmi_mode_needs_scrambli
19 return (mode->clock * 1000) > HDMI_14_MAX_TMDS_CLK;
20 }
21
22 +static bool vc4_hdmi_is_full_range_rgb(struct vc4_hdmi *vc4_hdmi,
23 + const struct drm_display_mode *mode)
24 +{
25 + struct vc4_hdmi_encoder *vc4_encoder = &vc4_hdmi->encoder;
26 +
27 + return !vc4_encoder->hdmi_monitor ||
28 + drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_FULL;
29 +}
30 +
31 static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
32 {
33 struct drm_info_node *node = (struct drm_info_node *)m->private;
34 @@ -1117,8 +1126,7 @@ static void vc4_hdmi_encoder_pre_crtc_en
35
36 mutex_lock(&vc4_hdmi->mutex);
37
38 - if (vc4_encoder->hdmi_monitor &&
39 - drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED) {
40 + if (!vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode)) {
41 if (vc4_hdmi->variant->csc_setup)
42 vc4_hdmi->variant->csc_setup(vc4_hdmi, true);
43