drm/omap/hdmi4: switch to ->edid_read callback
authorJani Nikula <jani.nikula@intel.com>
Tue, 23 Jan 2024 19:37:36 +0000 (21:37 +0200)
committerJani Nikula <jani.nikula@intel.com>
Fri, 9 Feb 2024 08:15:59 +0000 (10:15 +0200)
Prefer using the struct drm_edid based callback and functions.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/4c9b24a399e8f305698f8fe5ebd687bfd6ce2e59.1706038510.git.jani.nikula@intel.com
drivers/gpu/drm/omapdrm/dss/hdmi4.c

index a26b77d99d52ae111f4901114fa35e667d869e27..9b8747d83ee877046ed9d0dfae626a4f3bccb6b2 100644 (file)
@@ -436,11 +436,11 @@ static void hdmi4_bridge_hpd_notify(struct drm_bridge *bridge,
                hdmi4_cec_set_phys_addr(&hdmi->core, CEC_PHYS_ADDR_INVALID);
 }
 
-static struct edid *hdmi4_bridge_get_edid(struct drm_bridge *bridge,
-                                         struct drm_connector *connector)
+static const struct drm_edid *hdmi4_bridge_edid_read(struct drm_bridge *bridge,
+                                                    struct drm_connector *connector)
 {
        struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
-       struct edid *edid = NULL;
+       const struct drm_edid *drm_edid = NULL;
        unsigned int cec_addr;
        bool need_enable;
        int r;
@@ -461,13 +461,21 @@ static struct edid *hdmi4_bridge_get_edid(struct drm_bridge *bridge,
        if (r)
                goto done;
 
-       edid = drm_do_get_edid(connector, hdmi4_core_ddc_read, &hdmi->core);
+       drm_edid = drm_edid_read_custom(connector, hdmi4_core_ddc_read, &hdmi->core);
 
 done:
        hdmi_runtime_put(hdmi);
        mutex_unlock(&hdmi->lock);
 
-       if (edid && edid->extensions) {
+       if (drm_edid) {
+               /*
+                * FIXME: The CEC physical address should be set using
+                * hdmi4_cec_set_phys_addr(&hdmi->core,
+                * connector->display_info.source_physical_address) from a path
+                * that has read the EDID and called
+                * drm_edid_connector_update().
+                */
+               const struct edid *edid = drm_edid_raw(drm_edid);
                unsigned int len = (edid->extensions + 1) * EDID_LENGTH;
 
                cec_addr = cec_get_edid_phys_addr((u8 *)edid, len, NULL);
@@ -480,7 +488,7 @@ done:
        if (need_enable)
                hdmi4_core_disable(&hdmi->core);
 
-       return edid;
+       return drm_edid;
 }
 
 static const struct drm_bridge_funcs hdmi4_bridge_funcs = {
@@ -492,7 +500,7 @@ static const struct drm_bridge_funcs hdmi4_bridge_funcs = {
        .atomic_enable = hdmi4_bridge_enable,
        .atomic_disable = hdmi4_bridge_disable,
        .hpd_notify = hdmi4_bridge_hpd_notify,
-       .get_edid = hdmi4_bridge_get_edid,
+       .edid_read = hdmi4_bridge_edid_read,
 };
 
 static void hdmi4_bridge_init(struct omap_hdmi *hdmi)