Hi Am 02.06.22 um 09:24 schrieb Patrik Jakobsson:
On Tue, May 31, 2022 at 1:15 PM Thomas Zimmermann <tzimmermann@xxxxxxx> wrote: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> --- 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 e19dd2f9b3ce..4ff8ec1c8931 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)Since this function is now generic you could consider removing _vga from the name.
It's not fully generic. There are DisplayPort functions that do their own thing.
From how I understand the driver's source code, there's a hardware setting to switch between either analog VGA or SIL164-based DVI. Both use the same registers. So the get_modes function can be shared.
Best regards Thomas
Either way: Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@xxxxxxxxx>{ - 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
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature