Message ID | 035c7c31a3e096625a69eb4657c1727da4021a62.1715347488.git.jani.nikula@intel.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | drm: struct drm_edid conversions | expand |
On Fri, May 10, 2024 at 3:26 PM Jani Nikula <jani.nikula@intel.com> wrote: > > Prefer struct drm_edid based functions over struct edid. > > Signed-off-by: Jani Nikula <jani.nikula@intel.com> > > --- > > Cc: Andrzej Hajda <andrzej.hajda@intel.com> > Cc: Neil Armstrong <neil.armstrong@linaro.org> > Cc: Robert Foss <rfoss@kernel.org> > Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> > Cc: Jonas Karlman <jonas@kwiboo.se> > Cc: Jernej Skrabec <jernej.skrabec@gmail.com> > --- > .../drm/bridge/analogix/analogix-anx78xx.c | 23 ++++++++++--------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c > index 5748a8581af4..ae79bcd8fa55 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c > @@ -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); > @@ -1091,8 +1092,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; > @@ -1363,7 +1364,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[] = { > -- > 2.39.2 > Reviewed-by: Robert Foss <rfoss@kernel.org>
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c index 5748a8581af4..ae79bcd8fa55 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c @@ -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); @@ -1091,8 +1092,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; @@ -1363,7 +1364,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[] = {
Prefer struct drm_edid based functions over struct edid. Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- Cc: Andrzej Hajda <andrzej.hajda@intel.com> Cc: Neil Armstrong <neil.armstrong@linaro.org> Cc: Robert Foss <rfoss@kernel.org> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Jonas Karlman <jonas@kwiboo.se> Cc: Jernej Skrabec <jernej.skrabec@gmail.com> --- .../drm/bridge/analogix/analogix-anx78xx.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-)