|
28 | 28 | * Authors: Dave Airlie <airlied@redhat.com> |
29 | 29 | */ |
30 | 30 |
|
| 31 | +#include <linux/delay.h> |
31 | 32 | #include <linux/export.h> |
32 | 33 | #include <linux/pci.h> |
33 | 34 |
|
@@ -1687,11 +1688,35 @@ static int ast_astdp_connector_helper_detect_ctx(struct drm_connector *connector |
1687 | 1688 | struct drm_modeset_acquire_ctx *ctx, |
1688 | 1689 | bool force) |
1689 | 1690 | { |
| 1691 | + struct drm_device *dev = connector->dev; |
1690 | 1692 | 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 | + } |
1691 | 1710 |
|
1692 | 1711 | 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; |
1695 | 1720 | } |
1696 | 1721 |
|
1697 | 1722 | static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs = { |
|
0 commit comments