LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: 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>,
	Emma Anholt <emma@anholt.net>,
	linux-rpi-kernel@lists.infradead.org,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Phil Elwell <phil@raspberrypi.com>,
	Tim Gover <tim.gover@raspberrypi.com>,
	Dom Cobley <dom@raspberrypi.com>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] drm/probe-helper: Create a HPD IRQ event helper for a single connector
Date: Tue, 14 Sep 2021 17:06:41 +0200	[thread overview]
Message-ID: <20210914150641.dzyioa3wkoyv2o7k@gilmour> (raw)
In-Reply-To: <YUB8c2If+E851x4A@ravnborg.org>

[-- Attachment #1: Type: text/plain, Size: 2850 bytes --]

Hi Sam,

On Tue, Sep 14, 2021 at 12:41:55PM +0200, Sam Ravnborg wrote:
> On Tue, Sep 14, 2021 at 12:17:23PM +0200, Maxime Ripard wrote:
> > The drm_helper_hpd_irq_event() function is iterating over all the
> > connectors when an hotplug event is detected.
> > 
> > During that iteration, it will call each connector detect function and
> > figure out if its status changed.
> > 
> > Finally, if any connector changed, it will notify the user-space and the
> > clients that something changed on the DRM device.
> > 
> > This is supposed to be used for drivers that don't have a hotplug
> > interrupt for individual connectors. However, drivers that can use an
> > interrupt for a single connector are left in the dust and can either
> > reimplement the logic used during the iteration for each connector or
> > use that helper and iterate over all connectors all the time.
> > 
> > Since both are suboptimal, let's create a helper that will only perform
> > the status detection on a single connector.
> > 
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > 
> > ---
> > Changes from v2:
> >   - Skip connectors with DRM_CONNECTOR_POLL_HPD in drm_helper_hpd_irq_event
> >   - Add drm_connector_helper_hpd_irq_event returned value documentation
> >   - Improve logging
> > 
> > Changes from v1:
> >   - Rename the shared function
> >   - Move the hotplug event notification out of the shared function
> >   - Added missing locks
> >   - Improve the documentation
> >   - Switched to drm_dbg_kms
> > ---
> >  drivers/gpu/drm/drm_probe_helper.c | 117 +++++++++++++++++++++--------
> >  include/drm/drm_probe_helper.h     |   1 +
> >  2 files changed, 87 insertions(+), 31 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
> > index 5b77fb5c1a32..a1ffc0c30b3a 100644
> > --- a/drivers/gpu/drm/drm_probe_helper.c
> > +++ b/drivers/gpu/drm/drm_probe_helper.c
> > @@ -795,6 +795,87 @@ void drm_kms_helper_poll_fini(struct drm_device *dev)
> >  }
> >  EXPORT_SYMBOL(drm_kms_helper_poll_fini);
> >  
> > +static bool check_connector_changed(struct drm_connector *connector)
> > +{
> > +	struct drm_device *dev = connector->dev;
> > +	enum drm_connector_status old_status;
> > +	u64 old_epoch_counter;
> > +	bool changed = false;
> > +
> > +	/* Only handle HPD capable connectors. */
> > +	drm_WARN_ON(dev, !(connector->polled & DRM_CONNECTOR_POLL_HPD));
>
> This will WARN if DRM_CONNECTOR_POLL_HPD is not set - which the previous
> code did not. I am not sure this is intentional.
> Or have I missed something?

Sorry, I misunderstood your previous comment and thought you wanted to
skip the !HPD connectors in the drm_helper_hpd_irq_event loop.

What do you think would be the proper scenario here? Just return false?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2021-09-14 15:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 10:17 [PATCH v2 1/3] drm/probe-helper: Document drm_helper_hpd_irq_event() return value Maxime Ripard
2021-09-14 10:17 ` [PATCH v2 2/3] drm/probe-helper: Create a HPD IRQ event helper for a single connector Maxime Ripard
     [not found]   ` <YUB8c2If+E851x4A@ravnborg.org>
2021-09-14 15:06     ` Maxime Ripard [this message]
2021-09-28 10:36   ` (subset) " Maxime Ripard
2021-09-14 10:17 ` [PATCH v2 3/3] drm/vc4: hdmi: Actually check for the connector status in hotplug Maxime Ripard
2021-09-14 14:34   ` Daniel Vetter
2021-09-14 15:03     ` Maxime Ripard
2021-09-28 10:36   ` (subset) " Maxime Ripard
2021-09-28 10:36 ` (subset) [PATCH v2 1/3] drm/probe-helper: Document drm_helper_hpd_irq_event() return value 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=20210914150641.dzyioa3wkoyv2o7k@gilmour \
    --to=maxime@cerno.tech \
    --cc=airlied@linux.ie \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=daniel.vetter@intel.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dom@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=nsaenz@kernel.org \
    --cc=phil@raspberrypi.com \
    --cc=sam@ravnborg.org \
    --cc=tim.gover@raspberrypi.com \
    --cc=tzimmermann@suse.de \
    --subject='Re: [PATCH v2 2/3] drm/probe-helper: Create a HPD IRQ event helper for a single connector' \
    /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

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).