drm/bridge: lt9611c: improve HPD handling and driver robustness
Subsystems (3)
cover drm/bridge: lt9611c: improve HPD handling and driver robustness
From: Mohit Dsor <[email protected]>
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.
Tested on LT9611UXD platforms.
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(-)
Signature · 1 line
2.34.1
PATCH 1/5 drm/bridge: lt9611c: fallback to cached HPD status on read failure
From: Mohit Dsor <[email protected]>
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 [email protected]From: Mohit Dsor <[email protected]>
Implement 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 [email protected]From: Mohit Dsor <[email protected]>
Ensure 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 [email protected]From: Mohit Dsor <[email protected]>
Remove 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 [email protected]From: Mohit Dsor <[email protected]>
Remove 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