* [PATCH v3 01/10] drm/tests: hdmi: check the infoframes behaviour
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2026-01-07 12:23 ` Maxime Ripard
2025-12-24 1:02 ` [PATCH v3 02/10] drm/vc4: hdmi: implement clear_infoframe Dmitry Baryshkov
` (8 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
Verify the InfoFrames behaviour. Check that reporting InfoFrame as
unsupported doesn't result in a commit error. Also check that HDR and
Audio InfoFrames are not triggered if corresponding features are not
enabled.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/tests/drm_client_modeset_test.c | 3 +
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 485 +++++++++++++++++++++
drivers/gpu/drm/tests/drm_kunit_edid.h | 119 +++++
3 files changed, 607 insertions(+)
diff --git a/drivers/gpu/drm/tests/drm_client_modeset_test.c b/drivers/gpu/drm/tests/drm_client_modeset_test.c
index 3f44fe5e92e4..ec58fe064d86 100644
--- a/drivers/gpu/drm/tests/drm_client_modeset_test.c
+++ b/drivers/gpu/drm/tests/drm_client_modeset_test.c
@@ -5,6 +5,7 @@
#include <kunit/test.h>
+#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_connector.h>
#include <drm/drm_edid.h>
#include <drm/drm_drv.h>
@@ -48,6 +49,8 @@ static const struct drm_connector_helper_funcs drm_client_modeset_connector_help
};
static const struct drm_connector_funcs drm_client_modeset_connector_funcs = {
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
+ .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state
};
static int drm_client_modeset_test_init(struct kunit *test)
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 8bd412735000..bdf14a0623b2 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -40,6 +40,9 @@ struct drm_atomic_helper_connector_hdmi_priv {
#define connector_to_priv(c) \
container_of_const(c, struct drm_atomic_helper_connector_hdmi_priv, connector)
+#define encoder_to_priv(e) \
+ container_of_const(e, struct drm_atomic_helper_connector_hdmi_priv, encoder)
+
static struct drm_display_mode *find_preferred_mode(struct drm_connector *connector)
{
struct drm_device *drm = connector->dev;
@@ -138,6 +141,24 @@ static const struct drm_connector_funcs dummy_connector_funcs = {
.reset = dummy_hdmi_connector_reset,
};
+static int hdmi_update_failures;
+
+static void test_encoder_atomic_enable(struct drm_encoder *encoder,
+ struct drm_atomic_state *state)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv =
+ encoder_to_priv(encoder);
+ int ret;
+
+ ret = drm_atomic_helper_connector_hdmi_update_infoframes(&priv->connector, state);
+ if (ret)
+ hdmi_update_failures++;
+}
+
+static const struct drm_encoder_helper_funcs test_encoder_helper_funcs = {
+ .atomic_enable = test_encoder_atomic_enable,
+};
+
static
struct drm_atomic_helper_connector_hdmi_priv *
__connector_hdmi_init(struct kunit *test,
@@ -2323,10 +2344,474 @@ static struct kunit_suite drm_atomic_helper_connector_hdmi_mode_valid_test_suite
.test_cases = drm_atomic_helper_connector_hdmi_mode_valid_tests,
};
+/*
+ * Test that the default behaviour works without errors.
+ */
+static void drm_test_check_infoframes(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_connector_state *new_conn_state;
+ struct drm_crtc_state *crtc_state;
+ struct drm_atomic_state *state;
+ struct drm_display_mode *preferred;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int old_hdmi_update_failures;
+ int ret;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 8,
+ &dummy_connector_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_200mhz);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+
+ preferred = find_preferred_mode(conn);
+ KUNIT_ASSERT_NOT_NULL(test, preferred);
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+ new_conn_state = drm_atomic_get_connector_state(state, conn);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
+
+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
+
+ crtc_state->mode_changed = true;
+
+ old_hdmi_update_failures = hdmi_update_failures;
+
+ ret = drm_atomic_check_only(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ ret = drm_atomic_commit(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ KUNIT_ASSERT_EQ(test, old_hdmi_update_failures, hdmi_update_failures);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
+static int reject_avi_infoframe_write_infoframe(struct drm_connector *connector,
+ enum hdmi_infoframe_type type,
+ const u8 *buffer, size_t len)
+{
+ if (type == HDMI_INFOFRAME_TYPE_AVI)
+ return -EOPNOTSUPP;
+
+ return 0;
+}
+
+static const struct drm_connector_hdmi_funcs reject_avi_infoframe_hdmi_funcs = {
+ .write_infoframe = reject_avi_infoframe_write_infoframe,
+};
+
+/*
+ * Test that the rejection of AVI InfoFrame results in the failure of
+ * drm_atomic_helper_connector_hdmi_update_infoframes().
+ */
+static void drm_test_check_reject_avi_infoframe(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_atomic_state *state;
+ struct drm_connector_state *new_conn_state;
+ struct drm_crtc_state *crtc_state;
+ struct drm_display_mode *preferred;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int old_hdmi_update_failures;
+ int ret;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 8,
+ &reject_avi_infoframe_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_200mhz);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+
+ preferred = find_preferred_mode(conn);
+ KUNIT_ASSERT_NOT_NULL(test, preferred);
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ drm_encoder_helper_add(&priv->encoder, &test_encoder_helper_funcs);
+
+ state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+ new_conn_state = drm_atomic_get_connector_state(state, conn);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
+
+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
+
+ crtc_state->mode_changed = true;
+
+ old_hdmi_update_failures = hdmi_update_failures;
+
+ ret = drm_atomic_check_only(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ ret = drm_atomic_commit(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ KUNIT_ASSERT_NE(test, old_hdmi_update_failures, hdmi_update_failures);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
+static int reject_hdr_infoframe_write_infoframe(struct drm_connector *connector,
+ enum hdmi_infoframe_type type,
+ const u8 *buffer, size_t len)
+{
+ if (type == HDMI_INFOFRAME_TYPE_DRM)
+ return -EOPNOTSUPP;
+
+ return 0;
+}
+
+static const struct drm_connector_hdmi_funcs reject_hdr_infoframe_hdmi_funcs = {
+ .write_infoframe = reject_hdr_infoframe_write_infoframe,
+};
+
+/*
+ * Test that the HDR InfoFrame isn't programmed in
+ * drm_atomic_helper_connector_hdmi_update_infoframes() if the max_bpc is 8.
+ */
+static void drm_test_check_reject_hdr_infoframe_bpc_8(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_atomic_state *state;
+ struct drm_connector_state *new_conn_state;
+ struct drm_crtc_state *crtc_state;
+ struct drm_display_mode *preferred;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int old_hdmi_update_failures;
+ int ret;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 8,
+ &reject_hdr_infoframe_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_200mhz_hdr);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+
+ preferred = find_preferred_mode(conn);
+ KUNIT_ASSERT_NOT_NULL(test, preferred);
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ drm_encoder_helper_add(&priv->encoder, &test_encoder_helper_funcs);
+
+ state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+ new_conn_state = drm_atomic_get_connector_state(state, conn);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
+
+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
+
+ /* Verify that there is no HDR property, so "userspace" can't set it. */
+ for (int i = 0; i < conn->base.properties->count; i++)
+ KUNIT_ASSERT_PTR_NE(test,
+ drm->mode_config.hdr_output_metadata_property,
+ conn->base.properties->properties[i]);
+
+ crtc_state->mode_changed = true;
+
+ old_hdmi_update_failures = hdmi_update_failures;
+
+ ret = drm_atomic_check_only(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ ret = drm_atomic_commit(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ KUNIT_ASSERT_EQ(test, old_hdmi_update_failures, hdmi_update_failures);
+
+ new_conn_state = conn->state;
+ KUNIT_ASSERT_NOT_NULL(test, new_conn_state);
+
+ KUNIT_ASSERT_EQ(test, new_conn_state->hdmi.output_bpc, 8);
+ KUNIT_ASSERT_EQ(test, new_conn_state->hdmi.infoframes.hdr_drm.set, false);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
+/*
+ * Test that the rejection of HDR InfoFrame results in the failure of
+ * drm_atomic_helper_connector_hdmi_update_infoframes() in the high bpc is
+ * supported.
+ */
+static void drm_test_check_reject_hdr_infoframe_bpc_10(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_atomic_state *state;
+ struct drm_connector_state *new_conn_state;
+ struct drm_crtc_state *crtc_state;
+ struct drm_display_mode *preferred;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int old_hdmi_update_failures;
+ struct hdr_output_metadata hdr_data;
+ struct drm_property_blob *hdr_blob;
+ bool replaced;
+ int ret;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 10,
+ &reject_hdr_infoframe_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_200mhz_hdr);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+
+ preferred = find_preferred_mode(conn);
+ KUNIT_ASSERT_NOT_NULL(test, preferred);
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ drm_encoder_helper_add(&priv->encoder, &test_encoder_helper_funcs);
+
+ state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+ new_conn_state = drm_atomic_get_connector_state(state, conn);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
+
+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
+
+ hdr_data.metadata_type = HDMI_STATIC_METADATA_TYPE1;
+ hdr_data.hdmi_metadata_type1.eotf = HDMI_EOTF_TRADITIONAL_GAMMA_SDR;
+ hdr_data.hdmi_metadata_type1.metadata_type = HDMI_STATIC_METADATA_TYPE1;
+
+ hdr_blob = drm_property_create_blob(drm, sizeof(hdr_data), &hdr_data);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hdr_blob);
+
+ ret = drm_property_replace_blob_from_id(drm,
+ &new_conn_state->hdr_output_metadata,
+ hdr_blob->base.id,
+ sizeof(struct hdr_output_metadata), -1,
+ &replaced);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+ KUNIT_ASSERT_EQ(test, replaced, true);
+
+ crtc_state->mode_changed = true;
+
+ old_hdmi_update_failures = hdmi_update_failures;
+
+ ret = drm_atomic_check_only(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ ret = drm_atomic_commit(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ KUNIT_ASSERT_NE(test, old_hdmi_update_failures, hdmi_update_failures);
+
+ new_conn_state = conn->state;
+ KUNIT_ASSERT_NOT_NULL(test, new_conn_state);
+
+ KUNIT_ASSERT_EQ(test, new_conn_state->hdmi.output_bpc, 10);
+ KUNIT_ASSERT_EQ(test, new_conn_state->hdmi.infoframes.hdr_drm.set, true);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
+static int reject_audio_infoframe_write_infoframe(struct drm_connector *connector,
+ enum hdmi_infoframe_type type,
+ const u8 *buffer, size_t len)
+{
+ if (type == HDMI_INFOFRAME_TYPE_AUDIO)
+ return -EOPNOTSUPP;
+
+ return 0;
+}
+
+static const struct drm_connector_hdmi_funcs reject_audio_infoframe_hdmi_funcs = {
+ .write_infoframe = reject_audio_infoframe_write_infoframe,
+};
+
+/*
+ * Test that Audio InfoFrame is only programmed if we call a corresponding API,
+ * thus the drivers can safely assume that they won't get Audio InfoFrames if
+ * they don't call it.
+ */
+static void drm_test_check_reject_audio_infoframe(struct kunit *test)
+{
+ struct drm_atomic_helper_connector_hdmi_priv *priv;
+ struct drm_modeset_acquire_ctx ctx;
+ struct drm_atomic_state *state;
+ struct drm_connector_state *new_conn_state;
+ struct drm_crtc_state *crtc_state;
+ struct drm_display_mode *preferred;
+ struct drm_connector *conn;
+ struct drm_device *drm;
+ struct drm_crtc *crtc;
+ int old_hdmi_update_failures;
+ struct hdmi_audio_infoframe cea;
+ int ret;
+
+ priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
+ BIT(HDMI_COLORSPACE_RGB),
+ 8,
+ &reject_audio_infoframe_hdmi_funcs,
+ test_edid_hdmi_1080p_rgb_max_200mhz);
+ KUNIT_ASSERT_NOT_NULL(test, priv);
+
+ drm = &priv->drm;
+ crtc = priv->crtc;
+ conn = &priv->connector;
+
+ preferred = find_preferred_mode(conn);
+ KUNIT_ASSERT_NOT_NULL(test, preferred);
+
+ drm_modeset_acquire_init(&ctx, 0);
+
+ ret = drm_kunit_helper_enable_crtc_connector(test, drm,
+ crtc, conn,
+ preferred,
+ &ctx);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ drm_encoder_helper_add(&priv->encoder, &test_encoder_helper_funcs);
+
+ state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+ new_conn_state = drm_atomic_get_connector_state(state, conn);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
+
+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
+
+ crtc_state->mode_changed = true;
+
+ old_hdmi_update_failures = hdmi_update_failures;
+
+ ret = drm_atomic_check_only(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ ret = drm_atomic_commit(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ KUNIT_ASSERT_EQ(test, old_hdmi_update_failures, hdmi_update_failures);
+
+ /*
+ * So, it works without Audio InfoFrame, let's fail with it in place,
+ * checking that writing the infofraem actually gets triggered.
+ */
+
+ hdmi_audio_infoframe_init(&cea);
+ cea.channels = 2;
+ cea.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM;
+ cea.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM;
+ cea.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM;
+
+ ret = drm_atomic_helper_connector_hdmi_update_audio_infoframe(conn, &cea);
+ KUNIT_ASSERT_EQ(test, ret, -EOPNOTSUPP);
+
+ state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
+
+ new_conn_state = drm_atomic_get_connector_state(state, conn);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
+
+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
+
+ crtc_state->mode_changed = true;
+
+ old_hdmi_update_failures = hdmi_update_failures;
+
+ ret = drm_atomic_check_only(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ ret = drm_atomic_commit(state);
+ KUNIT_ASSERT_EQ(test, ret, 0);
+
+ KUNIT_ASSERT_NE(test, old_hdmi_update_failures, hdmi_update_failures);
+
+ drm_modeset_drop_locks(&ctx);
+ drm_modeset_acquire_fini(&ctx);
+}
+
+
+static struct kunit_case drm_atomic_helper_connector_hdmi_infoframes_tests[] = {
+ KUNIT_CASE(drm_test_check_infoframes),
+ KUNIT_CASE(drm_test_check_reject_avi_infoframe),
+ KUNIT_CASE(drm_test_check_reject_hdr_infoframe_bpc_8),
+ KUNIT_CASE(drm_test_check_reject_hdr_infoframe_bpc_10),
+ KUNIT_CASE(drm_test_check_reject_audio_infoframe),
+ { }
+};
+
+static struct kunit_suite drm_atomic_helper_connector_hdmi_infoframes_test_suite = {
+ .name = "drm_atomic_helper_connector_hdmi_infoframes",
+ .test_cases = drm_atomic_helper_connector_hdmi_infoframes_tests,
+};
+
kunit_test_suites(
&drm_atomic_helper_connector_hdmi_check_test_suite,
&drm_atomic_helper_connector_hdmi_reset_test_suite,
&drm_atomic_helper_connector_hdmi_mode_valid_test_suite,
+ &drm_atomic_helper_connector_hdmi_infoframes_test_suite,
);
MODULE_AUTHOR("Maxime Ripard <mripard@kernel.org>");
diff --git a/drivers/gpu/drm/tests/drm_kunit_edid.h b/drivers/gpu/drm/tests/drm_kunit_edid.h
index c59c8528a3f7..f4923157f5bf 100644
--- a/drivers/gpu/drm/tests/drm_kunit_edid.h
+++ b/drivers/gpu/drm/tests/drm_kunit_edid.h
@@ -293,6 +293,125 @@ static const unsigned char test_edid_hdmi_1080p_rgb_max_200mhz[] = {
0x00, 0x00, 0x00, 0xfc
};
+/*
+ * edid-decode (hex):
+ *
+ * 00 ff ff ff ff ff ff 00 31 d8 2a 00 00 00 00 00
+ * 00 21 01 03 81 a0 5a 78 02 00 00 00 00 00 00 00
+ * 00 00 00 20 00 00 01 01 01 01 01 01 01 01 01 01
+ * 01 01 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c
+ * 45 00 40 84 63 00 00 1e 00 00 00 fc 00 54 65 73
+ * 74 20 45 44 49 44 0a 20 20 20 00 00 00 fd 00 32
+ * 46 1e 46 0f 00 0a 20 20 20 20 20 20 00 00 00 10
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 92
+ *
+ * 02 03 1c 81 e3 05 c0 20 41 10 e2 00 4a 67 03 0c
+ * 00 12 34 00 28 e6 06 05 01 52 52 51 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4e
+ *
+ * ----------------
+ *
+ * Block 0, Base EDID:
+ * EDID Structure Version & Revision: 1.3
+ * Vendor & Product Identification:
+ * Manufacturer: LNX
+ * Model: 42
+ * Made in: 2023
+ * Basic Display Parameters & Features:
+ * Digital display
+ * DFP 1.x compatible TMDS
+ * Maximum image size: 160 cm x 90 cm
+ * Gamma: 2.20
+ * Monochrome or grayscale display
+ * First detailed timing is the preferred timing
+ * Color Characteristics:
+ * Red : 0.0000, 0.0000
+ * Green: 0.0000, 0.0000
+ * Blue : 0.0000, 0.0000
+ * White: 0.0000, 0.0000
+ * Established Timings I & II:
+ * DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz
+ * Standard Timings: none
+ * Detailed Timing Descriptors:
+ * DTD 1: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz (1600 mm x 900 mm)
+ * Hfront 88 Hsync 44 Hback 148 Hpol P
+ * Vfront 4 Vsync 5 Vback 36 Vpol P
+ * Display Product Name: 'Test EDID'
+ * Display Range Limits:
+ * Monitor ranges (GTF): 50-70 Hz V, 30-70 kHz H, max dotclock 150 MHz
+ * Dummy Descriptor:
+ * Extension blocks: 1
+ * Checksum: 0x92
+ *
+ * ----------------
+ *
+ * Block 1, CTA-861 Extension Block:
+ * Revision: 3
+ * Underscans IT Video Formats by default
+ * Native detailed modes: 1
+ * Colorimetry Data Block:
+ * BT2020YCC
+ * BT2020RGB
+ * sRGB
+ * Video Data Block:
+ * VIC 16: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz
+ * Video Capability Data Block:
+ * YCbCr quantization: No Data
+ * RGB quantization: Selectable (via AVI Q)
+ * PT scan behavior: No Data
+ * IT scan behavior: Always Underscanned
+ * CE scan behavior: Always Underscanned
+ * Vendor-Specific Data Block (HDMI), OUI 00-0C-03:
+ * Source physical address: 1.2.3.4
+ * Maximum TMDS clock: 200 MHz
+ * HDR Static Metadata Data Block:
+ * Electro optical transfer functions:
+ * Traditional gamma - SDR luminance range
+ * SMPTE ST2084
+ * Supported static metadata descriptors:
+ * Static metadata type 1
+ * Desired content max luminance: 82 (295.365 cd/m^2)
+ * Desired content max frame-average luminance: 82 (295.365 cd/m^2)
+ * Desired content min luminance: 81 (0.298 cd/m^2)
+ * Checksum: 0x4e Unused space in Extension Block: 99 bytes
+ *
+ * ----------------
+ *
+ * edid-decode 1.31.0-5387
+ * edid-decode SHA: 5508bc4301ac 2025-08-25 08:14:22
+ *
+ * EDID conformity: PASS
+ */
+static const unsigned char test_edid_hdmi_1080p_rgb_max_200mhz_hdr[] = {
+ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x2a, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x01, 0x03, 0x81, 0xa0, 0x5a, 0x78,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a, 0x80, 0x18, 0x71, 0x38,
+ 0x2d, 0x40, 0x58, 0x2c, 0x45, 0x00, 0x40, 0x84, 0x63, 0x00, 0x00, 0x1e,
+ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x44,
+ 0x49, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x32,
+ 0x46, 0x1e, 0x46, 0x0f, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x92, 0x02, 0x03, 0x1c, 0x81,
+ 0xe3, 0x05, 0xc0, 0x20, 0x41, 0x10, 0xe2, 0x00, 0x4a, 0x67, 0x03, 0x0c,
+ 0x00, 0x12, 0x34, 0x78, 0x28, 0xe6, 0x06, 0x05, 0x01, 0x52, 0x52, 0x51,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xd6,
+};
+
/*
* edid-decode (hex):
*
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 01/10] drm/tests: hdmi: check the infoframes behaviour
2025-12-24 1:02 ` [PATCH v3 01/10] drm/tests: hdmi: check the infoframes behaviour Dmitry Baryshkov
@ 2026-01-07 12:23 ` Maxime Ripard
0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2026-01-07 12:23 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Liu Ying, Chun-Kuang Hu, Philipp Zabel, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Clark, Dmitry Baryshkov,
Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
Sandy Huang, Heiko Stübner, Andy Yan, dri-devel,
linux-kernel, linux-arm-kernel, linux-sunxi, linux-mediatek,
linux-arm-msm, freedreno, linux-rockchip
[-- Attachment #1: Type: text/plain, Size: 25507 bytes --]
On Wed, Dec 24, 2025 at 03:02:50AM +0200, Dmitry Baryshkov wrote:
> Verify the InfoFrames behaviour. Check that reporting InfoFrame as
> unsupported doesn't result in a commit error. Also check that HDR and
> Audio InfoFrames are not triggered if corresponding features are not
> enabled.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
> drivers/gpu/drm/tests/drm_client_modeset_test.c | 3 +
> drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 485 +++++++++++++++++++++
> drivers/gpu/drm/tests/drm_kunit_edid.h | 119 +++++
> 3 files changed, 607 insertions(+)
>
> diff --git a/drivers/gpu/drm/tests/drm_client_modeset_test.c b/drivers/gpu/drm/tests/drm_client_modeset_test.c
> index 3f44fe5e92e4..ec58fe064d86 100644
> --- a/drivers/gpu/drm/tests/drm_client_modeset_test.c
> +++ b/drivers/gpu/drm/tests/drm_client_modeset_test.c
> @@ -5,6 +5,7 @@
>
> #include <kunit/test.h>
>
> +#include <drm/drm_atomic_state_helper.h>
> #include <drm/drm_connector.h>
> #include <drm/drm_edid.h>
> #include <drm/drm_drv.h>
> @@ -48,6 +49,8 @@ static const struct drm_connector_helper_funcs drm_client_modeset_connector_help
> };
>
> static const struct drm_connector_funcs drm_client_modeset_connector_funcs = {
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state
> };
>
> static int drm_client_modeset_test_init(struct kunit *test)
> diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> index 8bd412735000..bdf14a0623b2 100644
> --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
> @@ -40,6 +40,9 @@ struct drm_atomic_helper_connector_hdmi_priv {
> #define connector_to_priv(c) \
> container_of_const(c, struct drm_atomic_helper_connector_hdmi_priv, connector)
>
> +#define encoder_to_priv(e) \
> + container_of_const(e, struct drm_atomic_helper_connector_hdmi_priv, encoder)
> +
> static struct drm_display_mode *find_preferred_mode(struct drm_connector *connector)
> {
> struct drm_device *drm = connector->dev;
> @@ -138,6 +141,24 @@ static const struct drm_connector_funcs dummy_connector_funcs = {
> .reset = dummy_hdmi_connector_reset,
> };
>
> +static int hdmi_update_failures;
It looks like it's only ever used between atomic_enable and the test
itself. Any reason we don't add it to
drm_atomic_helper_connector_hdmi_priv ?
That way, we wouldn't have to deal with the previous state, it's all
local to the test.
> +static void test_encoder_atomic_enable(struct drm_encoder *encoder,
> + struct drm_atomic_state *state)
> +{
> + struct drm_atomic_helper_connector_hdmi_priv *priv =
> + encoder_to_priv(encoder);
> + int ret;
> +
> + ret = drm_atomic_helper_connector_hdmi_update_infoframes(&priv->connector, state);
> + if (ret)
> + hdmi_update_failures++;
> +}
> +
> +static const struct drm_encoder_helper_funcs test_encoder_helper_funcs = {
> + .atomic_enable = test_encoder_atomic_enable,
> +};
> +
> static
> struct drm_atomic_helper_connector_hdmi_priv *
> __connector_hdmi_init(struct kunit *test,
> @@ -2323,10 +2344,474 @@ static struct kunit_suite drm_atomic_helper_connector_hdmi_mode_valid_test_suite
> .test_cases = drm_atomic_helper_connector_hdmi_mode_valid_tests,
> };
>
> +/*
> + * Test that the default behaviour works without errors.
> + */
The default behaviour can change. We should document what our
expectations are here, so something like "we expect the infoframes
related hooks to be called without error" or something.
> +static void drm_test_check_infoframes(struct kunit *test)
> +{
> + struct drm_atomic_helper_connector_hdmi_priv *priv;
> + struct drm_modeset_acquire_ctx ctx;
> + struct drm_connector_state *new_conn_state;
> + struct drm_crtc_state *crtc_state;
> + struct drm_atomic_state *state;
> + struct drm_display_mode *preferred;
> + struct drm_connector *conn;
> + struct drm_device *drm;
> + struct drm_crtc *crtc;
> + int old_hdmi_update_failures;
> + int ret;
> +
> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
> + BIT(HDMI_COLORSPACE_RGB),
> + 8,
> + &dummy_connector_hdmi_funcs,
> + test_edid_hdmi_1080p_rgb_max_200mhz);
> + KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> + drm = &priv->drm;
> + crtc = priv->crtc;
> + conn = &priv->connector;
> +
> + preferred = find_preferred_mode(conn);
> + KUNIT_ASSERT_NOT_NULL(test, preferred);
> +
> + drm_modeset_acquire_init(&ctx, 0);
> +
> + ret = drm_kunit_helper_enable_crtc_connector(test, drm,
> + crtc, conn,
> + preferred,
> + &ctx);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
> +
> + new_conn_state = drm_atomic_get_connector_state(state, conn);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
> +
> + crtc_state = drm_atomic_get_crtc_state(state, crtc);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
> +
> + crtc_state->mode_changed = true;
> +
> + old_hdmi_update_failures = hdmi_update_failures;
> +
> + ret = drm_atomic_check_only(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + ret = drm_atomic_commit(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + KUNIT_ASSERT_EQ(test, old_hdmi_update_failures, hdmi_update_failures);
> +
> + drm_modeset_drop_locks(&ctx);
> + drm_modeset_acquire_fini(&ctx);
> +}
> +
> +static int reject_avi_infoframe_write_infoframe(struct drm_connector *connector,
> + enum hdmi_infoframe_type type,
> + const u8 *buffer, size_t len)
> +{
> + if (type == HDMI_INFOFRAME_TYPE_AVI)
> + return -EOPNOTSUPP;
> +
> + return 0;
> +}
> +
> +static const struct drm_connector_hdmi_funcs reject_avi_infoframe_hdmi_funcs = {
> + .write_infoframe = reject_avi_infoframe_write_infoframe,
> +};
> +
> +/*
> + * Test that the rejection of AVI InfoFrame results in the failure of
> + * drm_atomic_helper_connector_hdmi_update_infoframes().
> + */
> +static void drm_test_check_reject_avi_infoframe(struct kunit *test)
> +{
> + struct drm_atomic_helper_connector_hdmi_priv *priv;
> + struct drm_modeset_acquire_ctx ctx;
> + struct drm_atomic_state *state;
> + struct drm_connector_state *new_conn_state;
> + struct drm_crtc_state *crtc_state;
> + struct drm_display_mode *preferred;
> + struct drm_connector *conn;
> + struct drm_device *drm;
> + struct drm_crtc *crtc;
> + int old_hdmi_update_failures;
> + int ret;
> +
> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
> + BIT(HDMI_COLORSPACE_RGB),
> + 8,
> + &reject_avi_infoframe_hdmi_funcs,
> + test_edid_hdmi_1080p_rgb_max_200mhz);
> + KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> + drm = &priv->drm;
> + crtc = priv->crtc;
> + conn = &priv->connector;
> +
> + preferred = find_preferred_mode(conn);
> + KUNIT_ASSERT_NOT_NULL(test, preferred);
> +
> + drm_modeset_acquire_init(&ctx, 0);
> +
> + ret = drm_kunit_helper_enable_crtc_connector(test, drm,
> + crtc, conn,
> + preferred,
> + &ctx);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + drm_encoder_helper_add(&priv->encoder, &test_encoder_helper_funcs);
> +
> + state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
> +
> + new_conn_state = drm_atomic_get_connector_state(state, conn);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
> +
> + crtc_state = drm_atomic_get_crtc_state(state, crtc);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
> +
> + crtc_state->mode_changed = true;
> +
> + old_hdmi_update_failures = hdmi_update_failures;
> +
> + ret = drm_atomic_check_only(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + ret = drm_atomic_commit(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + KUNIT_ASSERT_NE(test, old_hdmi_update_failures, hdmi_update_failures);
I'd say we expect it to be greater than old_hdmi_update_failures. We
also shouldn't really use ASSERT here, but rather EXPECT.
We should also handle EDEADLK.
> + drm_modeset_drop_locks(&ctx);
> + drm_modeset_acquire_fini(&ctx);
> +}
> +
> +static int reject_hdr_infoframe_write_infoframe(struct drm_connector *connector,
> + enum hdmi_infoframe_type type,
> + const u8 *buffer, size_t len)
> +{
> + if (type == HDMI_INFOFRAME_TYPE_DRM)
> + return -EOPNOTSUPP;
> +
> + return 0;
> +}
> +
> +static const struct drm_connector_hdmi_funcs reject_hdr_infoframe_hdmi_funcs = {
> + .write_infoframe = reject_hdr_infoframe_write_infoframe,
> +};
> +
> +/*
> + * Test that the HDR InfoFrame isn't programmed in
> + * drm_atomic_helper_connector_hdmi_update_infoframes() if the max_bpc is 8.
> + */
> +static void drm_test_check_reject_hdr_infoframe_bpc_8(struct kunit *test)
> +{
> + struct drm_atomic_helper_connector_hdmi_priv *priv;
> + struct drm_modeset_acquire_ctx ctx;
> + struct drm_atomic_state *state;
> + struct drm_connector_state *new_conn_state;
> + struct drm_crtc_state *crtc_state;
> + struct drm_display_mode *preferred;
> + struct drm_connector *conn;
> + struct drm_device *drm;
> + struct drm_crtc *crtc;
> + int old_hdmi_update_failures;
> + int ret;
> +
> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
> + BIT(HDMI_COLORSPACE_RGB),
> + 8,
> + &reject_hdr_infoframe_hdmi_funcs,
> + test_edid_hdmi_1080p_rgb_max_200mhz_hdr);
> + KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> + drm = &priv->drm;
> + crtc = priv->crtc;
> + conn = &priv->connector;
> +
> + preferred = find_preferred_mode(conn);
> + KUNIT_ASSERT_NOT_NULL(test, preferred);
> +
> + drm_modeset_acquire_init(&ctx, 0);
> +
> + ret = drm_kunit_helper_enable_crtc_connector(test, drm,
> + crtc, conn,
> + preferred,
> + &ctx);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + drm_encoder_helper_add(&priv->encoder, &test_encoder_helper_funcs);
> +
> + state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
> +
> + new_conn_state = drm_atomic_get_connector_state(state, conn);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
> +
> + crtc_state = drm_atomic_get_crtc_state(state, crtc);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
> +
> + /* Verify that there is no HDR property, so "userspace" can't set it. */
> + for (int i = 0; i < conn->base.properties->count; i++)
> + KUNIT_ASSERT_PTR_NE(test,
> + drm->mode_config.hdr_output_metadata_property,
> + conn->base.properties->properties[i]);
> +
> + crtc_state->mode_changed = true;
> +
> + old_hdmi_update_failures = hdmi_update_failures;
> +
> + ret = drm_atomic_check_only(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + ret = drm_atomic_commit(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + KUNIT_ASSERT_EQ(test, old_hdmi_update_failures, hdmi_update_failures);
> +
> + new_conn_state = conn->state;
> + KUNIT_ASSERT_NOT_NULL(test, new_conn_state);
> +
> + KUNIT_ASSERT_EQ(test, new_conn_state->hdmi.output_bpc, 8);
> + KUNIT_ASSERT_EQ(test, new_conn_state->hdmi.infoframes.hdr_drm.set, false);
> +
> + drm_modeset_drop_locks(&ctx);
> + drm_modeset_acquire_fini(&ctx);
> +}
> +
> +/*
> + * Test that the rejection of HDR InfoFrame results in the failure of
> + * drm_atomic_helper_connector_hdmi_update_infoframes() in the high bpc is
> + * supported.
> + */
> +static void drm_test_check_reject_hdr_infoframe_bpc_10(struct kunit *test)
> +{
> + struct drm_atomic_helper_connector_hdmi_priv *priv;
> + struct drm_modeset_acquire_ctx ctx;
> + struct drm_atomic_state *state;
> + struct drm_connector_state *new_conn_state;
> + struct drm_crtc_state *crtc_state;
> + struct drm_display_mode *preferred;
> + struct drm_connector *conn;
> + struct drm_device *drm;
> + struct drm_crtc *crtc;
> + int old_hdmi_update_failures;
> + struct hdr_output_metadata hdr_data;
> + struct drm_property_blob *hdr_blob;
> + bool replaced;
> + int ret;
> +
> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
> + BIT(HDMI_COLORSPACE_RGB),
> + 10,
> + &reject_hdr_infoframe_hdmi_funcs,
> + test_edid_hdmi_1080p_rgb_max_200mhz_hdr);
> + KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> + drm = &priv->drm;
> + crtc = priv->crtc;
> + conn = &priv->connector;
> +
> + preferred = find_preferred_mode(conn);
> + KUNIT_ASSERT_NOT_NULL(test, preferred);
> +
> + drm_modeset_acquire_init(&ctx, 0);
> +
> + ret = drm_kunit_helper_enable_crtc_connector(test, drm,
> + crtc, conn,
> + preferred,
> + &ctx);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + drm_encoder_helper_add(&priv->encoder, &test_encoder_helper_funcs);
> +
> + state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
> +
> + new_conn_state = drm_atomic_get_connector_state(state, conn);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
> +
> + crtc_state = drm_atomic_get_crtc_state(state, crtc);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
> +
> + hdr_data.metadata_type = HDMI_STATIC_METADATA_TYPE1;
> + hdr_data.hdmi_metadata_type1.eotf = HDMI_EOTF_TRADITIONAL_GAMMA_SDR;
> + hdr_data.hdmi_metadata_type1.metadata_type = HDMI_STATIC_METADATA_TYPE1;
> +
> + hdr_blob = drm_property_create_blob(drm, sizeof(hdr_data), &hdr_data);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hdr_blob);
> +
> + ret = drm_property_replace_blob_from_id(drm,
> + &new_conn_state->hdr_output_metadata,
> + hdr_blob->base.id,
> + sizeof(struct hdr_output_metadata), -1,
> + &replaced);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> + KUNIT_ASSERT_EQ(test, replaced, true);
> +
> + crtc_state->mode_changed = true;
> +
> + old_hdmi_update_failures = hdmi_update_failures;
> +
> + ret = drm_atomic_check_only(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + ret = drm_atomic_commit(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + KUNIT_ASSERT_NE(test, old_hdmi_update_failures, hdmi_update_failures);
> +
> + new_conn_state = conn->state;
> + KUNIT_ASSERT_NOT_NULL(test, new_conn_state);
> +
> + KUNIT_ASSERT_EQ(test, new_conn_state->hdmi.output_bpc, 10);
> + KUNIT_ASSERT_EQ(test, new_conn_state->hdmi.infoframes.hdr_drm.set, true);
> +
> + drm_modeset_drop_locks(&ctx);
> + drm_modeset_acquire_fini(&ctx);
> +}
> +
> +static int reject_audio_infoframe_write_infoframe(struct drm_connector *connector,
> + enum hdmi_infoframe_type type,
> + const u8 *buffer, size_t len)
> +{
> + if (type == HDMI_INFOFRAME_TYPE_AUDIO)
> + return -EOPNOTSUPP;
> +
> + return 0;
> +}
> +
> +static const struct drm_connector_hdmi_funcs reject_audio_infoframe_hdmi_funcs = {
> + .write_infoframe = reject_audio_infoframe_write_infoframe,
> +};
> +
> +/*
> + * Test that Audio InfoFrame is only programmed if we call a corresponding API,
> + * thus the drivers can safely assume that they won't get Audio InfoFrames if
> + * they don't call it.
> + */
> +static void drm_test_check_reject_audio_infoframe(struct kunit *test)
> +{
> + struct drm_atomic_helper_connector_hdmi_priv *priv;
> + struct drm_modeset_acquire_ctx ctx;
> + struct drm_atomic_state *state;
> + struct drm_connector_state *new_conn_state;
> + struct drm_crtc_state *crtc_state;
> + struct drm_display_mode *preferred;
> + struct drm_connector *conn;
> + struct drm_device *drm;
> + struct drm_crtc *crtc;
> + int old_hdmi_update_failures;
> + struct hdmi_audio_infoframe cea;
> + int ret;
> +
> + priv = drm_kunit_helper_connector_hdmi_init_with_edid_funcs(test,
> + BIT(HDMI_COLORSPACE_RGB),
> + 8,
> + &reject_audio_infoframe_hdmi_funcs,
> + test_edid_hdmi_1080p_rgb_max_200mhz);
> + KUNIT_ASSERT_NOT_NULL(test, priv);
> +
> + drm = &priv->drm;
> + crtc = priv->crtc;
> + conn = &priv->connector;
> +
> + preferred = find_preferred_mode(conn);
> + KUNIT_ASSERT_NOT_NULL(test, preferred);
> +
> + drm_modeset_acquire_init(&ctx, 0);
> +
> + ret = drm_kunit_helper_enable_crtc_connector(test, drm,
> + crtc, conn,
> + preferred,
> + &ctx);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + drm_encoder_helper_add(&priv->encoder, &test_encoder_helper_funcs);
> +
> + state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
> +
> + new_conn_state = drm_atomic_get_connector_state(state, conn);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
> +
> + crtc_state = drm_atomic_get_crtc_state(state, crtc);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
> +
> + crtc_state->mode_changed = true;
> +
> + old_hdmi_update_failures = hdmi_update_failures;
> +
> + ret = drm_atomic_check_only(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + ret = drm_atomic_commit(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + KUNIT_ASSERT_EQ(test, old_hdmi_update_failures, hdmi_update_failures);
> +
> + /*
> + * So, it works without Audio InfoFrame, let's fail with it in place,
> + * checking that writing the infofraem actually gets triggered.
> + */
> +
> + hdmi_audio_infoframe_init(&cea);
> + cea.channels = 2;
> + cea.coding_type = HDMI_AUDIO_CODING_TYPE_STREAM;
> + cea.sample_size = HDMI_AUDIO_SAMPLE_SIZE_STREAM;
> + cea.sample_frequency = HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM;
> +
> + ret = drm_atomic_helper_connector_hdmi_update_audio_infoframe(conn, &cea);
> + KUNIT_ASSERT_EQ(test, ret, -EOPNOTSUPP);
> +
> + state = drm_kunit_helper_atomic_state_alloc(test, drm, &ctx);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
> +
> + new_conn_state = drm_atomic_get_connector_state(state, conn);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, new_conn_state);
> +
> + crtc_state = drm_atomic_get_crtc_state(state, crtc);
> + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
> +
> + crtc_state->mode_changed = true;
> +
> + old_hdmi_update_failures = hdmi_update_failures;
> +
> + ret = drm_atomic_check_only(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + ret = drm_atomic_commit(state);
> + KUNIT_ASSERT_EQ(test, ret, 0);
> +
> + KUNIT_ASSERT_NE(test, old_hdmi_update_failures, hdmi_update_failures);
> +
> + drm_modeset_drop_locks(&ctx);
> + drm_modeset_acquire_fini(&ctx);
> +}
> +
> +
> +static struct kunit_case drm_atomic_helper_connector_hdmi_infoframes_tests[] = {
> + KUNIT_CASE(drm_test_check_infoframes),
> + KUNIT_CASE(drm_test_check_reject_avi_infoframe),
> + KUNIT_CASE(drm_test_check_reject_hdr_infoframe_bpc_8),
> + KUNIT_CASE(drm_test_check_reject_hdr_infoframe_bpc_10),
> + KUNIT_CASE(drm_test_check_reject_audio_infoframe),
> + { }
> +};
> +
> +static struct kunit_suite drm_atomic_helper_connector_hdmi_infoframes_test_suite = {
> + .name = "drm_atomic_helper_connector_hdmi_infoframes",
> + .test_cases = drm_atomic_helper_connector_hdmi_infoframes_tests,
> +};
> +
> kunit_test_suites(
> &drm_atomic_helper_connector_hdmi_check_test_suite,
> &drm_atomic_helper_connector_hdmi_reset_test_suite,
> &drm_atomic_helper_connector_hdmi_mode_valid_test_suite,
> + &drm_atomic_helper_connector_hdmi_infoframes_test_suite,
> );
>
> MODULE_AUTHOR("Maxime Ripard <mripard@kernel.org>");
> diff --git a/drivers/gpu/drm/tests/drm_kunit_edid.h b/drivers/gpu/drm/tests/drm_kunit_edid.h
> index c59c8528a3f7..f4923157f5bf 100644
> --- a/drivers/gpu/drm/tests/drm_kunit_edid.h
> +++ b/drivers/gpu/drm/tests/drm_kunit_edid.h
> @@ -293,6 +293,125 @@ static const unsigned char test_edid_hdmi_1080p_rgb_max_200mhz[] = {
> 0x00, 0x00, 0x00, 0xfc
> };
>
> +/*
> + * edid-decode (hex):
> + *
> + * 00 ff ff ff ff ff ff 00 31 d8 2a 00 00 00 00 00
> + * 00 21 01 03 81 a0 5a 78 02 00 00 00 00 00 00 00
> + * 00 00 00 20 00 00 01 01 01 01 01 01 01 01 01 01
> + * 01 01 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c
> + * 45 00 40 84 63 00 00 1e 00 00 00 fc 00 54 65 73
> + * 74 20 45 44 49 44 0a 20 20 20 00 00 00 fd 00 32
> + * 46 1e 46 0f 00 0a 20 20 20 20 20 20 00 00 00 10
> + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 92
> + *
> + * 02 03 1c 81 e3 05 c0 20 41 10 e2 00 4a 67 03 0c
> + * 00 12 34 00 28 e6 06 05 01 52 52 51 00 00 00 00
> + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4e
> + *
> + * ----------------
> + *
> + * Block 0, Base EDID:
> + * EDID Structure Version & Revision: 1.3
> + * Vendor & Product Identification:
> + * Manufacturer: LNX
> + * Model: 42
> + * Made in: 2023
> + * Basic Display Parameters & Features:
> + * Digital display
> + * DFP 1.x compatible TMDS
> + * Maximum image size: 160 cm x 90 cm
> + * Gamma: 2.20
> + * Monochrome or grayscale display
> + * First detailed timing is the preferred timing
> + * Color Characteristics:
> + * Red : 0.0000, 0.0000
> + * Green: 0.0000, 0.0000
> + * Blue : 0.0000, 0.0000
> + * White: 0.0000, 0.0000
> + * Established Timings I & II:
> + * DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz
> + * Standard Timings: none
> + * Detailed Timing Descriptors:
> + * DTD 1: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz (1600 mm x 900 mm)
> + * Hfront 88 Hsync 44 Hback 148 Hpol P
> + * Vfront 4 Vsync 5 Vback 36 Vpol P
> + * Display Product Name: 'Test EDID'
> + * Display Range Limits:
> + * Monitor ranges (GTF): 50-70 Hz V, 30-70 kHz H, max dotclock 150 MHz
> + * Dummy Descriptor:
> + * Extension blocks: 1
> + * Checksum: 0x92
> + *
> + * ----------------
> + *
> + * Block 1, CTA-861 Extension Block:
> + * Revision: 3
> + * Underscans IT Video Formats by default
> + * Native detailed modes: 1
> + * Colorimetry Data Block:
> + * BT2020YCC
> + * BT2020RGB
> + * sRGB
> + * Video Data Block:
> + * VIC 16: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000 MHz
> + * Video Capability Data Block:
> + * YCbCr quantization: No Data
> + * RGB quantization: Selectable (via AVI Q)
> + * PT scan behavior: No Data
> + * IT scan behavior: Always Underscanned
> + * CE scan behavior: Always Underscanned
> + * Vendor-Specific Data Block (HDMI), OUI 00-0C-03:
> + * Source physical address: 1.2.3.4
> + * Maximum TMDS clock: 200 MHz
> + * HDR Static Metadata Data Block:
> + * Electro optical transfer functions:
> + * Traditional gamma - SDR luminance range
> + * SMPTE ST2084
> + * Supported static metadata descriptors:
> + * Static metadata type 1
> + * Desired content max luminance: 82 (295.365 cd/m^2)
> + * Desired content max frame-average luminance: 82 (295.365 cd/m^2)
> + * Desired content min luminance: 81 (0.298 cd/m^2)
> + * Checksum: 0x4e Unused space in Extension Block: 99 bytes
> + *
> + * ----------------
> + *
> + * edid-decode 1.31.0-5387
> + * edid-decode SHA: 5508bc4301ac 2025-08-25 08:14:22
> + *
> + * EDID conformity: PASS
> + */
> +static const unsigned char test_edid_hdmi_1080p_rgb_max_200mhz_hdr[] = {
> + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x2a, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x01, 0x03, 0x81, 0xa0, 0x5a, 0x78,
> + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
> + 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
> + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a, 0x80, 0x18, 0x71, 0x38,
> + 0x2d, 0x40, 0x58, 0x2c, 0x45, 0x00, 0x40, 0x84, 0x63, 0x00, 0x00, 0x1e,
> + 0x00, 0x00, 0x00, 0xfc, 0x00, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x44,
> + 0x49, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x32,
> + 0x46, 0x1e, 0x46, 0x0f, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
> + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x92, 0x02, 0x03, 0x1c, 0x81,
> + 0xe3, 0x05, 0xc0, 0x20, 0x41, 0x10, 0xe2, 0x00, 0x4a, 0x67, 0x03, 0x0c,
> + 0x00, 0x12, 0x34, 0x78, 0x28, 0xe6, 0x06, 0x05, 0x01, 0x52, 0x52, 0x51,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0xd6,
> +};
> +
> /*
> * edid-decode (hex):
> *
>
> --
> 2.47.3
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 02/10] drm/vc4: hdmi: implement clear_infoframe
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
2025-12-24 1:02 ` [PATCH v3 01/10] drm/tests: hdmi: check the infoframes behaviour Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2026-01-07 12:23 ` Maxime Ripard
2025-12-24 1:02 ` [PATCH v3 03/10] drm/sun4i: hdmi_enc: implement clear_infoframe stub Dmitry Baryshkov
` (7 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
Implement the clear_infoframe callback, disabling corresponding
InfoFrame type.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 1798d1156d10..4cfb7ebc0c81 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -624,6 +624,30 @@ static int vc4_hdmi_stop_packet(struct vc4_hdmi *vc4_hdmi,
return ret;
}
+static int vc4_hdmi_clear_infoframe(struct drm_connector *connector,
+ enum hdmi_infoframe_type type)
+{
+ struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
+ struct drm_device *drm = connector->dev;
+ int ret;
+ int idx;
+
+ if (!drm_dev_enter(drm, &idx))
+ return 0;
+
+ WARN_ONCE(!(HDMI_READ(HDMI_RAM_PACKET_CONFIG) &
+ VC4_HDMI_RAM_PACKET_ENABLE),
+ "Packet RAM has to be on to store the packet.");
+
+ ret = vc4_hdmi_stop_packet(vc4_hdmi, type, true);
+ if (ret)
+ drm_err(drm, "Failed to wait for infoframe to go idle: %d\n", ret);
+
+ drm_dev_exit(idx);
+
+ return ret;
+}
+
static int vc4_hdmi_write_infoframe(struct drm_connector *connector,
enum hdmi_infoframe_type type,
const u8 *infoframe, size_t len)
@@ -1660,6 +1684,7 @@ vc4_hdmi_connector_clock_valid(const struct drm_connector *connector,
static const struct drm_connector_hdmi_funcs vc4_hdmi_hdmi_connector_funcs = {
.tmds_char_rate_valid = vc4_hdmi_connector_clock_valid,
+ .clear_infoframe = vc4_hdmi_clear_infoframe,
.write_infoframe = vc4_hdmi_write_infoframe,
};
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 02/10] drm/vc4: hdmi: implement clear_infoframe
2025-12-24 1:02 ` [PATCH v3 02/10] drm/vc4: hdmi: implement clear_infoframe Dmitry Baryshkov
@ 2026-01-07 12:23 ` Maxime Ripard
0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2026-01-07 12:23 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: dri-devel, freedreno, linux-arm-kernel, linux-arm-msm,
linux-kernel, linux-mediatek, linux-rockchip, linux-sunxi,
Abhinav Kumar, Andrzej Hajda, Andy Yan,
AngeloGioacchino Del Regno, Chen-Yu Tsai, Chun-Kuang Hu,
Dave Stevenson, David Airlie, Dmitry Baryshkov,
Heiko Stübner, Jernej Skrabec, Jessica Zhang, Jonas Karlman,
Laurent Pinchart, Liu Ying, Maarten Lankhorst, Marijn Suijten,
Matthias Brugger, Maxime Ripard, Maíra Canal, Neil Armstrong,
Philipp Zabel, Raspberry Pi Kernel Maintenance, Rob Clark,
Robert Foss, Samuel Holland, Sandy Huang, Sean Paul,
Simona Vetter, Thomas Zimmermann
On Wed, 24 Dec 2025 03:02:51 +0200, Dmitry Baryshkov wrote:
> Implement the clear_infoframe callback, disabling corresponding
> InfoFrame type.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 03/10] drm/sun4i: hdmi_enc: implement clear_infoframe stub
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
2025-12-24 1:02 ` [PATCH v3 01/10] drm/tests: hdmi: check the infoframes behaviour Dmitry Baryshkov
2025-12-24 1:02 ` [PATCH v3 02/10] drm/vc4: hdmi: implement clear_infoframe Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2025-12-24 1:02 ` [PATCH v3 04/10] drm/connector: make clear_infoframe callback mandatory for HDMI connectors Dmitry Baryshkov
` (6 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
In preparation to making clear_infoframes callbacks required, add a stub
to the sun4i driver.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index ab0938ba61f7..6263ee15880a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -40,6 +40,14 @@
#define drm_connector_to_sun4i_hdmi(c) \
container_of_const(c, struct sun4i_hdmi, connector)
+static int sun4i_hdmi_clear_infoframe(struct drm_connector *connector,
+ enum hdmi_infoframe_type type)
+{
+ drm_warn_once(connector->dev, "clearing of AVI infoframe is not implemented\n");
+
+ return 0;
+}
+
static int sun4i_hdmi_write_infoframe(struct drm_connector *connector,
enum hdmi_infoframe_type type,
const u8 *buffer, size_t len)
@@ -236,6 +244,7 @@ static struct i2c_adapter *sun4i_hdmi_get_ddc(struct device *dev)
static const struct drm_connector_hdmi_funcs sun4i_hdmi_hdmi_connector_funcs = {
.tmds_char_rate_valid = sun4i_hdmi_connector_clock_valid,
+ .clear_infoframe = sun4i_hdmi_clear_infoframe,
.write_infoframe = sun4i_hdmi_write_infoframe,
};
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH v3 04/10] drm/connector: make clear_infoframe callback mandatory for HDMI connectors
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
` (2 preceding siblings ...)
2025-12-24 1:02 ` [PATCH v3 03/10] drm/sun4i: hdmi_enc: implement clear_infoframe stub Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2026-01-07 12:32 ` Maxime Ripard
2025-12-24 1:02 ` [PATCH v3 05/10] drm/bridge: refactor HDMI InfoFrame callbacks Dmitry Baryshkov
` (5 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
We already require both hdmi_write_infoframe and hdmi_clear_infoframe
for bridges implementing DRM_BRIDGE_OP_HDMI. It makes sense to require
the clear_infoframes callback for HDMI connectors utilizing
drmm_connector_hdmi_init().
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/drm_connector.c | 4 ++++
drivers/gpu/drm/tests/drm_connector_test.c | 15 +++++++++++++++
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 22 ++++++++++++++++++++++
include/drm/drm_connector.h | 2 +-
4 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 4d6dc9ebfdb5..40e025712c9b 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -600,6 +600,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
if (!(max_bpc == 8 || max_bpc == 10 || max_bpc == 12))
return -EINVAL;
+ if (!hdmi_funcs->clear_infoframe ||
+ !hdmi_funcs->write_infoframe)
+ return -EINVAL;
+
ret = drmm_connector_init(dev, connector, funcs, connector_type, ddc);
if (ret)
return ret;
diff --git a/drivers/gpu/drm/tests/drm_connector_test.c b/drivers/gpu/drm/tests/drm_connector_test.c
index 22e2d959eb31..f356ea695ae7 100644
--- a/drivers/gpu/drm/tests/drm_connector_test.c
+++ b/drivers/gpu/drm/tests/drm_connector_test.c
@@ -25,7 +25,22 @@ struct drm_connector_init_priv {
struct i2c_adapter ddc;
};
+static int accept_infoframe_clear_infoframe(struct drm_connector *connector,
+ enum hdmi_infoframe_type type)
+{
+ return 0;
+}
+
+static int accept_infoframe_write_infoframe(struct drm_connector *connector,
+ enum hdmi_infoframe_type type,
+ const u8 *buffer, size_t len)
+{
+ return 0;
+}
+
static const struct drm_connector_hdmi_funcs dummy_hdmi_funcs = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
};
static const struct drm_connector_funcs dummy_funcs = {
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index bdf14a0623b2..915dcd106703 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -76,7 +76,22 @@ static int set_connector_edid(struct kunit *test, struct drm_connector *connecto
return ret;
}
+static int accept_infoframe_clear_infoframe(struct drm_connector *connector,
+ enum hdmi_infoframe_type type)
+{
+ return 0;
+}
+
+static int accept_infoframe_write_infoframe(struct drm_connector *connector,
+ enum hdmi_infoframe_type type,
+ const u8 *buffer, size_t len)
+{
+ return 0;
+}
+
static const struct drm_connector_hdmi_funcs dummy_connector_hdmi_funcs = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
};
static enum drm_mode_status
@@ -89,6 +104,8 @@ reject_connector_tmds_char_rate_valid(const struct drm_connector *connector,
static const struct drm_connector_hdmi_funcs reject_connector_hdmi_funcs = {
.tmds_char_rate_valid = reject_connector_tmds_char_rate_valid,
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
};
static enum drm_mode_status
@@ -101,6 +118,8 @@ reject_100mhz_connector_tmds_char_rate_valid(const struct drm_connector *connect
static const struct drm_connector_hdmi_funcs reject_100mhz_connector_hdmi_funcs = {
.tmds_char_rate_valid = reject_100mhz_connector_tmds_char_rate_valid,
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
};
static int dummy_connector_get_modes(struct drm_connector *connector)
@@ -2419,6 +2438,7 @@ static int reject_avi_infoframe_write_infoframe(struct drm_connector *connector,
}
static const struct drm_connector_hdmi_funcs reject_avi_infoframe_hdmi_funcs = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
.write_infoframe = reject_avi_infoframe_write_infoframe,
};
@@ -2500,6 +2520,7 @@ static int reject_hdr_infoframe_write_infoframe(struct drm_connector *connector,
}
static const struct drm_connector_hdmi_funcs reject_hdr_infoframe_hdmi_funcs = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
.write_infoframe = reject_hdr_infoframe_write_infoframe,
};
@@ -2685,6 +2706,7 @@ static int reject_audio_infoframe_write_infoframe(struct drm_connector *connecto
}
static const struct drm_connector_hdmi_funcs reject_audio_infoframe_hdmi_funcs = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
.write_infoframe = reject_audio_infoframe_write_infoframe,
};
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 8f34f4b8183d..4543833acdec 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1253,7 +1253,7 @@ struct drm_connector_hdmi_funcs {
* called multiple times, once for every disabled infoframe
* type.
*
- * The @clear_infoframe callback is optional.
+ * The @clear_infoframe callback is mandatory.
*
* Returns:
* 0 on success, a negative error code otherwise
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 04/10] drm/connector: make clear_infoframe callback mandatory for HDMI connectors
2025-12-24 1:02 ` [PATCH v3 04/10] drm/connector: make clear_infoframe callback mandatory for HDMI connectors Dmitry Baryshkov
@ 2026-01-07 12:32 ` Maxime Ripard
0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2026-01-07 12:32 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: dri-devel, freedreno, linux-arm-kernel, linux-arm-msm,
linux-kernel, linux-mediatek, linux-rockchip, linux-sunxi,
Abhinav Kumar, Andrzej Hajda, Andy Yan,
AngeloGioacchino Del Regno, Chen-Yu Tsai, Chun-Kuang Hu,
Dave Stevenson, David Airlie, Dmitry Baryshkov,
Heiko Stübner, Jernej Skrabec, Jessica Zhang, Jonas Karlman,
Laurent Pinchart, Liu Ying, Maarten Lankhorst, Marijn Suijten,
Matthias Brugger, Maxime Ripard, Maíra Canal, Neil Armstrong,
Philipp Zabel, Raspberry Pi Kernel Maintenance, Rob Clark,
Robert Foss, Samuel Holland, Sandy Huang, Sean Paul,
Simona Vetter, Thomas Zimmermann
On Wed, 24 Dec 2025 03:02:53 +0200, Dmitry Baryshkov wrote:
> We already require both hdmi_write_infoframe and hdmi_clear_infoframe
> for bridges implementing DRM_BRIDGE_OP_HDMI. It makes sense to require
> the clear_infoframes callback for HDMI connectors utilizing
> drmm_connector_hdmi_init().
>
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 05/10] drm/bridge: refactor HDMI InfoFrame callbacks
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
` (3 preceding siblings ...)
2025-12-24 1:02 ` [PATCH v3 04/10] drm/connector: make clear_infoframe callback mandatory for HDMI connectors Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2026-01-07 13:27 ` Maxime Ripard
2025-12-24 1:02 ` [PATCH v3 06/10] drm/display: hdmi_state_helper: split InfoFrame functions per type Dmitry Baryshkov
` (4 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
Having only a single set of callbacks, hdmi_clear_infoframe and
hdmi_write_infoframe, bridge drivers don't have an easy way to signal to
the DRM framework, which InfoFrames are actually supported by the
hardware and by the driver and which are not. Also, it makes it
extremely easy for HDMI bridge drivers to skip implementing the
seemingly required InfoFrames (e.g. HDMI VSI). Last, but not least,
those callbacks take a single 'type' parameter, which makes it
impossible to implement support for multiple VSIs (which will be
required once we start working on HDMI Forum VSI).
Split the callbacks into a per-InfoFrame-kind pairs, letting the bridge
drivers actually signal supported features. The implementation follows
the overall drm_bridge design, where the bridge has a single
drm_bridge_funcs implementation and signals, which functions are to be
called using the drm_bridge->ops flags.
The AVI and HDMI VSI are assumed to be required for a normal HDMI
operation (with the drivers getting a drm_warn_once() stub
implementation if one is missing). The Audio InfoFrame is handled by the
existing DRM_BRIDGE_OP_HDMI_AUDIO, while the SPD and HDR DRM InfoFrames
got new drm_bridge_ops values.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 180 +++++++++++++----------
drivers/gpu/drm/bridge/ite-it6263.c | 95 ++++++------
drivers/gpu/drm/bridge/lontium-lt9611.c | 143 ++++++++++--------
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 110 +++++++++-----
drivers/gpu/drm/display/drm_bridge_connector.c | 70 ++++++++-
drivers/gpu/drm/mediatek/mtk_hdmi_common.c | 8 +-
drivers/gpu/drm/mediatek/mtk_hdmi_v2.c | 110 +++++++-------
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 195 +++++++++++++------------
drivers/gpu/drm/rockchip/rk3066_hdmi.c | 47 +++---
include/drm/drm_bridge.h | 127 ++++++++++++++--
10 files changed, 682 insertions(+), 403 deletions(-)
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index b9be86541307..1050bb62280b 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -887,88 +887,111 @@ static const struct drm_edid *adv7511_bridge_edid_read(struct drm_bridge *bridge
return adv7511_edid_read(adv, connector);
}
-static int adv7511_bridge_hdmi_clear_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type)
+static int adv7511_bridge_hdmi_clear_audio_infoframe(struct drm_bridge *bridge)
{
struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AUDIO:
- adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_AUDIO_INFOFRAME);
- break;
- case HDMI_INFOFRAME_TYPE_AVI:
- adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_AVI_INFOFRAME);
- break;
- case HDMI_INFOFRAME_TYPE_SPD:
- adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_SPD);
- break;
- case HDMI_INFOFRAME_TYPE_VENDOR:
- adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_SPARE1);
- break;
- default:
- drm_dbg_driver(adv7511->bridge.dev, "Unsupported HDMI InfoFrame %x\n", type);
- break;
- }
+ adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_AUDIO_INFOFRAME);
return 0;
}
-static int adv7511_bridge_hdmi_write_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+static int adv7511_bridge_hdmi_clear_avi_infoframe(struct drm_bridge *bridge)
{
struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AUDIO:
- /* send current Audio infoframe values while updating */
- regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
- BIT(5), BIT(5));
-
- /* The Audio infoframe id is not configurable */
- regmap_bulk_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME_VERSION,
- buffer + 1, len - 1);
-
- /* use Audio infoframe updated info */
- regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
- BIT(5), 0);
-
- adv7511_packet_enable(adv7511, ADV7511_PACKET_ENABLE_AUDIO_INFOFRAME);
- break;
- case HDMI_INFOFRAME_TYPE_AVI:
- /* send current AVI infoframe values while updating */
- regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
- BIT(6), BIT(6));
-
- /* The AVI infoframe id is not configurable */
- regmap_bulk_write(adv7511->regmap, ADV7511_REG_AVI_INFOFRAME_VERSION,
- buffer + 1, len - 1);
-
- regmap_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME_LENGTH, 0x2);
- regmap_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME(1), 0x1);
-
- /* use AVI infoframe updated info */
- regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
- BIT(6), 0);
-
- adv7511_packet_enable(adv7511, ADV7511_PACKET_ENABLE_AVI_INFOFRAME);
- break;
- case HDMI_INFOFRAME_TYPE_SPD:
- adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_SPD);
- regmap_bulk_write(adv7511->regmap_packet, ADV7511_PACKET_SPD(0),
- buffer, len);
- adv7511_packet_enable(adv7511, ADV7511_PACKET_ENABLE_SPD);
- break;
- case HDMI_INFOFRAME_TYPE_VENDOR:
- adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_SPARE1);
- regmap_bulk_write(adv7511->regmap_packet, ADV7511_PACKET_SPARE1(0),
- buffer, len);
- adv7511_packet_enable(adv7511, ADV7511_PACKET_ENABLE_SPARE1);
- break;
- default:
- drm_dbg_driver(adv7511->bridge.dev, "Unsupported HDMI InfoFrame %x\n", type);
- break;
- }
+ adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_AVI_INFOFRAME);
+
+ return 0;
+}
+
+static int adv7511_bridge_hdmi_clear_spd_infoframe(struct drm_bridge *bridge)
+{
+ struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
+
+ adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_SPD);
+
+ return 0;
+}
+
+static int adv7511_bridge_hdmi_clear_hdmi_infoframe(struct drm_bridge *bridge)
+{
+ struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
+
+ adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_SPARE1);
+
+ return 0;
+}
+
+static int adv7511_bridge_hdmi_write_audio_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
+
+ /* send current Audio infoframe values while updating */
+ regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
+ BIT(5), BIT(5));
+
+ /* The Audio infoframe id is not configurable */
+ regmap_bulk_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME_VERSION,
+ buffer + 1, len - 1);
+
+ /* use Audio infoframe updated info */
+ regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
+ BIT(5), 0);
+
+ adv7511_packet_enable(adv7511, ADV7511_PACKET_ENABLE_AUDIO_INFOFRAME);
+
+ return 0;
+}
+
+static int adv7511_bridge_hdmi_write_avi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
+
+ /* send current AVI infoframe values while updating */
+ regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
+ BIT(6), BIT(6));
+
+ /* The AVI infoframe id is not configurable */
+ regmap_bulk_write(adv7511->regmap, ADV7511_REG_AVI_INFOFRAME_VERSION,
+ buffer + 1, len - 1);
+
+ regmap_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME_LENGTH, 0x2);
+ regmap_write(adv7511->regmap, ADV7511_REG_AUDIO_INFOFRAME(1), 0x1);
+
+ /* use AVI infoframe updated info */
+ regmap_update_bits(adv7511->regmap, ADV7511_REG_INFOFRAME_UPDATE,
+ BIT(6), 0);
+
+ adv7511_packet_enable(adv7511, ADV7511_PACKET_ENABLE_AVI_INFOFRAME);
+
+ return 0;
+}
+
+static int adv7511_bridge_hdmi_write_spd_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
+
+ adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_SPD);
+ regmap_bulk_write(adv7511->regmap_packet, ADV7511_PACKET_SPD(0),
+ buffer, len);
+ adv7511_packet_enable(adv7511, ADV7511_PACKET_ENABLE_SPD);
+
+ return 0;
+}
+
+static int adv7511_bridge_hdmi_write_hdmi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct adv7511 *adv7511 = bridge_to_adv7511(bridge);
+
+ adv7511_packet_disable(adv7511, ADV7511_PACKET_ENABLE_SPARE1);
+ regmap_bulk_write(adv7511->regmap_packet, ADV7511_PACKET_SPARE1(0),
+ buffer, len);
+ adv7511_packet_enable(adv7511, ADV7511_PACKET_ENABLE_SPARE1);
return 0;
}
@@ -986,8 +1009,14 @@ static const struct drm_bridge_funcs adv7511_bridge_funcs = {
.atomic_reset = drm_atomic_helper_bridge_reset,
.hdmi_tmds_char_rate_valid = adv7511_bridge_hdmi_tmds_char_rate_valid,
- .hdmi_clear_infoframe = adv7511_bridge_hdmi_clear_infoframe,
- .hdmi_write_infoframe = adv7511_bridge_hdmi_write_infoframe,
+ .hdmi_clear_audio_infoframe = adv7511_bridge_hdmi_clear_audio_infoframe,
+ .hdmi_write_audio_infoframe = adv7511_bridge_hdmi_write_audio_infoframe,
+ .hdmi_clear_avi_infoframe = adv7511_bridge_hdmi_clear_avi_infoframe,
+ .hdmi_write_avi_infoframe = adv7511_bridge_hdmi_write_avi_infoframe,
+ .hdmi_clear_spd_infoframe = adv7511_bridge_hdmi_clear_spd_infoframe,
+ .hdmi_write_spd_infoframe = adv7511_bridge_hdmi_write_spd_infoframe,
+ .hdmi_clear_hdmi_infoframe = adv7511_bridge_hdmi_clear_hdmi_infoframe,
+ .hdmi_write_hdmi_infoframe = adv7511_bridge_hdmi_write_hdmi_infoframe,
.hdmi_audio_startup = adv7511_hdmi_audio_startup,
.hdmi_audio_prepare = adv7511_hdmi_audio_prepare,
@@ -1322,7 +1351,8 @@ static int adv7511_probe(struct i2c_client *i2c)
adv7511->bridge.ops = DRM_BRIDGE_OP_DETECT |
DRM_BRIDGE_OP_EDID |
- DRM_BRIDGE_OP_HDMI;
+ DRM_BRIDGE_OP_HDMI |
+ DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME;
if (adv7511->i2c_main->irq)
adv7511->bridge.ops |= DRM_BRIDGE_OP_HPD;
diff --git a/drivers/gpu/drm/bridge/ite-it6263.c b/drivers/gpu/drm/bridge/ite-it6263.c
index 2eb8fba7016c..3991fb76143c 100644
--- a/drivers/gpu/drm/bridge/ite-it6263.c
+++ b/drivers/gpu/drm/bridge/ite-it6263.c
@@ -759,61 +759,62 @@ it6263_hdmi_tmds_char_rate_valid(const struct drm_bridge *bridge,
return MODE_OK;
}
-static int it6263_hdmi_clear_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type)
+static int it6263_hdmi_clear_avi_infoframe(struct drm_bridge *bridge)
{
struct it6263 *it = bridge_to_it6263(bridge);
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AVI:
- regmap_write(it->hdmi_regmap, HDMI_REG_AVI_INFOFRM_CTRL, 0);
- break;
- case HDMI_INFOFRAME_TYPE_VENDOR:
- regmap_write(it->hdmi_regmap, HDMI_REG_PKT_NULL_CTRL, 0);
- break;
- default:
- dev_dbg(it->dev, "unsupported HDMI infoframe 0x%x\n", type);
- }
+ regmap_write(it->hdmi_regmap, HDMI_REG_AVI_INFOFRM_CTRL, 0);
+
+ return 0;
+}
+
+static int it6263_hdmi_clear_hdmi_infoframe(struct drm_bridge *bridge)
+{
+ struct it6263 *it = bridge_to_it6263(bridge);
+
+ regmap_write(it->hdmi_regmap, HDMI_REG_PKT_NULL_CTRL, 0);
return 0;
}
-static int it6263_hdmi_write_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+static int it6263_hdmi_write_avi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
struct it6263 *it = bridge_to_it6263(bridge);
struct regmap *regmap = it->hdmi_regmap;
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AVI:
- /* write the first AVI infoframe data byte chunk(DB1-DB5) */
- regmap_bulk_write(regmap, HDMI_REG_AVI_DB1,
- &buffer[HDMI_INFOFRAME_HEADER_SIZE],
- HDMI_AVI_DB_CHUNK1_SIZE);
-
- /* write the second AVI infoframe data byte chunk(DB6-DB13) */
- regmap_bulk_write(regmap, HDMI_REG_AVI_DB6,
- &buffer[HDMI_INFOFRAME_HEADER_SIZE +
- HDMI_AVI_DB_CHUNK1_SIZE],
- HDMI_AVI_DB_CHUNK2_SIZE);
-
- /* write checksum */
- regmap_write(regmap, HDMI_REG_AVI_CSUM, buffer[3]);
-
- regmap_write(regmap, HDMI_REG_AVI_INFOFRM_CTRL,
- ENABLE_PKT | REPEAT_PKT);
- break;
- case HDMI_INFOFRAME_TYPE_VENDOR:
- /* write header and payload */
- regmap_bulk_write(regmap, HDMI_REG_PKT_HB(0), buffer, len);
-
- regmap_write(regmap, HDMI_REG_PKT_NULL_CTRL,
- ENABLE_PKT | REPEAT_PKT);
- break;
- default:
- dev_dbg(it->dev, "unsupported HDMI infoframe 0x%x\n", type);
- }
+ /* write the first AVI infoframe data byte chunk(DB1-DB5) */
+ regmap_bulk_write(regmap, HDMI_REG_AVI_DB1,
+ &buffer[HDMI_INFOFRAME_HEADER_SIZE],
+ HDMI_AVI_DB_CHUNK1_SIZE);
+
+ /* write the second AVI infoframe data byte chunk(DB6-DB13) */
+ regmap_bulk_write(regmap, HDMI_REG_AVI_DB6,
+ &buffer[HDMI_INFOFRAME_HEADER_SIZE +
+ HDMI_AVI_DB_CHUNK1_SIZE],
+ HDMI_AVI_DB_CHUNK2_SIZE);
+
+ /* write checksum */
+ regmap_write(regmap, HDMI_REG_AVI_CSUM, buffer[3]);
+
+ regmap_write(regmap, HDMI_REG_AVI_INFOFRM_CTRL,
+ ENABLE_PKT | REPEAT_PKT);
+
+ return 0;
+}
+
+static int it6263_hdmi_write_hdmi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct it6263 *it = bridge_to_it6263(bridge);
+ struct regmap *regmap = it->hdmi_regmap;
+
+ /* write header and payload */
+ regmap_bulk_write(regmap, HDMI_REG_PKT_HB(0), buffer, len);
+
+ regmap_write(regmap, HDMI_REG_PKT_NULL_CTRL,
+ ENABLE_PKT | REPEAT_PKT);
+
return 0;
}
@@ -830,8 +831,10 @@ static const struct drm_bridge_funcs it6263_bridge_funcs = {
.edid_read = it6263_bridge_edid_read,
.atomic_get_input_bus_fmts = it6263_bridge_atomic_get_input_bus_fmts,
.hdmi_tmds_char_rate_valid = it6263_hdmi_tmds_char_rate_valid,
- .hdmi_clear_infoframe = it6263_hdmi_clear_infoframe,
- .hdmi_write_infoframe = it6263_hdmi_write_infoframe,
+ .hdmi_clear_avi_infoframe = it6263_hdmi_clear_avi_infoframe,
+ .hdmi_write_avi_infoframe = it6263_hdmi_write_avi_infoframe,
+ .hdmi_clear_hdmi_infoframe = it6263_hdmi_clear_hdmi_infoframe,
+ .hdmi_write_hdmi_infoframe = it6263_hdmi_write_hdmi_infoframe,
};
static int it6263_probe(struct i2c_client *client)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index a2d032ee4744..0628d8e737ab 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -843,84 +843,96 @@ lt9611_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
#define LT9611_INFOFRAME_AUDIO 0x02
#define LT9611_INFOFRAME_AVI 0x08
#define LT9611_INFOFRAME_SPD 0x10
-#define LT9611_INFOFRAME_VENDOR 0x20
+#define LT9611_INFOFRAME_HDMI 0x20
-static int lt9611_hdmi_clear_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type)
+static int lt9611_hdmi_clear_audio_infoframe(struct drm_bridge *bridge)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- unsigned int mask;
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AUDIO:
- mask = LT9611_INFOFRAME_AUDIO;
- break;
+ regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_AUDIO, 0);
- case HDMI_INFOFRAME_TYPE_AVI:
- mask = LT9611_INFOFRAME_AVI;
- break;
+ return 0;
+}
- case HDMI_INFOFRAME_TYPE_SPD:
- mask = LT9611_INFOFRAME_SPD;
- break;
+static int lt9611_hdmi_clear_avi_infoframe(struct drm_bridge *bridge)
+{
+ struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- case HDMI_INFOFRAME_TYPE_VENDOR:
- mask = LT9611_INFOFRAME_VENDOR;
- break;
+ regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_AVI, 0);
- default:
- drm_dbg_driver(lt9611->bridge.dev, "Unsupported HDMI InfoFrame %x\n", type);
- mask = 0;
- break;
- }
+ return 0;
+}
+
+static int lt9611_hdmi_clear_spd_infoframe(struct drm_bridge *bridge)
+{
+ struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- if (mask)
- regmap_update_bits(lt9611->regmap, 0x843d, mask, 0);
+ regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_SPD, 0);
return 0;
}
-static int lt9611_hdmi_write_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+static int lt9611_hdmi_clear_hdmi_infoframe(struct drm_bridge *bridge)
+{
+ struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
+
+ regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_HDMI, 0);
+
+ return 0;
+}
+
+static int lt9611_hdmi_write_audio_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- unsigned int mask, addr;
int i;
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AUDIO:
- mask = LT9611_INFOFRAME_AUDIO;
- addr = 0x84b2;
- break;
-
- case HDMI_INFOFRAME_TYPE_AVI:
- mask = LT9611_INFOFRAME_AVI;
- addr = 0x8440;
- break;
-
- case HDMI_INFOFRAME_TYPE_SPD:
- mask = LT9611_INFOFRAME_SPD;
- addr = 0x8493;
- break;
-
- case HDMI_INFOFRAME_TYPE_VENDOR:
- mask = LT9611_INFOFRAME_VENDOR;
- addr = 0x8474;
- break;
-
- default:
- drm_dbg_driver(lt9611->bridge.dev, "Unsupported HDMI InfoFrame %x\n", type);
- mask = 0;
- break;
- }
+ for (i = 0; i < len; i++)
+ regmap_write(lt9611->regmap, 0x84b2 + i, buffer[i]);
- if (mask) {
- for (i = 0; i < len; i++)
- regmap_write(lt9611->regmap, addr + i, buffer[i]);
+ regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_AUDIO, LT9611_INFOFRAME_AUDIO);
- regmap_update_bits(lt9611->regmap, 0x843d, mask, mask);
- }
+ return 0;
+}
+
+static int lt9611_hdmi_write_avi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
+ int i;
+
+ for (i = 0; i < len; i++)
+ regmap_write(lt9611->regmap, 0x8440 + i, buffer[i]);
+
+ regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_AVI, LT9611_INFOFRAME_AVI);
+
+ return 0;
+}
+
+static int lt9611_hdmi_write_spd_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
+ int i;
+
+ for (i = 0; i < len; i++)
+ regmap_write(lt9611->regmap, 0x8493 + i, buffer[i]);
+
+ regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_SPD, LT9611_INFOFRAME_SPD);
+
+ return 0;
+}
+
+static int lt9611_hdmi_write_hdmi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
+ int i;
+
+ for (i = 0; i < len; i++)
+ regmap_write(lt9611->regmap, 0x8474 + i, buffer[i]);
+
+ regmap_update_bits(lt9611->regmap, 0x843d, LT9611_INFOFRAME_HDMI, LT9611_INFOFRAME_HDMI);
return 0;
}
@@ -1003,8 +1015,14 @@ static const struct drm_bridge_funcs lt9611_bridge_funcs = {
.atomic_get_input_bus_fmts = lt9611_atomic_get_input_bus_fmts,
.hdmi_tmds_char_rate_valid = lt9611_hdmi_tmds_char_rate_valid,
- .hdmi_write_infoframe = lt9611_hdmi_write_infoframe,
- .hdmi_clear_infoframe = lt9611_hdmi_clear_infoframe,
+ .hdmi_write_audio_infoframe = lt9611_hdmi_write_audio_infoframe,
+ .hdmi_clear_audio_infoframe = lt9611_hdmi_clear_audio_infoframe,
+ .hdmi_write_avi_infoframe = lt9611_hdmi_write_avi_infoframe,
+ .hdmi_clear_avi_infoframe = lt9611_hdmi_clear_avi_infoframe,
+ .hdmi_write_spd_infoframe = lt9611_hdmi_write_spd_infoframe,
+ .hdmi_clear_spd_infoframe = lt9611_hdmi_clear_spd_infoframe,
+ .hdmi_write_hdmi_infoframe = lt9611_hdmi_write_hdmi_infoframe,
+ .hdmi_clear_hdmi_infoframe = lt9611_hdmi_clear_hdmi_infoframe,
.hdmi_audio_startup = lt9611_hdmi_audio_startup,
.hdmi_audio_prepare = lt9611_hdmi_audio_prepare,
@@ -1132,7 +1150,8 @@ static int lt9611_probe(struct i2c_client *client)
lt9611->bridge.of_node = client->dev.of_node;
lt9611->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID |
DRM_BRIDGE_OP_HPD | DRM_BRIDGE_OP_MODES |
- DRM_BRIDGE_OP_HDMI | DRM_BRIDGE_OP_HDMI_AUDIO;
+ DRM_BRIDGE_OP_HDMI | DRM_BRIDGE_OP_HDMI_AUDIO |
+ DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME;
lt9611->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
lt9611->bridge.vendor = "Lontium";
lt9611->bridge.product = "LT9611";
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
index fe4c026280f0..f57307dd61c8 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
@@ -26,6 +26,7 @@
#include <drm/drm_connector.h>
#include <drm/drm_edid.h>
#include <drm/drm_modes.h>
+#include <drm/drm_print.h>
#include <media/cec.h>
@@ -933,57 +934,85 @@ dw_hdmi_qp_bridge_tmds_char_rate_valid(const struct drm_bridge *bridge,
return MODE_OK;
}
-static int dw_hdmi_qp_bridge_clear_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type)
+static int dw_hdmi_qp_bridge_clear_avi_infoframe(struct drm_bridge *bridge)
{
struct dw_hdmi_qp *hdmi = bridge->driver_private;
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AVI:
- dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_AVI_TX_EN | PKTSCHED_GCP_TX_EN,
- PKTSCHED_PKT_EN);
- break;
+ dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_AVI_TX_EN | PKTSCHED_GCP_TX_EN,
+ PKTSCHED_PKT_EN);
- case HDMI_INFOFRAME_TYPE_DRM:
- dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_TX_EN, PKTSCHED_PKT_EN);
- break;
+ return 0;
+}
- case HDMI_INFOFRAME_TYPE_AUDIO:
- dw_hdmi_qp_mod(hdmi, 0,
- PKTSCHED_ACR_TX_EN |
- PKTSCHED_AUDS_TX_EN |
- PKTSCHED_AUDI_TX_EN,
- PKTSCHED_PKT_EN);
- break;
- default:
- dev_dbg(hdmi->dev, "Unsupported infoframe type %x\n", type);
- }
+static int dw_hdmi_qp_bridge_clear_hdmi_infoframe(struct drm_bridge *bridge)
+{
+ /* FIXME: add support for this InfoFrame */
+
+ drm_warn_once(bridge->encoder->dev, "HDMI VSI not supported\n");
return 0;
}
-static int dw_hdmi_qp_bridge_write_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+static int dw_hdmi_qp_bridge_clear_hdr_drm_infoframe(struct drm_bridge *bridge)
{
struct dw_hdmi_qp *hdmi = bridge->driver_private;
- dw_hdmi_qp_bridge_clear_infoframe(bridge, type);
+ dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_TX_EN, PKTSCHED_PKT_EN);
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AVI:
- return dw_hdmi_qp_config_avi_infoframe(hdmi, buffer, len);
+ return 0;
+}
- case HDMI_INFOFRAME_TYPE_DRM:
- return dw_hdmi_qp_config_drm_infoframe(hdmi, buffer, len);
+static int dw_hdmi_qp_bridge_clear_audio_infoframe(struct drm_bridge *bridge)
+{
+ struct dw_hdmi_qp *hdmi = bridge->driver_private;
- case HDMI_INFOFRAME_TYPE_AUDIO:
- return dw_hdmi_qp_config_audio_infoframe(hdmi, buffer, len);
+ dw_hdmi_qp_mod(hdmi, 0,
+ PKTSCHED_ACR_TX_EN |
+ PKTSCHED_AUDS_TX_EN |
+ PKTSCHED_AUDI_TX_EN,
+ PKTSCHED_PKT_EN);
- default:
- dev_dbg(hdmi->dev, "Unsupported infoframe type %x\n", type);
- return 0;
- }
+ return 0;
+}
+
+static int dw_hdmi_qp_bridge_write_avi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct dw_hdmi_qp *hdmi = bridge->driver_private;
+
+ dw_hdmi_qp_bridge_clear_avi_infoframe(bridge);
+
+ return dw_hdmi_qp_config_avi_infoframe(hdmi, buffer, len);
+}
+
+static int dw_hdmi_qp_bridge_write_hdmi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ dw_hdmi_qp_bridge_clear_hdmi_infoframe(bridge);
+
+ /* FIXME: add support for the HDMI VSI */
+
+ return 0;
+}
+
+static int dw_hdmi_qp_bridge_write_hdr_drm_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct dw_hdmi_qp *hdmi = bridge->driver_private;
+
+ dw_hdmi_qp_bridge_clear_hdr_drm_infoframe(bridge);
+
+ return dw_hdmi_qp_config_drm_infoframe(hdmi, buffer, len);
+}
+
+static int dw_hdmi_qp_bridge_write_audio_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct dw_hdmi_qp *hdmi = bridge->driver_private;
+
+ dw_hdmi_qp_bridge_clear_audio_infoframe(bridge);
+
+ return dw_hdmi_qp_config_audio_infoframe(hdmi, buffer, len);
}
#ifdef CONFIG_DRM_DW_HDMI_QP_CEC
@@ -1168,8 +1197,14 @@ static const struct drm_bridge_funcs dw_hdmi_qp_bridge_funcs = {
.detect = dw_hdmi_qp_bridge_detect,
.edid_read = dw_hdmi_qp_bridge_edid_read,
.hdmi_tmds_char_rate_valid = dw_hdmi_qp_bridge_tmds_char_rate_valid,
- .hdmi_clear_infoframe = dw_hdmi_qp_bridge_clear_infoframe,
- .hdmi_write_infoframe = dw_hdmi_qp_bridge_write_infoframe,
+ .hdmi_clear_avi_infoframe = dw_hdmi_qp_bridge_clear_avi_infoframe,
+ .hdmi_write_avi_infoframe = dw_hdmi_qp_bridge_write_avi_infoframe,
+ .hdmi_clear_hdmi_infoframe = dw_hdmi_qp_bridge_clear_hdmi_infoframe,
+ .hdmi_write_hdmi_infoframe = dw_hdmi_qp_bridge_write_hdmi_infoframe,
+ .hdmi_clear_hdr_drm_infoframe = dw_hdmi_qp_bridge_clear_hdr_drm_infoframe,
+ .hdmi_write_hdr_drm_infoframe = dw_hdmi_qp_bridge_write_hdr_drm_infoframe,
+ .hdmi_clear_audio_infoframe = dw_hdmi_qp_bridge_clear_audio_infoframe,
+ .hdmi_write_audio_infoframe = dw_hdmi_qp_bridge_write_audio_infoframe,
.hdmi_audio_startup = dw_hdmi_qp_audio_enable,
.hdmi_audio_shutdown = dw_hdmi_qp_audio_disable,
.hdmi_audio_prepare = dw_hdmi_qp_audio_prepare,
@@ -1282,6 +1317,7 @@ struct dw_hdmi_qp *dw_hdmi_qp_bind(struct platform_device *pdev,
DRM_BRIDGE_OP_EDID |
DRM_BRIDGE_OP_HDMI |
DRM_BRIDGE_OP_HDMI_AUDIO |
+ DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME |
DRM_BRIDGE_OP_HPD;
hdmi->bridge.of_node = pdev->dev.of_node;
hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c
index a2d30cf9e06d..8fd7722fe9a3 100644
--- a/drivers/gpu/drm/display/drm_bridge_connector.c
+++ b/drivers/gpu/drm/display/drm_bridge_connector.c
@@ -412,7 +412,30 @@ static int drm_bridge_connector_clear_infoframe(struct drm_connector *connector,
if (!bridge)
return -EINVAL;
- return bridge->funcs->hdmi_clear_infoframe(bridge, type);
+ switch (type) {
+ case HDMI_INFOFRAME_TYPE_AVI:
+ /* required */
+ return bridge->funcs->hdmi_clear_avi_infoframe(bridge);
+ case HDMI_INFOFRAME_TYPE_VENDOR:
+ /* required */
+ return bridge->funcs->hdmi_clear_hdmi_infoframe(bridge);
+ case HDMI_INFOFRAME_TYPE_AUDIO:
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_AUDIO)
+ return bridge->funcs->hdmi_clear_audio_infoframe(bridge);
+ break;
+ case HDMI_INFOFRAME_TYPE_DRM:
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME)
+ return bridge->funcs->hdmi_clear_hdr_drm_infoframe(bridge);
+ break;
+ case HDMI_INFOFRAME_TYPE_SPD:
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME)
+ return bridge->funcs->hdmi_clear_spd_infoframe(bridge);
+ break;
+ }
+
+ drm_dbg_driver(connector->dev, "Unsupported HDMI InfoFrame %x\n", type);
+
+ return 0;
}
static int drm_bridge_connector_write_infoframe(struct drm_connector *connector,
@@ -427,7 +450,30 @@ static int drm_bridge_connector_write_infoframe(struct drm_connector *connector,
if (!bridge)
return -EINVAL;
- return bridge->funcs->hdmi_write_infoframe(bridge, type, buffer, len);
+ switch (type) {
+ case HDMI_INFOFRAME_TYPE_AVI:
+ /* required */
+ return bridge->funcs->hdmi_write_avi_infoframe(bridge, buffer, len);
+ case HDMI_INFOFRAME_TYPE_VENDOR:
+ /* required */
+ return bridge->funcs->hdmi_write_hdmi_infoframe(bridge, buffer, len);
+ case HDMI_INFOFRAME_TYPE_AUDIO:
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_AUDIO)
+ return bridge->funcs->hdmi_write_audio_infoframe(bridge, buffer, len);
+ break;
+ case HDMI_INFOFRAME_TYPE_DRM:
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME)
+ return bridge->funcs->hdmi_write_hdr_drm_infoframe(bridge, buffer, len);
+ break;
+ case HDMI_INFOFRAME_TYPE_SPD:
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME)
+ return bridge->funcs->hdmi_write_spd_infoframe(bridge, buffer, len);
+ break;
+ }
+
+ drm_dbg_driver(connector->dev, "Unsupported HDMI InfoFrame %x\n", type);
+
+ return 0;
}
static const struct drm_edid *
@@ -709,8 +755,20 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
if (bridge->ops & DRM_BRIDGE_OP_HDMI) {
if (bridge_connector->bridge_hdmi)
return ERR_PTR(-EBUSY);
- if (!bridge->funcs->hdmi_write_infoframe ||
- !bridge->funcs->hdmi_clear_infoframe)
+ if (!bridge->funcs->hdmi_write_avi_infoframe ||
+ !bridge->funcs->hdmi_clear_avi_infoframe ||
+ !bridge->funcs->hdmi_write_hdmi_infoframe ||
+ !bridge->funcs->hdmi_clear_hdmi_infoframe)
+ return ERR_PTR(-EINVAL);
+
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME &&
+ (!bridge->funcs->hdmi_write_hdr_drm_infoframe ||
+ !bridge->funcs->hdmi_clear_hdr_drm_infoframe))
+ return ERR_PTR(-EINVAL);
+
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME &&
+ (!bridge->funcs->hdmi_write_spd_infoframe ||
+ !bridge->funcs->hdmi_clear_spd_infoframe))
return ERR_PTR(-EINVAL);
bridge_connector->bridge_hdmi = drm_bridge_get(bridge);
@@ -732,7 +790,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
!bridge->hdmi_audio_spdif_playback)
return ERR_PTR(-EINVAL);
- if (!bridge->funcs->hdmi_audio_prepare ||
+ if (!bridge->funcs->hdmi_write_audio_infoframe ||
+ !bridge->funcs->hdmi_clear_audio_infoframe ||
+ !bridge->funcs->hdmi_audio_prepare ||
!bridge->funcs->hdmi_audio_shutdown)
return ERR_PTR(-EINVAL);
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
index e78eb0876f16..c599ba767093 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_common.c
@@ -433,9 +433,11 @@ struct mtk_hdmi *mtk_hdmi_common_probe(struct platform_device *pdev)
hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID
| DRM_BRIDGE_OP_HPD;
- if (ver_conf->bridge_funcs->hdmi_write_infoframe &&
- ver_conf->bridge_funcs->hdmi_clear_infoframe)
- hdmi->bridge.ops |= DRM_BRIDGE_OP_HDMI;
+ /* Only v2 support OP_HDMI now and it we know that it also support SPD */
+ if (ver_conf->bridge_funcs->hdmi_write_avi_infoframe &&
+ ver_conf->bridge_funcs->hdmi_clear_avi_infoframe)
+ hdmi->bridge.ops |= DRM_BRIDGE_OP_HDMI |
+ DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME;
hdmi->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
hdmi->bridge.ddc = hdmi->ddc_adpt;
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
index c272e1e74b7d..d0e4440b7491 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
@@ -145,8 +145,11 @@ static inline u32 mtk_hdmi_v2_format_hw_packet(const u8 *buffer, u8 len)
return val;
}
-static void mtk_hdmi_v2_hw_write_audio_infoframe(struct mtk_hdmi *hdmi, const u8 *buffer)
+static int mtk_hdmi_v2_hdmi_write_audio_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
+ struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
+
regmap_clear_bits(hdmi->regs, TOP_INFO_EN, AUD_EN | AUD_EN_WR);
regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, AUD_RPT_EN);
@@ -158,10 +161,15 @@ static void mtk_hdmi_v2_hw_write_audio_infoframe(struct mtk_hdmi *hdmi, const u8
regmap_set_bits(hdmi->regs, TOP_INFO_RPT, AUD_RPT_EN);
regmap_set_bits(hdmi->regs, TOP_INFO_EN, AUD_EN | AUD_EN_WR);
+
+ return 0;
}
-static void mtk_hdmi_v2_hw_write_avi_infoframe(struct mtk_hdmi *hdmi, const u8 *buffer)
+static int mtk_hdmi_v2_hdmi_write_avi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
+ struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
+
regmap_clear_bits(hdmi->regs, TOP_INFO_EN, AVI_EN_WR | AVI_EN);
regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, AVI_RPT_EN);
@@ -175,10 +183,15 @@ static void mtk_hdmi_v2_hw_write_avi_infoframe(struct mtk_hdmi *hdmi, const u8 *
regmap_set_bits(hdmi->regs, TOP_INFO_RPT, AVI_RPT_EN);
regmap_set_bits(hdmi->regs, TOP_INFO_EN, AVI_EN_WR | AVI_EN);
+
+ return 0;
}
-static void mtk_hdmi_v2_hw_write_spd_infoframe(struct mtk_hdmi *hdmi, const u8 *buffer)
+static int mtk_hdmi_v2_hdmi_write_spd_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
+ struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
+
regmap_clear_bits(hdmi->regs, TOP_INFO_EN, SPD_EN_WR | SPD_EN);
regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, SPD_RPT_EN);
@@ -194,10 +207,15 @@ static void mtk_hdmi_v2_hw_write_spd_infoframe(struct mtk_hdmi *hdmi, const u8 *
regmap_set_bits(hdmi->regs, TOP_INFO_EN, SPD_EN_WR | SPD_EN);
regmap_set_bits(hdmi->regs, TOP_INFO_RPT, SPD_RPT_EN);
+
+ return 0;
}
-static void mtk_hdmi_v2_hw_write_vendor_infoframe(struct mtk_hdmi *hdmi, const u8 *buffer)
+static int mtk_hdmi_v2_hdmi_write_hdmi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
+ struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
+
regmap_clear_bits(hdmi->regs, TOP_INFO_EN, VSIF_EN_WR | VSIF_EN);
regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, VSIF_RPT_EN);
@@ -213,6 +231,8 @@ static void mtk_hdmi_v2_hw_write_vendor_infoframe(struct mtk_hdmi *hdmi, const u
regmap_set_bits(hdmi->regs, TOP_INFO_EN, VSIF_EN_WR | VSIF_EN);
regmap_set_bits(hdmi->regs, TOP_INFO_RPT, VSIF_RPT_EN);
+
+ return 0;
}
static void mtk_hdmi_yuv420_downsampling(struct mtk_hdmi *hdmi, bool enable)
@@ -255,7 +275,7 @@ static int mtk_hdmi_v2_setup_audio_infoframe(struct mtk_hdmi *hdmi)
if (ret < 0)
return ret;
- mtk_hdmi_v2_hw_write_audio_infoframe(hdmi, buffer);
+ mtk_hdmi_v2_hdmi_write_audio_infoframe(&hdmi->bridge, buffer, sizeof(buffer));
return 0;
}
@@ -1132,60 +1152,42 @@ static int mtk_hdmi_v2_hdmi_tmds_char_rate_valid(const struct drm_bridge *bridge
return MODE_OK;
}
-static int mtk_hdmi_v2_hdmi_clear_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type)
+static int mtk_hdmi_v2_hdmi_clear_audio_infoframe(struct drm_bridge *bridge)
{
struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AUDIO:
- regmap_clear_bits(hdmi->regs, TOP_INFO_EN, AUD_EN_WR | AUD_EN);
- regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, AUD_RPT_EN);
- break;
- case HDMI_INFOFRAME_TYPE_AVI:
- regmap_clear_bits(hdmi->regs, TOP_INFO_EN, AVI_EN_WR | AVI_EN);
- regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, AVI_RPT_EN);
- break;
- case HDMI_INFOFRAME_TYPE_SPD:
- regmap_clear_bits(hdmi->regs, TOP_INFO_EN, SPD_EN_WR | SPD_EN);
- regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, SPD_RPT_EN);
- break;
- case HDMI_INFOFRAME_TYPE_VENDOR:
- regmap_clear_bits(hdmi->regs, TOP_INFO_EN, VSIF_EN_WR | VSIF_EN);
- regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, VSIF_RPT_EN);
- break;
- case HDMI_INFOFRAME_TYPE_DRM:
- default:
- break;
- };
+ regmap_clear_bits(hdmi->regs, TOP_INFO_EN, AUD_EN_WR | AUD_EN);
+ regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, AUD_RPT_EN);
return 0;
}
-static int mtk_hdmi_v2_hdmi_write_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+static int mtk_hdmi_v2_hdmi_clear_avi_infoframe(struct drm_bridge *bridge)
{
struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AUDIO:
- mtk_hdmi_v2_hw_write_audio_infoframe(hdmi, buffer);
- break;
- case HDMI_INFOFRAME_TYPE_AVI:
- mtk_hdmi_v2_hw_write_avi_infoframe(hdmi, buffer);
- break;
- case HDMI_INFOFRAME_TYPE_SPD:
- mtk_hdmi_v2_hw_write_spd_infoframe(hdmi, buffer);
- break;
- case HDMI_INFOFRAME_TYPE_VENDOR:
- mtk_hdmi_v2_hw_write_vendor_infoframe(hdmi, buffer);
- break;
- case HDMI_INFOFRAME_TYPE_DRM:
- default:
- dev_err(hdmi->dev, "Unsupported HDMI infoframe type %u\n", type);
- break;
- };
+ regmap_clear_bits(hdmi->regs, TOP_INFO_EN, AVI_EN_WR | AVI_EN);
+ regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, AVI_RPT_EN);
+
+ return 0;
+}
+
+static int mtk_hdmi_v2_hdmi_clear_spd_infoframe(struct drm_bridge *bridge)
+{
+ struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
+
+ regmap_clear_bits(hdmi->regs, TOP_INFO_EN, SPD_EN_WR | SPD_EN);
+ regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, SPD_RPT_EN);
+
+ return 0;
+}
+
+static int mtk_hdmi_v2_hdmi_clear_hdmi_infoframe(struct drm_bridge *bridge)
+{
+ struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
+
+ regmap_clear_bits(hdmi->regs, TOP_INFO_EN, VSIF_EN_WR | VSIF_EN);
+ regmap_clear_bits(hdmi->regs, TOP_INFO_RPT, VSIF_RPT_EN);
return 0;
}
@@ -1329,8 +1331,14 @@ static const struct drm_bridge_funcs mtk_v2_hdmi_bridge_funcs = {
.hpd_enable = mtk_hdmi_v2_hpd_enable,
.hpd_disable = mtk_hdmi_v2_hpd_disable,
.hdmi_tmds_char_rate_valid = mtk_hdmi_v2_hdmi_tmds_char_rate_valid,
- .hdmi_clear_infoframe = mtk_hdmi_v2_hdmi_clear_infoframe,
- .hdmi_write_infoframe = mtk_hdmi_v2_hdmi_write_infoframe,
+ .hdmi_clear_audio_infoframe = mtk_hdmi_v2_hdmi_clear_audio_infoframe,
+ .hdmi_write_audio_infoframe = mtk_hdmi_v2_hdmi_write_audio_infoframe,
+ .hdmi_clear_avi_infoframe = mtk_hdmi_v2_hdmi_clear_avi_infoframe,
+ .hdmi_write_avi_infoframe = mtk_hdmi_v2_hdmi_write_avi_infoframe,
+ .hdmi_clear_spd_infoframe = mtk_hdmi_v2_hdmi_clear_spd_infoframe,
+ .hdmi_write_spd_infoframe = mtk_hdmi_v2_hdmi_write_spd_infoframe,
+ .hdmi_clear_hdmi_infoframe = mtk_hdmi_v2_hdmi_clear_hdmi_infoframe,
+ .hdmi_write_hdmi_infoframe = mtk_hdmi_v2_hdmi_write_hdmi_infoframe,
.debugfs_init = mtk_hdmi_v2_debugfs_init,
};
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
index 46fd58646d32..98cd490e7ab0 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
@@ -54,9 +54,80 @@ static void power_off(struct drm_bridge *bridge)
#define SPD_IFRAME_LINE_NUMBER 1
#define VENSPEC_IFRAME_LINE_NUMBER 3
-static int msm_hdmi_config_avi_infoframe(struct hdmi *hdmi,
- const u8 *buffer, size_t len)
+static int msm_hdmi_bridge_clear_avi_infoframe(struct drm_bridge *bridge)
{
+ struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
+ struct hdmi *hdmi = hdmi_bridge->hdmi;
+ u32 val;
+
+ val = hdmi_read(hdmi, REG_HDMI_INFOFRAME_CTRL0);
+ val &= ~(HDMI_INFOFRAME_CTRL0_AVI_SEND |
+ HDMI_INFOFRAME_CTRL0_AVI_CONT);
+ hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL0, val);
+
+ val = hdmi_read(hdmi, REG_HDMI_INFOFRAME_CTRL1);
+ val &= ~HDMI_INFOFRAME_CTRL1_AVI_INFO_LINE__MASK;
+ hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL1, val);
+
+ return 0;
+}
+
+static int msm_hdmi_bridge_clear_audio_infoframe(struct drm_bridge *bridge)
+{
+ struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
+ struct hdmi *hdmi = hdmi_bridge->hdmi;
+ u32 val;
+
+ val = hdmi_read(hdmi, REG_HDMI_INFOFRAME_CTRL0);
+ val &= ~(HDMI_INFOFRAME_CTRL0_AUDIO_INFO_SEND |
+ HDMI_INFOFRAME_CTRL0_AUDIO_INFO_CONT |
+ HDMI_INFOFRAME_CTRL0_AUDIO_INFO_SOURCE |
+ HDMI_INFOFRAME_CTRL0_AUDIO_INFO_UPDATE);
+ hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL0, val);
+
+ val = hdmi_read(hdmi, REG_HDMI_INFOFRAME_CTRL1);
+ val &= ~HDMI_INFOFRAME_CTRL1_AUDIO_INFO_LINE__MASK;
+ hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL1, val);
+
+ return 0;
+}
+
+static int msm_hdmi_bridge_clear_spd_infoframe(struct drm_bridge *bridge)
+{
+ struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
+ struct hdmi *hdmi = hdmi_bridge->hdmi;
+ u32 val;
+
+ val = hdmi_read(hdmi, REG_HDMI_GEN_PKT_CTRL);
+ val &= ~(HDMI_GEN_PKT_CTRL_GENERIC1_SEND |
+ HDMI_GEN_PKT_CTRL_GENERIC1_CONT |
+ HDMI_GEN_PKT_CTRL_GENERIC1_LINE__MASK);
+ hdmi_write(hdmi, REG_HDMI_GEN_PKT_CTRL, val);
+
+ return 0;
+}
+
+static int msm_hdmi_bridge_clear_hdmi_infoframe(struct drm_bridge *bridge)
+{
+ struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
+ struct hdmi *hdmi = hdmi_bridge->hdmi;
+ u32 val;
+
+ val = hdmi_read(hdmi, REG_HDMI_GEN_PKT_CTRL);
+ val &= ~(HDMI_GEN_PKT_CTRL_GENERIC0_SEND |
+ HDMI_GEN_PKT_CTRL_GENERIC0_CONT |
+ HDMI_GEN_PKT_CTRL_GENERIC0_UPDATE |
+ HDMI_GEN_PKT_CTRL_GENERIC0_LINE__MASK);
+ hdmi_write(hdmi, REG_HDMI_GEN_PKT_CTRL, val);
+
+ return 0;
+}
+
+static int msm_hdmi_bridge_write_avi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
+ struct hdmi *hdmi = hdmi_bridge->hdmi;
u32 buf[4] = {};
u32 val;
int i;
@@ -67,6 +138,8 @@ static int msm_hdmi_config_avi_infoframe(struct hdmi *hdmi,
return -EINVAL;
}
+ msm_hdmi_bridge_clear_avi_infoframe(bridge);
+
/*
* the AVI_INFOx registers don't map exactly to how the AVI infoframes
* are packed according to the spec. The checksum from the header is
@@ -93,9 +166,11 @@ static int msm_hdmi_config_avi_infoframe(struct hdmi *hdmi,
return 0;
}
-static int msm_hdmi_config_audio_infoframe(struct hdmi *hdmi,
- const u8 *buffer, size_t len)
+static int msm_hdmi_bridge_write_audio_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
+ struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
+ struct hdmi *hdmi = hdmi_bridge->hdmi;
u32 val;
if (len != HDMI_INFOFRAME_SIZE(AUDIO)) {
@@ -104,6 +179,8 @@ static int msm_hdmi_config_audio_infoframe(struct hdmi *hdmi,
return -EINVAL;
}
+ msm_hdmi_bridge_clear_audio_infoframe(bridge);
+
hdmi_write(hdmi, REG_HDMI_AUDIO_INFO0,
buffer[3] |
buffer[4] << 8 |
@@ -126,9 +203,11 @@ static int msm_hdmi_config_audio_infoframe(struct hdmi *hdmi,
return 0;
}
-static int msm_hdmi_config_spd_infoframe(struct hdmi *hdmi,
- const u8 *buffer, size_t len)
+static int msm_hdmi_bridge_write_spd_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
+ struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
+ struct hdmi *hdmi = hdmi_bridge->hdmi;
u32 buf[7] = {};
u32 val;
int i;
@@ -139,6 +218,8 @@ static int msm_hdmi_config_spd_infoframe(struct hdmi *hdmi,
return -EINVAL;
}
+ msm_hdmi_bridge_clear_spd_infoframe(bridge);
+
/* checksum gets written together with the body of the frame */
hdmi_write(hdmi, REG_HDMI_GENERIC1_HDR,
buffer[0] |
@@ -159,9 +240,11 @@ static int msm_hdmi_config_spd_infoframe(struct hdmi *hdmi,
return 0;
}
-static int msm_hdmi_config_hdmi_infoframe(struct hdmi *hdmi,
- const u8 *buffer, size_t len)
+static int msm_hdmi_bridge_write_hdmi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
+ struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
+ struct hdmi *hdmi = hdmi_bridge->hdmi;
u32 buf[7] = {};
u32 val;
int i;
@@ -173,6 +256,8 @@ static int msm_hdmi_config_hdmi_infoframe(struct hdmi *hdmi,
return -EINVAL;
}
+ msm_hdmi_bridge_clear_hdmi_infoframe(bridge);
+
/* checksum gets written together with the body of the frame */
hdmi_write(hdmi, REG_HDMI_GENERIC0_HDR,
buffer[0] |
@@ -194,90 +279,6 @@ static int msm_hdmi_config_hdmi_infoframe(struct hdmi *hdmi,
return 0;
}
-static int msm_hdmi_bridge_clear_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type)
-{
- struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
- struct hdmi *hdmi = hdmi_bridge->hdmi;
- u32 val;
-
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AVI:
- val = hdmi_read(hdmi, REG_HDMI_INFOFRAME_CTRL0);
- val &= ~(HDMI_INFOFRAME_CTRL0_AVI_SEND |
- HDMI_INFOFRAME_CTRL0_AVI_CONT);
- hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL0, val);
-
- val = hdmi_read(hdmi, REG_HDMI_INFOFRAME_CTRL1);
- val &= ~HDMI_INFOFRAME_CTRL1_AVI_INFO_LINE__MASK;
- hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL1, val);
-
- break;
-
- case HDMI_INFOFRAME_TYPE_AUDIO:
- val = hdmi_read(hdmi, REG_HDMI_INFOFRAME_CTRL0);
- val &= ~(HDMI_INFOFRAME_CTRL0_AUDIO_INFO_SEND |
- HDMI_INFOFRAME_CTRL0_AUDIO_INFO_CONT |
- HDMI_INFOFRAME_CTRL0_AUDIO_INFO_SOURCE |
- HDMI_INFOFRAME_CTRL0_AUDIO_INFO_UPDATE);
- hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL0, val);
-
- val = hdmi_read(hdmi, REG_HDMI_INFOFRAME_CTRL1);
- val &= ~HDMI_INFOFRAME_CTRL1_AUDIO_INFO_LINE__MASK;
- hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL1, val);
-
- break;
-
- case HDMI_INFOFRAME_TYPE_SPD:
- val = hdmi_read(hdmi, REG_HDMI_GEN_PKT_CTRL);
- val &= ~(HDMI_GEN_PKT_CTRL_GENERIC1_SEND |
- HDMI_GEN_PKT_CTRL_GENERIC1_CONT |
- HDMI_GEN_PKT_CTRL_GENERIC1_LINE__MASK);
- hdmi_write(hdmi, REG_HDMI_GEN_PKT_CTRL, val);
-
- break;
-
- case HDMI_INFOFRAME_TYPE_VENDOR:
- val = hdmi_read(hdmi, REG_HDMI_GEN_PKT_CTRL);
- val &= ~(HDMI_GEN_PKT_CTRL_GENERIC0_SEND |
- HDMI_GEN_PKT_CTRL_GENERIC0_CONT |
- HDMI_GEN_PKT_CTRL_GENERIC0_UPDATE |
- HDMI_GEN_PKT_CTRL_GENERIC0_LINE__MASK);
- hdmi_write(hdmi, REG_HDMI_GEN_PKT_CTRL, val);
-
- break;
-
- default:
- drm_dbg_driver(hdmi_bridge->base.dev, "Unsupported infoframe type %x\n", type);
- }
-
- return 0;
-}
-
-static int msm_hdmi_bridge_write_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
-{
- struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
- struct hdmi *hdmi = hdmi_bridge->hdmi;
-
- msm_hdmi_bridge_clear_infoframe(bridge, type);
-
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AVI:
- return msm_hdmi_config_avi_infoframe(hdmi, buffer, len);
- case HDMI_INFOFRAME_TYPE_AUDIO:
- return msm_hdmi_config_audio_infoframe(hdmi, buffer, len);
- case HDMI_INFOFRAME_TYPE_SPD:
- return msm_hdmi_config_spd_infoframe(hdmi, buffer, len);
- case HDMI_INFOFRAME_TYPE_VENDOR:
- return msm_hdmi_config_hdmi_infoframe(hdmi, buffer, len);
- default:
- drm_dbg_driver(hdmi_bridge->base.dev, "Unsupported infoframe type %x\n", type);
- return 0;
- }
-}
-
static void msm_hdmi_set_timings(struct hdmi *hdmi,
const struct drm_display_mode *mode);
@@ -462,8 +463,14 @@ static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = {
.hpd_enable = msm_hdmi_hpd_enable,
.hpd_disable = msm_hdmi_hpd_disable,
.hdmi_tmds_char_rate_valid = msm_hdmi_bridge_tmds_char_rate_valid,
- .hdmi_clear_infoframe = msm_hdmi_bridge_clear_infoframe,
- .hdmi_write_infoframe = msm_hdmi_bridge_write_infoframe,
+ .hdmi_clear_audio_infoframe = msm_hdmi_bridge_clear_audio_infoframe,
+ .hdmi_write_audio_infoframe = msm_hdmi_bridge_write_audio_infoframe,
+ .hdmi_clear_avi_infoframe = msm_hdmi_bridge_clear_avi_infoframe,
+ .hdmi_write_avi_infoframe = msm_hdmi_bridge_write_avi_infoframe,
+ .hdmi_clear_spd_infoframe = msm_hdmi_bridge_clear_spd_infoframe,
+ .hdmi_write_spd_infoframe = msm_hdmi_bridge_write_spd_infoframe,
+ .hdmi_clear_hdmi_infoframe = msm_hdmi_bridge_clear_hdmi_infoframe,
+ .hdmi_write_hdmi_infoframe = msm_hdmi_bridge_write_hdmi_infoframe,
.hdmi_audio_prepare = msm_hdmi_bridge_audio_prepare,
.hdmi_audio_shutdown = msm_hdmi_bridge_audio_shutdown,
};
diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
index 997429115068..9066ee2d1dff 100644
--- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c
+++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c
@@ -158,35 +158,33 @@ static void rk3066_hdmi_set_power_mode(struct rk3066_hdmi *hdmi, int mode)
hdmi->tmdsclk = DEFAULT_PLLA_RATE;
}
-static int rk3066_hdmi_bridge_clear_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type)
+static int rk3066_hdmi_bridge_clear_avi_infoframe(struct drm_bridge *bridge)
{
struct rk3066_hdmi *hdmi = bridge_to_rk3066_hdmi(bridge);
- if (type != HDMI_INFOFRAME_TYPE_AVI) {
- drm_err(bridge->dev, "Unsupported infoframe type: %u\n", type);
- return 0;
- }
-
hdmi_writeb(hdmi, HDMI_CP_BUF_INDEX, HDMI_INFOFRAME_AVI);
return 0;
}
static int
-rk3066_hdmi_bridge_write_infoframe(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+rk3066_hdmi_bridge_clear_hdmi_infoframe(struct drm_bridge *bridge)
+{
+ /* FIXME: add support for this InfoFrame */
+
+ drm_warn_once(bridge->encoder->dev, "HDMI VSI not supported\n");
+
+ return 0;
+}
+
+static int
+rk3066_hdmi_bridge_write_avi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
{
struct rk3066_hdmi *hdmi = bridge_to_rk3066_hdmi(bridge);
ssize_t i;
- if (type != HDMI_INFOFRAME_TYPE_AVI) {
- drm_err(bridge->dev, "Unsupported infoframe type: %u\n", type);
- return 0;
- }
-
- rk3066_hdmi_bridge_clear_infoframe(bridge, type);
+ rk3066_hdmi_bridge_clear_avi_infoframe(bridge);
for (i = 0; i < len; i++)
hdmi_writeb(hdmi, HDMI_CP_BUF_ACC_HB0 + i * 4, buffer[i]);
@@ -194,6 +192,17 @@ rk3066_hdmi_bridge_write_infoframe(struct drm_bridge *bridge,
return 0;
}
+static int
+rk3066_hdmi_bridge_write_hdmi_infoframe(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len)
+{
+ rk3066_hdmi_bridge_clear_hdmi_infoframe(bridge);
+
+ /* FIXME: add support for this InfoFrame */
+
+ return 0;
+}
+
static int rk3066_hdmi_config_video_timing(struct rk3066_hdmi *hdmi,
struct drm_display_mode *mode)
{
@@ -493,8 +502,10 @@ static const struct drm_bridge_funcs rk3066_hdmi_bridge_funcs = {
.atomic_disable = rk3066_hdmi_bridge_atomic_disable,
.detect = rk3066_hdmi_bridge_detect,
.edid_read = rk3066_hdmi_bridge_edid_read,
- .hdmi_clear_infoframe = rk3066_hdmi_bridge_clear_infoframe,
- .hdmi_write_infoframe = rk3066_hdmi_bridge_write_infoframe,
+ .hdmi_clear_avi_infoframe = rk3066_hdmi_bridge_clear_avi_infoframe,
+ .hdmi_write_avi_infoframe = rk3066_hdmi_bridge_write_avi_infoframe,
+ .hdmi_clear_hdmi_infoframe = rk3066_hdmi_bridge_clear_hdmi_infoframe,
+ .hdmi_write_hdmi_infoframe = rk3066_hdmi_bridge_write_hdmi_infoframe,
.mode_valid = rk3066_hdmi_bridge_mode_valid,
};
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index d2683846cc61..071e2f72fd0f 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -784,29 +784,113 @@ struct drm_bridge_funcs {
unsigned long long tmds_rate);
/**
- * @hdmi_clear_infoframe:
+ * @hdmi_clear_avi_infoframe:
*
* This callback clears the infoframes in the hardware during commit.
- * It will be called multiple times, once for every disabled infoframe
- * type.
*
* This callback is optional but it must be implemented by bridges that
* set the DRM_BRIDGE_OP_HDMI flag in their &drm_bridge->ops.
*/
- int (*hdmi_clear_infoframe)(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type);
+ int (*hdmi_clear_avi_infoframe)(struct drm_bridge *bridge);
+
+ /**
+ * @hdmi_write_avi_infoframe:
+ *
+ * Program the infoframe into the hardware.
+ *
+ * This callback is optional but it must be implemented by bridges that
+ * set the DRM_BRIDGE_OP_HDMI flag in their &drm_bridge->ops.
+ */
+ int (*hdmi_write_avi_infoframe)(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len);
+
+ /**
+ * @hdmi_clear_hdmi_infoframe:
+ *
+ * This callback clears the infoframes in the hardware during commit.
+ *
+ * This callback is optional but it must be implemented by bridges that
+ * set the DRM_BRIDGE_OP_HDMI flag in their &drm_bridge->ops.
+ */
+ int (*hdmi_clear_hdmi_infoframe)(struct drm_bridge *bridge);
+
/**
- * @hdmi_write_infoframe:
+ * @hdmi_write_hdmi_infoframe:
*
- * Program the infoframe into the hardware. It will be called multiple
- * times, once for every updated infoframe type.
+ * Program the infoframe into the hardware.
*
* This callback is optional but it must be implemented by bridges that
* set the DRM_BRIDGE_OP_HDMI flag in their &drm_bridge->ops.
*/
- int (*hdmi_write_infoframe)(struct drm_bridge *bridge,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len);
+ int (*hdmi_write_hdmi_infoframe)(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len);
+
+ /**
+ * @hdmi_clear_hdr_drm_infoframe:
+ *
+ * This callback clears the infoframes in the hardware during commit.
+ *
+ * This callback is optional but it must be implemented by bridges that
+ * set the DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME flag in their
+ * &drm_bridge->ops.
+ */
+ int (*hdmi_clear_hdr_drm_infoframe)(struct drm_bridge *bridge);
+
+ /**
+ * @hdmi_write_hdr_drm_infoframe:
+ *
+ * Program the infoframe into the hardware.
+ *
+ * This callback is optional but it must be implemented by bridges that
+ * set the DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME flag in their
+ * &drm_bridge->ops.
+ */
+ int (*hdmi_write_hdr_drm_infoframe)(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len);
+
+ /**
+ * @hdmi_clear_spd_infoframe:
+ *
+ * This callback clears the infoframes in the hardware during commit.
+ *
+ * This callback is optional but it must be implemented by bridges that
+ * set the DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME flag in their
+ * &drm_bridge->ops.
+ */
+ int (*hdmi_clear_spd_infoframe)(struct drm_bridge *bridge);
+
+ /**
+ * @hdmi_write_spd_infoframe:
+ *
+ * Program the infoframe into the hardware.
+ *
+ * This callback is optional but it must be implemented by bridges that
+ * set the DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME flag in their
+ * &drm_bridge->ops.
+ */
+ int (*hdmi_write_spd_infoframe)(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len);
+
+ /**
+ * @hdmi_clear_audio_infoframe:
+ *
+ * This callback clears the infoframes in the hardware during commit.
+ *
+ * This callback is optional but it must be implemented by bridges that
+ * set the DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.
+ */
+ int (*hdmi_clear_audio_infoframe)(struct drm_bridge *bridge);
+
+ /**
+ * @hdmi_write_audio_infoframe:
+ *
+ * Program the infoframe into the hardware.
+ *
+ * This callback is optional but it must be implemented by bridges that
+ * set the DRM_BRIDGE_OP_HDMI_AUDIO flag in their &drm_bridge->ops.
+ */
+ int (*hdmi_write_audio_infoframe)(struct drm_bridge *bridge,
+ const u8 *buffer, size_t len);
/**
* @hdmi_audio_startup:
@@ -1062,7 +1146,11 @@ enum drm_bridge_ops {
/**
* @DRM_BRIDGE_OP_HDMI: The bridge provides HDMI connector operations,
* including infoframes support. Bridges that set this flag must
- * implement the &drm_bridge_funcs->write_infoframe callback.
+ * provide HDMI-related information and implement the
+ * &drm_bridge_funcs->clear_avi_infoframe,
+ * &drm_bridge_funcs->write_avi_infoframe,
+ * &drm_bridge_funcs->clear_hdmi_infoframe and
+ * &drm_bridge_funcs->write_hdmi_infoframe callbacks.
*
* Note: currently there can be at most one bridge in a chain that sets
* this bit. This is to simplify corresponding glue code in connector
@@ -1074,6 +1162,9 @@ enum drm_bridge_ops {
* Bridges that set this flag must implement the
* &drm_bridge_funcs->hdmi_audio_prepare and
* &drm_bridge_funcs->hdmi_audio_shutdown callbacks.
+ * If the bridge implements @DRM_BRIDGE_OP_HDMI, it also must implement
+ * &drm_bridge_funcs->hdmi_write_audio_infoframe and
+ * &drm_bridge_funcs->hdmi_cleaer_audio_infoframe callbacks.
*
* Note: currently there can be at most one bridge in a chain that sets
* this bit. This is to simplify corresponding glue code in connector
@@ -1105,6 +1196,18 @@ enum drm_bridge_ops {
* to be present.
*/
DRM_BRIDGE_OP_HDMI_CEC_ADAPTER = BIT(8),
+ /**
+ * @DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME: The bridge supports
+ * &drm_bridge_funcs->hdmi_write_hdr_drm_infoframe and
+ * &drm_bridge_funcs->hdmi_clear_hdr_drm_infoframe callbacks.
+ */
+ DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME = BIT(9),
+ /**
+ * @DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME: The bridge supports
+ * &drm_bridge_funcs->hdmi_write_spd_infoframe and
+ * &drm_bridge_funcs->hdmi_clear_spd_infoframe callbacks.
+ */
+ DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME = BIT(10),
};
/**
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 05/10] drm/bridge: refactor HDMI InfoFrame callbacks
2025-12-24 1:02 ` [PATCH v3 05/10] drm/bridge: refactor HDMI InfoFrame callbacks Dmitry Baryshkov
@ 2026-01-07 13:27 ` Maxime Ripard
0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2026-01-07 13:27 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: dri-devel, freedreno, linux-arm-kernel, linux-arm-msm,
linux-kernel, linux-mediatek, linux-rockchip, linux-sunxi,
Abhinav Kumar, Andrzej Hajda, Andy Yan,
AngeloGioacchino Del Regno, Chen-Yu Tsai, Chun-Kuang Hu,
Dave Stevenson, David Airlie, Dmitry Baryshkov,
Heiko Stübner, Jernej Skrabec, Jessica Zhang, Jonas Karlman,
Laurent Pinchart, Liu Ying, Maarten Lankhorst, Marijn Suijten,
Matthias Brugger, Maxime Ripard, Maíra Canal, Neil Armstrong,
Philipp Zabel, Raspberry Pi Kernel Maintenance, Rob Clark,
Robert Foss, Samuel Holland, Sandy Huang, Sean Paul,
Simona Vetter, Thomas Zimmermann
On Wed, 24 Dec 2025 03:02:54 +0200, Dmitry Baryshkov wrote:
> Having only a single set of callbacks, hdmi_clear_infoframe and
> hdmi_write_infoframe, bridge drivers don't have an easy way to signal to
> the DRM framework, which InfoFrames are actually supported by the
> hardware and by the driver and which are not. Also, it makes it
> extremely easy for HDMI bridge drivers to skip implementing the
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 06/10] drm/display: hdmi_state_helper: split InfoFrame functions per type
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
` (4 preceding siblings ...)
2025-12-24 1:02 ` [PATCH v3 05/10] drm/bridge: refactor HDMI InfoFrame callbacks Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2026-01-07 13:28 ` Maxime Ripard
2025-12-24 1:02 ` [PATCH v3 07/10] drm/display: hdmi_state_helper: reject Audio IF updates if it's not supported Dmitry Baryshkov
` (3 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
Havign a single set of InfoFrame callbacks doesn't provide enough
information to the DRM framework about the InfoFrame types that are
actually supported. Also it's not really future-proof: it provides a way
to program only a single Vendor-Specific frame, however we might need to
support multiple VSIs at the same time (e.g. HDMI vs HDMI Forum
VSIs).
Provide separate sets of callbacks, one per the InfoFrame type.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/display/drm_bridge_connector.c | 206 ++++++++++++++++-----
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 86 ++++-----
drivers/gpu/drm/drm_connector.c | 6 +-
drivers/gpu/drm/rockchip/inno_hdmi.c | 47 +++--
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 39 ++--
drivers/gpu/drm/tests/drm_connector_test.c | 14 +-
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 102 +++++-----
drivers/gpu/drm/vc4/vc4_hdmi.c | 82 +++++++-
include/drm/drm_connector.h | 105 ++++++++---
9 files changed, 482 insertions(+), 205 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c
index 8fd7722fe9a3..c8858d48199c 100644
--- a/drivers/gpu/drm/display/drm_bridge_connector.c
+++ b/drivers/gpu/drm/display/drm_bridge_connector.c
@@ -401,8 +401,7 @@ drm_bridge_connector_tmds_char_rate_valid(const struct drm_connector *connector,
return MODE_OK;
}
-static int drm_bridge_connector_clear_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type)
+static int drm_bridge_connector_clear_avi_infoframe(struct drm_connector *connector)
{
struct drm_bridge_connector *bridge_connector =
to_drm_bridge_connector(connector);
@@ -412,35 +411,70 @@ static int drm_bridge_connector_clear_infoframe(struct drm_connector *connector,
if (!bridge)
return -EINVAL;
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AVI:
- /* required */
- return bridge->funcs->hdmi_clear_avi_infoframe(bridge);
- case HDMI_INFOFRAME_TYPE_VENDOR:
- /* required */
- return bridge->funcs->hdmi_clear_hdmi_infoframe(bridge);
- case HDMI_INFOFRAME_TYPE_AUDIO:
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_AUDIO)
- return bridge->funcs->hdmi_clear_audio_infoframe(bridge);
- break;
- case HDMI_INFOFRAME_TYPE_DRM:
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME)
- return bridge->funcs->hdmi_clear_hdr_drm_infoframe(bridge);
- break;
- case HDMI_INFOFRAME_TYPE_SPD:
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME)
- return bridge->funcs->hdmi_clear_spd_infoframe(bridge);
- break;
- }
+ return bridge->funcs->hdmi_clear_avi_infoframe(bridge);
+}
+
+static int drm_bridge_connector_write_avi_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ struct drm_bridge_connector *bridge_connector =
+ to_drm_bridge_connector(connector);
+ struct drm_bridge *bridge;
+
+ bridge = bridge_connector->bridge_hdmi;
+ if (!bridge)
+ return -EINVAL;
+
+ return bridge->funcs->hdmi_write_avi_infoframe(bridge, buffer, len);
+}
- drm_dbg_driver(connector->dev, "Unsupported HDMI InfoFrame %x\n", type);
+static int drm_bridge_connector_clear_hdmi_infoframe(struct drm_connector *connector)
+{
+ struct drm_bridge_connector *bridge_connector =
+ to_drm_bridge_connector(connector);
+ struct drm_bridge *bridge;
+
+ bridge = bridge_connector->bridge_hdmi;
+ if (!bridge)
+ return -EINVAL;
+
+ return bridge->funcs->hdmi_clear_hdmi_infoframe(bridge);
+}
+
+static int drm_bridge_connector_write_hdmi_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ struct drm_bridge_connector *bridge_connector =
+ to_drm_bridge_connector(connector);
+ struct drm_bridge *bridge;
+
+ bridge = bridge_connector->bridge_hdmi;
+ if (!bridge)
+ return -EINVAL;
+
+ return bridge->funcs->hdmi_write_hdmi_infoframe(bridge, buffer, len);
+}
+
+static int drm_bridge_connector_clear_audio_infoframe(struct drm_connector *connector)
+{
+ struct drm_bridge_connector *bridge_connector =
+ to_drm_bridge_connector(connector);
+ struct drm_bridge *bridge;
+
+ bridge = bridge_connector->bridge_hdmi;
+ if (!bridge)
+ return -EINVAL;
+
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_AUDIO)
+ return bridge->funcs->hdmi_clear_audio_infoframe(bridge);
+
+ drm_dbg_driver(connector->dev, "Unsupported HDMI Audio InfoFrame\n");
return 0;
}
-static int drm_bridge_connector_write_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+static int drm_bridge_connector_write_audio_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
{
struct drm_bridge_connector *bridge_connector =
to_drm_bridge_connector(connector);
@@ -450,28 +484,84 @@ static int drm_bridge_connector_write_infoframe(struct drm_connector *connector,
if (!bridge)
return -EINVAL;
- switch (type) {
- case HDMI_INFOFRAME_TYPE_AVI:
- /* required */
- return bridge->funcs->hdmi_write_avi_infoframe(bridge, buffer, len);
- case HDMI_INFOFRAME_TYPE_VENDOR:
- /* required */
- return bridge->funcs->hdmi_write_hdmi_infoframe(bridge, buffer, len);
- case HDMI_INFOFRAME_TYPE_AUDIO:
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_AUDIO)
- return bridge->funcs->hdmi_write_audio_infoframe(bridge, buffer, len);
- break;
- case HDMI_INFOFRAME_TYPE_DRM:
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME)
- return bridge->funcs->hdmi_write_hdr_drm_infoframe(bridge, buffer, len);
- break;
- case HDMI_INFOFRAME_TYPE_SPD:
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME)
- return bridge->funcs->hdmi_write_spd_infoframe(bridge, buffer, len);
- break;
- }
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_AUDIO)
+ return bridge->funcs->hdmi_write_audio_infoframe(bridge, buffer, len);
+
+ drm_dbg_driver(connector->dev, "Unsupported HDMI Audio InfoFrame\n");
+
+ return 0;
+}
+
+static int drm_bridge_connector_clear_hdr_drm_infoframe(struct drm_connector *connector)
+{
+ struct drm_bridge_connector *bridge_connector =
+ to_drm_bridge_connector(connector);
+ struct drm_bridge *bridge;
+
+ bridge = bridge_connector->bridge_hdmi;
+ if (!bridge)
+ return -EINVAL;
+
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME)
+ return bridge->funcs->hdmi_clear_hdr_drm_infoframe(bridge);
+
+ drm_dbg_driver(connector->dev, "Unsupported HDMI HDR DRM InfoFrame\n");
+
+ return 0;
+}
+
+static int drm_bridge_connector_write_hdr_drm_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ struct drm_bridge_connector *bridge_connector =
+ to_drm_bridge_connector(connector);
+ struct drm_bridge *bridge;
+
+ bridge = bridge_connector->bridge_hdmi;
+ if (!bridge)
+ return -EINVAL;
+
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME)
+ return bridge->funcs->hdmi_write_hdr_drm_infoframe(bridge, buffer, len);
+
+ drm_dbg_driver(connector->dev, "Unsupported HDMI HDR DRM InfoFrame\n");
+
+ return 0;
+}
+
+static int drm_bridge_connector_clear_spd_infoframe(struct drm_connector *connector)
+{
+ struct drm_bridge_connector *bridge_connector =
+ to_drm_bridge_connector(connector);
+ struct drm_bridge *bridge;
+
+ bridge = bridge_connector->bridge_hdmi;
+ if (!bridge)
+ return -EINVAL;
+
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME)
+ return bridge->funcs->hdmi_clear_spd_infoframe(bridge);
+
+ drm_dbg_driver(connector->dev, "Unsupported HDMI SPD InfoFrame\n");
+
+ return 0;
+}
+
+static int drm_bridge_connector_write_spd_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ struct drm_bridge_connector *bridge_connector =
+ to_drm_bridge_connector(connector);
+ struct drm_bridge *bridge;
+
+ bridge = bridge_connector->bridge_hdmi;
+ if (!bridge)
+ return -EINVAL;
+
+ if (bridge->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME)
+ return bridge->funcs->hdmi_write_spd_infoframe(bridge, buffer, len);
- drm_dbg_driver(connector->dev, "Unsupported HDMI InfoFrame %x\n", type);
+ drm_dbg_driver(connector->dev, "Unsupported HDMI SPD InfoFrame\n");
return 0;
}
@@ -492,9 +582,27 @@ drm_bridge_connector_read_edid(struct drm_connector *connector)
static const struct drm_connector_hdmi_funcs drm_bridge_connector_hdmi_funcs = {
.tmds_char_rate_valid = drm_bridge_connector_tmds_char_rate_valid,
- .clear_infoframe = drm_bridge_connector_clear_infoframe,
- .write_infoframe = drm_bridge_connector_write_infoframe,
.read_edid = drm_bridge_connector_read_edid,
+ .avi = {
+ .clear_infoframe = drm_bridge_connector_clear_avi_infoframe,
+ .write_infoframe = drm_bridge_connector_write_avi_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = drm_bridge_connector_clear_hdmi_infoframe,
+ .write_infoframe = drm_bridge_connector_write_hdmi_infoframe,
+ },
+ .audio = {
+ .clear_infoframe = drm_bridge_connector_clear_audio_infoframe,
+ .write_infoframe = drm_bridge_connector_write_audio_infoframe,
+ },
+ .hdr_drm = {
+ .clear_infoframe = drm_bridge_connector_clear_hdr_drm_infoframe,
+ .write_infoframe = drm_bridge_connector_write_hdr_drm_infoframe,
+ },
+ .spd = {
+ .clear_infoframe = drm_bridge_connector_clear_spd_infoframe,
+ .write_infoframe = drm_bridge_connector_write_spd_infoframe,
+ },
};
static int drm_bridge_connector_audio_startup(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index a561f124be99..5a3817271d91 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -891,21 +891,21 @@ drm_hdmi_connector_mode_valid(struct drm_connector *connector,
}
EXPORT_SYMBOL(drm_hdmi_connector_mode_valid);
-static int clear_device_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type)
+static int clear_infoframe(struct drm_connector *connector,
+ const struct drm_connector_infoframe_funcs *funcs,
+ const char *type)
{
- const struct drm_connector_hdmi_funcs *funcs = connector->hdmi.funcs;
struct drm_device *dev = connector->dev;
int ret;
- drm_dbg_kms(dev, "Clearing infoframe type 0x%x\n", type);
+ drm_dbg_kms(dev, "Clearing %s InfoFrame\n", type);
- if (!funcs || !funcs->clear_infoframe) {
+ if (!funcs->clear_infoframe) {
drm_dbg_kms(dev, "Function not implemented, bailing.\n");
return 0;
}
- ret = funcs->clear_infoframe(connector, type);
+ ret = funcs->clear_infoframe(connector);
if (ret) {
drm_dbg_kms(dev, "Call failed: %d\n", ret);
return ret;
@@ -914,39 +914,28 @@ static int clear_device_infoframe(struct drm_connector *connector,
return 0;
}
-static int clear_infoframe(struct drm_connector *connector,
- struct drm_connector_hdmi_infoframe *old_frame)
-{
- int ret;
-
- ret = clear_device_infoframe(connector, old_frame->data.any.type);
- if (ret)
- return ret;
-
- return 0;
-}
-
-static int write_device_infoframe(struct drm_connector *connector,
- union hdmi_infoframe *frame)
+static int write_infoframe(struct drm_connector *connector,
+ const struct drm_connector_infoframe_funcs *funcs,
+ const char *type,
+ struct drm_connector_hdmi_infoframe *new_frame)
{
- const struct drm_connector_hdmi_funcs *funcs = connector->hdmi.funcs;
struct drm_device *dev = connector->dev;
u8 buffer[HDMI_INFOFRAME_SIZE(MAX)];
int ret;
int len;
- drm_dbg_kms(dev, "Writing infoframe type %x\n", frame->any.type);
+ drm_dbg_kms(dev, "Writing %s InfoFrame\n", type);
- if (!funcs || !funcs->write_infoframe) {
+ if (!funcs->write_infoframe) {
drm_dbg_kms(dev, "Function not implemented, bailing.\n");
- return -EINVAL;
+ return 0; /* XXX: temporal until we stop generating unsupported frames */
}
- len = hdmi_infoframe_pack(frame, buffer, sizeof(buffer));
+ len = hdmi_infoframe_pack(&new_frame->data, buffer, sizeof(buffer));
if (len < 0)
return len;
- ret = funcs->write_infoframe(connector, frame->any.type, buffer, len);
+ ret = funcs->write_infoframe(connector, buffer, len);
if (ret) {
drm_dbg_kms(dev, "Call failed: %d\n", ret);
return ret;
@@ -955,27 +944,17 @@ static int write_device_infoframe(struct drm_connector *connector,
return 0;
}
-static int write_infoframe(struct drm_connector *connector,
- struct drm_connector_hdmi_infoframe *new_frame)
-{
- int ret;
-
- ret = write_device_infoframe(connector, &new_frame->data);
- if (ret)
- return ret;
-
- return 0;
-}
-
static int write_or_clear_infoframe(struct drm_connector *connector,
+ const struct drm_connector_infoframe_funcs *funcs,
+ const char *type,
struct drm_connector_hdmi_infoframe *old_frame,
struct drm_connector_hdmi_infoframe *new_frame)
{
if (new_frame->set)
- return write_infoframe(connector, new_frame);
+ return write_infoframe(connector, funcs, type, new_frame);
if (old_frame->set && !new_frame->set)
- return clear_infoframe(connector, old_frame);
+ return clear_infoframe(connector, funcs, type);
return 0;
}
@@ -995,6 +974,7 @@ static int write_or_clear_infoframe(struct drm_connector *connector,
int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *connector,
struct drm_atomic_state *state)
{
+ const struct drm_connector_hdmi_funcs *funcs = connector->hdmi.funcs;
struct drm_connector_state *old_conn_state =
drm_atomic_get_old_connector_state(state, connector);
struct drm_connector_state *new_conn_state =
@@ -1005,9 +985,15 @@ int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *con
if (!info->is_hdmi)
return 0;
+ if (!funcs) {
+ drm_dbg_kms(connector->dev, "Function not implemented, bailing.\n");
+ return -EINVAL;
+ }
+
mutex_lock(&connector->hdmi.infoframes.lock);
ret = write_or_clear_infoframe(connector,
+ &funcs->avi, "AVI",
&old_conn_state->hdmi.infoframes.avi,
&new_conn_state->hdmi.infoframes.avi);
if (ret)
@@ -1015,18 +1001,21 @@ int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *con
if (connector->hdmi.infoframes.audio.set) {
ret = write_infoframe(connector,
+ &funcs->audio, "Audio",
&connector->hdmi.infoframes.audio);
if (ret)
goto out;
}
ret = write_or_clear_infoframe(connector,
+ &funcs->hdr_drm, "HDR DRM",
&old_conn_state->hdmi.infoframes.hdr_drm,
&new_conn_state->hdmi.infoframes.hdr_drm);
if (ret)
goto out;
ret = write_or_clear_infoframe(connector,
+ &funcs->spd, "SPD",
&old_conn_state->hdmi.infoframes.spd,
&new_conn_state->hdmi.infoframes.spd);
if (ret)
@@ -1034,6 +1023,7 @@ int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *con
if (info->has_hdmi_infoframe) {
ret = write_or_clear_infoframe(connector,
+ &funcs->hdmi, "HDMI-VS",
&old_conn_state->hdmi.infoframes.hdmi,
&new_conn_state->hdmi.infoframes.hdmi);
if (ret)
@@ -1062,6 +1052,7 @@ int
drm_atomic_helper_connector_hdmi_update_audio_infoframe(struct drm_connector *connector,
struct hdmi_audio_infoframe *frame)
{
+ const struct drm_connector_hdmi_funcs *funcs = connector->hdmi.funcs;
struct drm_connector_hdmi_infoframe *infoframe =
&connector->hdmi.infoframes.audio;
struct drm_display_info *info = &connector->display_info;
@@ -1070,12 +1061,17 @@ drm_atomic_helper_connector_hdmi_update_audio_infoframe(struct drm_connector *co
if (!info->is_hdmi)
return 0;
+ if (!funcs) {
+ drm_dbg_kms(connector->dev, "Function not implemented, bailing.\n");
+ return -EINVAL;
+ }
+
mutex_lock(&connector->hdmi.infoframes.lock);
memcpy(&infoframe->data, frame, sizeof(infoframe->data));
infoframe->set = true;
- ret = write_infoframe(connector, infoframe);
+ ret = write_infoframe(connector, &funcs->audio, "Audio", infoframe);
mutex_unlock(&connector->hdmi.infoframes.lock);
@@ -1097,6 +1093,7 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_update_audio_infoframe);
int
drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector *connector)
{
+ const struct drm_connector_hdmi_funcs *funcs = connector->hdmi.funcs;
struct drm_connector_hdmi_infoframe *infoframe =
&connector->hdmi.infoframes.audio;
struct drm_display_info *info = &connector->display_info;
@@ -1105,11 +1102,16 @@ drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector *con
if (!info->is_hdmi)
return 0;
+ if (!funcs) {
+ drm_dbg_kms(connector->dev, "Function not implemented, bailing.\n");
+ return -EINVAL;
+ }
+
mutex_lock(&connector->hdmi.infoframes.lock);
infoframe->set = false;
- ret = clear_infoframe(connector, infoframe);
+ ret = clear_infoframe(connector, &funcs->audio, "Audio");
memset(&infoframe->data, 0, sizeof(infoframe->data));
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 40e025712c9b..4f5b27fab475 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -600,8 +600,10 @@ int drmm_connector_hdmi_init(struct drm_device *dev,
if (!(max_bpc == 8 || max_bpc == 10 || max_bpc == 12))
return -EINVAL;
- if (!hdmi_funcs->clear_infoframe ||
- !hdmi_funcs->write_infoframe)
+ if (!hdmi_funcs->avi.clear_infoframe ||
+ !hdmi_funcs->avi.write_infoframe ||
+ !hdmi_funcs->hdmi.clear_infoframe ||
+ !hdmi_funcs->hdmi.write_infoframe)
return -EINVAL;
ret = drmm_connector_init(dev, connector, funcs, connector_type, ddc);
diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c
index 9f7a8cf0ab44..1575f05bb4af 100644
--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -637,36 +637,22 @@ static void inno_hdmi_init_hw(struct inno_hdmi *hdmi)
hdmi_modb(hdmi, HDMI_STATUS, m_MASK_INT_HOTPLUG, v_MASK_INT_HOTPLUG(1));
}
-static int inno_hdmi_disable_frame(struct drm_connector *connector,
- enum hdmi_infoframe_type type)
+static int inno_hdmi_clear_avi_infoframe(struct drm_connector *connector)
{
struct inno_hdmi *hdmi = connector_to_inno_hdmi(connector);
- if (type != HDMI_INFOFRAME_TYPE_AVI) {
- drm_err(connector->dev,
- "Unsupported infoframe type: %u\n", type);
- return 0;
- }
-
hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_BUF_INDEX, INFOFRAME_AVI);
return 0;
}
-static int inno_hdmi_upload_frame(struct drm_connector *connector,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+static int inno_hdmi_write_avi_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
{
struct inno_hdmi *hdmi = connector_to_inno_hdmi(connector);
ssize_t i;
- if (type != HDMI_INFOFRAME_TYPE_AVI) {
- drm_err(connector->dev,
- "Unsupported infoframe type: %u\n", type);
- return 0;
- }
-
- inno_hdmi_disable_frame(connector, type);
+ inno_hdmi_clear_avi_infoframe(connector);
for (i = 0; i < len; i++)
hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_ADDR + i, buffer[i]);
@@ -674,9 +660,30 @@ static int inno_hdmi_upload_frame(struct drm_connector *connector,
return 0;
}
+static int inno_hdmi_clear_hdmi_infoframe(struct drm_connector *connector)
+{
+ drm_warn_once(connector->dev, "HDMI VSI not implemented\n");
+
+ return 0;
+}
+
+static int inno_hdmi_write_hdmi_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ drm_warn_once(connector->dev, "HDMI VSI not implemented\n");
+
+ return 0;
+}
+
static const struct drm_connector_hdmi_funcs inno_hdmi_hdmi_connector_funcs = {
- .clear_infoframe = inno_hdmi_disable_frame,
- .write_infoframe = inno_hdmi_upload_frame,
+ .avi = {
+ .clear_infoframe = inno_hdmi_clear_avi_infoframe,
+ .write_infoframe = inno_hdmi_write_avi_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = inno_hdmi_clear_hdmi_infoframe,
+ .write_infoframe = inno_hdmi_write_hdmi_infoframe,
+ },
};
static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi)
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index 6263ee15880a..a50f260c73e4 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -40,27 +40,19 @@
#define drm_connector_to_sun4i_hdmi(c) \
container_of_const(c, struct sun4i_hdmi, connector)
-static int sun4i_hdmi_clear_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type)
+static int sun4i_hdmi_clear_avi_infoframe(struct drm_connector *connector)
{
drm_warn_once(connector->dev, "clearing of AVI infoframe is not implemented\n");
return 0;
}
-static int sun4i_hdmi_write_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+static int sun4i_hdmi_write_avi_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
{
struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector);
int i;
- if (type != HDMI_INFOFRAME_TYPE_AVI) {
- drm_err(connector->dev,
- "Unsupported infoframe type: %u\n", type);
- return 0;
- }
-
for (i = 0; i < len; i++)
writeb(buffer[i], hdmi->base + SUN4I_HDMI_AVI_INFOFRAME_REG(i));
@@ -68,6 +60,21 @@ static int sun4i_hdmi_write_infoframe(struct drm_connector *connector,
}
+static int sun4i_hdmi_clear_hdmi_infoframe(struct drm_connector *connector)
+{
+ drm_warn_once(connector->dev, "HDMI VSI not implemented\n");
+
+ return 0;
+}
+
+static int sun4i_hdmi_write_hdmi_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ drm_warn_once(connector->dev, "HDMI VSI not implemented\n");
+
+ return 0;
+}
+
static void sun4i_hdmi_disable(struct drm_encoder *encoder,
struct drm_atomic_state *state)
{
@@ -244,8 +251,14 @@ static struct i2c_adapter *sun4i_hdmi_get_ddc(struct device *dev)
static const struct drm_connector_hdmi_funcs sun4i_hdmi_hdmi_connector_funcs = {
.tmds_char_rate_valid = sun4i_hdmi_connector_clock_valid,
- .clear_infoframe = sun4i_hdmi_clear_infoframe,
- .write_infoframe = sun4i_hdmi_write_infoframe,
+ .avi = {
+ .clear_infoframe = sun4i_hdmi_clear_avi_infoframe,
+ .write_infoframe = sun4i_hdmi_write_avi_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = sun4i_hdmi_clear_hdmi_infoframe,
+ .write_infoframe = sun4i_hdmi_write_hdmi_infoframe,
+ },
};
static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/tests/drm_connector_test.c b/drivers/gpu/drm/tests/drm_connector_test.c
index f356ea695ae7..86860ad0861c 100644
--- a/drivers/gpu/drm/tests/drm_connector_test.c
+++ b/drivers/gpu/drm/tests/drm_connector_test.c
@@ -25,22 +25,26 @@ struct drm_connector_init_priv {
struct i2c_adapter ddc;
};
-static int accept_infoframe_clear_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type)
+static int accept_infoframe_clear_infoframe(struct drm_connector *connector)
{
return 0;
}
static int accept_infoframe_write_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type,
const u8 *buffer, size_t len)
{
return 0;
}
static const struct drm_connector_hdmi_funcs dummy_hdmi_funcs = {
- .clear_infoframe = accept_infoframe_clear_infoframe,
- .write_infoframe = accept_infoframe_write_infoframe,
+ .avi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
};
static const struct drm_connector_funcs dummy_funcs = {
diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
index 915dcd106703..7e4e986bdfd6 100644
--- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
+++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c
@@ -76,22 +76,26 @@ static int set_connector_edid(struct kunit *test, struct drm_connector *connecto
return ret;
}
-static int accept_infoframe_clear_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type)
+static int accept_infoframe_clear_infoframe(struct drm_connector *connector)
{
return 0;
}
static int accept_infoframe_write_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type,
const u8 *buffer, size_t len)
{
return 0;
}
static const struct drm_connector_hdmi_funcs dummy_connector_hdmi_funcs = {
- .clear_infoframe = accept_infoframe_clear_infoframe,
- .write_infoframe = accept_infoframe_write_infoframe,
+ .avi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
};
static enum drm_mode_status
@@ -104,8 +108,14 @@ reject_connector_tmds_char_rate_valid(const struct drm_connector *connector,
static const struct drm_connector_hdmi_funcs reject_connector_hdmi_funcs = {
.tmds_char_rate_valid = reject_connector_tmds_char_rate_valid,
- .clear_infoframe = accept_infoframe_clear_infoframe,
- .write_infoframe = accept_infoframe_write_infoframe,
+ .avi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
};
static enum drm_mode_status
@@ -118,8 +128,14 @@ reject_100mhz_connector_tmds_char_rate_valid(const struct drm_connector *connect
static const struct drm_connector_hdmi_funcs reject_100mhz_connector_hdmi_funcs = {
.tmds_char_rate_valid = reject_100mhz_connector_tmds_char_rate_valid,
- .clear_infoframe = accept_infoframe_clear_infoframe,
- .write_infoframe = accept_infoframe_write_infoframe,
+ .avi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
};
static int dummy_connector_get_modes(struct drm_connector *connector)
@@ -2427,19 +2443,21 @@ static void drm_test_check_infoframes(struct kunit *test)
drm_modeset_acquire_fini(&ctx);
}
-static int reject_avi_infoframe_write_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
+static int reject_infoframe_write_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
{
- if (type == HDMI_INFOFRAME_TYPE_AVI)
- return -EOPNOTSUPP;
-
- return 0;
+ return -EOPNOTSUPP;
}
static const struct drm_connector_hdmi_funcs reject_avi_infoframe_hdmi_funcs = {
- .clear_infoframe = accept_infoframe_clear_infoframe,
- .write_infoframe = reject_avi_infoframe_write_infoframe,
+ .avi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = reject_infoframe_write_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
};
/*
@@ -2509,19 +2527,19 @@ static void drm_test_check_reject_avi_infoframe(struct kunit *test)
drm_modeset_acquire_fini(&ctx);
}
-static int reject_hdr_infoframe_write_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
-{
- if (type == HDMI_INFOFRAME_TYPE_DRM)
- return -EOPNOTSUPP;
-
- return 0;
-}
-
static const struct drm_connector_hdmi_funcs reject_hdr_infoframe_hdmi_funcs = {
- .clear_infoframe = accept_infoframe_clear_infoframe,
- .write_infoframe = reject_hdr_infoframe_write_infoframe,
+ .avi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
+ .hdr_drm = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = reject_infoframe_write_infoframe,
+ },
};
/*
@@ -2695,19 +2713,19 @@ static void drm_test_check_reject_hdr_infoframe_bpc_10(struct kunit *test)
drm_modeset_acquire_fini(&ctx);
}
-static int reject_audio_infoframe_write_infoframe(struct drm_connector *connector,
- enum hdmi_infoframe_type type,
- const u8 *buffer, size_t len)
-{
- if (type == HDMI_INFOFRAME_TYPE_AUDIO)
- return -EOPNOTSUPP;
-
- return 0;
-}
-
static const struct drm_connector_hdmi_funcs reject_audio_infoframe_hdmi_funcs = {
- .clear_infoframe = accept_infoframe_clear_infoframe,
- .write_infoframe = reject_audio_infoframe_write_infoframe,
+ .avi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = accept_infoframe_write_infoframe,
+ },
+ .audio = {
+ .clear_infoframe = accept_infoframe_clear_infoframe,
+ .write_infoframe = reject_infoframe_write_infoframe,
+ },
};
/*
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 4cfb7ebc0c81..9fe605a42df7 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -727,6 +727,66 @@ static int vc4_hdmi_write_infoframe(struct drm_connector *connector,
return ret;
}
+static int vc4_hdmi_clear_avi_infoframe(struct drm_connector *connector)
+{
+ return vc4_hdmi_clear_infoframe(connector, HDMI_INFOFRAME_TYPE_AVI);
+}
+
+static int vc4_hdmi_clear_hdmi_infoframe(struct drm_connector *connector)
+{
+ return vc4_hdmi_clear_infoframe(connector, HDMI_INFOFRAME_TYPE_VENDOR);
+}
+
+static int vc4_hdmi_clear_audio_infoframe(struct drm_connector *connector)
+{
+ return vc4_hdmi_clear_infoframe(connector, HDMI_INFOFRAME_TYPE_AUDIO);
+}
+
+static int vc4_hdmi_clear_hdr_drm_infoframe(struct drm_connector *connector)
+{
+ return vc4_hdmi_clear_infoframe(connector, HDMI_INFOFRAME_TYPE_DRM);
+}
+
+static int vc4_hdmi_clear_spd_infoframe(struct drm_connector *connector)
+{
+ return vc4_hdmi_clear_infoframe(connector, HDMI_INFOFRAME_TYPE_SPD);
+}
+
+static int vc4_hdmi_write_avi_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ return vc4_hdmi_write_infoframe(connector, HDMI_INFOFRAME_TYPE_AVI,
+ buffer, len);
+}
+
+static int vc4_hdmi_write_hdmi_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ return vc4_hdmi_write_infoframe(connector, HDMI_INFOFRAME_TYPE_VENDOR,
+ buffer, len);
+}
+
+static int vc4_hdmi_write_audio_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ return vc4_hdmi_write_infoframe(connector, HDMI_INFOFRAME_TYPE_AUDIO,
+ buffer, len);
+}
+
+static int vc4_hdmi_write_hdr_drm_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ return vc4_hdmi_write_infoframe(connector, HDMI_INFOFRAME_TYPE_DRM,
+ buffer, len);
+}
+
+static int vc4_hdmi_write_spd_infoframe(struct drm_connector *connector,
+ const u8 *buffer, size_t len)
+{
+ return vc4_hdmi_write_infoframe(connector, HDMI_INFOFRAME_TYPE_SPD,
+ buffer, len);
+}
+
#define SCRAMBLING_POLLING_DELAY_MS 1000
static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder)
@@ -1684,8 +1744,26 @@ vc4_hdmi_connector_clock_valid(const struct drm_connector *connector,
static const struct drm_connector_hdmi_funcs vc4_hdmi_hdmi_connector_funcs = {
.tmds_char_rate_valid = vc4_hdmi_connector_clock_valid,
- .clear_infoframe = vc4_hdmi_clear_infoframe,
- .write_infoframe = vc4_hdmi_write_infoframe,
+ .avi = {
+ .clear_infoframe = vc4_hdmi_clear_avi_infoframe,
+ .write_infoframe = vc4_hdmi_write_avi_infoframe,
+ },
+ .hdmi = {
+ .clear_infoframe = vc4_hdmi_clear_hdmi_infoframe,
+ .write_infoframe = vc4_hdmi_write_hdmi_infoframe,
+ },
+ .audio = {
+ .clear_infoframe = vc4_hdmi_clear_audio_infoframe,
+ .write_infoframe = vc4_hdmi_write_audio_infoframe,
+ },
+ .hdr_drm = {
+ .clear_infoframe = vc4_hdmi_clear_hdr_drm_infoframe,
+ .write_infoframe = vc4_hdmi_write_hdr_drm_infoframe,
+ },
+ .spd = {
+ .clear_infoframe = vc4_hdmi_clear_spd_infoframe,
+ .write_infoframe = vc4_hdmi_write_spd_infoframe,
+ },
};
#define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 4543833acdec..7eaec37ae1c7 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1222,44 +1222,24 @@ struct drm_connector_cec_funcs {
};
/**
- * struct drm_connector_hdmi_funcs - drm_hdmi_connector control functions
+ * struct drm_connector_infoframe_funcs - InfoFrame-related functions
*/
-struct drm_connector_hdmi_funcs {
- /**
- * @tmds_char_rate_valid:
- *
- * This callback is invoked at atomic_check time to figure out
- * whether a particular TMDS character rate is supported by the
- * driver.
- *
- * The @tmds_char_rate_valid callback is optional.
- *
- * Returns:
- *
- * Either &drm_mode_status.MODE_OK or one of the failure reasons
- * in &enum drm_mode_status.
- */
- enum drm_mode_status
- (*tmds_char_rate_valid)(const struct drm_connector *connector,
- const struct drm_display_mode *mode,
- unsigned long long tmds_rate);
-
+struct drm_connector_infoframe_funcs {
/**
* @clear_infoframe:
*
* This callback is invoked through
* @drm_atomic_helper_connector_hdmi_update_infoframes during a
* commit to clear the infoframes into the hardware. It will be
- * called multiple times, once for every disabled infoframe
- * type.
+ * called once for each frame type to be disabled.
*
- * The @clear_infoframe callback is mandatory.
+ * The @clear_infoframe callback is mandatory for AVI and HDMI-VS
+ * InfoFrame types.
*
* Returns:
* 0 on success, a negative error code otherwise
*/
- int (*clear_infoframe)(struct drm_connector *connector,
- enum hdmi_infoframe_type type);
+ int (*clear_infoframe)(struct drm_connector *connector);
/**
* @write_infoframe:
@@ -1267,18 +1247,42 @@ struct drm_connector_hdmi_funcs {
* This callback is invoked through
* @drm_atomic_helper_connector_hdmi_update_infoframes during a
* commit to program the infoframes into the hardware. It will
- * be called multiple times, once for every updated infoframe
- * type.
+ * be called for every updated infoframe type.
*
- * The @write_infoframe callback is mandatory.
+ * The @write_infoframe callback is mandatory for AVI and HDMI-VS
+ * InfoFrame types.
*
* Returns:
* 0 on success, a negative error code otherwise
*/
int (*write_infoframe)(struct drm_connector *connector,
- enum hdmi_infoframe_type type,
const u8 *buffer, size_t len);
+};
+
+/**
+ * struct drm_connector_hdmi_funcs - drm_hdmi_connector control functions
+ */
+struct drm_connector_hdmi_funcs {
+ /**
+ * @tmds_char_rate_valid:
+ *
+ * This callback is invoked at atomic_check time to figure out
+ * whether a particular TMDS character rate is supported by the
+ * driver.
+ *
+ * The @tmds_char_rate_valid callback is optional.
+ *
+ * Returns:
+ *
+ * Either &drm_mode_status.MODE_OK or one of the failure reasons
+ * in &enum drm_mode_status.
+ */
+ enum drm_mode_status
+ (*tmds_char_rate_valid)(const struct drm_connector *connector,
+ const struct drm_display_mode *mode,
+ unsigned long long tmds_rate);
+
/**
* @read_edid:
*
@@ -1293,6 +1297,47 @@ struct drm_connector_hdmi_funcs {
* Valid EDID on success, NULL in case of failure.
*/
const struct drm_edid *(*read_edid)(struct drm_connector *connector);
+
+ /**
+ * @avi:
+ *
+ * Set of callbacks for handling the AVI InfoFrame. These callbacks are
+ * mandatory.
+ */
+ struct drm_connector_infoframe_funcs avi;
+
+ /**
+ * @hdmi:
+ *
+ * Set of callbacks for handling the HDMI Vendor-Specific InfoFrame.
+ * These callbacks are mandatory.
+ */
+ struct drm_connector_infoframe_funcs hdmi;
+
+ /**
+ * @audio:
+ *
+ * Set of callbacks for handling the Audio InfoFrame. These callbacks
+ * are optional, but they are required for drivers which use
+ * drm_atomic_helper_connector_hdmi_update_audio_infoframe().
+ */
+ struct drm_connector_infoframe_funcs audio;
+
+ /**
+ * @hdr_drm:
+ *
+ * Set of callbacks for handling the HDR DRM InfoFrame. These callbacks
+ * are mandatory if HDR output is to be supported.
+ */
+ struct drm_connector_infoframe_funcs hdr_drm;
+
+ /**
+ * @spd:
+ *
+ * Set of callbacks for handling the SPD InfoFrame. These callbacks are
+ * optional.
+ */
+ struct drm_connector_infoframe_funcs spd;
};
/**
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 06/10] drm/display: hdmi_state_helper: split InfoFrame functions per type
2025-12-24 1:02 ` [PATCH v3 06/10] drm/display: hdmi_state_helper: split InfoFrame functions per type Dmitry Baryshkov
@ 2026-01-07 13:28 ` Maxime Ripard
0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2026-01-07 13:28 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: dri-devel, freedreno, linux-arm-kernel, linux-arm-msm,
linux-kernel, linux-mediatek, linux-rockchip, linux-sunxi,
Abhinav Kumar, Andrzej Hajda, Andy Yan,
AngeloGioacchino Del Regno, Chen-Yu Tsai, Chun-Kuang Hu,
Dave Stevenson, David Airlie, Dmitry Baryshkov,
Heiko Stübner, Jernej Skrabec, Jessica Zhang, Jonas Karlman,
Laurent Pinchart, Liu Ying, Maarten Lankhorst, Marijn Suijten,
Matthias Brugger, Maxime Ripard, Maíra Canal, Neil Armstrong,
Philipp Zabel, Raspberry Pi Kernel Maintenance, Rob Clark,
Robert Foss, Samuel Holland, Sandy Huang, Sean Paul,
Simona Vetter, Thomas Zimmermann
On Wed, 24 Dec 2025 03:02:55 +0200, Dmitry Baryshkov wrote:
> Havign a single set of InfoFrame callbacks doesn't provide enough
> information to the DRM framework about the InfoFrame types that are
> actually supported. Also it's not really future-proof: it provides a way
> to program only a single Vendor-Specific frame, however we might need to
> support multiple VSIs at the same time (e.g. HDMI vs HDMI Forum
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 07/10] drm/display: hdmi_state_helper: reject Audio IF updates if it's not supported
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
` (5 preceding siblings ...)
2025-12-24 1:02 ` [PATCH v3 06/10] drm/display: hdmi_state_helper: split InfoFrame functions per type Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2026-01-07 12:50 ` Maxime Ripard
2025-12-24 1:02 ` [PATCH v3 08/10] drm/display: hdmi_state_helper: don't generate unsupported InfoFrames Dmitry Baryshkov
` (2 subsequent siblings)
9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
Updating the InfoFrame if it can not be sent over the wire makes no
sense. Change drm_atomic_helper_connector_hdmi_update_audio_infoframe()
and drm_atomic_helper_connector_hdmi_clear_audio_infoframe() to return
an error if Audio InfoFrame callbacks are not implemented.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index 5a3817271d91..e8556bf9e1da 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -1061,7 +1061,7 @@ drm_atomic_helper_connector_hdmi_update_audio_infoframe(struct drm_connector *co
if (!info->is_hdmi)
return 0;
- if (!funcs) {
+ if (!funcs || !funcs->audio.write_infoframe) {
drm_dbg_kms(connector->dev, "Function not implemented, bailing.\n");
return -EINVAL;
}
@@ -1102,7 +1102,7 @@ drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector *con
if (!info->is_hdmi)
return 0;
- if (!funcs) {
+ if (!funcs || !funcs->audio.write_infoframe) {
drm_dbg_kms(connector->dev, "Function not implemented, bailing.\n");
return -EINVAL;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 07/10] drm/display: hdmi_state_helper: reject Audio IF updates if it's not supported
2025-12-24 1:02 ` [PATCH v3 07/10] drm/display: hdmi_state_helper: reject Audio IF updates if it's not supported Dmitry Baryshkov
@ 2026-01-07 12:50 ` Maxime Ripard
2026-01-07 13:21 ` Dmitry Baryshkov
0 siblings, 1 reply; 21+ messages in thread
From: Maxime Ripard @ 2026-01-07 12:50 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Liu Ying, Chun-Kuang Hu, Philipp Zabel, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Clark, Dmitry Baryshkov,
Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
Sandy Huang, Heiko Stübner, Andy Yan, dri-devel,
linux-kernel, linux-arm-kernel, linux-sunxi, linux-mediatek,
linux-arm-msm, freedreno, linux-rockchip
[-- Attachment #1: Type: text/plain, Size: 679 bytes --]
Hi,
On Wed, Dec 24, 2025 at 03:02:56AM +0200, Dmitry Baryshkov wrote:
> Updating the InfoFrame if it can not be sent over the wire makes no
> sense. Change drm_atomic_helper_connector_hdmi_update_audio_infoframe()
> and drm_atomic_helper_connector_hdmi_clear_audio_infoframe() to return
> an error if Audio InfoFrame callbacks are not implemented.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
IIRC, audio infoframes are mandatory if you send audio over the cable,
so maybe we should do like you did for drmm_connector_hdmi_init and
error in drm_connector_hdmi_audio_init if we don't have the proper
write_infoframe hook set?
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v3 07/10] drm/display: hdmi_state_helper: reject Audio IF updates if it's not supported
2026-01-07 12:50 ` Maxime Ripard
@ 2026-01-07 13:21 ` Dmitry Baryshkov
0 siblings, 0 replies; 21+ messages in thread
From: Dmitry Baryshkov @ 2026-01-07 13:21 UTC (permalink / raw)
To: Maxime Ripard
Cc: Maarten Lankhorst, Thomas Zimmermann, David Airlie, Simona Vetter,
Dave Stevenson, Maíra Canal, Raspberry Pi Kernel Maintenance,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Andrzej Hajda,
Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman,
Liu Ying, Chun-Kuang Hu, Philipp Zabel, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Clark, Dmitry Baryshkov,
Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
Sandy Huang, Heiko Stübner, Andy Yan, dri-devel,
linux-kernel, linux-arm-kernel, linux-sunxi, linux-mediatek,
linux-arm-msm, freedreno, linux-rockchip
On Wed, Jan 07, 2026 at 01:50:51PM +0100, Maxime Ripard wrote:
> Hi,
>
> On Wed, Dec 24, 2025 at 03:02:56AM +0200, Dmitry Baryshkov wrote:
> > Updating the InfoFrame if it can not be sent over the wire makes no
> > sense. Change drm_atomic_helper_connector_hdmi_update_audio_infoframe()
> > and drm_atomic_helper_connector_hdmi_clear_audio_infoframe() to return
> > an error if Audio InfoFrame callbacks are not implemented.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>
> IIRC, audio infoframes are mandatory if you send audio over the cable,
> so maybe we should do like you did for drmm_connector_hdmi_init and
> error in drm_connector_hdmi_audio_init if we don't have the proper
> write_infoframe hook set?
HDMI hosts can be sending Audio InfoFrames in some other way (think
about LT9611UXC, which manages infoframes on its own).
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 08/10] drm/display: hdmi_state_helper: don't generate unsupported InfoFrames
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
` (6 preceding siblings ...)
2025-12-24 1:02 ` [PATCH v3 07/10] drm/display: hdmi_state_helper: reject Audio IF updates if it's not supported Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2026-01-07 12:57 ` Maxime Ripard
2025-12-24 1:02 ` [PATCH v3 09/10] drm/display: bridge_connector: dynamically generate HDMI callbacks Dmitry Baryshkov
2025-12-24 1:02 ` [PATCH v3 10/10] drm/debug: don't register files for unsupported HDMI InfoFrames Dmitry Baryshkov
9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
There is little point in generating InfoFrames which are not supported
by the driver. Skip generating the unsupported InfoFrames, making sure
that the kernel never tries to write the unsupported frame. As there are
no remaining usecases, change write_infoframe / clear_infoframe helpers
return an error if the corresponding callback is NULL.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index e8556bf9e1da..a1d16762ac7a 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -718,6 +718,9 @@ static int hdmi_generate_spd_infoframe(const struct drm_connector *connector,
infoframe->set = false;
+ if (!connector->hdmi.funcs->spd.write_infoframe)
+ return 0;
+
ret = hdmi_spd_infoframe_init(frame,
connector->hdmi.vendor,
connector->hdmi.product);
@@ -742,6 +745,9 @@ static int hdmi_generate_hdr_infoframe(const struct drm_connector *connector,
infoframe->set = false;
+ if (!connector->hdmi.funcs->hdr_drm.write_infoframe)
+ return 0;
+
if (connector->max_bpc < 10)
return 0;
@@ -902,7 +908,7 @@ static int clear_infoframe(struct drm_connector *connector,
if (!funcs->clear_infoframe) {
drm_dbg_kms(dev, "Function not implemented, bailing.\n");
- return 0;
+ return -EOPNOTSUPP;
}
ret = funcs->clear_infoframe(connector);
@@ -928,7 +934,7 @@ static int write_infoframe(struct drm_connector *connector,
if (!funcs->write_infoframe) {
drm_dbg_kms(dev, "Function not implemented, bailing.\n");
- return 0; /* XXX: temporal until we stop generating unsupported frames */
+ return -EOPNOTSUPP;
}
len = hdmi_infoframe_pack(&new_frame->data, buffer, sizeof(buffer));
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 08/10] drm/display: hdmi_state_helper: don't generate unsupported InfoFrames
2025-12-24 1:02 ` [PATCH v3 08/10] drm/display: hdmi_state_helper: don't generate unsupported InfoFrames Dmitry Baryshkov
@ 2026-01-07 12:57 ` Maxime Ripard
0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2026-01-07 12:57 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: dri-devel, freedreno, linux-arm-kernel, linux-arm-msm,
linux-kernel, linux-mediatek, linux-rockchip, linux-sunxi,
Abhinav Kumar, Andrzej Hajda, Andy Yan,
AngeloGioacchino Del Regno, Chen-Yu Tsai, Chun-Kuang Hu,
Dave Stevenson, David Airlie, Dmitry Baryshkov,
Heiko Stübner, Jernej Skrabec, Jessica Zhang, Jonas Karlman,
Laurent Pinchart, Liu Ying, Maarten Lankhorst, Marijn Suijten,
Matthias Brugger, Maxime Ripard, Maíra Canal, Neil Armstrong,
Philipp Zabel, Raspberry Pi Kernel Maintenance, Rob Clark,
Robert Foss, Samuel Holland, Sandy Huang, Sean Paul,
Simona Vetter, Thomas Zimmermann
On Wed, 24 Dec 2025 03:02:57 +0200, Dmitry Baryshkov wrote:
> There is little point in generating InfoFrames which are not supported
> by the driver. Skip generating the unsupported InfoFrames, making sure
> that the kernel never tries to write the unsupported frame. As there are
> no remaining usecases, change write_infoframe / clear_infoframe helpers
> return an error if the corresponding callback is NULL.
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 09/10] drm/display: bridge_connector: dynamically generate HDMI callbacks
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
` (7 preceding siblings ...)
2025-12-24 1:02 ` [PATCH v3 08/10] drm/display: hdmi_state_helper: don't generate unsupported InfoFrames Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2026-01-07 13:28 ` Maxime Ripard
2025-12-24 1:02 ` [PATCH v3 10/10] drm/debug: don't register files for unsupported HDMI InfoFrames Dmitry Baryshkov
9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
The rest of the DRM framework uses presence of the callbacks to check if
the particular infoframe is supported. Register HDMI callbacks
dynamically, basing on the corresponding drm_bridge ops.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/display/drm_bridge_connector.c | 94 ++++++++++++--------------
1 file changed, 45 insertions(+), 49 deletions(-)
diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c
index c8858d48199c..2a8f586c6d13 100644
--- a/drivers/gpu/drm/display/drm_bridge_connector.c
+++ b/drivers/gpu/drm/display/drm_bridge_connector.c
@@ -123,6 +123,14 @@ struct drm_bridge_connector {
* DRM_BRIDGE_OP_HDMI_CEC_NOTIFIER).
*/
struct drm_bridge *bridge_hdmi_cec;
+
+ /**
+ * @hdmi_funcs:
+ *
+ * The particular &drm_connector_hdmi_funcs implementation for this
+ * bridge connector.
+ */
+ struct drm_connector_hdmi_funcs hdmi_funcs;
};
#define to_drm_bridge_connector(x) \
@@ -465,12 +473,7 @@ static int drm_bridge_connector_clear_audio_infoframe(struct drm_connector *conn
if (!bridge)
return -EINVAL;
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_AUDIO)
- return bridge->funcs->hdmi_clear_audio_infoframe(bridge);
-
- drm_dbg_driver(connector->dev, "Unsupported HDMI Audio InfoFrame\n");
-
- return 0;
+ return bridge->funcs->hdmi_clear_audio_infoframe(bridge);
}
static int drm_bridge_connector_write_audio_infoframe(struct drm_connector *connector,
@@ -484,12 +487,7 @@ static int drm_bridge_connector_write_audio_infoframe(struct drm_connector *conn
if (!bridge)
return -EINVAL;
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_AUDIO)
- return bridge->funcs->hdmi_write_audio_infoframe(bridge, buffer, len);
-
- drm_dbg_driver(connector->dev, "Unsupported HDMI Audio InfoFrame\n");
-
- return 0;
+ return bridge->funcs->hdmi_write_audio_infoframe(bridge, buffer, len);
}
static int drm_bridge_connector_clear_hdr_drm_infoframe(struct drm_connector *connector)
@@ -502,12 +500,7 @@ static int drm_bridge_connector_clear_hdr_drm_infoframe(struct drm_connector *co
if (!bridge)
return -EINVAL;
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME)
- return bridge->funcs->hdmi_clear_hdr_drm_infoframe(bridge);
-
- drm_dbg_driver(connector->dev, "Unsupported HDMI HDR DRM InfoFrame\n");
-
- return 0;
+ return bridge->funcs->hdmi_clear_hdr_drm_infoframe(bridge);
}
static int drm_bridge_connector_write_hdr_drm_infoframe(struct drm_connector *connector,
@@ -521,12 +514,7 @@ static int drm_bridge_connector_write_hdr_drm_infoframe(struct drm_connector *co
if (!bridge)
return -EINVAL;
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME)
- return bridge->funcs->hdmi_write_hdr_drm_infoframe(bridge, buffer, len);
-
- drm_dbg_driver(connector->dev, "Unsupported HDMI HDR DRM InfoFrame\n");
-
- return 0;
+ return bridge->funcs->hdmi_write_hdr_drm_infoframe(bridge, buffer, len);
}
static int drm_bridge_connector_clear_spd_infoframe(struct drm_connector *connector)
@@ -539,12 +527,7 @@ static int drm_bridge_connector_clear_spd_infoframe(struct drm_connector *connec
if (!bridge)
return -EINVAL;
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME)
- return bridge->funcs->hdmi_clear_spd_infoframe(bridge);
-
- drm_dbg_driver(connector->dev, "Unsupported HDMI SPD InfoFrame\n");
-
- return 0;
+ return bridge->funcs->hdmi_clear_spd_infoframe(bridge);
}
static int drm_bridge_connector_write_spd_infoframe(struct drm_connector *connector,
@@ -558,12 +541,7 @@ static int drm_bridge_connector_write_spd_infoframe(struct drm_connector *connec
if (!bridge)
return -EINVAL;
- if (bridge->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME)
- return bridge->funcs->hdmi_write_spd_infoframe(bridge, buffer, len);
-
- drm_dbg_driver(connector->dev, "Unsupported HDMI SPD InfoFrame\n");
-
- return 0;
+ return bridge->funcs->hdmi_write_spd_infoframe(bridge, buffer, len);
}
static const struct drm_edid *
@@ -591,18 +569,22 @@ static const struct drm_connector_hdmi_funcs drm_bridge_connector_hdmi_funcs = {
.clear_infoframe = drm_bridge_connector_clear_hdmi_infoframe,
.write_infoframe = drm_bridge_connector_write_hdmi_infoframe,
},
- .audio = {
- .clear_infoframe = drm_bridge_connector_clear_audio_infoframe,
- .write_infoframe = drm_bridge_connector_write_audio_infoframe,
- },
- .hdr_drm = {
- .clear_infoframe = drm_bridge_connector_clear_hdr_drm_infoframe,
- .write_infoframe = drm_bridge_connector_write_hdr_drm_infoframe,
- },
- .spd = {
- .clear_infoframe = drm_bridge_connector_clear_spd_infoframe,
- .write_infoframe = drm_bridge_connector_write_spd_infoframe,
- },
+ /* audio, hdr_drm and spd are set dynamically during init */
+};
+
+static const struct drm_connector_infoframe_funcs drm_bridge_connector_hdmi_audio_infoframe = {
+ .clear_infoframe = drm_bridge_connector_clear_audio_infoframe,
+ .write_infoframe = drm_bridge_connector_write_audio_infoframe,
+};
+
+static const struct drm_connector_infoframe_funcs drm_bridge_connector_hdmi_hdr_drm_infoframe = {
+ .clear_infoframe = drm_bridge_connector_clear_hdr_drm_infoframe,
+ .write_infoframe = drm_bridge_connector_write_hdr_drm_infoframe,
+};
+
+static const struct drm_connector_infoframe_funcs drm_bridge_connector_hdmi_spd_infoframe = {
+ .clear_infoframe = drm_bridge_connector_clear_spd_infoframe,
+ .write_infoframe = drm_bridge_connector_write_spd_infoframe,
};
static int drm_bridge_connector_audio_startup(struct drm_connector *connector)
@@ -971,11 +953,25 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
if (!connector->ycbcr_420_allowed)
supported_formats &= ~BIT(HDMI_COLORSPACE_YUV420);
+ bridge_connector->hdmi_funcs = drm_bridge_connector_hdmi_funcs;
+
+ if (bridge_connector->bridge_hdmi->ops & DRM_BRIDGE_OP_HDMI_AUDIO)
+ bridge_connector->hdmi_funcs.audio =
+ drm_bridge_connector_hdmi_audio_infoframe;
+
+ if (bridge_connector->bridge_hdmi->ops & DRM_BRIDGE_OP_HDMI_HDR_DRM_INFOFRAME)
+ bridge_connector->hdmi_funcs.hdr_drm =
+ drm_bridge_connector_hdmi_hdr_drm_infoframe;
+
+ if (bridge_connector->bridge_hdmi->ops & DRM_BRIDGE_OP_HDMI_SPD_INFOFRAME)
+ bridge_connector->hdmi_funcs.spd =
+ drm_bridge_connector_hdmi_spd_infoframe;
+
ret = drmm_connector_hdmi_init(drm, connector,
bridge_connector->bridge_hdmi->vendor,
bridge_connector->bridge_hdmi->product,
&drm_bridge_connector_funcs,
- &drm_bridge_connector_hdmi_funcs,
+ &bridge_connector->hdmi_funcs,
connector_type, ddc,
supported_formats,
max_bpc);
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 09/10] drm/display: bridge_connector: dynamically generate HDMI callbacks
2025-12-24 1:02 ` [PATCH v3 09/10] drm/display: bridge_connector: dynamically generate HDMI callbacks Dmitry Baryshkov
@ 2026-01-07 13:28 ` Maxime Ripard
0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2026-01-07 13:28 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: dri-devel, freedreno, linux-arm-kernel, linux-arm-msm,
linux-kernel, linux-mediatek, linux-rockchip, linux-sunxi,
Abhinav Kumar, Andrzej Hajda, Andy Yan,
AngeloGioacchino Del Regno, Chen-Yu Tsai, Chun-Kuang Hu,
Dave Stevenson, David Airlie, Dmitry Baryshkov,
Heiko Stübner, Jernej Skrabec, Jessica Zhang, Jonas Karlman,
Laurent Pinchart, Liu Ying, Maarten Lankhorst, Marijn Suijten,
Matthias Brugger, Maxime Ripard, Maíra Canal, Neil Armstrong,
Philipp Zabel, Raspberry Pi Kernel Maintenance, Rob Clark,
Robert Foss, Samuel Holland, Sandy Huang, Sean Paul,
Simona Vetter, Thomas Zimmermann
On Wed, 24 Dec 2025 03:02:58 +0200, Dmitry Baryshkov wrote:
> The rest of the DRM framework uses presence of the callbacks to check if
> the particular infoframe is supported. Register HDMI callbacks
> dynamically, basing on the corresponding drm_bridge ops.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>
> [ ... ]
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v3 10/10] drm/debug: don't register files for unsupported HDMI InfoFrames
2025-12-24 1:02 [PATCH v3 00/10] drm/connector: hdmi: limit infoframes per driver capabilities, second approach Dmitry Baryshkov
` (8 preceding siblings ...)
2025-12-24 1:02 ` [PATCH v3 09/10] drm/display: bridge_connector: dynamically generate HDMI callbacks Dmitry Baryshkov
@ 2025-12-24 1:02 ` Dmitry Baryshkov
2026-01-07 12:47 ` Maxime Ripard
9 siblings, 1 reply; 21+ messages in thread
From: Dmitry Baryshkov @ 2025-12-24 1:02 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
Simona Vetter, Dave Stevenson, Maíra Canal,
Raspberry Pi Kernel Maintenance, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Liu Ying, Chun-Kuang Hu,
Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, Sandy Huang, Heiko Stübner,
Andy Yan
Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-sunxi,
linux-mediatek, linux-arm-msm, freedreno, linux-rockchip
Having debugfs files for the InfoFrames that are not supported by the
driver is confusing, stop registering those in the debugfs.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/gpu/drm/drm_debugfs.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 365cf337529f..ae1c6126c2c5 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -672,6 +672,10 @@ static int create_hdmi_audio_infoframe_file(struct drm_connector *connector,
{
struct dentry *file;
+ if (!connector->hdmi.funcs ||
+ !connector->hdmi.funcs->audio.write_infoframe)
+ return 0;
+
file = debugfs_create_file("audio", 0400, parent, connector, &audio_infoframe_fops);
if (IS_ERR(file))
return PTR_ERR(file);
@@ -726,6 +730,9 @@ static int create_hdmi_## _f ## _infoframe_file(struct drm_connector *connector,
{ \
struct dentry *file; \
\
+ if (!connector->hdmi.funcs || \
+ !connector->hdmi.funcs->_f.write_infoframe) \
+ return 0; \
file = debugfs_create_file(#_f, 0400, parent, connector, &_f ## _infoframe_fops); \
if (IS_ERR(file)) \
return PTR_ERR(file); \
--
2.47.3
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH v3 10/10] drm/debug: don't register files for unsupported HDMI InfoFrames
2025-12-24 1:02 ` [PATCH v3 10/10] drm/debug: don't register files for unsupported HDMI InfoFrames Dmitry Baryshkov
@ 2026-01-07 12:47 ` Maxime Ripard
0 siblings, 0 replies; 21+ messages in thread
From: Maxime Ripard @ 2026-01-07 12:47 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: dri-devel, freedreno, linux-arm-kernel, linux-arm-msm,
linux-kernel, linux-mediatek, linux-rockchip, linux-sunxi,
Abhinav Kumar, Andrzej Hajda, Andy Yan,
AngeloGioacchino Del Regno, Chen-Yu Tsai, Chun-Kuang Hu,
Dave Stevenson, David Airlie, Dmitry Baryshkov,
Heiko Stübner, Jernej Skrabec, Jessica Zhang, Jonas Karlman,
Laurent Pinchart, Liu Ying, Maarten Lankhorst, Marijn Suijten,
Matthias Brugger, Maxime Ripard, Maíra Canal, Neil Armstrong,
Philipp Zabel, Raspberry Pi Kernel Maintenance, Rob Clark,
Robert Foss, Samuel Holland, Sandy Huang, Sean Paul,
Simona Vetter, Thomas Zimmermann
On Wed, 24 Dec 2025 03:02:59 +0200, Dmitry Baryshkov wrote:
> Having debugfs files for the InfoFrames that are not supported by the
> driver is confusing, stop registering those in the debugfs.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Thanks!
Maxime
^ permalink raw reply [flat|nested] 21+ messages in thread