On some systems the interrupt pin may not be used.
In this case we exclude DRM_BRIDGE_OP_HPD from supported operations,
after which a polling thread is started to detect the connection.
(the default polling period for DRM is 10 seconds)

Signed-off-by: Vladimir Yakovlev <[email protected]>
---
 drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 26 ++++++++++++++--------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c 
b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
index 3868ad05e011..4d550cd1a9a1 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
@@ -851,19 +851,25 @@ static int lt9611uxc_probe(struct i2c_client *client)
        init_waitqueue_head(&lt9611uxc->wq);
        INIT_WORK(&lt9611uxc->work, lt9611uxc_hpd_work);
 
-       ret = request_threaded_irq(client->irq, NULL,
-                                  lt9611uxc_irq_thread_handler,
-                                  IRQF_ONESHOT, "lt9611uxc", lt9611uxc);
-       if (ret) {
-               dev_err(dev, "failed to request irq\n");
-               goto err_disable_regulators;
+       if (client->irq) {
+               ret = request_threaded_irq(client->irq, NULL,
+                                          lt9611uxc_irq_thread_handler,
+                                          IRQF_ONESHOT, "lt9611uxc", 
lt9611uxc);
+               if (ret) {
+                       dev_err(dev, "failed to request irq\n");
+                       goto err_disable_regulators;
+               }
+               dev_dbg(dev, "Uses IRQ\n");
+       } else {
+               dev_warn(dev, "The interrupt (IRQ) is not specified in the 
DTS.\n");
+               dev_warn(dev, "Check the interrupt (IRQ) or polling will be 
used!!!\n");
        }
 
        i2c_set_clientdata(client, lt9611uxc);
 
        lt9611uxc->bridge.of_node = client->dev.of_node;
        lt9611uxc->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID;
-       if (lt9611uxc->hpd_supported)
+       if (lt9611uxc->hpd_supported && client->irq)
                lt9611uxc->bridge.ops |= DRM_BRIDGE_OP_HPD;
        lt9611uxc->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
 
@@ -892,7 +898,8 @@ static int lt9611uxc_probe(struct i2c_client *client)
        return 0;
 
 err_remove_bridge:
-       free_irq(client->irq, lt9611uxc);
+       if (client->irq)
+               free_irq(client->irq, lt9611uxc);
        cancel_work_sync(&lt9611uxc->work);
        drm_bridge_remove(&lt9611uxc->bridge);
 
@@ -910,7 +917,8 @@ static void lt9611uxc_remove(struct i2c_client *client)
 {
        struct lt9611uxc *lt9611uxc = i2c_get_clientdata(client);
 
-       free_irq(client->irq, lt9611uxc);
+       if (client->irq)
+               free_irq(client->irq, lt9611uxc);
        cancel_work_sync(&lt9611uxc->work);
        lt9611uxc_audio_exit(lt9611uxc);
        drm_bridge_remove(&lt9611uxc->bridge);
-- 
2.34.1

Reply via email to