Skip to content

Commit 0ce9192

Browse files
author
Thomas Zimmermann
committed
drm/ast: astdp: Wake up during connector status detection
Power up the ASTDP connector for connection status detection if the connector is not active. Keep it powered if a display is attached. This fixes a bug where the connector does not come back after disconnecting the display. The encoder's atomic_disable turns off power on the physical connector. Further HPD reads will fail, thus preventing the driver from detecting re-connected displays. For connectors that are actively used, only test the HPD flag without touching power. Fixes: f81bb0a ("drm/ast: report connection status on Display Port.") Cc: Jocelyn Falempe <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: Dave Airlie <[email protected]> Cc: [email protected] Cc: <[email protected]> # v6.6+ Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Jocelyn Falempe <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 11dcda9 commit 0ce9192

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

drivers/gpu/drm/ast/ast_dp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,14 @@ void ast_dp_launch(struct drm_device *dev)
158158
ASTDP_HOST_EDID_READ_DONE);
159159
}
160160

161+
bool ast_dp_power_is_on(struct ast_device *ast)
162+
{
163+
u8 vgacre3;
164+
165+
vgacre3 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xe3);
161166

167+
return !(vgacre3 & AST_DP_PHY_SLEEP);
168+
}
162169

163170
void ast_dp_power_on_off(struct drm_device *dev, bool on)
164171
{

drivers/gpu/drm/ast/ast_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ void ast_init_3rdtx(struct drm_device *dev);
472472
bool ast_astdp_is_connected(struct ast_device *ast);
473473
int ast_astdp_read_edid(struct drm_device *dev, u8 *ediddata);
474474
void ast_dp_launch(struct drm_device *dev);
475+
bool ast_dp_power_is_on(struct ast_device *ast);
475476
void ast_dp_power_on_off(struct drm_device *dev, bool no);
476477
void ast_dp_set_on_off(struct drm_device *dev, bool no);
477478
void ast_dp_set_mode(struct drm_crtc *crtc, struct ast_vbios_mode_info *vbios_mode);

drivers/gpu/drm/ast/ast_mode.c

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* Authors: Dave Airlie <[email protected]>
2929
*/
3030

31+
#include <linux/delay.h>
3132
#include <linux/export.h>
3233
#include <linux/pci.h>
3334

@@ -1687,11 +1688,35 @@ static int ast_astdp_connector_helper_detect_ctx(struct drm_connector *connector
16871688
struct drm_modeset_acquire_ctx *ctx,
16881689
bool force)
16891690
{
1691+
struct drm_device *dev = connector->dev;
16901692
struct ast_device *ast = to_ast_device(connector->dev);
1693+
enum drm_connector_status status = connector_status_disconnected;
1694+
struct drm_connector_state *connector_state = connector->state;
1695+
bool is_active = false;
1696+
1697+
mutex_lock(&ast->modeset_lock);
1698+
1699+
if (connector_state && connector_state->crtc) {
1700+
struct drm_crtc_state *crtc_state = connector_state->crtc->state;
1701+
1702+
if (crtc_state && crtc_state->active)
1703+
is_active = true;
1704+
}
1705+
1706+
if (!is_active && !ast_dp_power_is_on(ast)) {
1707+
ast_dp_power_on_off(dev, true);
1708+
msleep(50);
1709+
}
16911710

16921711
if (ast_astdp_is_connected(ast))
1693-
return connector_status_connected;
1694-
return connector_status_disconnected;
1712+
status = connector_status_connected;
1713+
1714+
if (!is_active && status == connector_status_disconnected)
1715+
ast_dp_power_on_off(dev, false);
1716+
1717+
mutex_unlock(&ast->modeset_lock);
1718+
1719+
return status;
16951720
}
16961721

16971722
static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs = {

0 commit comments

Comments
 (0)