* [PATCH] drm/vc4: hdmi: Rely on interrupts to handle hotplug
@ 2021-05-24 13:20 Maxime Ripard
2021-06-16 10:09 ` Dave Stevenson
0 siblings, 1 reply; 3+ messages in thread
From: Maxime Ripard @ 2021-05-24 13:20 UTC (permalink / raw)
To: dri-devel, Daniel Vetter, David Airlie, Maarten Lankhorst,
Thomas Zimmermann, Maxime Ripard
Cc: Eric Anholt, Dave Stevenson, Phil Elwell, Tim Gover, Dom Cobley,
linux-kernel, Daniel Vetter, Maxime Ripard
DRM currently polls for the HDMI connector status every 10s, which can
be an issue when we connect/disconnect a display quickly or the device
on the other end only issues a hotplug pulse (for example on EDID
change).
Switch the driver to rely on the internal controller logic for the
BCM2711/RPi4.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
drivers/gpu/drm/vc4/vc4_hdmi.c | 44 ++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index c27b287d2053..3988969f7410 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1510,6 +1510,46 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
}
+static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv)
+{
+ struct vc4_hdmi *vc4_hdmi = priv;
+ struct drm_device *dev = vc4_hdmi->connector.dev;
+
+ if (dev)
+ drm_kms_helper_hotplug_event(dev);
+
+ return IRQ_HANDLED;
+}
+
+static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi)
+{
+ struct platform_device *pdev = vc4_hdmi->pdev;
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ if (vc4_hdmi->variant->external_irq_controller) {
+ ret = devm_request_threaded_irq(dev,
+ platform_get_irq_byname(pdev, "hpd-connected"),
+ NULL,
+ vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT,
+ "vc4 hdmi hpd connected", vc4_hdmi);
+ if (ret)
+ return ret;
+
+ ret = devm_request_threaded_irq(dev,
+ platform_get_irq_byname(pdev, "hpd-removed"),
+ NULL,
+ vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT,
+ "vc4 hdmi hpd disconnected", vc4_hdmi);
+ if (ret)
+ return ret;
+
+ connector->polled = DRM_CONNECTOR_POLL_HPD;
+ }
+
+ return 0;
+}
+
#ifdef CONFIG_DRM_VC4_HDMI_CEC
static irqreturn_t vc4_cec_irq_handler_rx_thread(int irq, void *priv)
{
@@ -2060,6 +2100,10 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
if (ret)
goto err_destroy_encoder;
+ ret = vc4_hdmi_hotplug_init(vc4_hdmi);
+ if (ret)
+ goto err_destroy_conn;
+
ret = vc4_hdmi_cec_init(vc4_hdmi);
if (ret)
goto err_destroy_conn;
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/vc4: hdmi: Rely on interrupts to handle hotplug
2021-05-24 13:20 [PATCH] drm/vc4: hdmi: Rely on interrupts to handle hotplug Maxime Ripard
@ 2021-06-16 10:09 ` Dave Stevenson
2021-06-16 12:20 ` Maxime Ripard
0 siblings, 1 reply; 3+ messages in thread
From: Dave Stevenson @ 2021-06-16 10:09 UTC (permalink / raw)
To: Maxime Ripard
Cc: DRI Development, Daniel Vetter, David Airlie, Maarten Lankhorst,
Thomas Zimmermann, Eric Anholt, Phil Elwell, Tim Gover,
Dom Cobley, LKML, Daniel Vetter, Maxime Ripard
On Mon, 24 May 2021 at 14:20, Maxime Ripard <maxime@cerno.tech> wrote:
>
> DRM currently polls for the HDMI connector status every 10s, which can
> be an issue when we connect/disconnect a display quickly or the device
> on the other end only issues a hotplug pulse (for example on EDID
> change).
>
> Switch the driver to rely on the internal controller logic for the
> BCM2711/RPi4.
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
> drivers/gpu/drm/vc4/vc4_hdmi.c | 44 ++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index c27b287d2053..3988969f7410 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -1510,6 +1510,46 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
>
> }
>
> +static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv)
> +{
> + struct vc4_hdmi *vc4_hdmi = priv;
> + struct drm_device *dev = vc4_hdmi->connector.dev;
> +
> + if (dev)
> + drm_kms_helper_hotplug_event(dev);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi)
> +{
> + struct platform_device *pdev = vc4_hdmi->pdev;
> + struct device *dev = &pdev->dev;
> + int ret;
> +
> + if (vc4_hdmi->variant->external_irq_controller) {
> + ret = devm_request_threaded_irq(dev,
> + platform_get_irq_byname(pdev, "hpd-connected"),
> + NULL,
> + vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT,
> + "vc4 hdmi hpd connected", vc4_hdmi);
> + if (ret)
> + return ret;
> +
> + ret = devm_request_threaded_irq(dev,
> + platform_get_irq_byname(pdev, "hpd-removed"),
> + NULL,
> + vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT,
> + "vc4 hdmi hpd disconnected", vc4_hdmi);
> + if (ret)
> + return ret;
> +
> + connector->polled = DRM_CONNECTOR_POLL_HPD;
> + }
> +
> + return 0;
> +}
> +
> #ifdef CONFIG_DRM_VC4_HDMI_CEC
> static irqreturn_t vc4_cec_irq_handler_rx_thread(int irq, void *priv)
> {
> @@ -2060,6 +2100,10 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
> if (ret)
> goto err_destroy_encoder;
>
> + ret = vc4_hdmi_hotplug_init(vc4_hdmi);
> + if (ret)
> + goto err_destroy_conn;
> +
> ret = vc4_hdmi_cec_init(vc4_hdmi);
> if (ret)
> goto err_destroy_conn;
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/vc4: hdmi: Rely on interrupts to handle hotplug
2021-06-16 10:09 ` Dave Stevenson
@ 2021-06-16 12:20 ` Maxime Ripard
0 siblings, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2021-06-16 12:20 UTC (permalink / raw)
To: Dave Stevenson
Cc: DRI Development, Daniel Vetter, David Airlie, Maarten Lankhorst,
Thomas Zimmermann, Eric Anholt, Phil Elwell, Tim Gover,
Dom Cobley, LKML, Daniel Vetter
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
On Wed, Jun 16, 2021 at 11:09:29AM +0100, Dave Stevenson wrote:
> On Mon, 24 May 2021 at 14:20, Maxime Ripard <maxime@cerno.tech> wrote:
> >
> > DRM currently polls for the HDMI connector status every 10s, which can
> > be an issue when we connect/disconnect a display quickly or the device
> > on the other end only issues a hotplug pulse (for example on EDID
> > change).
> >
> > Switch the driver to rely on the internal controller logic for the
> > BCM2711/RPi4.
>
> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Applied (with a compilation fix), thanks
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-16 12:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 13:20 [PATCH] drm/vc4: hdmi: Rely on interrupts to handle hotplug Maxime Ripard
2021-06-16 10:09 ` Dave Stevenson
2021-06-16 12:20 ` Maxime Ripard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).