Skip to content

Commit 770a961

Browse files
committed
drm/ast: astdp: Simplify power management when detecting display
Remove the CRTC handling in the ASTDP detect_ctx helper and enable power while the detecting the display. Unconditionally wait a few milliseconds after switching power. Simplifies the code and makes it more robust. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240815151953.184679-6-tzimmermann@suse.de
1 parent 0e35457 commit 770a961

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

drivers/gpu/drm/ast/ast_dp.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ static void ast_dp_power_on_off(struct drm_device *dev, bool on)
170170

171171
// DP Power on/off
172172
ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xE3, (u8) ~AST_DP_PHY_SLEEP, bE3);
173+
174+
msleep(50);
173175
}
174176

175177
static void ast_dp_link_training(struct ast_device *ast)
@@ -367,27 +369,18 @@ static int ast_astdp_connector_helper_detect_ctx(struct drm_connector *connector
367369
struct drm_device *dev = connector->dev;
368370
struct ast_device *ast = to_ast_device(connector->dev);
369371
enum drm_connector_status status = connector_status_disconnected;
370-
struct drm_connector_state *connector_state = connector->state;
371-
bool is_active = false;
372+
bool power_is_on;
372373

373374
mutex_lock(&ast->modeset_lock);
374375

375-
if (connector_state && connector_state->crtc) {
376-
struct drm_crtc_state *crtc_state = connector_state->crtc->state;
377-
378-
if (crtc_state && crtc_state->active)
379-
is_active = true;
380-
}
381-
382-
if (!is_active && !ast_dp_power_is_on(ast)) {
376+
power_is_on = ast_dp_power_is_on(ast);
377+
if (!power_is_on)
383378
ast_dp_power_on_off(dev, true);
384-
msleep(50);
385-
}
386379

387380
if (ast_astdp_is_connected(ast))
388381
status = connector_status_connected;
389382

390-
if (!is_active && status == connector_status_disconnected)
383+
if (!power_is_on && status == connector_status_disconnected)
391384
ast_dp_power_on_off(dev, false);
392385

393386
mutex_unlock(&ast->modeset_lock);

0 commit comments

Comments
 (0)