Read the display modes from the connectors DDC helper, which also updates the connector's EDID property. The code for the connector's .get_modes helper is now shared between VGA and SIL164. Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx> --- drivers/gpu/drm/ast/ast_mode.c | 57 ++-------------------------------- 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index db2010a55674..57f41e56c6cb 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -1302,37 +1302,19 @@ static int ast_crtc_init(struct drm_device *dev) static int ast_vga_connector_helper_get_modes(struct drm_connector *connector) { - struct ast_vga_connector *ast_vga_connector = to_ast_vga_connector(connector); struct drm_device *dev = connector->dev; struct ast_private *ast = to_ast_private(dev); - struct edid *edid; int count; - if (!ast_vga_connector->i2c) - goto err_drm_connector_update_edid_property; - /* * Protect access to I/O registers from concurrent modesetting * by acquiring the I/O-register lock. */ mutex_lock(&ast->ioregs_lock); - - edid = drm_get_edid(connector, &ast_vga_connector->i2c->adapter); - if (!edid) - goto err_mutex_unlock; - + count = drm_connector_helper_get_modes_from_ddc(connector); mutex_unlock(&ast->ioregs_lock); - count = drm_add_edid_modes(connector, edid); - kfree(edid); - return count; - -err_mutex_unlock: - mutex_unlock(&ast->ioregs_lock); -err_drm_connector_update_edid_property: - drm_connector_update_edid_property(connector, NULL); - return 0; } static const struct drm_connector_helper_funcs ast_vga_connector_helper_funcs = { @@ -1406,43 +1388,8 @@ static int ast_vga_output_init(struct ast_private *ast) * SIL164 Connector */ -static int ast_sil164_connector_helper_get_modes(struct drm_connector *connector) -{ - struct ast_sil164_connector *ast_sil164_connector = to_ast_sil164_connector(connector); - struct drm_device *dev = connector->dev; - struct ast_private *ast = to_ast_private(dev); - struct edid *edid; - int count; - - if (!ast_sil164_connector->i2c) - goto err_drm_connector_update_edid_property; - - /* - * Protect access to I/O registers from concurrent modesetting - * by acquiring the I/O-register lock. - */ - mutex_lock(&ast->ioregs_lock); - - edid = drm_get_edid(connector, &ast_sil164_connector->i2c->adapter); - if (!edid) - goto err_mutex_unlock; - - mutex_unlock(&ast->ioregs_lock); - - count = drm_add_edid_modes(connector, edid); - kfree(edid); - - return count; - -err_mutex_unlock: - mutex_unlock(&ast->ioregs_lock); -err_drm_connector_update_edid_property: - drm_connector_update_edid_property(connector, NULL); - return 0; -} - static const struct drm_connector_helper_funcs ast_sil164_connector_helper_funcs = { - .get_modes = ast_sil164_connector_helper_get_modes, + .get_modes = ast_vga_connector_helper_get_modes, // same as VGA connector }; static const struct drm_connector_funcs ast_sil164_connector_funcs = { -- 2.36.1