Subject: [PATCH 0/5] drm/bridge: lt9611c: improve HPD handling and driver robustness
Subsystems (3)
cover Subject: [PATCH 0/5] drm/bridge: lt9611c: improve HPD handling and driver robustness
This series improves HPD handling and overall robustness of the lt9611c bridge driver.
The HPD status read from the internal MCU may fail when the device is not fully initialized, leading to spurious disconnect events. This series mitigates such issues by falling back to a cached HPD state and adds support for explicit HPD enable handling.
Additionally, it fixes DT parsing and bridge refcount handling, corrects chip type initialization, and cleans up probe and remove paths to avoid redundant or unsafe resource handling.
The changes have been validated on LT9611UXD-based platforms.
Changes in this series:
- Fallback to cached HPD status on read failures
- Add hpd_enable callback implementation
- Fix DT parsing and bridge reference counting
- Correct chip_type initialization
- Clean up probe/remove error paths
---
Changes in v2:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v1: https://patch.msgid.link/[email protected]
To: Andrzej Hajda <[email protected]>
To: Neil Armstrong <[email protected]>
To: Robert Foss <[email protected]>
To: Laurent Pinchart <[email protected]>
To: Jonas Karlman <[email protected]>
To: Jernej Skrabec <[email protected]>
To: Maarten Lankhorst <[email protected]>
To: Maxime Ripard <[email protected]>
To: Thomas Zimmermann <[email protected]>
To: David Airlie <[email protected]>
To: Simona Vetter <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
Mohit Dsor (5):
drm/bridge: lt9611c: fallback to cached HPD status on read failure drm/bridge: lt9611c: implement hpd_enable callback drm/bridge: lt9611c: fix DT parsing and bridge refcount drm/bridge: lt9611c: fix chip type initialization drm/bridge: lt9611c: clean up probe error and remove paths
drivers/gpu/drm/bridge/lontium-lt9611c.c | 39 ++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-)
---
base-commit: 04c2c33c284caa521524328939d67d78d581ebaf
change-id: 20260628-hpd_stable-6cee31998b8d
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: e9ce15b4a5842cfde130a813afecf136798179f4
prerequisite-patch-id: 569618a60e8c3615e7347c79b48c4756b7bf85d0
prerequisite-message-id: <[email protected]>
prerequisite-patch-id: b73480be758c902f497733155b478248a507931c
prerequisite-patch-id: c6eb91e2966154892770cd77785eb140fa0dba5e
prerequisite-patch-id: 536e974105afdf99db85a6d117b69206fe7c50ae
prerequisite-patch-id: da212266879bd72ab2848551a5e2dda4a1ae5c90
Best regards,
Signature · 1 line
Mohit Dsor <[email protected]>
PATCH 1/5 drm/bridge: lt9611c: fallback to cached HPD status on read failure
HPD status is retrieved via an MCU command. In some cases the command may fail, for example when the MCU is not yet ready, leading to incorrect disconnect reporting.
Instead of returning an error state, fall back to the last known HPD status to provide a more stable detection result.
This avoids spurious disconnect events during initialization.
--- drivers/gpu/drm/bridge/lontium-lt9611c.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/lontium-lt9611c.c +4 -2
@@ -711,10 +711,12 @@ lt9611c_bridge_detect(struct drm_bridge *bridge, struct drm_connector *connectorguard (mutex)(<9611c->ocm_lock); ret =lt9611c_read_write_flow (lt9611c, cmd,ARRAY_SIZE (cmd), data,ARRAY_SIZE (data)); -if (ret) +if (ret) {dev_err (dev,"failed to read HPD status (err=%d)\n" , ret); -else + connected = lt9611c->hdmi_connected; + }else { connected = (data[4 ] ==0x02 ); + } lt9611c->hdmi_connected = connected;
Signature · 1 line
2.34.1
PATCH 2/5 drm/bridge: lt9611c: implement hpd_enable callback
In reply to Mohit DsorImplement the .hpd_enable callback to trigger HPD status update and schedule event propagation.
--- drivers/gpu/drm/bridge/lontium-lt9611c.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/bridge/lontium-lt9611c.c +18 -0
@@ -923,6 +923,23 @@ static void lt9611c_hdmi_audio_shutdown(struct drm_bridge *bridge,drm_atomic_helper_connector_hdmi_clear_audio_infoframe (connector); } +static void lt9611c_bridge_hpd_enable (struct drm_bridge *bridge) +{ +struct lt9611c *lt9611c =bridge_to_lt9611c (bridge); +u8 cmd[5 ] = {0x52 ,0x48 ,0x31 ,0x3a ,0x00 }; +u8 data[5 ]; +int ret; + +mutex_lock (<9611c->ocm_lock); + ret =lt9611c_read_write_flow (lt9611c, cmd,ARRAY_SIZE (cmd), + data,ARRAY_SIZE (data)); +if (!ret) + lt9611c->hdmi_connected = (data[4 ] ==0x02 ); +mutex_unlock (<9611c->ocm_lock); + +schedule_work (<9611c->work); +} +static int lt9611c_hdmi_audio_startup (struct drm_bridge *bridge,struct drm_connector *connector) {
@@ -939,6 +956,7 @@ static const struct drm_bridge_funcs lt9611c_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, + .hpd_enable = lt9611c_bridge_hpd_enable, .hdmi_tmds_char_rate_valid = lt9611c_hdmi_tmds_char_rate_valid, .hdmi_write_avi_infoframe = lt9611c_hdmi_write_avi_infoframe,
Signature · 1 line
2.34.1
PATCH 3/5 drm/bridge: lt9611c: fix DT parsing and bridge refcount
In reply to Mohit DsorEnsure DT nodes are properly released on error and acquire a reference to next_bridge
--- drivers/gpu/drm/bridge/lontium-lt9611c.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/lontium-lt9611c.c +10 -1
@@ -974,6 +974,8 @@ static const struct drm_bridge_funcs lt9611c_bridge_funcs = {static int lt9611c_parse_dt (struct device *dev,struct lt9611c *lt9611c) { +int ret; + lt9611c->dsi0_node =of_graph_get_remote_node (dev->of_node,0 ,-1 );if (!lt9611c->dsi0_node)return dev_err_probe (dev, -ENODEV ,"failed to get remote node for primary dsi\n" );
@@ -984,7 +986,14 @@ static int lt9611c_parse_dt(struct device *dev, <9611c->selected_port)) lt9611c->selected_port =0 ; -return drm_of_find_panel_or_bridge (dev->of_node,2 ,-1 ,NULL , <9611c->bridge.next_bridge); + ret =drm_of_find_panel_or_bridge (dev->of_node,2 ,-1 ,NULL , <9611c->bridge.next_bridge); +if (ret) { +of_node_put (lt9611c->dsi1_node); +of_node_put (lt9611c->dsi0_node); +return ret; + } +drm_bridge_get (lt9611c->bridge.next_bridge); +return 0 ; }static int lt9611c_gpio_init (struct lt9611c *lt9611c)
Signature · 1 line
2.34.1
PATCH 4/5 drm/bridge: lt9611c: fix chip type initialization
In reply to Mohit DsorRemove redundant assignment of chip_type from I2C match as it is derived from DT data when available.
--- drivers/gpu/drm/bridge/lontium-lt9611c.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/bridge/lontium-lt9611c.c +0 -1
@@ -1105,7 +1105,6 @@ static int lt9611c_probe(struct i2c_client *client) lt9611c->dev = dev; lt9611c->client = client; - lt9611c->chip_type = id->driver_data;if (dev->of_node) { lt9611c->chip_type = (uintptr_t )of_device_get_match_data (dev);
Signature · 1 line
2.34.1
PATCH 5/5 drm/bridge: lt9611c: clean up probe error and remove paths
In reply to Mohit DsorRemove redundant cleanup of IRQ and bridge resources.
--- drivers/gpu/drm/bridge/lontium-lt9611c.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/bridge/lontium-lt9611c.c +0 -3
@@ -1234,9 +1234,7 @@ static int lt9611c_probe(struct i2c_client *client)return 0 ; err_remove_bridge: -free_irq (client->irq, lt9611c);cancel_work_sync (<9611c->work); -drm_bridge_remove (<9611c->bridge); err_disable_regulators:regulator_bulk_disable (ARRAY_SIZE (lt9611c->supplies), lt9611c->supplies);
@@ -1252,7 +1250,6 @@ static void lt9611c_remove(struct i2c_client *client) {struct lt9611c *lt9611c =i2c_get_clientdata (client); -free_irq (client->irq, lt9611c);cancel_work_sync (<9611c->work);regulator_bulk_disable (ARRAY_SIZE (lt9611c->supplies), lt9611c->supplies);of_node_put (lt9611c->dsi1_node);
Signature · 1 line
2.34.1