[PATCH v1 10/17] drm/mediatek: hdmi: add frame_colorimetry flag

From: Guillaume Ranquet
Date: Mon Sep 19 2022 - 13:01:00 EST


Add a flag to indicate support for frame colorimetry.

Signed-off-by: Guillaume Ranquet <granquet@xxxxxxxxxxxx>

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
index 30407603d693..9fe086e2cd7c 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
@@ -120,6 +120,17 @@ int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi, u8 *buffer, size_t bufsz
return err;
}

+ if (hdmi->conf->has_frame_colorimetry) {
+ frame.colorimetry = hdmi->colorimtery;
+ if (frame.colorimetry == HDMI_COLORIMETRY_EXTENDED)
+ frame.extended_colorimetry = hdmi->extended_colorimetry;
+
+ /* quantiation range:limited or full */
+ if (frame.colorspace == HDMI_COLORSPACE_RGB)
+ frame.quantization_range = hdmi->quantization_range;
+ else
+ frame.ycc_quantization_range = hdmi->ycc_quantization_range;
+ }
err = hdmi_avi_infoframe_pack(&frame, buffer, bufsz);

if (err < 0) {
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
index 62a14435be69..75a9b62dccee 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.h
@@ -33,6 +33,7 @@ struct mtk_hdmi_conf {
bool cea_modes_only;
bool has_cec;
bool has_connector;
+ bool has_frame_colorimetry;
unsigned long max_mode_clock;
const struct drm_bridge_funcs *bridge_funcs;
void (*mtk_hdmi_output_init)(struct mtk_hdmi *hdmi);

--
b4 0.10.0-dev