]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/bridge/analogix/anx78xx: switch to struct drm_edid
authorJani Nikula <jani.nikula@intel.com>
Fri, 10 May 2024 13:26:05 +0000 (16:26 +0300)
committerRobert Foss <rfoss@kernel.org>
Mon, 13 May 2024 17:10:53 +0000 (19:10 +0200)
Prefer struct drm_edid based functions over struct edid.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Robert Foss <rfoss@kernel.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/035c7c31a3e096625a69eb4657c1727da4021a62.1715347488.git.jani.nikula@intel.com
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c

index 58875dde496f399dcc030ea87e18399b3281a5a7..f74694bb9c50a2f71d51d27e08c08bb854cf29ea 100644 (file)
@@ -67,7 +67,7 @@ struct anx78xx {
        struct drm_dp_aux aux;
        struct drm_bridge bridge;
        struct i2c_client *client;
-       struct edid *edid;
+       const struct drm_edid *drm_edid;
        struct drm_connector connector;
        struct anx78xx_platform_data pdata;
        struct mutex lock;
@@ -830,8 +830,8 @@ static int anx78xx_get_modes(struct drm_connector *connector)
        if (WARN_ON(!anx78xx->powered))
                return 0;
 
-       if (anx78xx->edid)
-               return drm_add_edid_modes(connector, anx78xx->edid);
+       if (anx78xx->drm_edid)
+               return drm_edid_connector_add_modes(connector);
 
        mutex_lock(&anx78xx->lock);
 
@@ -841,20 +841,21 @@ static int anx78xx_get_modes(struct drm_connector *connector)
                goto unlock;
        }
 
-       anx78xx->edid = drm_get_edid(connector, &anx78xx->aux.ddc);
-       if (!anx78xx->edid) {
+       anx78xx->drm_edid = drm_edid_read_ddc(connector, &anx78xx->aux.ddc);
+
+       err = drm_edid_connector_update(connector, anx78xx->drm_edid);
+
+       if (!anx78xx->drm_edid) {
                DRM_ERROR("Failed to read EDID\n");
                goto unlock;
        }
 
-       err = drm_connector_update_edid_property(connector,
-                                                anx78xx->edid);
        if (err) {
                DRM_ERROR("Failed to update EDID property: %d\n", err);
                goto unlock;
        }
 
-       num_modes = drm_add_edid_modes(connector, anx78xx->edid);
+       num_modes = drm_edid_connector_add_modes(connector);
 
 unlock:
        mutex_unlock(&anx78xx->lock);
@@ -1086,8 +1087,8 @@ static bool anx78xx_handle_common_int_4(struct anx78xx *anx78xx, u8 irq)
                event = true;
                anx78xx_poweroff(anx78xx);
                /* Free cached EDID */
-               kfree(anx78xx->edid);
-               anx78xx->edid = NULL;
+               drm_edid_free(anx78xx->drm_edid);
+               anx78xx->drm_edid = NULL;
        } else if (irq & SP_HPD_PLUG) {
                DRM_DEBUG_KMS("IRQ: Hot plug detect - cable plug\n");
                event = true;
@@ -1358,7 +1359,7 @@ static void anx78xx_i2c_remove(struct i2c_client *client)
 
        unregister_i2c_dummy_clients(anx78xx);
 
-       kfree(anx78xx->edid);
+       drm_edid_free(anx78xx->drm_edid);
 }
 
 static const struct of_device_id anx78xx_match_table[] = {