linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: DRI Development <dri-devel@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>,
	David Airlie <airlied@linux.ie>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Eric Anholt <eric@anholt.net>, Phil Elwell <phil@raspberrypi.com>,
	Tim Gover <tim.gover@raspberrypi.com>,
	Dom Cobley <dom@raspberrypi.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Daniel Vetter <daniel@ffwll.ch>,
	Maxime Ripard <mripard@kernel.org>
Subject: Re: [PATCH] drm/vc4: hdmi: Rely on interrupts to handle hotplug
Date: Wed, 16 Jun 2021 11:09:29 +0100	[thread overview]
Message-ID: <CAPY8ntAqh2wEhN2wO_RQ2jJ7X3ovwB_5UwbrbPypDOhd1KVN6A@mail.gmail.com> (raw)
In-Reply-To: <20210524132018.264396-1-maxime@cerno.tech>

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
>

  reply	other threads:[~2021-06-16 10:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24 13:20 [PATCH] drm/vc4: hdmi: Rely on interrupts to handle hotplug Maxime Ripard
2021-06-16 10:09 ` Dave Stevenson [this message]
2021-06-16 12:20   ` Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPY8ntAqh2wEhN2wO_RQ2jJ7X3ovwB_5UwbrbPypDOhd1KVN6A@mail.gmail.com \
    --to=dave.stevenson@raspberrypi.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dom@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime@cerno.tech \
    --cc=mripard@kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=tim.gover@raspberrypi.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).