drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not available
Subsystems (3)
PATCH 1/1 drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not available
In case either the HPD gpio is not specified or when the HPD gpio can not be used as interrupt we should tell the core that the HPD needs to be polled for detecting hotplug.
--- drivers/gpu/drm/bridge/ti-tfp410.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/ti-tfp410.c +11 -3
@@ -31,6 +31,7 @@ struct tfp410 {struct i2c_adapter *ddc;struct gpio_desc *hpd; +int hpd_irq;struct delayed_work hpd_work;struct gpio_desc *powerdown;
@@ -124,8 +125,10 @@ static int tfp410_attach(struct drm_bridge *bridge)return -ENODEV ; } -if (dvi->hpd) +if (dvi->hpd_irq >=0 ) dvi->connector.polled =DRM_CONNECTOR_POLL_HPD ; +else + dvi->connector.polled =DRM_CONNECTOR_POLL_CONNECT |DRM_CONNECTOR_POLL_DISCONNECT ;drm_connector_helper_add (&dvi->connector, &tfp410_con_helper_funcs);
@@ -324,10 +327,15 @@ static int tfp410_init(struct device *dev, bool i2c)return PTR_ERR (dvi->powerdown); } -if (dvi->hpd) { +if (dvi->hpd) + dvi->hpd_irq =gpiod_to_irq (dvi->hpd); +else + dvi->hpd_irq = -ENXIO ; + +if (dvi->hpd_irq >=0 ) {INIT_DELAYED_WORK (&dvi->hpd_work, tfp410_hpd_work_func); - ret =devm_request_threaded_irq (dev,gpiod_to_irq (dvi->hpd), + ret =devm_request_threaded_irq (dev, dvi->hpd_irq,NULL , tfp410_hpd_irq_thread,IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING |IRQF_ONESHOT ,"hdmi-hpd" , dvi);
Signature · 9 lines
Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Laurent Pinchart
reviewerHi Peter,
Thank you for the patch.
Quoted 22 lines · Peter Ujfalusi
In case either the HPD gpio is not specified or when the HPD gpio can not be used as interrupt we should tell the core that the HPD needs to be polled for detecting hotplug.
Signed-off-by Peter Ujfalusi <[email protected]>--- drivers/gpu/drm/bridge/ti-tfp410.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/ti-tfp410.c +1
-0@@ -31,6 +31,7 @@ struct tfp410 {struct i2c_adapter *ddc;struct gpio_desc *hpd; +int hpd_irq;struct delayed_work hpd_work;struct gpio_desc *powerdown;
drivers/gpu/drm/bridge/ti-tfp410.c static int tfp410_attach(struct drm_bridge *bridge) · line 128
Quoted 5 lines
drivers/gpu/drm/bridge/ti-tfp410.c +1
-1@@ -124,8 +125,10 @@ static int tfp410_attach(struct drm_bridge *bridge)return -ENODEV ; } -if (dvi->hpd) +if (dvi->hpd_irq >=0 )
Do you need a new hpd_irq field ? Can't you just test dvi->hpd as done today, simply adding the else clause to this if ?
Quoted 24 lines
drivers/gpu/drm/bridge/ti-tfp410.c +9
-2dvi->connector.polled =DRM_CONNECTOR_POLL_HPD ; + else + dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;drm_connector_helper_add (&dvi->connector, &tfp410_con_helper_funcs);@@ -324,10 +327,15 @@ static int tfp410_init(struct device *dev, bool i2c)return PTR_ERR (dvi->powerdown); } -if (dvi->hpd) { +if (dvi->hpd) + dvi->hpd_irq =gpiod_to_irq (dvi->hpd); +else + dvi->hpd_irq = -ENXIO ; + +if (dvi->hpd_irq >=0 ) {INIT_DELAYED_WORK (&dvi->hpd_work, tfp410_hpd_work_func); - ret =devm_request_threaded_irq (dev,gpiod_to_irq (dvi->hpd), + ret =devm_request_threaded_irq (dev, dvi->hpd_irq,NULL , tfp410_hpd_irq_thread,IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING |IRQF_ONESHOT ,"hdmi-hpd" , dvi);
Signature · 7 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 30 lines · Laurent Pinchart
Hi Peter,
Thank you for the patch.
Quoted 25 lines · Peter Ujfalusi
In case either the HPD gpio is not specified or when the HPD gpio can not be used as interrupt we should tell the core that the HPD needs to be polled for detecting hotplug.
Signed-off-by Peter Ujfalusi <[email protected]>--- drivers/gpu/drm/bridge/ti-tfp410.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/ti-tfp410.c +1
-0@@ -31,6 +31,7 @@ struct tfp410 {struct i2c_adapter *ddc;struct gpio_desc *hpd; +int hpd_irq;struct delayed_work hpd_work;struct gpio_desc *powerdown;@@ -124,8 +125,10 @@ static int tfp410_attach(struct drm_bridge *bridge)return -ENODEV ; }
Quoted 5 lines
drivers/gpu/drm/bridge/ti-tfp410.c static int tfp410_attach(struct drm_bridge *bridge) · line 128
Quoted 2 lines
drivers/gpu/drm/bridge/ti-tfp410.c +1
-1-if (dvi->hpd) +if (dvi->hpd_irq >=0 )Do you need a new
hpd_irqfield ? Can't you just testdvi->hpdas done today, simply adding the else clause to this if ?
We can have hpd GPIO, but the GPIO might not be usable for interrupt.
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/bridge/ti-tfp410.c +8
-1dvi->connector.polled =DRM_CONNECTOR_POLL_HPD ; + else + dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;drm_connector_helper_add (&dvi->connector, &tfp410_con_helper_funcs);@@ -324,10 +327,15 @@ static int tfp410_init(struct device *dev, bool i2c)return PTR_ERR (dvi->powerdown); } -if (dvi->hpd) { +if (dvi->hpd) + dvi->hpd_irq =gpiod_to_irq (dvi->hpd); +else + dvi->hpd_irq = -ENXIO ; + +if (dvi->hpd_irq >=0 ) {INIT_DELAYED_WORK (&dvi->hpd_work, tfp410_hpd_work_func);
Quoted 6 lines
drivers/gpu/drm/bridge/ti-tfp410.c static int tfp410_init(struct device *dev, bool i2c) · line 341
Quoted 5 lines
drivers/gpu/drm/bridge/ti-tfp410.c +1
-1- ret =devm_request_threaded_irq (dev,gpiod_to_irq (dvi->hpd), + ret =devm_request_threaded_irq (dev, dvi->hpd_irq,NULL , tfp410_hpd_irq_thread,IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING |IRQF_ONESHOT ,"hdmi-hpd" , dvi);
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Peter,
Quoted 27 lines · Peter Ujfalusi
Quoted 26 lines · Laurent Pinchart
Quoted 25 lines · Peter Ujfalusi
In case either the HPD gpio is not specified or when the HPD gpio can not be used as interrupt we should tell the core that the HPD needs to be polled for detecting hotplug.
Signed-off-by Peter Ujfalusi <[email protected]>--- drivers/gpu/drm/bridge/ti-tfp410.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/ti-tfp410.c +1
-0@@ -31,6 +31,7 @@ struct tfp410 {struct i2c_adapter *ddc;struct gpio_desc *hpd; +int hpd_irq;struct delayed_work hpd_work;struct gpio_desc *powerdown;@@ -124,8 +125,10 @@ static int tfp410_attach(struct drm_bridge *bridge)return -ENODEV ; }
Quoted 7 lines
Quoted 5 lines
drivers/gpu/drm/bridge/ti-tfp410.c static int tfp410_attach(struct drm_bridge *bridge) · line 128
Quoted 2 lines
drivers/gpu/drm/bridge/ti-tfp410.c +1
-1-if (dvi->hpd) +if (dvi->hpd_irq >=0 )Do you need a new
hpd_irqfield ? Can't you just testdvi->hpdas done today, simply adding the else clause to this if ?We can have hpd GPIO, but the GPIO might not be usable for interrupt.
Ah, good point. I hadn't understood that from the commit message. Maybe an additional sentence pointing out that not all GPIOs can be used as IRQs would be useful.
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
drivers/gpu/drm/bridge/ti-tfp410.c +9
-2dvi->connector.polled =DRM_CONNECTOR_POLL_HPD ; + else + dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;drm_connector_helper_add (&dvi->connector, &tfp410_con_helper_funcs);@@ -324,10 +327,15 @@ static int tfp410_init(struct device *dev, bool i2c)return PTR_ERR (dvi->powerdown); } -if (dvi->hpd) { +if (dvi->hpd) + dvi->hpd_irq =gpiod_to_irq (dvi->hpd); +else + dvi->hpd_irq = -ENXIO ; + +if (dvi->hpd_irq >=0 ) {INIT_DELAYED_WORK (&dvi->hpd_work, tfp410_hpd_work_func); - ret =devm_request_threaded_irq (dev,gpiod_to_irq (dvi->hpd), + ret =devm_request_threaded_irq (dev, dvi->hpd_irq,NULL , tfp410_hpd_irq_thread,IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING |IRQF_ONESHOT ,"hdmi-hpd" , dvi);
Signature · 7 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel