Skip to content

Commit

Permalink
drm/bridge: ti-tfp410: Fall back to HPD polling if HPD irq is not ava…
Browse files Browse the repository at this point in the history
…ilable

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 <peter.ujfalusi@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190401123342.15767-1-peter.ujfalusi@ti.com
  • Loading branch information
Peter Ujfalusi authored and Andrzej Hajda committed Apr 12, 2019
1 parent beb941b commit 3d31e21
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions drivers/gpu/drm/bridge/ti-tfp410.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3d31e21

Please sign in to comment.