Skip to content

Commit 3692aba

Browse files
jammyaspeedThomas Zimmermann
authored andcommitted
drm/ast: Fix modeset failed on DisplayPort
If we switch display and update cursor together, it could lead to modeset failed because of concurrent access to IO registers. Add lock protection in DP's edid access to avoid this problem. Reviewed-by: Thomas Zimmermann <[email protected]> Signed-off-by: Jammy Huang <[email protected]> Signed-off-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent bed61c8 commit 3692aba

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,8 @@ static int ast_dp501_output_init(struct ast_device *ast)
16471647
static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)
16481648
{
16491649
void *edid;
1650+
struct drm_device *dev = connector->dev;
1651+
struct ast_device *ast = to_ast_device(dev);
16501652

16511653
int succ;
16521654
int count;
@@ -1655,17 +1657,26 @@ static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)
16551657
if (!edid)
16561658
goto err_drm_connector_update_edid_property;
16571659

1660+
/*
1661+
* Protect access to I/O registers from concurrent modesetting
1662+
* by acquiring the I/O-register lock.
1663+
*/
1664+
mutex_lock(&ast->ioregs_lock);
1665+
16581666
succ = ast_astdp_read_edid(connector->dev, edid);
16591667
if (succ < 0)
1660-
goto err_kfree;
1668+
goto err_mutex_unlock;
1669+
1670+
mutex_unlock(&ast->ioregs_lock);
16611671

16621672
drm_connector_update_edid_property(connector, edid);
16631673
count = drm_add_edid_modes(connector, edid);
16641674
kfree(edid);
16651675

16661676
return count;
16671677

1668-
err_kfree:
1678+
err_mutex_unlock:
1679+
mutex_unlock(&ast->ioregs_lock);
16691680
kfree(edid);
16701681
err_drm_connector_update_edid_property:
16711682
drm_connector_update_edid_property(connector, NULL);

0 commit comments

Comments
 (0)