Skip to contentSkip to conversation

drm/bridge_connector: perform HPD enablement automatically

PATCH Applied Dmitry Baryshkov 7 participants 34 messages Nov 2, 2022 – Mar 8, 2023

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

v3 cover drm/bridge_connector: perform HPD enablement automatically

From all the drivers using drm_bridge_connector only iMX/dcss and OMAP DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Changes since v2:
- Fixed a typo in the commit message of the second patch.

Changes since v1:
- Rebased on top of v6.1-rc1
- Removed the drm_bridge_connector_enable_hpd() from drm_bridge_connector_init()
- Removed extra underscore prefix from drm_bridge_connector_en/disable_hpd() helpers

Dmitry Baryshkov (7):
drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini() drm/probe-helper: enable and disable HPD on connectors drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement drm/imx/dcss: stop using drm_bridge_connector_en/disable_hpd() drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd() drm/omap: stop using drm_bridge_connector_en/disable_hpd() drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()

 drivers/gpu/drm/drm_bridge_connector.c   | 27 +++-------------
 drivers/gpu/drm/drm_probe_helper.c       | 40 ++++++++++++++++++-----
 drivers/gpu/drm/imx/dcss/dcss-dev.c      |  4 ---
 drivers/gpu/drm/imx/dcss/dcss-kms.c      |  2 --
 drivers/gpu/drm/msm/hdmi/hdmi.c          |  2 --
 drivers/gpu/drm/omapdrm/omap_drv.c       | 41 ------------------------
 include/drm/drm_bridge_connector.h       |  2 --
 include/drm/drm_modeset_helper_vtables.h | 22 +++++++++++++
 8 files changed, 59 insertions(+), 81 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH v3 1/7 drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini()

Merge drm_kms_helper_poll_disable() and drm_kms_helper_poll_fini() code into a common helper function.

---
 drivers/gpu/drm/drm_probe_helper.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_probe_helper.c +13 -8
index 69b0b2b9cc1c..f97fda3b1d34 100644
@@ -803,6 +803,17 @@ bool drm_kms_helper_is_poll_worker(void)
 }
 EXPORT_SYMBOL(drm_kms_helper_is_poll_worker);
 
+static void drm_kms_helper_poll_disable_fini(struct drm_device *dev, bool fini)
+{
+	if (!dev->mode_config.poll_enabled)
+		return;
+
+	if (fini)
+		dev->mode_config.poll_enabled = false;
+
+	cancel_delayed_work_sync(&dev->mode_config.output_poll_work);
+}
+
 /**
  * drm_kms_helper_poll_disable - disable output polling
  * @dev: drm_device
@@ -819,9 +830,7 @@ EXPORT_SYMBOL(drm_kms_helper_is_poll_worker);
  */
 void drm_kms_helper_poll_disable(struct drm_device *dev)
 {
-	if (!dev->mode_config.poll_enabled)
-		return;
-	cancel_delayed_work_sync(&dev->mode_config.output_poll_work);
+	drm_kms_helper_poll_disable_fini(dev, false);
 }
 EXPORT_SYMBOL(drm_kms_helper_poll_disable);
 
@@ -859,11 +868,7 @@ EXPORT_SYMBOL(drm_kms_helper_poll_init);
  */
 void drm_kms_helper_poll_fini(struct drm_device *dev)
 {
-	if (!dev->mode_config.poll_enabled)
-		return;
-
-	dev->mode_config.poll_enabled = false;
-	cancel_delayed_work_sync(&dev->mode_config.output_poll_work);
+	drm_kms_helper_poll_disable_fini(dev, true);
 }
 EXPORT_SYMBOL(drm_kms_helper_poll_fini);
 
Signature · 1 line
2.35.1
#2 lore raw

PATCH v3 2/7 drm/probe-helper: enable and disable HPD on connectors

In reply to Dmitry Baryshkov

Introduce two drm_connector_helper_funcs: enable_hpd() and disable_hpd(). They are called by drm_kms_helper_poll_enable() and drm_kms_helper_poll_disable() (and thus drm_kms_helper_poll_init() and drm_kms_helper_poll_fini()) respectively.

This allows DRM drivers to rely on drm_kms_helper_poll for enabling and disabling HPD detection rather than doing that manually.

---
 drivers/gpu/drm/drm_probe_helper.c       | 19 +++++++++++++++++++
 include/drm/drm_modeset_helper_vtables.h | 22 ++++++++++++++++++++++
 2 files changed, 41 insertions(+)
drivers/gpu/drm/drm_probe_helper.c +19 -0
index f97fda3b1d34..a7b4590d8ec1 100644
@@ -251,6 +251,12 @@ void drm_kms_helper_poll_enable(struct drm_device *dev)
 
 	drm_connector_list_iter_begin(dev, &conn_iter);
 	drm_for_each_connector_iter(connector, &conn_iter) {
+		const struct drm_connector_helper_funcs *funcs =
+			connector->helper_private;
+
+		if (funcs && funcs->enable_hpd)
+			funcs->enable_hpd(connector);
+
 		if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT |
 					 DRM_CONNECTOR_POLL_DISCONNECT))
 			poll = true;
@@ -805,12 +811,25 @@ EXPORT_SYMBOL(drm_kms_helper_is_poll_worker);
 
 static void drm_kms_helper_poll_disable_fini(struct drm_device *dev, bool fini)
 {
+	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
+
 	if (!dev->mode_config.poll_enabled)
 		return;
 
 	if (fini)
 		dev->mode_config.poll_enabled = false;
 
+	drm_connector_list_iter_begin(dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
+		const struct drm_connector_helper_funcs *funcs =
+			connector->helper_private;
+
+		if (funcs && funcs->disable_hpd)
+			funcs->disable_hpd(connector);
+	}
+	drm_connector_list_iter_end(&conn_iter);
+
 	cancel_delayed_work_sync(&dev->mode_config.output_poll_work);
 }
 
include/drm/drm_modeset_helper_vtables.h +22 -0
index fafa70ac1337..7aa1f01223f9 100644
@@ -1143,6 +1143,28 @@ struct drm_connector_helper_funcs {
 	 */
 	void (*cleanup_writeback_job)(struct drm_writeback_connector *connector,
 				      struct drm_writeback_job *job);
+
+	/**
+	 * @enable_hpd:
+	 *
+	 * Enable hot-plug detection for the connector.
+	 *
+	 * This operation is optional.
+	 *
+	 * This callback is used by the drm_kms_helper_poll_enable() helpers.
+	 */
+	void (*enable_hpd)(struct drm_connector *connector);
+
+	/**
+	 * @disable_hpd:
+	 *
+	 * Disable hot-plug detection for the connector.
+	 *
+	 * This operation is optional.
+	 *
+	 * This callback is used by the drm_kms_helper_poll_disable() helpers.
+	 */
+	void (*disable_hpd)(struct drm_connector *connector);
 };
 
 /**
Signature · 1 line
2.35.1
#3 lore raw

PATCH v3 3/7 drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement

In reply to Dmitry Baryshkov

Use drm_connector's helpers enable_hpd and disable_hpd to enable and disable HPD automatically by the means of drm_kms_helper_poll_* functions. As the drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() functions are now unused, replace them with stubs to ease driver migration.

Enabling the HPD from drm_bridge_connector_init() can happen too early, before the driver is prepared to handle HPD events. As the drm_bridge_connector_enable_hpd() is empty anyway, drop this call anyway.

---
 drivers/gpu/drm/drm_bridge_connector.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_bridge_connector.c +13 -5
index 1c7d936523df..0e13bc87a6ac 100644
@@ -136,6 +136,11 @@ static void drm_bridge_connector_hpd_cb(void *cb_data,
  * This is typically used by display drivers in their resume handler.
  */
 void drm_bridge_connector_enable_hpd(struct drm_connector *connector)
+{
+}
+EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
+
+static void _drm_bridge_connector_enable_hpd(struct drm_connector *connector)
 {
 	struct drm_bridge_connector *bridge_connector =
 		to_drm_bridge_connector(connector);
@@ -145,7 +150,6 @@ void drm_bridge_connector_enable_hpd(struct drm_connector *connector)
 		drm_bridge_hpd_enable(hpd, drm_bridge_connector_hpd_cb,
 				      bridge_connector);
 }
-EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
 
 /**
  * drm_bridge_connector_disable_hpd - Disable hot-plug detection for the
@@ -156,6 +160,11 @@ EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
  * This is typically used by display drivers in their suspend handler.
  */
 void drm_bridge_connector_disable_hpd(struct drm_connector *connector)
+{
+}
+EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd);
+
+static void _drm_bridge_connector_disable_hpd(struct drm_connector *connector)
 {
 	struct drm_bridge_connector *bridge_connector =
 		to_drm_bridge_connector(connector);
@@ -164,7 +173,6 @@ void drm_bridge_connector_disable_hpd(struct drm_connector *connector)
 	if (hpd)
 		drm_bridge_hpd_disable(hpd);
 }
-EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd);
 
 /* -----------------------------------------------------------------------------
  * Bridge Connector Functions
@@ -305,6 +313,8 @@ static int drm_bridge_connector_get_modes(struct drm_connector *connector)
 static const struct drm_connector_helper_funcs drm_bridge_connector_helper_funcs = {
 	.get_modes = drm_bridge_connector_get_modes,
 	/* No need for .mode_valid(), the bridges are checked by the core. */
+	.enable_hpd = _drm_bridge_connector_enable_hpd,
+	.disable_hpd = _drm_bridge_connector_disable_hpd,
 };
 
 /* -----------------------------------------------------------------------------
@@ -387,10 +397,8 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
 				    connector_type, ddc);
 	drm_connector_helper_add(connector, &drm_bridge_connector_helper_funcs);
 
-	if (bridge_connector->bridge_hpd) {
+	if (bridge_connector->bridge_hpd)
 		connector->polled = DRM_CONNECTOR_POLL_HPD;
-		drm_bridge_connector_enable_hpd(connector);
-	}
 	else if (bridge_connector->bridge_detect)
 		connector->polled = DRM_CONNECTOR_POLL_CONNECT
 				  | DRM_CONNECTOR_POLL_DISCONNECT;
Signature · 1 line
2.35.1
#4 lore raw

Re: [v3,3/7] drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement

Quoted 6 lines · Dmitry Baryshkov

Use drm_connector's helpers enable_hpd and disable_hpd to enable and disable HPD automatically by the means of drm_kms_helper_poll_* functions. As the drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() functions are now unused, replace them with stubs to ease driver migration.

Quoted 7 lines

Enabling the HPD from drm_bridge_connector_init() can happen too early, before the driver is prepared to handle HPD events. As the drm_bridge_connector_enable_hpd() is empty anyway, drop this call anyway.

---

This patch, merged to recent linux-next as commit 92d755d8f13b ("drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement"), triggers the following warning on all my Amlogic Meson based boards:

------------[ cut here ]------------
Hot plug detection already enabled
WARNING: CPU: 2 PID: 285 at drivers/gpu/drm/drm_bridge.c:1257 
drm_bridge_hpd_enable+0x90/0xa0
Modules linked in: snd_soc_meson_axg_frddr snd_soc_meson_axg_fifo 

dwmac_generic panfrost(+) reset_meson_audio_arb(+) drm_shmem_helper meson_dw_hdmi(+) dw_hdmi rc_odroid drm_display_helper meson_ir(+) gpu_sched meson_rng rng_core meson_gxbb_wdt crct10dif_ce dwmac_meson8b stmmac_platform snd_soc_meson_axg_sound_card snd_soc_meson_card_utils mdio_mux_meson_g12a stmmac meson_drm pwm_meson pcs_xpcs meson_canvas snd_soc_meson_axg_tdm_interface rtc_meson_vrtc snd_soc_meson_axg_tdm_formatter nvmem_meson_efuse display_connector

CPU: 2 PID: 285 Comm: systemd-udevd Not tainted 6.1.0-rc6+ #13236
Hardware name: Hardkernel ODROID-C4 (DT)
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_bridge_hpd_enable+0x90/0xa0
lr : drm_bridge_hpd_enable+0x90/0xa0
...
Call trace:
  drm_bridge_hpd_enable+0x90/0xa0
  _drm_bridge_connector_enable_hpd+0x24/0x34
  drm_kms_helper_poll_enable.part.0+0x50/0xd0
  drm_helper_probe_single_connector_modes+0x400/0x530
  drm_client_modeset_probe+0x1ec/0xba0
  __drm_fb_helper_initial_config_and_unlock+0x4c/0x630
  drm_fb_helper_initial_config+0x50/0x60
  drm_fbdev_client_hotplug+0xc4/0x150
  drm_fbdev_generic_setup+0x88/0x150
  meson_drv_bind_master+0x3d4/0x4a0 [meson_drm]
  meson_drv_bind+0x14/0x20 [meson_drm]
  try_to_bring_up_aggregate_device+0x164/0x1d0
  __component_add+0xa8/0x174
  component_add+0x14/0x20
  meson_dw_hdmi_probe+0x1c/0x30 [meson_dw_hdmi]
  platform_probe+0x68/0xe0
  really_probe+0xbc/0x2e0
  __driver_probe_device+0x78/0xe0
  driver_probe_device+0x3c/0x160
  __driver_attach+0x88/0x1a0
  bus_for_each_dev+0x70/0xd0
  driver_attach+0x24/0x30
  bus_add_driver+0x154/0x204
  driver_register+0x78/0x130
  __platform_driver_register+0x28/0x34
  meson_dw_hdmi_platform_driver_init+0x24/0x1000 [meson_dw_hdmi]
  do_one_initcall+0x74/0x400
  do_init_module+0x48/0x1d4
  load_module+0x1818/0x1de0
  __do_sys_finit_module+0xc0/0x114
  __arm64_sys_finit_module+0x20/0x30
  invoke_syscall+0x48/0x114
  el0_svc_common.constprop.0+0x60/0x11c
  do_el0_svc_compat+0x1c/0x40
  el0_svc_compat+0x48/0xc0
  el0t_32_sync_handler+0x90/0x140
  el0t_32_sync+0x190/0x194
irq event stamp: 17422
hardirqs last  enabled at (17421): [<ffff800009196058>] 
__schedule+0x998/0xa14
hardirqs last disabled at (17422): [<ffff80000918e4a4>] el1_dbg+0x24/0x90
softirqs last  enabled at (17404): [<ffff80000801046c>] _stext+0x46c/0x5d8
softirqs last disabled at (17383): [<ffff8000080166d0>] 
____do_softirq+0x10/0x20
---[ end trace 0000000000000000 ]---

I looks that this change requires some additional changes/fixes in the drivers/gpu/drm/meson/meson_dw_hdmi.c

Quoted 58 lines
  drivers/gpu/drm/drm_bridge_connector.c | 18 +++++++++++++-----
  1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_bridge_connector.c +12 -2
index 1c7d936523df..0e13bc87a6ac 100644
@@ -136,6 +136,11 @@ static void drm_bridge_connector_hpd_cb(void *cb_data,
   * This is typically used by display drivers in their resume handler.
   */
  void drm_bridge_connector_enable_hpd(struct drm_connector *connector)
+{
+}
+EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
+
+static void _drm_bridge_connector_enable_hpd(struct drm_connector *connector)
  {
  	struct drm_bridge_connector *bridge_connector =
  		to_drm_bridge_connector(connector);
@@ -145,7 +150,6 @@ void drm_bridge_connector_enable_hpd(struct drm_connector *connector)
  		drm_bridge_hpd_enable(hpd, drm_bridge_connector_hpd_cb,
  				      bridge_connector);
  }
-EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
 
  /**
   * drm_bridge_connector_disable_hpd - Disable hot-plug detection for the
@@ -156,6 +160,11 @@ EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
   * This is typically used by display drivers in their suspend handler.
   */
  void drm_bridge_connector_disable_hpd(struct drm_connector *connector)
+{
+}
+EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd);
+
+static void _drm_bridge_connector_disable_hpd(struct drm_connector *connector)
  {
  	struct drm_bridge_connector *bridge_connector =
  		to_drm_bridge_connector(connector);
@@ -164,7 +173,6 @@ void drm_bridge_connector_disable_hpd(struct drm_connector *connector)
  	if (hpd)
  		drm_bridge_hpd_disable(hpd);
  }
-EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd);
 
  /* -----------------------------------------------------------------------------
   * Bridge Connector Functions
@@ -305,6 +313,8 @@ static int drm_bridge_connector_get_modes(struct drm_connector *connector)
  static const struct drm_connector_helper_funcs drm_bridge_connector_helper_funcs = {
  	.get_modes = drm_bridge_connector_get_modes,
  	/* No need for .mode_valid(), the bridges are checked by the core. */
+	.enable_hpd = _drm_bridge_connector_enable_hpd,
+	.disable_hpd = _drm_bridge_connector_disable_hpd,
  };
 
  /* -----------------------------------------------------------------------------
@@ -387,10 +397,8 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
  				    connector_type, ddc);

drivers/gpu/drm/drm_bridge_connector.c struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, · line 404

Quoted 10 lines
drivers/gpu/drm/drm_bridge_connector.c +1 -3
  	drm_connector_helper_add(connector, &drm_bridge_connector_helper_funcs);
 
-	if (bridge_connector->bridge_hpd) {
+	if (bridge_connector->bridge_hpd)
  		connector->polled = DRM_CONNECTOR_POLL_HPD;
-		drm_bridge_connector_enable_hpd(connector);
-	}
  	else if (bridge_connector->bridge_detect)
  		connector->polled = DRM_CONNECTOR_POLL_CONNECT
  				  | DRM_CONNECTOR_POLL_DISCONNECT;

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
maintainer
#5 lore raw

Re: [v3, 3/7] drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement

Quoted 32 lines · Marek Szyprowski
Quoted 6 lines · Dmitry Baryshkov

Use drm_connector's helpers enable_hpd and disable_hpd to enable and disable HPD automatically by the means of drm_kms_helper_poll_* functions. As the drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() functions are now unused, replace them with stubs to ease driver migration.

Quoted 7 lines

Enabling the HPD from drm_bridge_connector_init() can happen too early, before the driver is prepared to handle HPD events. As the drm_bridge_connector_enable_hpd() is empty anyway, drop this call anyway.

---

This patch, merged to recent linux-next as commit 92d755d8f13b ("drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement"), triggers the following warning on all my Amlogic Meson based boards:

------------[ cut here ]------------
Hot plug detection already enabled
WARNING: CPU: 2 PID: 285 at drivers/gpu/drm/drm_bridge.c:1257
drm_bridge_hpd_enable+0x90/0xa0
Modules linked in: snd_soc_meson_axg_frddr snd_soc_meson_axg_fifo

dwmac_generic panfrost(+) reset_meson_audio_arb(+) drm_shmem_helper meson_dw_hdmi(+) dw_hdmi rc_odroid drm_display_helper meson_ir(+) gpu_sched meson_rng rng_core meson_gxbb_wdt crct10dif_ce dwmac_meson8b stmmac_platform snd_soc_meson_axg_sound_card snd_soc_meson_card_utils mdio_mux_meson_g12a stmmac meson_drm pwm_meson pcs_xpcs meson_canvas snd_soc_meson_axg_tdm_interface rtc_meson_vrtc snd_soc_meson_axg_tdm_formatter nvmem_meson_efuse display_connector

Quoted 9 lines
CPU: 2 PID: 285 Comm: systemd-udevd Not tainted 6.1.0-rc6+ #13236
Hardware name: Hardkernel ODROID-C4 (DT)
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_bridge_hpd_enable+0x90/0xa0
lr : drm_bridge_hpd_enable+0x90/0xa0
...
Call trace:
   drm_bridge_hpd_enable+0x90/0xa0
   _drm_bridge_connector_enable_hpd+0x24/0x34

Weird because _drm_bridge_connector_enable_hpd() has been removed with 4c00ac500d0e ("drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()")

Quoted 1 line

 drm_kms_helper_poll_enable.part.0+0x50/0xd0

It seems drm_kms_helper_poll_enable is called again by drm_helper_probe_single_connector_modes() because poll_running isn't set.

Can you try with this change:
===============><===========================================

drivers/gpu/drm/drm_probe_helper.c +11 -7
index 7973f2589ced..5d60d4fd868f 100644
@@ -245,7 +245,7 @@ void drm_kms_helper_poll_enable(struct drm_device *dev)
 	struct drm_connector_list_iter conn_iter;
 	unsigned long delay = DRM_OUTPUT_POLL_PERIOD;
 
-	if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll)
+	if (!dev->mode_config.poll_init || !drm_kms_helper_poll || dev->mode_config.poll_enabled)
 		return;
 
 	drm_connector_list_iter_begin(dev, &conn_iter);
@@ -279,6 +279,8 @@ void drm_kms_helper_poll_enable(struct drm_device *dev)
 
 	if (poll)
 		schedule_delayed_work(&dev->mode_config.output_poll_work, delay);
+
+	dev->mode_config.poll_enabled = true;
 }
 EXPORT_SYMBOL(drm_kms_helper_poll_enable);
 
@@ -561,7 +563,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 		 * disable itself again.
 		 */
 		dev->mode_config.delayed_event = true;
-		if (dev->mode_config.poll_enabled)
+		if (dev->mode_config.poll_init)
 			schedule_delayed_work(&dev->mode_config.output_poll_work,
 					      0);
 	}
@@ -703,7 +705,7 @@ static void output_poll_execute(struct work_struct *work)
 	bool repoll = false, changed;
 	u64 old_epoch_counter;
 
-	if (!dev->mode_config.poll_enabled)
+	if (!dev->mode_config.poll_init)
 		return;
 
 	/* Pick up any changes detected by the probe functions. */
@@ -813,11 +815,11 @@ static void drm_kms_helper_poll_disable_fini(struct drm_device *dev, bool fini)
 	struct drm_connector *connector;
 	struct drm_connector_list_iter conn_iter;
 
-	if (!dev->mode_config.poll_enabled)
+	if (!dev->mode_config.poll_init || !dev->mode_config.poll_enabled)
 		return;
 
 	if (fini)
-		dev->mode_config.poll_enabled = false;
+		dev->mode_config.poll_init = false;
 
 	drm_connector_list_iter_begin(dev, &conn_iter);
 	drm_for_each_connector_iter(connector, &conn_iter) {
@@ -830,6 +832,8 @@ static void drm_kms_helper_poll_disable_fini(struct drm_device *dev, bool fini)
 	drm_connector_list_iter_end(&conn_iter);
 
 	cancel_delayed_work_sync(&dev->mode_config.output_poll_work);
+
+	dev->mode_config.poll_enabled = false;
 }
 
 /**
@@ -874,7 +878,7 @@ EXPORT_SYMBOL(drm_kms_helper_poll_disable);
 void drm_kms_helper_poll_init(struct drm_device *dev)
 {
 	INIT_DELAYED_WORK(&dev->mode_config.output_poll_work, output_poll_execute);
-	dev->mode_config.poll_enabled = true;
+	dev->mode_config.poll_init = true;
 
 	drm_kms_helper_poll_enable(dev);
 }
@@ -1003,7 +1007,7 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev)
 	struct drm_connector_list_iter conn_iter;
 	int changed = 0;
 
-	if (!dev->mode_config.poll_enabled)
+	if (!dev->mode_config.poll_init)
 		return false;
 
 	mutex_lock(&dev->mode_config.mutex);
include/drm/drm_mode_config.h +2 -0
index e5b053001d22..86c5f66f1a6c 100644
@@ -345,6 +345,7 @@ struct drm_mode_config_funcs {
  * @max_width: maximum fb pixel width on this device
  * @max_height: maximum fb pixel height on this device
  * @funcs: core driver provided mode setting functions
+ * @poll_init: track polling initialization for this device
  * @poll_enabled: track polling support for this device
  * @poll_running: track polling status for this device
  * @delayed_event: track delayed poll uevent deliver for this device
@@ -543,6 +544,7 @@ struct drm_mode_config {
 	const struct drm_mode_config_funcs *funcs;
 
 	/* output poll support */
+	bool poll_init;
 	bool poll_enabled;
 	bool poll_running;
 	bool delayed_event;

===============><===========================================

Neil

Quoted 117 lines
   drm_helper_probe_single_connector_modes+0x400/0x530
   drm_client_modeset_probe+0x1ec/0xba0
   __drm_fb_helper_initial_config_and_unlock+0x4c/0x630
   drm_fb_helper_initial_config+0x50/0x60
   drm_fbdev_client_hotplug+0xc4/0x150
   drm_fbdev_generic_setup+0x88/0x150
   meson_drv_bind_master+0x3d4/0x4a0 [meson_drm]
   meson_drv_bind+0x14/0x20 [meson_drm]
   try_to_bring_up_aggregate_device+0x164/0x1d0
   __component_add+0xa8/0x174
   component_add+0x14/0x20
   meson_dw_hdmi_probe+0x1c/0x30 [meson_dw_hdmi]
   platform_probe+0x68/0xe0
   really_probe+0xbc/0x2e0
   __driver_probe_device+0x78/0xe0
   driver_probe_device+0x3c/0x160
   __driver_attach+0x88/0x1a0
   bus_for_each_dev+0x70/0xd0
   driver_attach+0x24/0x30
   bus_add_driver+0x154/0x204
   driver_register+0x78/0x130
   __platform_driver_register+0x28/0x34
   meson_dw_hdmi_platform_driver_init+0x24/0x1000 [meson_dw_hdmi]
   do_one_initcall+0x74/0x400
   do_init_module+0x48/0x1d4
   load_module+0x1818/0x1de0
   __do_sys_finit_module+0xc0/0x114
   __arm64_sys_finit_module+0x20/0x30
   invoke_syscall+0x48/0x114
   el0_svc_common.constprop.0+0x60/0x11c
   do_el0_svc_compat+0x1c/0x40
   el0_svc_compat+0x48/0xc0
   el0t_32_sync_handler+0x90/0x140
   el0t_32_sync+0x190/0x194
irq event stamp: 17422
hardirqs last  enabled at (17421): [<ffff800009196058>]
__schedule+0x998/0xa14
hardirqs last disabled at (17422): [<ffff80000918e4a4>] el1_dbg+0x24/0x90
softirqs last  enabled at (17404): [<ffff80000801046c>] _stext+0x46c/0x5d8
softirqs last disabled at (17383): [<ffff8000080166d0>]
____do_softirq+0x10/0x20
---[ end trace 0000000000000000 ]---

I looks that this change requires some additional changes/fixes in the drivers/gpu/drm/meson/meson_dw_hdmi.c

Quoted 58 lines
   drivers/gpu/drm/drm_bridge_connector.c | 18 +++++++++++++-----
   1 file changed, 13 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_bridge_connector.c +12 -2
index 1c7d936523df..0e13bc87a6ac 100644
@@ -136,6 +136,11 @@ static void drm_bridge_connector_hpd_cb(void *cb_data,
    * This is typically used by display drivers in their resume handler.
    */
   void drm_bridge_connector_enable_hpd(struct drm_connector *connector)
+{
+}
+EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
+
+static void _drm_bridge_connector_enable_hpd(struct drm_connector *connector)
   {
   	struct drm_bridge_connector *bridge_connector =
   		to_drm_bridge_connector(connector);
@@ -145,7 +150,6 @@ void drm_bridge_connector_enable_hpd(struct drm_connector *connector)
   		drm_bridge_hpd_enable(hpd, drm_bridge_connector_hpd_cb,
   				      bridge_connector);
   }
-EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
 
   /**
    * drm_bridge_connector_disable_hpd - Disable hot-plug detection for the
@@ -156,6 +160,11 @@ EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
    * This is typically used by display drivers in their suspend handler.
    */
   void drm_bridge_connector_disable_hpd(struct drm_connector *connector)
+{
+}
+EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd);
+
+static void _drm_bridge_connector_disable_hpd(struct drm_connector *connector)
   {
   	struct drm_bridge_connector *bridge_connector =
   		to_drm_bridge_connector(connector);
@@ -164,7 +173,6 @@ void drm_bridge_connector_disable_hpd(struct drm_connector *connector)
   	if (hpd)
   		drm_bridge_hpd_disable(hpd);
   }
-EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd);
 
   /* -----------------------------------------------------------------------------
    * Bridge Connector Functions
@@ -305,6 +313,8 @@ static int drm_bridge_connector_get_modes(struct drm_connector *connector)
   static const struct drm_connector_helper_funcs drm_bridge_connector_helper_funcs = {
   	.get_modes = drm_bridge_connector_get_modes,
   	/* No need for .mode_valid(), the bridges are checked by the core. */
+	.enable_hpd = _drm_bridge_connector_enable_hpd,
+	.disable_hpd = _drm_bridge_connector_disable_hpd,
   };
 
   /* -----------------------------------------------------------------------------
@@ -387,10 +397,8 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
   				    connector_type, ddc);

drivers/gpu/drm/drm_bridge_connector.c struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, · line 404

Quoted 10 lines
drivers/gpu/drm/drm_bridge_connector.c +1 -3
   	drm_connector_helper_add(connector, &drm_bridge_connector_helper_funcs);
 
-	if (bridge_connector->bridge_hpd) {
+	if (bridge_connector->bridge_hpd)
   		connector->polled = DRM_CONNECTOR_POLL_HPD;
-		drm_bridge_connector_enable_hpd(connector);
-	}
   	else if (bridge_connector->bridge_detect)
   		connector->polled = DRM_CONNECTOR_POLL_CONNECT
   				  | DRM_CONNECTOR_POLL_DISCONNECT;

Best regards

#6 lore raw

Re: [v3, 3/7] drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement

Quoted 43 lines · Neil Armstrong
Quoted 32 lines · Marek Szyprowski
Quoted 6 lines · Dmitry Baryshkov

Use drm_connector's helpers enable_hpd and disable_hpd to enable and disable HPD automatically by the means of drm_kms_helper_poll_* functions. As the drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() functions are now unused, replace them with stubs to ease driver migration.

Quoted 7 lines

Enabling the HPD from drm_bridge_connector_init() can happen too early, before the driver is prepared to handle HPD events. As the drm_bridge_connector_enable_hpd() is empty anyway, drop this call anyway.

---

This patch, merged to recent linux-next as commit 92d755d8f13b ("drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement"), triggers the following warning on all my Amlogic Meson based boards:

------------[ cut here ]------------
Hot plug detection already enabled
WARNING: CPU: 2 PID: 285 at drivers/gpu/drm/drm_bridge.c:1257
drm_bridge_hpd_enable+0x90/0xa0
Modules linked in: snd_soc_meson_axg_frddr snd_soc_meson_axg_fifo

dwmac_generic panfrost(+) reset_meson_audio_arb(+) drm_shmem_helper meson_dw_hdmi(+) dw_hdmi rc_odroid drm_display_helper meson_ir(+) gpu_sched meson_rng rng_core meson_gxbb_wdt crct10dif_ce dwmac_meson8b stmmac_platform snd_soc_meson_axg_sound_card snd_soc_meson_card_utils mdio_mux_meson_g12a stmmac meson_drm pwm_meson pcs_xpcs meson_canvas snd_soc_meson_axg_tdm_interface rtc_meson_vrtc snd_soc_meson_axg_tdm_formatter nvmem_meson_efuse display_connector

Quoted 9 lines
CPU: 2 PID: 285 Comm: systemd-udevd Not tainted 6.1.0-rc6+ #13236
Hardware name: Hardkernel ODROID-C4 (DT)
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_bridge_hpd_enable+0x90/0xa0
lr : drm_bridge_hpd_enable+0x90/0xa0
...
Call trace:
   drm_bridge_hpd_enable+0x90/0xa0
   _drm_bridge_connector_enable_hpd+0x24/0x34
Quoted 8 lines

Weird because _drm_bridge_connector_enable_hpd() has been removed with 4c00ac500d0e ("drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()")

Quoted 1 line

   drm_kms_helper_poll_enable.part.0+0x50/0xd0

It seems drm_kms_helper_poll_enable is called again by drm_helper_probe_single_connector_modes() because poll_running isn't set.

Yes, I'm currently reworking poll_running handling. I hope to post a patch today.

Signature · 2 lines
With best wishes
Dmitry
#7 lore raw

Re: [v3,3/7] drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement

In reply to Neil Armstrong

Hi Neil,

Quoted 43 lines · Neil Armstrong
Quoted 32 lines · Marek Szyprowski
Quoted 6 lines · Dmitry Baryshkov

Use drm_connector's helpers enable_hpd and disable_hpd to enable and disable HPD automatically by the means of drm_kms_helper_poll_* functions. As the drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() functions are now unused, replace them with stubs to ease driver migration.

Quoted 7 lines

Enabling the HPD from drm_bridge_connector_init() can happen too early, before the driver is prepared to handle HPD events. As the drm_bridge_connector_enable_hpd() is empty anyway, drop this call anyway.

---

This patch, merged to recent linux-next as commit 92d755d8f13b ("drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement"), triggers the following warning on all my Amlogic Meson based boards:

------------[ cut here ]------------
Hot plug detection already enabled
WARNING: CPU: 2 PID: 285 at drivers/gpu/drm/drm_bridge.c:1257
drm_bridge_hpd_enable+0x90/0xa0
Modules linked in: snd_soc_meson_axg_frddr snd_soc_meson_axg_fifo

dwmac_generic panfrost(+) reset_meson_audio_arb(+) drm_shmem_helper meson_dw_hdmi(+) dw_hdmi rc_odroid drm_display_helper meson_ir(+) gpu_sched meson_rng rng_core meson_gxbb_wdt crct10dif_ce dwmac_meson8b stmmac_platform snd_soc_meson_axg_sound_card snd_soc_meson_card_utils mdio_mux_meson_g12a stmmac meson_drm pwm_meson pcs_xpcs meson_canvas snd_soc_meson_axg_tdm_interface rtc_meson_vrtc snd_soc_meson_axg_tdm_formatter nvmem_meson_efuse display_connector

Quoted 9 lines
CPU: 2 PID: 285 Comm: systemd-udevd Not tainted 6.1.0-rc6+ #13236
Hardware name: Hardkernel ODROID-C4 (DT)
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_bridge_hpd_enable+0x90/0xa0
lr : drm_bridge_hpd_enable+0x90/0xa0
...
Call trace:
   drm_bridge_hpd_enable+0x90/0xa0
   _drm_bridge_connector_enable_hpd+0x24/0x34
Quoted 3 lines

Weird because _drm_bridge_connector_enable_hpd() has been removed with 4c00ac500d0e ("drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()")

The above log has been captured at commit 92d755d8f13b during bisecting, so 4c00ac500d0e is not applied yet. Maybe I should have mention that. The issue on top of linux-next is similar.

Quoted 7 lines
Quoted 2 lines

 drm_kms_helper_poll_enable.part.0+0x50/0xd0

It seems drm_kms_helper_poll_enable is called again by drm_helper_probe_single_connector_modes() because poll_running isn't set.

Can you try with this change:

This fixes the issue on top of linux next-20230112. Thanks! Feel free to add if you plan to submit it as a formal patch:

Quoted 1 line

...

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
#8 lore raw

PATCH v3 4/7 drm/imx/dcss: stop using drm_bridge_connector_en/disable_hpd()

In reply to Dmitry Baryshkov

The functionality of drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() is provided automatically by the drm_kms_poll helpers. Stop calling these functions manually.

---
 drivers/gpu/drm/imx/dcss/dcss-dev.c | 4 ----
 drivers/gpu/drm/imx/dcss/dcss-kms.c | 2 --
 2 files changed, 6 deletions(-)
drivers/gpu/drm/imx/dcss/dcss-dev.c +0 -4
index 3f5750cc2673..0d8e44f20ec4 100644
@@ -257,8 +257,6 @@ int dcss_dev_suspend(struct device *dev)
 	struct dcss_kms_dev *kms = container_of(ddev, struct dcss_kms_dev, base);
 	int ret;
 
-	drm_bridge_connector_disable_hpd(kms->connector);
-
 	drm_mode_config_helper_suspend(ddev);
 
 	if (pm_runtime_suspended(dev))
@@ -292,8 +290,6 @@ int dcss_dev_resume(struct device *dev)
 
 	drm_mode_config_helper_resume(ddev);
 
-	drm_bridge_connector_enable_hpd(kms->connector);
-
 	return 0;
 }
 #endif /* CONFIG_PM_SLEEP */
drivers/gpu/drm/imx/dcss/dcss-kms.c +0 -2
index b4f82ebca532..16ef8aa6da37 100644
@@ -151,7 +151,6 @@ struct dcss_kms_dev *dcss_kms_attach(struct dcss_dev *dcss)
 	return kms;
 
 cleanup_crtc:
-	drm_bridge_connector_disable_hpd(kms->connector);
 	drm_kms_helper_poll_fini(drm);
 	dcss_crtc_deinit(crtc, drm);
 
@@ -167,7 +166,6 @@ void dcss_kms_detach(struct dcss_kms_dev *kms)
 	struct drm_device *drm = &kms->base;
 
 	drm_dev_unregister(drm);
-	drm_bridge_connector_disable_hpd(kms->connector);
 	drm_kms_helper_poll_fini(drm);
 	drm_atomic_helper_shutdown(drm);
 	drm_crtc_vblank_off(&kms->crtc.base);
Signature · 1 line
2.35.1
maintainer
#9 lore raw

Re: [PATCH v3 4/7] drm/imx/dcss: stop using drm_bridge_connector_en/disable_hpd()

Quoted 45 lines · Dmitry Baryshkov

The functionality of drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() is provided automatically by the drm_kms_poll helpers. Stop calling these functions manually.

---
  drivers/gpu/drm/imx/dcss/dcss-dev.c | 4 ----
  drivers/gpu/drm/imx/dcss/dcss-kms.c | 2 --
  2 files changed, 6 deletions(-)
drivers/gpu/drm/imx/dcss/dcss-dev.c +0 -4
index 3f5750cc2673..0d8e44f20ec4 100644
@@ -257,8 +257,6 @@ int dcss_dev_suspend(struct device *dev)
  	struct dcss_kms_dev *kms = container_of(ddev, struct dcss_kms_dev, base);
  	int ret;
 
-	drm_bridge_connector_disable_hpd(kms->connector);
-
  	drm_mode_config_helper_suspend(ddev);
 
  	if (pm_runtime_suspended(dev))
@@ -292,8 +290,6 @@ int dcss_dev_resume(struct device *dev)
 
  	drm_mode_config_helper_resume(ddev);
 
-	drm_bridge_connector_enable_hpd(kms->connector);
-
  	return 0;
  }
  #endif /* CONFIG_PM_SLEEP */
drivers/gpu/drm/imx/dcss/dcss-kms.c +0 -1
index b4f82ebca532..16ef8aa6da37 100644
@@ -151,7 +151,6 @@ struct dcss_kms_dev *dcss_kms_attach(struct dcss_dev *dcss)
  	return kms;
 
  cleanup_crtc:
-	drm_bridge_connector_disable_hpd(kms->connector);
  	drm_kms_helper_poll_fini(drm);
  	dcss_crtc_deinit(crtc, drm);
 

drivers/gpu/drm/imx/dcss/dcss-kms.c void dcss_kms_detach(struct dcss_kms_dev *kms) · line 171

Quoted 7 lines
drivers/gpu/drm/imx/dcss/dcss-kms.c +0 -1
@@ -167,7 +166,6 @@ void dcss_kms_detach(struct dcss_kms_dev *kms)
  	struct drm_device *drm = &kms->base;
 
  	drm_dev_unregister(drm);
-	drm_bridge_connector_disable_hpd(kms->connector);
  	drm_kms_helper_poll_fini(drm);
  	drm_atomic_helper_shutdown(drm);
  	drm_crtc_vblank_off(&kms->crtc.base);

I get:
/drivers/gpu/drm/imx/dcss/dcss-dev.c: In function ‘dcss_dev_suspend’:
/drivers/gpu/drm/imx/dcss/dcss-dev.c:256:23: warning: unused variable ‘kms’ [-Wunused-variable]
256 | struct dcss_kms_dev *kms = container_of(ddev, struct dcss_kms_dev, base);
| ^~~
/drivers/gpu/drm/imx/dcss/dcss-dev.c: In function ‘dcss_dev_resume’:
/drivers/gpu/drm/imx/dcss/dcss-dev.c:277:23: warning: unused variable ‘kms’ [-Wunused-variable]
277 | struct dcss_kms_dev *kms = container_of(ddev, struct dcss_kms_dev, base);
| ^~~

I'll fix while applying,

Neil

#10 lore raw

PATCH v3 5/7 drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd()

In reply to Dmitry Baryshkov

The functionality of drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() is provided automatically by the drm_kms_poll helpers. Stop calling these functions manually.

---
 drivers/gpu/drm/msm/hdmi/hdmi.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi.c +0 -2
index 93fe61b86967..a540c45d4fd3 100644
@@ -348,8 +348,6 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
 		goto fail;
 	}
 
-	drm_bridge_connector_enable_hpd(hdmi->connector);
-
 	ret = msm_hdmi_hpd_enable(hdmi->bridge);
 	if (ret < 0) {
 		DRM_DEV_ERROR(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret);
Signature · 1 line
2.35.1
#11 lore raw

Re: [PATCH v3 5/7] drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd()

Quoted 3 lines · Dmitry Baryshkov

The functionality of drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() is provided automatically by the drm_kms_poll helpers. Stop calling these functions manually.

I stumbled over this one when investigating a hotplug-related crash in the MSM DRM driver which this series prevents by moving hotplug notification enable to drm_kms_helper_poll_enable().

Quoted 10 lines
---
 drivers/gpu/drm/msm/hdmi/hdmi.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi.c +0 -0
index 93fe61b86967..a540c45d4fd3 100644

drivers/gpu/drm/msm/hdmi/hdmi.c int msm_hdmi_modeset_init(struct hdmi *hdmi, · line 353

Quoted 8 lines
drivers/gpu/drm/msm/hdmi/hdmi.c +0 -2
@@ -348,8 +348,6 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
 		goto fail;
 	}
 
-	drm_bridge_connector_enable_hpd(hdmi->connector);
-
 	ret = msm_hdmi_hpd_enable(hdmi->bridge);
 	if (ret < 0) {
 		DRM_DEV_ERROR(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret);

It looks like you are now enabling hotplug events before the DRM driver is ready to receive them (i.e. msm_hdmi_hpd_enable() is called before drm_bridge_connector_enable_hpd()).

Could this not lead to missed events or is the state being setup correctly somewhere else?

Shouldn't the call to msm_hdmi_hpd_enable() be moved to when HPD is enabled either way (e.g. by being converted to a hpd_enable callback)?

Johan

#12 lore raw

Re: [PATCH v3 5/7] drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd()

Quoted 33 lines · Johan Hovold
Quoted 3 lines · Dmitry Baryshkov

The functionality of drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() is provided automatically by the drm_kms_poll helpers. Stop calling these functions manually.

I stumbled over this one when investigating a hotplug-related crash in the MSM DRM driver which this series prevents by moving hotplug notification enable to drm_kms_helper_poll_enable().

Quoted 10 lines
---
 drivers/gpu/drm/msm/hdmi/hdmi.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi.c +0 -0
index 93fe61b86967..a540c45d4fd3 100644

drivers/gpu/drm/msm/hdmi/hdmi.c int msm_hdmi_modeset_init(struct hdmi *hdmi, · line 353

Quoted 8 lines
drivers/gpu/drm/msm/hdmi/hdmi.c +0 -2
@@ -348,8 +348,6 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
              goto fail;
      }
 
-     drm_bridge_connector_enable_hpd(hdmi->connector);
-
      ret = msm_hdmi_hpd_enable(hdmi->bridge);
      if (ret < 0) {
              DRM_DEV_ERROR(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret);

It looks like you are now enabling hotplug events before the DRM driver is ready to receive them (i.e. msm_hdmi_hpd_enable() is called before drm_bridge_connector_enable_hpd()).

Quoted 5 lines

Could this not lead to missed events or is the state being setup correctly somewhere else?

Shouldn't the call to msm_hdmi_hpd_enable() be moved to when HPD is enabled either way (e.g. by being converted to a hpd_enable callback)?

Eventually I'll get to it (hopefully during this weekend). There is one item which needs to be investigated, see [1]. I have to check if this is applicable to earlier generations, which also means resurrecting the msm8974 HDMI PHY patchset posted ages ago. I think the initial status is determined correctly using the .detect(). At least I saw no issues with this patchset. However, thanks for the pointer.

[1] https://git.codelinaro.org/linaro/qcomlt/kernel/-/commit/6ae2c308555f470ba63f90b7171519a242f96a67

Signature · 2 lines
With best wishes
Dmitry
#13 lore raw

PATCH v3 6/7 drm/omap: stop using drm_bridge_connector_en/disable_hpd()

In reply to Dmitry Baryshkov

The functionality of drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() is provided automatically by the drm_kms_poll helpers. Stop calling these functions manually.

---
 drivers/gpu/drm/omapdrm/omap_drv.c | 41 ------------------------------
 1 file changed, 41 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.c +0 -41
index eaf67b9e5f12..699ed814e021 100644
@@ -545,44 +545,6 @@ static void omap_modeset_fini(struct drm_device *ddev)
 	drm_mode_config_cleanup(ddev);
 }
 
-/*
- * Enable the HPD in external components if supported
- */
-static void omap_modeset_enable_external_hpd(struct drm_device *ddev)
-{
-	struct omap_drm_private *priv = ddev->dev_private;
-	unsigned int i;
-
-	for (i = 0; i < priv->num_pipes; i++) {
-		struct drm_connector *connector = priv->pipes[i].connector;
-
-		if (!connector)
-			continue;
-
-		if (priv->pipes[i].output->bridge)
-			drm_bridge_connector_enable_hpd(connector);
-	}
-}
-
-/*
- * Disable the HPD in external components if supported
- */
-static void omap_modeset_disable_external_hpd(struct drm_device *ddev)
-{
-	struct omap_drm_private *priv = ddev->dev_private;
-	unsigned int i;
-
-	for (i = 0; i < priv->num_pipes; i++) {
-		struct drm_connector *connector = priv->pipes[i].connector;
-
-		if (!connector)
-			continue;
-
-		if (priv->pipes[i].output->bridge)
-			drm_bridge_connector_disable_hpd(connector);
-	}
-}
-
 /*
  * drm ioctl funcs
  */
@@ -782,7 +744,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	omap_fbdev_init(ddev);
 
 	drm_kms_helper_poll_init(ddev);
-	omap_modeset_enable_external_hpd(ddev);
 
 	/*
 	 * Register the DRM device with the core and the connectors with
@@ -795,7 +756,6 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
 	return 0;
 
 err_cleanup_helpers:
-	omap_modeset_disable_external_hpd(ddev);
 	drm_kms_helper_poll_fini(ddev);
 
 	omap_fbdev_fini(ddev);
@@ -822,7 +782,6 @@ static void omapdrm_cleanup(struct omap_drm_private *priv)
 
 	drm_dev_unregister(ddev);
 
-	omap_modeset_disable_external_hpd(ddev);
 	drm_kms_helper_poll_fini(ddev);
 
 	omap_fbdev_fini(ddev);
Signature · 1 line
2.35.1
#14 lore raw

PATCH v3 7/7 drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()

In reply to Dmitry Baryshkov

Now as all drivers stopped calling drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() it is safe to remove them complelely. Rename our internal helpers to remove the underscore prefix.

---
 drivers/gpu/drm/drm_bridge_connector.c | 33 ++++----------------------
 include/drm/drm_bridge_connector.h     |  2 --
 2 files changed, 4 insertions(+), 31 deletions(-)
drivers/gpu/drm/drm_bridge_connector.c +4 -29
index 0e13bc87a6ac..19ae4a177ac3 100644
@@ -128,19 +128,7 @@ static void drm_bridge_connector_hpd_cb(void *cb_data,
 	drm_kms_helper_hotplug_event(dev);
 }
 
-/**
- * drm_bridge_connector_enable_hpd - Enable hot-plug detection for the connector
- * @connector: The DRM bridge connector
- *
- * This function enables hot-plug detection for the given bridge connector.
- * This is typically used by display drivers in their resume handler.
- */
-void drm_bridge_connector_enable_hpd(struct drm_connector *connector)
-{
-}
-EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd);
-
-static void _drm_bridge_connector_enable_hpd(struct drm_connector *connector)
+static void drm_bridge_connector_enable_hpd(struct drm_connector *connector)
 {
 	struct drm_bridge_connector *bridge_connector =
 		to_drm_bridge_connector(connector);
@@ -151,20 +139,7 @@ static void _drm_bridge_connector_enable_hpd(struct drm_connector *connector)
 				      bridge_connector);
 }
 
-/**
- * drm_bridge_connector_disable_hpd - Disable hot-plug detection for the
- * connector
- * @connector: The DRM bridge connector
- *
- * This function disables hot-plug detection for the given bridge connector.
- * This is typically used by display drivers in their suspend handler.
- */
-void drm_bridge_connector_disable_hpd(struct drm_connector *connector)
-{
-}
-EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd);
-
-static void _drm_bridge_connector_disable_hpd(struct drm_connector *connector)
+static void drm_bridge_connector_disable_hpd(struct drm_connector *connector)
 {
 	struct drm_bridge_connector *bridge_connector =
 		to_drm_bridge_connector(connector);
@@ -313,8 +288,8 @@ static int drm_bridge_connector_get_modes(struct drm_connector *connector)
 static const struct drm_connector_helper_funcs drm_bridge_connector_helper_funcs = {
 	.get_modes = drm_bridge_connector_get_modes,
 	/* No need for .mode_valid(), the bridges are checked by the core. */
-	.enable_hpd = _drm_bridge_connector_enable_hpd,
-	.disable_hpd = _drm_bridge_connector_disable_hpd,
+	.enable_hpd = drm_bridge_connector_enable_hpd,
+	.disable_hpd = drm_bridge_connector_disable_hpd,
 };
 
 /* -----------------------------------------------------------------------------
include/drm/drm_bridge_connector.h +0 -2
index 33f6c3bbdb4a..69630815fb09 100644
@@ -10,8 +10,6 @@ struct drm_connector;
 struct drm_device;
 struct drm_encoder;
 
-void drm_bridge_connector_enable_hpd(struct drm_connector *connector);
-void drm_bridge_connector_disable_hpd(struct drm_connector *connector);
 struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
 						struct drm_encoder *encoder);
 
Signature · 1 line
2.35.1
#15 lore raw
In reply to Dmitry Baryshkov
Quoted 10 lines · Dmitry Baryshkov

From all the drivers using drm_bridge_connector only iMX/dcss and OMAP
DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Since we are at the beginning of the development window, gracious ping for this patchset.

It would be nice to finally handle the bridge_connector's hpd properly. Calling drm_bridge_connector_enable_hpd() from drm_bridge_connector_init() is not a proper way to do this. It results in calling bridge->funcs->hpd_enable() before the rest of the pipeline was set up properly.

Quoted 30 lines

Changes since v2:
- Fixed a typo in the commit message of the second patch.

Changes since v1:
- Rebased on top of v6.1-rc1
- Removed the drm_bridge_connector_enable_hpd() from drm_bridge_connector_init()
- Removed extra underscore prefix from drm_bridge_connector_en/disable_hpd() helpers

Dmitry Baryshkov (7):
drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini() drm/probe-helper: enable and disable HPD on connectors drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement drm/imx/dcss: stop using drm_bridge_connector_en/disable_hpd() drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd() drm/omap: stop using drm_bridge_connector_en/disable_hpd() drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()

  drivers/gpu/drm/drm_bridge_connector.c   | 27 +++-------------
  drivers/gpu/drm/drm_probe_helper.c       | 40 ++++++++++++++++++-----
  drivers/gpu/drm/imx/dcss/dcss-dev.c      |  4 ---
  drivers/gpu/drm/imx/dcss/dcss-kms.c      |  2 --
  drivers/gpu/drm/msm/hdmi/hdmi.c          |  2 --
  drivers/gpu/drm/omapdrm/omap_drv.c       | 41 ------------------------
  include/drm/drm_bridge_connector.h       |  2 --
  include/drm/drm_modeset_helper_vtables.h | 22 +++++++++++++
  8 files changed, 59 insertions(+), 81 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
maintainer Reviewed-by
#16 lore raw
Quoted 7 lines · Dmitry Baryshkov
Quoted 6 lines · Dmitry Baryshkov

 From all the drivers using drm_bridge_connector only iMX/dcss and OMAP DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Quoted 8 lines
Quoted 4 lines

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Since we are at the beginning of the development window, gracious ping for this patchset.

It would be nice to finally handle the bridge_connector's hpd properly. Calling drm_bridge_connector_enable_hpd() from drm_bridge_connector_init() is not a proper way to do this. It results in calling bridge->funcs->hpd_enable() before the rest of the pipeline was set up properly.

For the series:

I've been using this series in my local branch for quite a while to fix the HPD issues. Works for me.

I still think the "fix" aspect should be highlighted more here, as the current upstream triggers a WARN for "Hot plug detection already enabled" (at least) on OMAP.

Tomi

maintainer
#17 lore raw
Quoted 17 lines · Tomi Valkeinen
Quoted 7 lines · Dmitry Baryshkov
Quoted 6 lines · Dmitry Baryshkov

 From all the drivers using drm_bridge_connector only iMX/dcss and OMAP DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Quoted 8 lines
Quoted 4 lines

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Since we are at the beginning of the development window, gracious ping for this patchset.

It would be nice to finally handle the bridge_connector's hpd properly. Calling drm_bridge_connector_enable_hpd() from drm_bridge_connector_init() is not a proper way to do this. It results in calling bridge->funcs->hpd_enable() before the rest of the pipeline was set up properly.

Quoted 7 lines

For the series:

I've been using this series in my local branch for quite a while to fix the HPD issues. Works for me.

I still think the "fix" aspect should be highlighted more here, as the current upstream triggers a WARN for "Hot plug detection already enabled" (at least) on OMAP.

LGTM then !

Tomi, Dmitry, I can push the whole serie via drm-misc-next or -fixes then, as you wish.

Neil

Quoted 3 lines

 Tomi

#18 lore raw
Quoted 16 lines · Neil Armstrong
Quoted 15 lines · Tomi Valkeinen
Quoted 14 lines · Dmitry Baryshkov
Quoted 10 lines · Dmitry Baryshkov

 From all the drivers using drm_bridge_connector only iMX/dcss and OMAP DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Since we are at the beginning of the development window, gracious ping for this patchset.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

It would be nice to finally handle the bridge_connector's hpd properly. Calling drm_bridge_connector_enable_hpd() from drm_bridge_connector_init() is not a proper way to do this. It results in calling bridge->funcs->hpd_enable() before the rest of the pipeline was set up properly.

For the series:

I've been using this series in my local branch for quite a while to fix the HPD issues. Works for me.

Thanks!

Quoted 6 lines
Quoted 2 lines

I still think the "fix" aspect should be highlighted more here, as the current upstream triggers a WARN for "Hot plug detection already enabled" (at least) on OMAP.

LGTM then !

Tomi, Dmitry, I can push the whole serie via drm-misc-next or -fixes then, as you wish.

I'm fine either way. We have been living with the warning for some time, so I don't think there is any urgency to get rid of it immediately.

Signature · 2 lines
With best wishes
Dmitry
maintainer
#19 lore raw
Quoted 28 lines · Dmitry Baryshkov
Quoted 16 lines · Neil Armstrong
Quoted 15 lines · Tomi Valkeinen
Quoted 14 lines · Dmitry Baryshkov
Quoted 10 lines · Dmitry Baryshkov

 From all the drivers using drm_bridge_connector only iMX/dcss and OMAP DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Since we are at the beginning of the development window, gracious ping for this patchset.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

It would be nice to finally handle the bridge_connector's hpd properly. Calling drm_bridge_connector_enable_hpd() from drm_bridge_connector_init() is not a proper way to do this. It results in calling bridge->funcs->hpd_enable() before the rest of the pipeline was set up properly.

For the series:

I've been using this series in my local branch for quite a while to fix the HPD issues. Works for me.

Thanks!

Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I still think the "fix" aspect should be highlighted more here, as the current upstream triggers a WARN for "Hot plug detection already enabled" (at least) on OMAP.

LGTM then !

Tomi, Dmitry, I can push the whole serie via drm-misc-next or -fixes then, as you wish.

I'm fine either way. We have been living with the warning for some time, so I don't think there is any urgency to get rid of it immediately.

Yes, drm-misc-next is fine for me too.

Tomi

maintainer Applied
#20 lore raw
In reply to Dmitry Baryshkov

Hi,

Quoted 6 lines · Dmitry Baryshkov

From all the drivers using drm_bridge_connector only iMX/dcss and OMAP DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Quoted 6 lines

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

[...]

Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)

[1/7] drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini()

      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=78b991ccfa64a438e2d8c2997d22d55621ab277d
[2/7] drm/probe-helper: enable and disable HPD on connectors
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=c8268795c9a9cc7be50f78d4502fad83a2a4f8df
[3/7] drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=92d755d8f13b6791c72d4e980c09f054d8175c94
[4/7] drm/imx/dcss: stop using drm_bridge_connector_en/disable_hpd()
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=60c376e4549b6844af94cf319960ef48080230a8
[5/7] drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd()
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=9e954403bc9cc024cf052e9429c0e6db86ffe0f7
[6/7] drm/omap: stop using drm_bridge_connector_en/disable_hpd()
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=c4f5538fa65dd093b71859c4792afd4e13fae5f1
[7/7] drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=4c00ac500d0edd1a6730c4e8293834a694c1b304
Signature · 1 line
Neil
maintainer
#21 lore raw
In reply to Dmitry Baryshkov

Hi Dmitry,

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

After a short investigation, it seems that we end up calling drm_bridge_hpd_enable() from both drm_kms_helper_poll_init() and drm_fbdev_generic_setup(), hence the warning.

There are drivers using the drm_bridge_connector API that also call drm_kms_helper_poll_init() followed by drm_fbdev_generic_setup(). So, they might experience the same behavior, unless I'm missing something... :/

Also, even if drm_fbdev_generic_setup() is not called in the driver initialization, the warning will still appear the first time the GETCONNECTOR ioctl is called, because that'll call drm_helper_probe_single_connector_modes() helper which will eventually call drm_bridge_hpd_enable().

Any idea?

Cheers,
Laurentiu

Quoted 43 lines · Dmitry Baryshkov

From all the drivers using drm_bridge_connector only iMX/dcss and OMAP DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Changes since v2:
- Fixed a typo in the commit message of the second patch.

Changes since v1:
- Rebased on top of v6.1-rc1
- Removed the drm_bridge_connector_enable_hpd() from drm_bridge_connector_init()
- Removed extra underscore prefix from drm_bridge_connector_en/disable_hpd() helpers

Dmitry Baryshkov (7):
drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini() drm/probe-helper: enable and disable HPD on connectors drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement drm/imx/dcss: stop using drm_bridge_connector_en/disable_hpd() drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd() drm/omap: stop using drm_bridge_connector_en/disable_hpd() drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()

 drivers/gpu/drm/drm_bridge_connector.c   | 27 +++-------------
 drivers/gpu/drm/drm_probe_helper.c       | 40 ++++++++++++++++++-----
 drivers/gpu/drm/imx/dcss/dcss-dev.c      |  4 ---
 drivers/gpu/drm/imx/dcss/dcss-kms.c      |  2 --
 drivers/gpu/drm/msm/hdmi/hdmi.c          |  2 --
 drivers/gpu/drm/omapdrm/omap_drv.c       | 41 ------------------------
 include/drm/drm_bridge_connector.h       |  2 --
 include/drm/drm_modeset_helper_vtables.h | 22 +++++++++++++
 8 files changed, 59 insertions(+), 81 deletions(-)
Signature · 1 line
2.35.1
#22 lore raw

Hi,

Quoted 5 lines · Laurentiu Palcu

Hi Dmitry,

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Quoted 65 lines

After a short investigation, it seems that we end up calling drm_bridge_hpd_enable() from both drm_kms_helper_poll_init() and drm_fbdev_generic_setup(), hence the warning.

There are drivers using the drm_bridge_connector API that also call drm_kms_helper_poll_init() followed by drm_fbdev_generic_setup(). So, they might experience the same behavior, unless I'm missing something... :/

Also, even if drm_fbdev_generic_setup() is not called in the driver initialization, the warning will still appear the first time the GETCONNECTOR ioctl is called, because that'll call drm_helper_probe_single_connector_modes() helper which will eventually call drm_bridge_hpd_enable().

Any idea?

Cheers,
Laurentiu

Quoted 43 lines · Dmitry Baryshkov

From all the drivers using drm_bridge_connector only iMX/dcss and OMAP
DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Changes since v2:
- Fixed a typo in the commit message of the second patch.

Changes since v1:
- Rebased on top of v6.1-rc1
- Removed the drm_bridge_connector_enable_hpd() from drm_bridge_connector_init()
- Removed extra underscore prefix from drm_bridge_connector_en/disable_hpd() helpers

Dmitry Baryshkov (7):
drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini() drm/probe-helper: enable and disable HPD on connectors drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement drm/imx/dcss: stop using drm_bridge_connector_en/disable_hpd() drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd() drm/omap: stop using drm_bridge_connector_en/disable_hpd() drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()

  drivers/gpu/drm/drm_bridge_connector.c   | 27 +++-------------
  drivers/gpu/drm/drm_probe_helper.c       | 40 ++++++++++++++++++-----
  drivers/gpu/drm/imx/dcss/dcss-dev.c      |  4 ---
  drivers/gpu/drm/imx/dcss/dcss-kms.c      |  2 --
  drivers/gpu/drm/msm/hdmi/hdmi.c          |  2 --
  drivers/gpu/drm/omapdrm/omap_drv.c       | 41 ------------------------
  include/drm/drm_bridge_connector.h       |  2 --
  include/drm/drm_modeset_helper_vtables.h | 22 +++++++++++++
  8 files changed, 59 insertions(+), 81 deletions(-)
Signature · 1 line
2.35.1
Signature · 2 lines
With best wishes
Dmitry
maintainer
#23 lore raw

Hi,

Quoted 10 lines · Dmitry Baryshkov

Hi,

Quoted 5 lines · Laurentiu Palcu

Hi Dmitry,

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

------------[ cut here ]------------
Hot plug detection already enabled
WARNING: CPU: 2 PID: 9 at drivers/gpu/drm/drm_bridge.c:1257 drm_bridge_hpd_enable+0x94/0x9c [drm]
Modules linked in: videobuf2_memops snd_soc_simple_card snd_soc_simple_card_utils fsl_imx8_ddr_perf videobuf2_common snd_soc_imx_spdif adv7511 etnaviv imx8m_ddrc imx_dcss mc cec nwl_dsi gov
CPU: 2 PID: 9 Comm: kworker/u8:0 Not tainted 6.2.0-rc2-15208-g25b283acd578 #6
Hardware name: NXP i.MX8MQ EVK (DT)
Workqueue: events_unbound deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_bridge_hpd_enable+0x94/0x9c [drm]
lr : drm_bridge_hpd_enable+0x94/0x9c [drm]

sp : ffff800009ef3740
x29: ffff800009ef3740 x28: ffff000009331f00 x27: 0000000000001000
x26: 0000000000000020 x25: ffff800001148ed8 x24: ffff00000a8fe000
x23: 00000000fffffffd x22: ffff000005086348 x21: ffff800001133ee0
x20: ffff00000550d800 x19: ffff000005086288 x18: 0000000000000006
x17: 0000000000000000 x16: ffff8000096ef008 x15: 97ffff2891004260
x14: 2a1403e194000000 x13: 97ffff2891004260 x12: 2a1403e194000000
x11: 7100385f29400801 x10: 0000000000000aa0 x9 : ffff800008112744 x8 : ffff000000250b00 x7 : 0000000000000003 x6 : 0000000000000011 x5 : 0000000000000000 x4 : ffff0000bd986a48 x3 : 0000000000000001 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000000250000

Call trace:
 drm_bridge_hpd_enable+0x94/0x9c [drm]
 drm_bridge_connector_enable_hpd+0x2c/0x3c [drm_kms_helper]
 drm_kms_helper_poll_enable+0x94/0x10c [drm_kms_helper]
 drm_helper_probe_single_connector_modes+0x1a8/0x510 [drm_kms_helper]
 drm_client_modeset_probe+0x204/0x1190 [drm]
 __drm_fb_helper_initial_config_and_unlock+0x5c/0x4a4 [drm_kms_helper]
 drm_fb_helper_initial_config+0x54/0x6c [drm_kms_helper]
 drm_fbdev_client_hotplug+0xd0/0x140 [drm_kms_helper]
 drm_fbdev_generic_setup+0x90/0x154 [drm_kms_helper]
 dcss_kms_attach+0x1c8/0x254 [imx_dcss]
 dcss_drv_platform_probe+0x90/0xfc [imx_dcss]
 platform_probe+0x70/0xcc
 really_probe+0xc4/0x2e0
 __driver_probe_device+0x80/0xf0
 driver_probe_device+0xe0/0x164
 __device_attach_driver+0xc0/0x13c
 bus_for_each_drv+0x84/0xe0
 __device_attach+0xa4/0x1a0
 device_initial_probe+0x1c/0x30
 bus_probe_device+0xa4/0xb0
 deferred_probe_work_func+0x90/0xd0
 process_one_work+0x200/0x474
 worker_thread+0x74/0x43c
 kthread+0xfc/0x110
 ret_from_fork+0x10/0x20
---[ end trace 0000000000000000 ]---

Cheers,
Laurentiu

Quoted 71 lines
Quoted 66 lines

After a short investigation, it seems that we end up calling drm_bridge_hpd_enable() from both drm_kms_helper_poll_init() and drm_fbdev_generic_setup(), hence the warning.

There are drivers using the drm_bridge_connector API that also call drm_kms_helper_poll_init() followed by drm_fbdev_generic_setup(). So, they might experience the same behavior, unless I'm missing something... :/

Also, even if drm_fbdev_generic_setup() is not called in the driver initialization, the warning will still appear the first time the GETCONNECTOR ioctl is called, because that'll call drm_helper_probe_single_connector_modes() helper which will eventually call drm_bridge_hpd_enable().

Any idea?

Cheers,
Laurentiu

Quoted 43 lines · Dmitry Baryshkov

From all the drivers using drm_bridge_connector only iMX/dcss and OMAP
DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Changes since v2:
- Fixed a typo in the commit message of the second patch.

Changes since v1:
- Rebased on top of v6.1-rc1
- Removed the drm_bridge_connector_enable_hpd() from drm_bridge_connector_init()
- Removed extra underscore prefix from drm_bridge_connector_en/disable_hpd() helpers

Dmitry Baryshkov (7):
drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini() drm/probe-helper: enable and disable HPD on connectors drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement drm/imx/dcss: stop using drm_bridge_connector_en/disable_hpd() drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd() drm/omap: stop using drm_bridge_connector_en/disable_hpd() drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()

  drivers/gpu/drm/drm_bridge_connector.c   | 27 +++-------------
  drivers/gpu/drm/drm_probe_helper.c       | 40 ++++++++++++++++++-----
  drivers/gpu/drm/imx/dcss/dcss-dev.c      |  4 ---
  drivers/gpu/drm/imx/dcss/dcss-kms.c      |  2 --
  drivers/gpu/drm/msm/hdmi/hdmi.c          |  2 --
  drivers/gpu/drm/omapdrm/omap_drv.c       | 41 ------------------------
  include/drm/drm_bridge_connector.h       |  2 --
  include/drm/drm_modeset_helper_vtables.h | 22 +++++++++++++
  8 files changed, 59 insertions(+), 81 deletions(-)
Signature · 1 line
2.35.1
Signature · 2 lines
With best wishes
Dmitry
#24 lore raw
Quoted 50 lines · Laurentiu Palcu
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Laurentiu Palcu

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

------------[ cut here ]------------
Hot plug detection already enabled
WARNING: CPU: 2 PID: 9 at drivers/gpu/drm/drm_bridge.c:1257 drm_bridge_hpd_enable+0x94/0x9c [drm]
Modules linked in: videobuf2_memops snd_soc_simple_card snd_soc_simple_card_utils fsl_imx8_ddr_perf videobuf2_common snd_soc_imx_spdif adv7511 etnaviv imx8m_ddrc imx_dcss mc cec nwl_dsi gov
CPU: 2 PID: 9 Comm: kworker/u8:0 Not tainted 6.2.0-rc2-15208-g25b283acd578 #6
Hardware name: NXP i.MX8MQ EVK (DT)
Workqueue: events_unbound deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_bridge_hpd_enable+0x94/0x9c [drm]
lr : drm_bridge_hpd_enable+0x94/0x9c [drm]

sp : ffff800009ef3740
x29: ffff800009ef3740 x28: ffff000009331f00 x27: 0000000000001000
x26: 0000000000000020 x25: ffff800001148ed8 x24: ffff00000a8fe000
x23: 00000000fffffffd x22: ffff000005086348 x21: ffff800001133ee0
x20: ffff00000550d800 x19: ffff000005086288 x18: 0000000000000006
x17: 0000000000000000 x16: ffff8000096ef008 x15: 97ffff2891004260
x14: 2a1403e194000000 x13: 97ffff2891004260 x12: 2a1403e194000000
x11: 7100385f29400801 x10: 0000000000000aa0 x9 : ffff800008112744 x8 : ffff000000250b00 x7 : 0000000000000003 x6 : 0000000000000011 x5 : 0000000000000000 x4 : ffff0000bd986a48 x3 : 0000000000000001 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000000250000

Call trace:
 drm_bridge_hpd_enable+0x94/0x9c [drm]
 drm_bridge_connector_enable_hpd+0x2c/0x3c [drm_kms_helper]
 drm_kms_helper_poll_enable+0x94/0x10c [drm_kms_helper]
 drm_helper_probe_single_connector_modes+0x1a8/0x510 [drm_kms_helper]
 drm_client_modeset_probe+0x204/0x1190 [drm]
 __drm_fb_helper_initial_config_and_unlock+0x5c/0x4a4 [drm_kms_helper]
 drm_fb_helper_initial_config+0x54/0x6c [drm_kms_helper]
 drm_fbdev_client_hotplug+0xd0/0x140 [drm_kms_helper]
 drm_fbdev_generic_setup+0x90/0x154 [drm_kms_helper]
 dcss_kms_attach+0x1c8/0x254 [imx_dcss]
 dcss_drv_platform_probe+0x90/0xfc [imx_dcss]
 platform_probe+0x70/0xcc
 really_probe+0xc4/0x2e0
 __driver_probe_device+0x80/0xf0
 driver_probe_device+0xe0/0x164
 __device_attach_driver+0xc0/0x13c
 bus_for_each_drv+0x84/0xe0
 __device_attach+0xa4/0x1a0
Quoted 8 lines
 device_initial_probe+0x1c/0x30
 bus_probe_device+0xa4/0xb0
 deferred_probe_work_func+0x90/0xd0
 process_one_work+0x200/0x474
 worker_thread+0x74/0x43c
 kthread+0xfc/0x110
 ret_from_fork+0x10/0x20
---[ end trace 0000000000000000 ]---

I get a similar trace on R-Car Gen2 (Koelsch with R-Car M2-W) and Gen3 (Salvator-XS with R-Car H3 ES2.0), and bisected it to commit 92d755d8f13b6791 ("drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement") in drm-misc/for-linux-next.

As I do not have any displays connected, I do not know what is the full impact.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#25 lore raw
Quoted 61 lines · Geert Uytterhoeven
Quoted 50 lines · Laurentiu Palcu
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Laurentiu Palcu

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

------------[ cut here ]------------
Hot plug detection already enabled
WARNING: CPU: 2 PID: 9 at drivers/gpu/drm/drm_bridge.c:1257 drm_bridge_hpd_enable+0x94/0x9c [drm]
Modules linked in: videobuf2_memops snd_soc_simple_card snd_soc_simple_card_utils fsl_imx8_ddr_perf videobuf2_common snd_soc_imx_spdif adv7511 etnaviv imx8m_ddrc imx_dcss mc cec nwl_dsi gov
CPU: 2 PID: 9 Comm: kworker/u8:0 Not tainted 6.2.0-rc2-15208-g25b283acd578 #6
Hardware name: NXP i.MX8MQ EVK (DT)
Workqueue: events_unbound deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_bridge_hpd_enable+0x94/0x9c [drm]
lr : drm_bridge_hpd_enable+0x94/0x9c [drm]

sp : ffff800009ef3740
x29: ffff800009ef3740 x28: ffff000009331f00 x27: 0000000000001000
x26: 0000000000000020 x25: ffff800001148ed8 x24: ffff00000a8fe000
x23: 00000000fffffffd x22: ffff000005086348 x21: ffff800001133ee0
x20: ffff00000550d800 x19: ffff000005086288 x18: 0000000000000006
x17: 0000000000000000 x16: ffff8000096ef008 x15: 97ffff2891004260
x14: 2a1403e194000000 x13: 97ffff2891004260 x12: 2a1403e194000000
x11: 7100385f29400801 x10: 0000000000000aa0 x9 : ffff800008112744 x8 : ffff000000250b00 x7 : 0000000000000003 x6 : 0000000000000011 x5 : 0000000000000000 x4 : ffff0000bd986a48 x3 : 0000000000000001 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000000250000

Call trace:
 drm_bridge_hpd_enable+0x94/0x9c [drm]
 drm_bridge_connector_enable_hpd+0x2c/0x3c [drm_kms_helper]
 drm_kms_helper_poll_enable+0x94/0x10c [drm_kms_helper]
 drm_helper_probe_single_connector_modes+0x1a8/0x510 [drm_kms_helper]
 drm_client_modeset_probe+0x204/0x1190 [drm]
 __drm_fb_helper_initial_config_and_unlock+0x5c/0x4a4 [drm_kms_helper]
 drm_fb_helper_initial_config+0x54/0x6c [drm_kms_helper]
 drm_fbdev_client_hotplug+0xd0/0x140 [drm_kms_helper]
 drm_fbdev_generic_setup+0x90/0x154 [drm_kms_helper]
 dcss_kms_attach+0x1c8/0x254 [imx_dcss]
 dcss_drv_platform_probe+0x90/0xfc [imx_dcss]
 platform_probe+0x70/0xcc
 really_probe+0xc4/0x2e0
 __driver_probe_device+0x80/0xf0
 driver_probe_device+0xe0/0x164
 __device_attach_driver+0xc0/0x13c
 bus_for_each_drv+0x84/0xe0
 __device_attach+0xa4/0x1a0
Quoted 8 lines
 device_initial_probe+0x1c/0x30
 bus_probe_device+0xa4/0xb0
 deferred_probe_work_func+0x90/0xd0
 process_one_work+0x200/0x474
 worker_thread+0x74/0x43c
 kthread+0xfc/0x110
 ret_from_fork+0x10/0x20
---[ end trace 0000000000000000 ]---
Quoted 7 lines

I get a similar trace on R-Car Gen2 (Koelsch with R-Car M2-W) and Gen3 (Salvator-XS with R-Car H3 ES2.0), and bisected it to commit 92d755d8f13b6791 ("drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement") in drm-misc/for-linux-next.

As I do not have any displays connected, I do not know what is the full impact.

FTR, the issue is still present.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#26 lore raw
In reply to Laurentiu Palcu
Quoted 8 lines · Laurentiu Palcu

Hi,

Quoted 5 lines · Dmitry Baryshkov

Hi,

Quoted 2 lines · Laurentiu Palcu

Hi Dmitry,

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

I wondered, why didn't I see this on msm, my main target nowadays. The msm driver is calling msm_kms_helper_poll_init() after initializing fbdev, so all previous kms_helper_poll_enable() calls return early.

I think I have the fix ready. Let me test it locally before posting.

Quoted 124 lines
------------[ cut here ]------------
Hot plug detection already enabled
WARNING: CPU: 2 PID: 9 at drivers/gpu/drm/drm_bridge.c:1257 drm_bridge_hpd_enable+0x94/0x9c [drm]
Modules linked in: videobuf2_memops snd_soc_simple_card snd_soc_simple_card_utils fsl_imx8_ddr_perf videobuf2_common snd_soc_imx_spdif adv7511 etnaviv imx8m_ddrc imx_dcss mc cec nwl_dsi gov
CPU: 2 PID: 9 Comm: kworker/u8:0 Not tainted 6.2.0-rc2-15208-g25b283acd578 #6
Hardware name: NXP i.MX8MQ EVK (DT)
Workqueue: events_unbound deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_bridge_hpd_enable+0x94/0x9c [drm]
lr : drm_bridge_hpd_enable+0x94/0x9c [drm]

sp : ffff800009ef3740
x29: ffff800009ef3740 x28: ffff000009331f00 x27: 0000000000001000
x26: 0000000000000020 x25: ffff800001148ed8 x24: ffff00000a8fe000
x23: 00000000fffffffd x22: ffff000005086348 x21: ffff800001133ee0
x20: ffff00000550d800 x19: ffff000005086288 x18: 0000000000000006
x17: 0000000000000000 x16: ffff8000096ef008 x15: 97ffff2891004260
x14: 2a1403e194000000 x13: 97ffff2891004260 x12: 2a1403e194000000
x11: 7100385f29400801 x10: 0000000000000aa0 x9 : ffff800008112744 x8 : ffff000000250b00 x7 : 0000000000000003 x6 : 0000000000000011 x5 : 0000000000000000 x4 : ffff0000bd986a48 x3 : 0000000000000001 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000000250000

Call trace:
  drm_bridge_hpd_enable+0x94/0x9c [drm]
  drm_bridge_connector_enable_hpd+0x2c/0x3c [drm_kms_helper]
  drm_kms_helper_poll_enable+0x94/0x10c [drm_kms_helper]
  drm_helper_probe_single_connector_modes+0x1a8/0x510 [drm_kms_helper]
  drm_client_modeset_probe+0x204/0x1190 [drm]
  __drm_fb_helper_initial_config_and_unlock+0x5c/0x4a4 [drm_kms_helper]
  drm_fb_helper_initial_config+0x54/0x6c [drm_kms_helper]
  drm_fbdev_client_hotplug+0xd0/0x140 [drm_kms_helper]
  drm_fbdev_generic_setup+0x90/0x154 [drm_kms_helper]
  dcss_kms_attach+0x1c8/0x254 [imx_dcss]
  dcss_drv_platform_probe+0x90/0xfc [imx_dcss]
  platform_probe+0x70/0xcc
  really_probe+0xc4/0x2e0
  __driver_probe_device+0x80/0xf0
  driver_probe_device+0xe0/0x164
  __device_attach_driver+0xc0/0x13c
  bus_for_each_drv+0x84/0xe0
  __device_attach+0xa4/0x1a0
  device_initial_probe+0x1c/0x30
  bus_probe_device+0xa4/0xb0
  deferred_probe_work_func+0x90/0xd0
  process_one_work+0x200/0x474
  worker_thread+0x74/0x43c
  kthread+0xfc/0x110
  ret_from_fork+0x10/0x20
---[ end trace 0000000000000000 ]---

Cheers,
Laurentiu

Quoted 71 lines
Quoted 66 lines

After a short investigation, it seems that we end up calling drm_bridge_hpd_enable() from both drm_kms_helper_poll_init() and drm_fbdev_generic_setup(), hence the warning.

There are drivers using the drm_bridge_connector API that also call drm_kms_helper_poll_init() followed by drm_fbdev_generic_setup(). So, they might experience the same behavior, unless I'm missing something... :/

Also, even if drm_fbdev_generic_setup() is not called in the driver initialization, the warning will still appear the first time the GETCONNECTOR ioctl is called, because that'll call drm_helper_probe_single_connector_modes() helper which will eventually call drm_bridge_hpd_enable().

Any idea?

Cheers,
Laurentiu

Quoted 43 lines · Dmitry Baryshkov

From all the drivers using drm_bridge_connector only iMX/dcss and OMAP
DRM driver do a proper work of calling drm_bridge_connector_en/disable_hpd() in right places. Rather than teaching each and every driver how to properly handle drm_bridge_connector's HPD, make that automatic.

Add two additional drm_connector helper funcs: enable_hpd() and disable_hpd(). Make drm_kms_helper_poll_* functions call them (as this is the time where the drm_bridge_connector's functions are called by the drivers too).

Changes since v2:
- Fixed a typo in the commit message of the second patch.

Changes since v1:
- Rebased on top of v6.1-rc1
- Removed the drm_bridge_connector_enable_hpd() from drm_bridge_connector_init()
- Removed extra underscore prefix from drm_bridge_connector_en/disable_hpd() helpers

Dmitry Baryshkov (7):
drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini() drm/probe-helper: enable and disable HPD on connectors drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement drm/imx/dcss: stop using drm_bridge_connector_en/disable_hpd() drm/msm/hdmi: stop using drm_bridge_connector_en/disable_hpd() drm/omap: stop using drm_bridge_connector_en/disable_hpd() drm/bridge_connector: drop drm_bridge_connector_en/disable_hpd()

   drivers/gpu/drm/drm_bridge_connector.c   | 27 +++-------------
   drivers/gpu/drm/drm_probe_helper.c       | 40 ++++++++++++++++++-----
   drivers/gpu/drm/imx/dcss/dcss-dev.c      |  4 ---
   drivers/gpu/drm/imx/dcss/dcss-kms.c      |  2 --
   drivers/gpu/drm/msm/hdmi/hdmi.c          |  2 --
   drivers/gpu/drm/omapdrm/omap_drv.c       | 41 ------------------------
   include/drm/drm_bridge_connector.h       |  2 --
   include/drm/drm_modeset_helper_vtables.h | 22 +++++++++++++
   8 files changed, 59 insertions(+), 81 deletions(-)
Signature · 1 line
2.35.1
Signature · 2 lines
With best wishes
Dmitry
Signature · 2 lines
With best wishes
Dmitry
#27 lore raw

Hi Dmitry,

Quoted 9 lines · Dmitry Baryshkov
Quoted 8 lines · Laurentiu Palcu
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Laurentiu Palcu

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Quoted 7 lines
Quoted 1 line

Sure, see below:

I wondered, why didn't I see this on msm, my main target nowadays. The msm driver is calling msm_kms_helper_poll_init() after initializing fbdev, so all previous kms_helper_poll_enable() calls return early.

I think I have the fix ready. Let me test it locally before posting.

Is this fix available?
Do you have a lore link?
Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#28 lore raw

Hi Geert,

Quoted 15 lines · Geert Uytterhoeven

Hi Dmitry,

Quoted 11 lines · Dmitry Baryshkov
Quoted 9 lines · Laurentiu Palcu
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Laurentiu Palcu

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

Quoted 8 lines
Quoted 5 lines

I wondered, why didn't I see this on msm, my main target nowadays. The msm driver is calling msm_kms_helper_poll_init() after initializing fbdev, so all previous kms_helper_poll_enable() calls return early.

I think I have the fix ready. Let me test it locally before posting.

Is this fix available?
Do you have a lore link?

The fix at [1] has been applied on 2023-01-26

[1] https://lore.kernel.org/all/[email protected]/

Quoted 12 lines

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#29 lore raw

Hi Neil,

Quoted 18 lines · Neil Armstrong
Quoted 17 lines · Geert Uytterhoeven
Quoted 15 lines · Dmitry Baryshkov
Quoted 9 lines · Laurentiu Palcu
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Laurentiu Palcu

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

I wondered, why didn't I see this on msm, my main target nowadays. The msm driver is calling msm_kms_helper_poll_init() after initializing fbdev, so all previous kms_helper_poll_enable() calls return early.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I think I have the fix ready. Let me test it locally before posting.

Is this fix available?
Do you have a lore link?

The fix at [1] has been applied on 2023-01-26

[1] https://lore.kernel.org/all/[email protected]/

Applied where? linux-next does not have it.
Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#30 lore raw
Quoted 24 lines · Geert Uytterhoeven

Hi Neil,

Quoted 20 lines · Neil Armstrong
Quoted 19 lines · Geert Uytterhoeven
Quoted 16 lines · Dmitry Baryshkov
Quoted 9 lines · Laurentiu Palcu
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Laurentiu Palcu

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

I wondered, why didn't I see this on msm, my main target nowadays. The msm driver is calling msm_kms_helper_poll_init() after initializing fbdev, so all previous kms_helper_poll_enable() calls return early.

I think I have the fix ready. Let me test it locally before posting.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Is this fix available?
Do you have a lore link?

The fix at [1] has been applied on 2023-01-26

[1] https://lore.kernel.org/all/[email protected]/

Applied where? linux-next does not have it.

On drm-misc-next, it should have been send to drm-misc, but it seems the last PR to drm-misc was sent without those:

https://cgit.freedesktop.org/drm/drm-misc/tag/?h=drm-misc-next-2023-01-26

Thomas, Maxime, is it too late to get those into v6.3 ? I did apply them before rc6.

Neil

Quoted 12 lines

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#31 lore raw
In reply to Geert Uytterhoeven

Hi Neil,

Quoted 22 lines · Geert Uytterhoeven
Quoted 20 lines · Neil Armstrong
Quoted 19 lines · Geert Uytterhoeven
Quoted 16 lines · Dmitry Baryshkov
Quoted 9 lines · Laurentiu Palcu
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Laurentiu Palcu

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

I wondered, why didn't I see this on msm, my main target nowadays. The msm driver is calling msm_kms_helper_poll_init() after initializing fbdev, so all previous kms_helper_poll_enable() calls return early.

I think I have the fix ready. Let me test it locally before posting.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Is this fix available?
Do you have a lore link?

The fix at [1] has been applied on 2023-01-26

[1] https://lore.kernel.org/all/[email protected]/

Applied where? linux-next does not have it.

commit cbf143b282c64e59
("drm/probe_helper: extract two helper functions") in next-20230127 next-20230130 next-20230131
commit d33a54e3991dfce8
("drm/probe_helper: sort out poll_running vs poll_enabled") in next-20230127 next-20230130 next-20230131

but not in any later version?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#32 lore raw
Quoted 34 lines · Geert Uytterhoeven

Hi Neil,

Quoted 22 lines · Geert Uytterhoeven
Quoted 20 lines · Neil Armstrong
Quoted 19 lines · Geert Uytterhoeven
Quoted 16 lines · Dmitry Baryshkov
Quoted 9 lines · Laurentiu Palcu
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Laurentiu Palcu

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

I wondered, why didn't I see this on msm, my main target nowadays. The msm driver is calling msm_kms_helper_poll_init() after initializing fbdev, so all previous kms_helper_poll_enable() calls return early.

I think I have the fix ready. Let me test it locally before posting.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Is this fix available?
Do you have a lore link?

The fix at [1] has been applied on 2023-01-26

[1] https://lore.kernel.org/all/[email protected]/

Applied where? linux-next does not have it.

Quoted 8 lines

commit cbf143b282c64e59
("drm/probe_helper: extract two helper functions") in next-20230127 next-20230130 next-20230131
commit d33a54e3991dfce8
("drm/probe_helper: sort out poll_running vs poll_enabled") in next-20230127 next-20230130 next-20230131

but not in any later version?

$ git log --oneline --author=dmitry next-20230207 drivers/gpu/drm/drm_probe_helper.c
c8268795c9a9 drm/probe-helper: enable and disable HPD on connectors
78b991ccfa64 drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini()
$ cat Next/SHA1s | grep drm
drm-fixes       4ec5183ec48656cec489c49f989c508b68b518e3
drm-intel-fixes 4c7b9344cadbed477372c75e3c0a8cfd542f5990
drm-misc-fixes  8f20660f053cefd4693e69cfff9cf58f4f7c4929
drm             1c0db6d84f8e0ac8f14178f13250e36ebcf457ee
drm-misc        d20a8f409259f1782f080b434054854020878f23
drm-intel       155c6b16eec2eaaaf6c71abf2d5e71641770d7ba
drm-tegra       b9930311641cf2ed905a84aabe27e8f3868aee4a
drm-msm         dbd7a2a941b8cbf9e5f79a777ed9fe0090eebb61
drm-msm-lumag   1d233b1cb149ec78c20fac58331b27bb460f9558
imx-drm         927d8fd465adbaaad6cce82f840d489d7c378f29

so weren't merged into drm-misc, I'll ping Thomas & Maxime on irc.

Neil

Quoted 11 lines

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#33 lore raw

Geert,

Quoted 60 lines · On 07/02/2023 14:30, [email protected] wrote:
Quoted 34 lines · Geert Uytterhoeven

Hi Neil,

Quoted 22 lines · Geert Uytterhoeven
Quoted 20 lines · Neil Armstrong
Quoted 19 lines · Geert Uytterhoeven
Quoted 16 lines · Dmitry Baryshkov
Quoted 9 lines · Laurentiu Palcu
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Laurentiu Palcu

It looks like there are some issues with this patchset... :/ I just fetched the drm-tip and, with these patches included, the "Hot plug detection already enabled" warning is back for i.MX DCSS.

Could you please provide a backtrace?

Sure, see below:

I wondered, why didn't I see this on msm, my main target nowadays. The msm driver is calling msm_kms_helper_poll_init() after initializing fbdev, so all previous kms_helper_poll_enable() calls return early.

I think I have the fix ready. Let me test it locally before posting.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Is this fix available?
Do you have a lore link?

The fix at [1] has been applied on 2023-01-26

[1] https://lore.kernel.org/all/[email protected]/

Applied where? linux-next does not have it.

Quoted 8 lines

commit cbf143b282c64e59
("drm/probe_helper: extract two helper functions") in next-20230127 next-20230130 next-20230131
commit d33a54e3991dfce8
("drm/probe_helper: sort out poll_running vs poll_enabled") in next-20230127 next-20230130 next-20230131

but not in any later version?

$ git log --oneline --author=dmitry next-20230207 drivers/gpu/drm/drm_probe_helper.c
c8268795c9a9 drm/probe-helper: enable and disable HPD on connectors
78b991ccfa64 drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini()
$ cat Next/SHA1s | grep drm
drm-fixes       4ec5183ec48656cec489c49f989c508b68b518e3
drm-intel-fixes 4c7b9344cadbed477372c75e3c0a8cfd542f5990
drm-misc-fixes  8f20660f053cefd4693e69cfff9cf58f4f7c4929
drm             1c0db6d84f8e0ac8f14178f13250e36ebcf457ee
drm-misc        d20a8f409259f1782f080b434054854020878f23
drm-intel       155c6b16eec2eaaaf6c71abf2d5e71641770d7ba
drm-tegra       b9930311641cf2ed905a84aabe27e8f3868aee4a
drm-msm         dbd7a2a941b8cbf9e5f79a777ed9fe0090eebb61
drm-msm-lumag   1d233b1cb149ec78c20fac58331b27bb460f9558
imx-drm         927d8fd465adbaaad6cce82f840d489d7c378f29
Quoted 1 line

so weren't merged into drm-misc, I'll ping Thomas & Maxime on irc.

Thomas just told me the commits were cherry-picked into drm-misc-next-fixes and should appear on tomorrow's linux-next tree.

https://cgit.freedesktop.org/drm/drm-misc/commit/?h=drm-misc-next-fixes&id=91f43949662c9eb4a443203a188e806df8290bc9
https://cgit.freedesktop.org/drm/drm-misc/commit/?h=drm-misc-next-fixes&id=a4e771729a51168bc36317effaa9962e336d4f5e

Neil

Quoted 15 lines

Neil

Quoted 11 lines

Gr{oetje,eeting}s,

                         Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                 -- Linus Torvalds