Commit 3b0a01a6 authored by Stefan Eichenberger's avatar Stefan Eichenberger Committed by Robert Foss

drm/bridge: lt8912b: Add hot plug detection

Enable hot plug detection when it is available on the HDMI port.
Without this connecting to a different monitor with incompatible timing
before the 10 seconds poll period will lead to a broken display output.

Fixes: 30e2ae94 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
Signed-off-by: default avatarStefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: default avatarFrancesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: default avatarAdrien Grassein <adrien.grassein@gmail.com>
Reviewed-by: default avatarRobert Foss <robert.foss@linaro.org>
Signed-off-by: default avatarRobert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20221128112320.25708-1-francesco@dolcini.it
parent 8dc6de28
...@@ -517,14 +517,27 @@ static int lt8912_attach_dsi(struct lt8912 *lt) ...@@ -517,14 +517,27 @@ static int lt8912_attach_dsi(struct lt8912 *lt)
return 0; return 0;
} }
static void lt8912_bridge_hpd_cb(void *data, enum drm_connector_status status)
{
struct lt8912 *lt = data;
if (lt->bridge.dev)
drm_helper_hpd_irq_event(lt->bridge.dev);
}
static int lt8912_bridge_connector_init(struct drm_bridge *bridge) static int lt8912_bridge_connector_init(struct drm_bridge *bridge)
{ {
int ret; int ret;
struct lt8912 *lt = bridge_to_lt8912(bridge); struct lt8912 *lt = bridge_to_lt8912(bridge);
struct drm_connector *connector = &lt->connector; struct drm_connector *connector = &lt->connector;
if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) {
drm_bridge_hpd_enable(lt->hdmi_port, lt8912_bridge_hpd_cb, lt);
connector->polled = DRM_CONNECTOR_POLL_HPD;
} else {
connector->polled = DRM_CONNECTOR_POLL_CONNECT | connector->polled = DRM_CONNECTOR_POLL_CONNECT |
DRM_CONNECTOR_POLL_DISCONNECT; DRM_CONNECTOR_POLL_DISCONNECT;
}
ret = drm_connector_init(bridge->dev, connector, ret = drm_connector_init(bridge->dev, connector,
&lt8912_connector_funcs, &lt8912_connector_funcs,
...@@ -578,6 +591,10 @@ static void lt8912_bridge_detach(struct drm_bridge *bridge) ...@@ -578,6 +591,10 @@ static void lt8912_bridge_detach(struct drm_bridge *bridge)
if (lt->is_attached) { if (lt->is_attached) {
lt8912_hard_power_off(lt); lt8912_hard_power_off(lt);
if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD)
drm_bridge_hpd_disable(lt->hdmi_port);
drm_connector_unregister(&lt->connector); drm_connector_unregister(&lt->connector);
drm_connector_cleanup(&lt->connector); drm_connector_cleanup(&lt->connector);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment