All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Paul Cercueil <paul@crapouillou.net>,
	Neil Armstrong <narmstrong@baylibre.com>
Cc: Paul Boddie <paul@boddie.org.uk>, Daniel Vetter <daniel@ffwll.ch>,
	Jonas Karlman <jonas@kwiboo.se>, David Airlie <airlied@linux.ie>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	linux-mips <linux-mips@vger.kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	Robert Foss <robert.foss@linaro.org>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Discussions about the Letux Kernel 
	<letux-kernel@openphoenux.org>, Maxime Ripard <maxime@cerno.tech>
Subject: Re: [Letux-kernel] [PATCH v16 1/4] drm/bridge: dw-hdmi: introduce dw_hdmi_enable_poll()
Date: Thu, 3 Mar 2022 18:59:47 +0100	[thread overview]
Message-ID: <F0F8F36B-3A0A-476C-8C7D-566255C629C6@goldelico.com> (raw)
In-Reply-To: <RUI68R.Z009SPJAAD8N1@crapouillou.net>

Hi Paul, Neil,

> Am 03.03.2022 um 18:20 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Hi Nikolaus,
> 
> [snip]
> 
>>> Well he said "the Ingenic DRM core" aka ingenic-drm-drv.c. You do have access to the main drm_device in the ingenic_drm_bind() function, so you can add it there (with a cleanup function calling drm_kms_helper_poll_fini() registered with drmm_add_action_or_reset()).
>> Well, do you really want to mix HPD detection between connector, Synopsys bridge and Ingenic DRM core? These are independent...
>> Or should be accessed only through the bridge chain pointers.
>> IMHO we should keep separate functions separate.
> 
> The drm_kms_helper_poll_init() just says "this DRM device may have connectors that need to be polled" so it very well fits inside the main driver, IMHO.

As far as I understand, it has the side-effect to always set dev->mode_config.poll_enabled and
schedule_delayed_work() for all devices.
I am not sure if this is intended for arbitrary ingenic-drm devices. But you know better than me.


Hm. But wait, I think I now finally remember why I have proposed it the way it is!
It is always better to go back to requirements and find the least invasive solution.

- HPD IRQ works and calls dw_hdmi_irq() [as can be shown by adding printk()]
- it is just that the udevd is only notified if poll_enabled = true (but no polling takes place!).

An earlier version (v4) to fix this proposed to add an explicit call to drm_kms_helper_hotplug_event()
in dw_hdmi_irq() but that was rejected a while ago because drm_helper_hpd_irq_event() will already call it:

	https://www.spinics.net/lists/dri-devel/msg316846.html

Since this did not take into account that dev->mode_config.poll_enabled must be set true, I then proposed the
enable_poll() mechanism just to set this bit for the ingenic-dw-hdmi specialization.

So a HPD event is delivered to the dw-hdmi driver as dw_hdmi_irq() and that calls drm_helper_hpd_irq_event()
but not drm_kms_helper_hotplug_event() and user-space is not getting aware.

It is all a hack because we mix the dw-hdmi driver which originally did register its own connector
with an explicit connector...

In summary I now thing that the v4 patch is the simplest and least invasive solution.

We neither have to introduce a dw_hdmi_enable_poll() function or call drm_kms_helper_poll_init() anywhere.

It is just a single line to add to dw-hdmi. And neither touches ingenic-dw-hdmi nor ingenic-drm-drv.

So let's go back to v4 version (just modify commit message to better describe why we have to call
drm_kms_helper_hotplug_event() explicitly) and forget about alternatives.

BR,
Nikolaus

WARNING: multiple messages have this Message-ID (diff)
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Paul Cercueil <paul@crapouillou.net>,
	Neil Armstrong <narmstrong@baylibre.com>
Cc: Paul Boddie <paul@boddie.org.uk>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Maxime Ripard <maxime@cerno.tech>,
	Jonas Karlman <jonas@kwiboo.se>, David Airlie <airlied@linux.ie>,
	Robert Foss <robert.foss@linaro.org>,
	linux-mips <linux-mips@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Discussions about the Letux Kernel <letux-kernel@openphoenux.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Subject: Re: [Letux-kernel] [PATCH v16 1/4] drm/bridge: dw-hdmi: introduce dw_hdmi_enable_poll()
Date: Thu, 3 Mar 2022 18:59:47 +0100	[thread overview]
Message-ID: <F0F8F36B-3A0A-476C-8C7D-566255C629C6@goldelico.com> (raw)
In-Reply-To: <RUI68R.Z009SPJAAD8N1@crapouillou.net>

Hi Paul, Neil,

> Am 03.03.2022 um 18:20 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Hi Nikolaus,
> 
> [snip]
> 
>>> Well he said "the Ingenic DRM core" aka ingenic-drm-drv.c. You do have access to the main drm_device in the ingenic_drm_bind() function, so you can add it there (with a cleanup function calling drm_kms_helper_poll_fini() registered with drmm_add_action_or_reset()).
>> Well, do you really want to mix HPD detection between connector, Synopsys bridge and Ingenic DRM core? These are independent...
>> Or should be accessed only through the bridge chain pointers.
>> IMHO we should keep separate functions separate.
> 
> The drm_kms_helper_poll_init() just says "this DRM device may have connectors that need to be polled" so it very well fits inside the main driver, IMHO.

As far as I understand, it has the side-effect to always set dev->mode_config.poll_enabled and
schedule_delayed_work() for all devices.
I am not sure if this is intended for arbitrary ingenic-drm devices. But you know better than me.


Hm. But wait, I think I now finally remember why I have proposed it the way it is!
It is always better to go back to requirements and find the least invasive solution.

- HPD IRQ works and calls dw_hdmi_irq() [as can be shown by adding printk()]
- it is just that the udevd is only notified if poll_enabled = true (but no polling takes place!).

An earlier version (v4) to fix this proposed to add an explicit call to drm_kms_helper_hotplug_event()
in dw_hdmi_irq() but that was rejected a while ago because drm_helper_hpd_irq_event() will already call it:

	https://www.spinics.net/lists/dri-devel/msg316846.html

Since this did not take into account that dev->mode_config.poll_enabled must be set true, I then proposed the
enable_poll() mechanism just to set this bit for the ingenic-dw-hdmi specialization.

So a HPD event is delivered to the dw-hdmi driver as dw_hdmi_irq() and that calls drm_helper_hpd_irq_event()
but not drm_kms_helper_hotplug_event() and user-space is not getting aware.

It is all a hack because we mix the dw-hdmi driver which originally did register its own connector
with an explicit connector...

In summary I now thing that the v4 patch is the simplest and least invasive solution.

We neither have to introduce a dw_hdmi_enable_poll() function or call drm_kms_helper_poll_init() anywhere.

It is just a single line to add to dw-hdmi. And neither touches ingenic-dw-hdmi nor ingenic-drm-drv.

So let's go back to v4 version (just modify commit message to better describe why we have to call
drm_kms_helper_hotplug_event() explicitly) and forget about alternatives.

BR,
Nikolaus

  reply	other threads:[~2022-03-03 18:00 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-26 17:12 [PATCH v16 0/4] MIPS: JZ4780 and CI20 HDMI H. Nikolaus Schaller
2022-02-26 17:12 ` H. Nikolaus Schaller
2022-02-26 17:12 ` [PATCH v16 1/4] drm/bridge: dw-hdmi: introduce dw_hdmi_enable_poll() H. Nikolaus Schaller
2022-02-26 17:12   ` H. Nikolaus Schaller
2022-03-03 16:23   ` Neil Armstrong
2022-03-03 16:23     ` Neil Armstrong
2022-03-03 16:30     ` H. Nikolaus Schaller
2022-03-03 16:30       ` H. Nikolaus Schaller
2022-03-03 16:43       ` [Letux-kernel] " H. Nikolaus Schaller
2022-03-03 16:43         ` H. Nikolaus Schaller
2022-03-03 16:51         ` Paul Cercueil
2022-03-03 16:51           ` Paul Cercueil
2022-03-03 17:09           ` H. Nikolaus Schaller
2022-03-03 17:09             ` H. Nikolaus Schaller
2022-03-03 17:20             ` Paul Cercueil
2022-03-03 17:20               ` Paul Cercueil
2022-03-03 17:59               ` H. Nikolaus Schaller [this message]
2022-03-03 17:59                 ` H. Nikolaus Schaller
2022-03-04 13:30                 ` Neil Armstrong
2022-03-04 13:30                   ` Neil Armstrong
2022-03-04 16:47                   ` Paul Cercueil
2022-03-04 16:47                     ` Paul Cercueil
2022-03-04 17:51                     ` H. Nikolaus Schaller
2022-03-04 17:51                       ` H. Nikolaus Schaller
2022-03-04 18:04                       ` Paul Cercueil
2022-03-04 18:04                         ` Paul Cercueil
2022-03-04 18:15                         ` H. Nikolaus Schaller
2022-03-04 18:15                           ` H. Nikolaus Schaller
2022-03-04 18:33                           ` Paul Cercueil
2022-03-04 18:33                             ` Paul Cercueil
2022-03-04 18:41                             ` H. Nikolaus Schaller
2022-03-04 18:41                               ` H. Nikolaus Schaller
2022-03-05  7:49                               ` H. Nikolaus Schaller
2022-03-05  7:49                                 ` H. Nikolaus Schaller
2022-03-03 16:46     ` Paul Cercueil
2022-03-03 16:46       ` Paul Cercueil
2022-03-03 17:05       ` H. Nikolaus Schaller
2022-03-03 17:05         ` H. Nikolaus Schaller
2022-02-26 17:13 ` [PATCH v16 2/4] drm/ingenic: Add dw-hdmi driver specialization for jz4780 H. Nikolaus Schaller
2022-02-26 17:13   ` H. Nikolaus Schaller
2022-02-26 17:13 ` [PATCH v16 3/4] drm/bridge: display-connector: add ddc-en gpio support H. Nikolaus Schaller
2022-02-26 17:13   ` H. Nikolaus Schaller
2022-02-26 17:13 ` [PATCH v16 4/4] drm/bridge: dw-hdmi: fix bus formats negotiation for 8 bit modes H. Nikolaus Schaller
2022-02-26 17:13   ` H. Nikolaus Schaller
2022-03-01  9:18   ` Neil Armstrong
2022-03-01  9:18     ` Neil Armstrong
2022-03-01 20:37     ` H. Nikolaus Schaller
2022-03-01 20:37       ` H. Nikolaus Schaller
2022-03-02 10:25       ` Neil Armstrong
2022-03-02 10:25         ` Neil Armstrong
2022-03-02 11:15         ` H. Nikolaus Schaller
2022-03-02 11:15           ` H. Nikolaus Schaller
2022-03-02 14:34           ` Neil Armstrong
2022-03-02 14:34             ` Neil Armstrong
2022-03-02 22:24             ` H. Nikolaus Schaller
2022-03-02 22:24               ` H. Nikolaus Schaller
2022-03-03  8:35               ` Neil Armstrong
2022-03-03  8:35                 ` Neil Armstrong
2022-03-03 10:40                 ` H. Nikolaus Schaller
2022-03-03 10:40                   ` H. Nikolaus Schaller
2022-03-03 11:42                   ` Neil Armstrong
2022-03-03 11:42                     ` Neil Armstrong
2022-03-03 11:45                     ` H. Nikolaus Schaller
2022-03-03 11:45                       ` H. Nikolaus Schaller
2022-03-03 15:37                       ` H. Nikolaus Schaller
2022-03-03 15:37                         ` H. Nikolaus Schaller
2022-03-03 16:14                         ` Neil Armstrong
2022-03-03 16:14                           ` Neil Armstrong
2022-03-03 15:15                     ` Paul Cercueil
2022-03-03 15:15                       ` Paul Cercueil

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=F0F8F36B-3A0A-476C-8C7D-566255C629C6@goldelico.com \
    --to=hns@goldelico.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=andrzej.hajda@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=narmstrong@baylibre.com \
    --cc=paul@boddie.org.uk \
    --cc=paul@crapouillou.net \
    --cc=robert.foss@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.