All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] drm/bridge: inno-hdmi: Fix sync polarity, hotplug and DDC adapter
       [not found] <CGME20261127161904eucas1p1e35356631d4599bbf6b2d02373d3b5b7@eucas1p1.samsung.com>
@ 2026-11-27 16:18   ` Michal Wilczynski
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Wilczynski @ 2026-11-27 16:18 UTC (permalink / raw)
  To: Andy Yan, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Yakir Yang,
	Dmitry Baryshkov, Heiko Stuebner
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-rockchip,
	Chaoyi Chen, Maud Spierings, Byron Stanoszek,
	Dominique Belhachemi, Owen O'Hehir, Michal Wilczynski

Three fixes for the Innosilicon HDMI bridge, which the Rockchip RK3036
and RK3128 use and, with the series in [1], the StarFive JH7110.

Patch 1 fixes the HSYNC and VSYNC polarity bits, which are swapped.

Patch 2 fixes a NULL pointer dereference when a hotplug interrupt
arrives before the bridge is attached, by reporting hotplug through
drm_bridge_hpd_notify(). That also keeps it safe against
drm_bridge_detach() once the interrupt is requested in probe, as the
JH7110 series does.

Patch 3 stops the I2C core from trying to create an I2C client for the
OF graph 'ports' node on every boot.

Patches 1 and 2 were part of the JH7110 display series up to v8 [1],
and are split out so they can land on their own.

Patch 2 changed approach in v8 of that series, after a Sashiko finding
on v7 patch 8, "Split probe out of bind" [2], showed that once the
interrupt is requested in probe, checking bridge.dev races with
drm_bridge_detach(). Heiko's Reviewed-by was dropped because of that.
Testing on an RK3036 or RK3128 would be welcome; all three were tested
on a StarFive VisionFive 2 with the JH7110 display series applied.

[1] https://lore.kernel.org/all/20261124-jh7110-clean-send-v8-0-de92635dd857@samsung.com/
[2] https://lore.kernel.org/all/sashiko-outbox-201623@kernel.org/

---
Michal Wilczynski (3):
      drm/bridge: inno-hdmi: fix swapped HSYNC and VSYNC polarity
      drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify()
      drm/bridge: inno-hdmi: Don't give the DDC adapter an OF node

 drivers/gpu/drm/bridge/inno-hdmi.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261127-inno-hdmi-ddc-of-node-67ac9a88fe5b

Best regards,
-- 
Michal Wilczynski <m.wilczynski@samsung.com>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 0/3] drm/bridge: inno-hdmi: Fix sync polarity, hotplug and DDC adapter
@ 2026-11-27 16:18   ` Michal Wilczynski
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Wilczynski @ 2026-11-27 16:18 UTC (permalink / raw)
  To: Andy Yan, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Yakir Yang,
	Dmitry Baryshkov, Heiko Stuebner
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-rockchip,
	Chaoyi Chen, Maud Spierings, Byron Stanoszek,
	Dominique Belhachemi, Owen O'Hehir, Michal Wilczynski

Three fixes for the Innosilicon HDMI bridge, which the Rockchip RK3036
and RK3128 use and, with the series in [1], the StarFive JH7110.

Patch 1 fixes the HSYNC and VSYNC polarity bits, which are swapped.

Patch 2 fixes a NULL pointer dereference when a hotplug interrupt
arrives before the bridge is attached, by reporting hotplug through
drm_bridge_hpd_notify(). That also keeps it safe against
drm_bridge_detach() once the interrupt is requested in probe, as the
JH7110 series does.

Patch 3 stops the I2C core from trying to create an I2C client for the
OF graph 'ports' node on every boot.

Patches 1 and 2 were part of the JH7110 display series up to v8 [1],
and are split out so they can land on their own.

Patch 2 changed approach in v8 of that series, after a Sashiko finding
on v7 patch 8, "Split probe out of bind" [2], showed that once the
interrupt is requested in probe, checking bridge.dev races with
drm_bridge_detach(). Heiko's Reviewed-by was dropped because of that.
Testing on an RK3036 or RK3128 would be welcome; all three were tested
on a StarFive VisionFive 2 with the JH7110 display series applied.

[1] https://lore.kernel.org/all/20261124-jh7110-clean-send-v8-0-de92635dd857@samsung.com/
[2] https://lore.kernel.org/all/sashiko-outbox-201623@kernel.org/

---
Michal Wilczynski (3):
      drm/bridge: inno-hdmi: fix swapped HSYNC and VSYNC polarity
      drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify()
      drm/bridge: inno-hdmi: Don't give the DDC adapter an OF node

 drivers/gpu/drm/bridge/inno-hdmi.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261127-inno-hdmi-ddc-of-node-67ac9a88fe5b

Best regards,
-- 
Michal Wilczynski <m.wilczynski@samsung.com>


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] drm/bridge: inno-hdmi: fix swapped HSYNC and VSYNC polarity
  2026-11-27 16:18   ` Michal Wilczynski
@ 2026-11-27 16:18     ` Michal Wilczynski
  -1 siblings, 0 replies; 9+ messages in thread
From: Michal Wilczynski @ 2026-11-27 16:18 UTC (permalink / raw)
  To: Andy Yan, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Yakir Yang,
	Dmitry Baryshkov, Heiko Stuebner
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-rockchip,
	Chaoyi Chen, Maud Spierings, Byron Stanoszek,
	Dominique Belhachemi, Owen O'Hehir, Michal Wilczynski

v_HSYNC_POLARITY() and v_VSYNC_POLARITY() write the wrong bits: the
hardware puts HSYNC in bit 2 and VSYNC in bit 3, the macros do the
opposite. Most CEA modes drive both syncs with the same polarity so it
goes unnoticed; it only shows up on modes where the two differ.

Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support")
Reported-by: Maud Spierings <maud_spierings@murena.io>
Closes: https://lore.kernel.org/all/e780ecb8-918f-4816-99c8-b69b10b25a18@murena.io/
Reported-by: Byron Stanoszek <gandalf@winds.org>
Closes: https://lore.kernel.org/all/b8b046ee-c574-3e16-6079-2fc415633dae@winds.org/
Suggested-by: Dominique Belhachemi <db@domibel.de>
Tested-by: Maud Spierings <maud_spierings@murena.io>
Tested-by: Byron Stanoszek <gandalf@winds.org>
Tested-by: Owen O'Hehir <oo.hehir@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
---
 drivers/gpu/drm/bridge/inno-hdmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
index 4d9d06d0419646f00142f984b797e810df37779a..3bdcacf3cbc8427c8420eac9a37e3ecb79682414 100644
--- a/drivers/gpu/drm/bridge/inno-hdmi.c
+++ b/drivers/gpu/drm/bridge/inno-hdmi.c
@@ -122,8 +122,8 @@ enum {
 #define v_VIDEO_MUTE(n)			((n) << 0)
 
 #define HDMI_VIDEO_TIMING_CTL		0x08
-#define v_HSYNC_POLARITY(n)		((n) << 3)
-#define v_VSYNC_POLARITY(n)		((n) << 2)
+#define v_VSYNC_POLARITY(n)		((n) << 3)
+#define v_HSYNC_POLARITY(n)		((n) << 2)
 #define v_INETLACE(n)			((n) << 1)
 #define v_EXTERANL_VIDEO(n)		((n) << 0)
 

-- 
2.34.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 1/3] drm/bridge: inno-hdmi: fix swapped HSYNC and VSYNC polarity
@ 2026-11-27 16:18     ` Michal Wilczynski
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Wilczynski @ 2026-11-27 16:18 UTC (permalink / raw)
  To: Andy Yan, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Yakir Yang,
	Dmitry Baryshkov, Heiko Stuebner
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-rockchip,
	Chaoyi Chen, Maud Spierings, Byron Stanoszek,
	Dominique Belhachemi, Owen O'Hehir, Michal Wilczynski

v_HSYNC_POLARITY() and v_VSYNC_POLARITY() write the wrong bits: the
hardware puts HSYNC in bit 2 and VSYNC in bit 3, the macros do the
opposite. Most CEA modes drive both syncs with the same polarity so it
goes unnoticed; it only shows up on modes where the two differ.

Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support")
Reported-by: Maud Spierings <maud_spierings@murena.io>
Closes: https://lore.kernel.org/all/e780ecb8-918f-4816-99c8-b69b10b25a18@murena.io/
Reported-by: Byron Stanoszek <gandalf@winds.org>
Closes: https://lore.kernel.org/all/b8b046ee-c574-3e16-6079-2fc415633dae@winds.org/
Suggested-by: Dominique Belhachemi <db@domibel.de>
Tested-by: Maud Spierings <maud_spierings@murena.io>
Tested-by: Byron Stanoszek <gandalf@winds.org>
Tested-by: Owen O'Hehir <oo.hehir@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
---
 drivers/gpu/drm/bridge/inno-hdmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
index 4d9d06d0419646f00142f984b797e810df37779a..3bdcacf3cbc8427c8420eac9a37e3ecb79682414 100644
--- a/drivers/gpu/drm/bridge/inno-hdmi.c
+++ b/drivers/gpu/drm/bridge/inno-hdmi.c
@@ -122,8 +122,8 @@ enum {
 #define v_VIDEO_MUTE(n)			((n) << 0)
 
 #define HDMI_VIDEO_TIMING_CTL		0x08
-#define v_HSYNC_POLARITY(n)		((n) << 3)
-#define v_VSYNC_POLARITY(n)		((n) << 2)
+#define v_VSYNC_POLARITY(n)		((n) << 3)
+#define v_HSYNC_POLARITY(n)		((n) << 2)
 #define v_INETLACE(n)			((n) << 1)
 #define v_EXTERANL_VIDEO(n)		((n) << 0)
 

-- 
2.34.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify()
  2026-11-27 16:18   ` Michal Wilczynski
@ 2026-11-27 16:19     ` Michal Wilczynski
  -1 siblings, 0 replies; 9+ messages in thread
From: Michal Wilczynski @ 2026-11-27 16:19 UTC (permalink / raw)
  To: Andy Yan, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Yakir Yang,
	Dmitry Baryshkov, Heiko Stuebner
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-rockchip,
	Chaoyi Chen, Maud Spierings, Byron Stanoszek,
	Dominique Belhachemi, Owen O'Hehir, Michal Wilczynski

inno_hdmi_irq() passes hdmi->bridge.dev to drm_helper_hpd_irq_event(),
which dereferences it in its first statement:

	if (!dev->mode_config.poll_enabled)

bridge.dev is assigned only by drm_bridge_attach(), but inno_hdmi_bind()
unmutes the hotplug interrupt in inno_hdmi_init_hw() and installs the
handler well before it attaches the bridge:

	inno_hdmi_init_hw(hdmi);		/* unmutes hotplug */
	devm_request_threaded_irq(...);		/* handler goes live */
	...
	hdmi->bridge.ddc = inno_hdmi_i2c_adapter(hdmi);
	devm_drm_bridge_add(dev, &hdmi->bridge);
	drm_bridge_attach(...);			/* bridge.dev set here */

The bridge is allocated by devm_drm_bridge_alloc(), which kzalloc()s it,
so bridge.dev is NULL for all of that window, and a hotplug event
arriving in it enters drm_helper_hpd_irq_event(NULL).

Before the conversion to a bridge the ordering was safe:
inno_hdmi_register() called drmm_connector_hdmi_init(), which set
connector.dev, before the interrupt was requested.

Report hotplug with drm_bridge_hpd_notify() instead. The bridge already
sets DRM_BRIDGE_OP_HPD, and the helper only calls into the connector
while HPD is enabled, under bridge->hpd_mutex, so it does not need
bridge.dev. Unlike a NULL check, it also stays safe against
drm_bridge_detach() if the interrupt outlives the component bind.

hpd_mutex is initialised by drm_bridge_add(), so request the interrupt
after devm_drm_bridge_add().

Fixes: 969325a2597e ("drm/rockchip: inno-hdmi: Convert to drm bridge")
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
---
This was patch 2 of the JH7110 display series up to v8, and the code is
unchanged from there.

Changes in v8 of that series, prompted by a Sashiko finding on v7
patch 8, "Split probe out of bind":
https://lore.kernel.org/all/sashiko-outbox-201623@kernel.org/
- Report hotplug through drm_bridge_hpd_notify() instead of checking
  bridge.dev, which also covers drm_bridge_detach() racing with the
  interrupt, and request the interrupt after devm_drm_bridge_add(),
  which initialises the HPD mutex. Heiko's Reviewed-by was dropped
  because the approach changed.
- Link: https://lore.kernel.org/all/20261124-jh7110-clean-send-v8-2-de92635dd857@samsung.com/

Changes in v6 of that series:
- Split out of "drm/bridge: inno-hdmi: Split probe out of bind" into
  its own patch (Heiko).
- Link: https://lore.kernel.org/all/20261029-jh7110-clean-send-v6-2-759594e43acf@samsung.com/

Tested on a VisionFive 2 with the display series applied: hotplug is
reported through the new path. The race itself has not been reproduced.
---
 drivers/gpu/drm/bridge/inno-hdmi.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
index 3bdcacf3cbc8427c8420eac9a37e3ecb79682414..bbc90ae9eaae04166d502c05fde52e126462b8be 100644
--- a/drivers/gpu/drm/bridge/inno-hdmi.c
+++ b/drivers/gpu/drm/bridge/inno-hdmi.c
@@ -929,7 +929,8 @@ static irqreturn_t inno_hdmi_irq(int irq, void *dev_id)
 {
 	struct inno_hdmi *hdmi = dev_id;
 
-	drm_helper_hpd_irq_event(hdmi->bridge.dev);
+	drm_bridge_hpd_notify(&hdmi->bridge,
+			      inno_hdmi_bridge_detect(&hdmi->bridge, NULL));
 
 	return IRQ_HANDLED;
 }
@@ -1104,12 +1105,6 @@ struct inno_hdmi *inno_hdmi_bind(struct device *dev,
 	if (irq < 0)
 		return ERR_PTR(irq);
 
-	ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
-					inno_hdmi_irq, IRQF_SHARED,
-					dev_name(dev), hdmi);
-	if (ret)
-		return ERR_PTR(ret);
-
 	hdmi->bridge.driver_private = hdmi;
 	hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT |
 			   DRM_BRIDGE_OP_EDID |
@@ -1129,6 +1124,16 @@ struct inno_hdmi *inno_hdmi_bind(struct device *dev,
 	if (ret)
 		return ERR_PTR(ret);
 
+	/*
+	 * The hotplug handler takes the bridge's HPD mutex, which
+	 * drm_bridge_add() initialises, so request the interrupt only now.
+	 */
+	ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
+					inno_hdmi_irq, IRQF_SHARED,
+					dev_name(dev), hdmi);
+	if (ret)
+		return ERR_PTR(ret);
+
 	ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
 	if (ret)
 		return ERR_PTR(ret);

-- 
2.34.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify()
@ 2026-11-27 16:19     ` Michal Wilczynski
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Wilczynski @ 2026-11-27 16:19 UTC (permalink / raw)
  To: Andy Yan, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Yakir Yang,
	Dmitry Baryshkov, Heiko Stuebner
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-rockchip,
	Chaoyi Chen, Maud Spierings, Byron Stanoszek,
	Dominique Belhachemi, Owen O'Hehir, Michal Wilczynski

inno_hdmi_irq() passes hdmi->bridge.dev to drm_helper_hpd_irq_event(),
which dereferences it in its first statement:

	if (!dev->mode_config.poll_enabled)

bridge.dev is assigned only by drm_bridge_attach(), but inno_hdmi_bind()
unmutes the hotplug interrupt in inno_hdmi_init_hw() and installs the
handler well before it attaches the bridge:

	inno_hdmi_init_hw(hdmi);		/* unmutes hotplug */
	devm_request_threaded_irq(...);		/* handler goes live */
	...
	hdmi->bridge.ddc = inno_hdmi_i2c_adapter(hdmi);
	devm_drm_bridge_add(dev, &hdmi->bridge);
	drm_bridge_attach(...);			/* bridge.dev set here */

The bridge is allocated by devm_drm_bridge_alloc(), which kzalloc()s it,
so bridge.dev is NULL for all of that window, and a hotplug event
arriving in it enters drm_helper_hpd_irq_event(NULL).

Before the conversion to a bridge the ordering was safe:
inno_hdmi_register() called drmm_connector_hdmi_init(), which set
connector.dev, before the interrupt was requested.

Report hotplug with drm_bridge_hpd_notify() instead. The bridge already
sets DRM_BRIDGE_OP_HPD, and the helper only calls into the connector
while HPD is enabled, under bridge->hpd_mutex, so it does not need
bridge.dev. Unlike a NULL check, it also stays safe against
drm_bridge_detach() if the interrupt outlives the component bind.

hpd_mutex is initialised by drm_bridge_add(), so request the interrupt
after devm_drm_bridge_add().

Fixes: 969325a2597e ("drm/rockchip: inno-hdmi: Convert to drm bridge")
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
---
This was patch 2 of the JH7110 display series up to v8, and the code is
unchanged from there.

Changes in v8 of that series, prompted by a Sashiko finding on v7
patch 8, "Split probe out of bind":
https://lore.kernel.org/all/sashiko-outbox-201623@kernel.org/
- Report hotplug through drm_bridge_hpd_notify() instead of checking
  bridge.dev, which also covers drm_bridge_detach() racing with the
  interrupt, and request the interrupt after devm_drm_bridge_add(),
  which initialises the HPD mutex. Heiko's Reviewed-by was dropped
  because the approach changed.
- Link: https://lore.kernel.org/all/20261124-jh7110-clean-send-v8-2-de92635dd857@samsung.com/

Changes in v6 of that series:
- Split out of "drm/bridge: inno-hdmi: Split probe out of bind" into
  its own patch (Heiko).
- Link: https://lore.kernel.org/all/20261029-jh7110-clean-send-v6-2-759594e43acf@samsung.com/

Tested on a VisionFive 2 with the display series applied: hotplug is
reported through the new path. The race itself has not been reproduced.
---
 drivers/gpu/drm/bridge/inno-hdmi.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
index 3bdcacf3cbc8427c8420eac9a37e3ecb79682414..bbc90ae9eaae04166d502c05fde52e126462b8be 100644
--- a/drivers/gpu/drm/bridge/inno-hdmi.c
+++ b/drivers/gpu/drm/bridge/inno-hdmi.c
@@ -929,7 +929,8 @@ static irqreturn_t inno_hdmi_irq(int irq, void *dev_id)
 {
 	struct inno_hdmi *hdmi = dev_id;
 
-	drm_helper_hpd_irq_event(hdmi->bridge.dev);
+	drm_bridge_hpd_notify(&hdmi->bridge,
+			      inno_hdmi_bridge_detect(&hdmi->bridge, NULL));
 
 	return IRQ_HANDLED;
 }
@@ -1104,12 +1105,6 @@ struct inno_hdmi *inno_hdmi_bind(struct device *dev,
 	if (irq < 0)
 		return ERR_PTR(irq);
 
-	ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
-					inno_hdmi_irq, IRQF_SHARED,
-					dev_name(dev), hdmi);
-	if (ret)
-		return ERR_PTR(ret);
-
 	hdmi->bridge.driver_private = hdmi;
 	hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT |
 			   DRM_BRIDGE_OP_EDID |
@@ -1129,6 +1124,16 @@ struct inno_hdmi *inno_hdmi_bind(struct device *dev,
 	if (ret)
 		return ERR_PTR(ret);
 
+	/*
+	 * The hotplug handler takes the bridge's HPD mutex, which
+	 * drm_bridge_add() initialises, so request the interrupt only now.
+	 */
+	ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
+					inno_hdmi_irq, IRQF_SHARED,
+					dev_name(dev), hdmi);
+	if (ret)
+		return ERR_PTR(ret);
+
 	ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
 	if (ret)
 		return ERR_PTR(ret);

-- 
2.34.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] drm/bridge: inno-hdmi: Don't give the DDC adapter an OF node
  2026-11-27 16:18   ` Michal Wilczynski
@ 2026-11-27 16:19     ` Michal Wilczynski
  -1 siblings, 0 replies; 9+ messages in thread
From: Michal Wilczynski @ 2026-11-27 16:19 UTC (permalink / raw)
  To: Andy Yan, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Yakir Yang,
	Dmitry Baryshkov, Heiko Stuebner
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-rockchip,
	Chaoyi Chen, Maud Spierings, Byron Stanoszek,
	Dominique Belhachemi, Owen O'Hehir, Michal Wilczynski

inno_hdmi_i2c_adapter() sets the DDC adapter's of_node to the HDMI
controller's node. When the adapter is registered, the I2C core then
tries to create an I2C client for every child of that node. On RK3036,
RK3128 and the JH7110 the only child is the OF graph 'ports' node, which
is not an I2C device, so each boot logs, here on the JH7110:

  i2c i2c-7: of_i2c: modalias failure on .../controller/ports
  i2c i2c-7: Failed to create I2C device for .../controller/ports

Nothing on the DDC bus is described in DT, and nothing looks the
adapter up by its node, so don't assign one, as dw-hdmi doesn't either.

Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support")
Reported-by: Owen O'Hehir <oo.hehir@gmail.com>
Closes: https://lore.kernel.org/all/20261012175941.258219-1-electronicconsult1@gmail.com/
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
---
 drivers/gpu/drm/bridge/inno-hdmi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
index bbc90ae9eaae04166d502c05fde52e126462b8be..bf39483d483e00ccef0daefb80f6579d5c86815a 100644
--- a/drivers/gpu/drm/bridge/inno-hdmi.c
+++ b/drivers/gpu/drm/bridge/inno-hdmi.c
@@ -1044,7 +1044,6 @@ static struct i2c_adapter *inno_hdmi_i2c_adapter(struct inno_hdmi *hdmi)
 	adap = &i2c->adap;
 	adap->owner = THIS_MODULE;
 	adap->dev.parent = hdmi->dev;
-	adap->dev.of_node = hdmi->dev->of_node;
 	adap->algo = &inno_hdmi_algorithm;
 	strscpy(adap->name, "Inno HDMI", sizeof(adap->name));
 	i2c_set_adapdata(adap, hdmi);

-- 
2.34.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] drm/bridge: inno-hdmi: Don't give the DDC adapter an OF node
@ 2026-11-27 16:19     ` Michal Wilczynski
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Wilczynski @ 2026-11-27 16:19 UTC (permalink / raw)
  To: Andy Yan, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Yakir Yang,
	Dmitry Baryshkov, Heiko Stuebner
  Cc: dri-devel, linux-kernel, linux-arm-kernel, linux-rockchip,
	Chaoyi Chen, Maud Spierings, Byron Stanoszek,
	Dominique Belhachemi, Owen O'Hehir, Michal Wilczynski

inno_hdmi_i2c_adapter() sets the DDC adapter's of_node to the HDMI
controller's node. When the adapter is registered, the I2C core then
tries to create an I2C client for every child of that node. On RK3036,
RK3128 and the JH7110 the only child is the OF graph 'ports' node, which
is not an I2C device, so each boot logs, here on the JH7110:

  i2c i2c-7: of_i2c: modalias failure on .../controller/ports
  i2c i2c-7: Failed to create I2C device for .../controller/ports

Nothing on the DDC bus is described in DT, and nothing looks the
adapter up by its node, so don't assign one, as dw-hdmi doesn't either.

Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support")
Reported-by: Owen O'Hehir <oo.hehir@gmail.com>
Closes: https://lore.kernel.org/all/20261012175941.258219-1-electronicconsult1@gmail.com/
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
---
 drivers/gpu/drm/bridge/inno-hdmi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
index bbc90ae9eaae04166d502c05fde52e126462b8be..bf39483d483e00ccef0daefb80f6579d5c86815a 100644
--- a/drivers/gpu/drm/bridge/inno-hdmi.c
+++ b/drivers/gpu/drm/bridge/inno-hdmi.c
@@ -1044,7 +1044,6 @@ static struct i2c_adapter *inno_hdmi_i2c_adapter(struct inno_hdmi *hdmi)
 	adap = &i2c->adap;
 	adap->owner = THIS_MODULE;
 	adap->dev.parent = hdmi->dev;
-	adap->dev.of_node = hdmi->dev->of_node;
 	adap->algo = &inno_hdmi_algorithm;
 	strscpy(adap->name, "Inno HDMI", sizeof(adap->name));
 	i2c_set_adapdata(adap, hdmi);

-- 
2.34.1


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify()
  2026-11-27 16:19     ` Michal Wilczynski
  (?)
@ 2026-11-27 16:27     ` sashiko-bot
  -1 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-27 16:27 UTC (permalink / raw)
  To: Michal Wilczynski; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/bridge: inno-hdmi: null pointer dereference in
  inno_hdmi_i2c_xfer() [1]
--

commit 95253be01dd44552656110fd639d49c16e43c337
Author: Michal Wilczynski <m.wilczynski@samsung.com>

drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify()

This commit changes inno_hdmi_irq() to report hotplug events through
drm_bridge_hpd_notify() and moves devm_request_threaded_irq() in
inno_hdmi_bind() after devm_drm_bridge_add().

> diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c
> index 3bdcacf3cbc84..bbc90ae9eaae0 100644
> --- a/drivers/gpu/drm/bridge/inno-hdmi.c
> +++ b/drivers/gpu/drm/bridge/inno-hdmi.c

[ ... ]

> @@ -1129,6 +1124,16 @@ struct inno_hdmi *inno_hdmi_bind(struct device *dev,
>  	if (ret)
>  		return ERR_PTR(ret);
>  
> +	/*
> +	 * The hotplug handler takes the bridge's HPD mutex, which
> +	 * drm_bridge_add() initialises, so request the interrupt only now.
> +	 */
> +	ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
> +					inno_hdmi_irq, IRQF_SHARED,
> +					dev_name(dev), hdmi);
> +	if (ret)
> +		return ERR_PTR(ret);
> +
>  	ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
>  	if (ret)
>  		return ERR_PTR(ret);

[Severity: High]
This problem wasn't introduced by this patch, but can
inno_hdmi_i2c_adapter() race with a concurrent I2C transfer and cause a
NULL pointer dereference in inno_hdmi_i2c_xfer() [1]?

Just before devm_drm_bridge_add(), inno_hdmi_bind() calls
inno_hdmi_i2c_adapter(), which publishes the adapter via
devm_i2c_add_adapter() before assigning hdmi->i2c:

CPU0                              CPU1
inno_hdmi_i2c_adapter()
  i2c_set_adapdata(adap, hdmi)
  devm_i2c_add_adapter(..., adap)
                                  inno_hdmi_i2c_xfer()
                                    hdmi = i2c_get_adapdata(adap)
                                    i2c = hdmi->i2c  <-- NULL
                                    mutex_lock(&i2c->lock)
  hdmi->i2c = i2c

If a transfer starts right after devm_i2c_add_adapter() registers the
adapter, inno_hdmi_i2c_xfer() reads a NULL hdmi->i2c and dereferences it
in mutex_lock(&i2c->lock).

[1] https://sashiko.dev/#/bug/linux-c25575e8-f25c-439d-83ee-81502085106c

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-inno-hdmi-ddc-of-node-v1-0-465622e1b7ad@samsung.com?part=2

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-27 16:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20261127161904eucas1p1e35356631d4599bbf6b2d02373d3b5b7@eucas1p1.samsung.com>
2026-11-27 16:18 ` [PATCH 0/3] drm/bridge: inno-hdmi: Fix sync polarity, hotplug and DDC adapter Michal Wilczynski
2026-11-27 16:18   ` Michal Wilczynski
2026-11-27 16:18   ` [PATCH 1/3] drm/bridge: inno-hdmi: fix swapped HSYNC and VSYNC polarity Michal Wilczynski
2026-11-27 16:18     ` Michal Wilczynski
2026-11-27 16:19   ` [PATCH 2/3] drm/bridge: inno-hdmi: Report hotplug through drm_bridge_hpd_notify() Michal Wilczynski
2026-11-27 16:19     ` Michal Wilczynski
2026-11-27 16:27     ` sashiko-bot
2026-11-27 16:19   ` [PATCH 3/3] drm/bridge: inno-hdmi: Don't give the DDC adapter an OF node Michal Wilczynski
2026-11-27 16:19     ` Michal Wilczynski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.