Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling
@ 2026-11-25 11:37 Andreas Kemnade
  2026-11-25 11:37 ` [PATCH v2 1/2] gpio: tc358762: fix reset gpio handling Andreas Kemnade
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andreas Kemnade @ 2026-11-25 11:37 UTC (permalink / raw)
  To: Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Christoph Niedermaier,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Tomi Valkeinen,
	Linus Walleij, Bartosz Golaszewski
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	linux-gpio, Andreas Kemnade

The bridge driver desserts reset after disable and asserts that 
upon enbale. That requires users to workaround that by declaring
the reset gpio wrongfully active high.

Fix polarity in the one device tree actually declaring
a reset line. That patch has to go in after the bridge fix.

The issue came to sight during experiments with reset lines on the
Epson Moverio BT-200. There are two of these chips with a shared reset
line, so also prepare for future conversion to use a reset controller.

To avoid having GPIO maintainers spammed with a bunch of patches for
BT200 support, do that fix separately and now, so it can go in more
fast-track way.

The devicetree change is only compile tested and is more
a cleanup, not an urgent fix.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
Changes in v2:
- do not use raw gpios but use the quirk framework fixing also initial
  state
- Link to v1: https://patch.msgid.link/20261124-tc3-reset-v1-0-a5d27fe4b5de@kemnade.info

---
Andreas Kemnade (2):
      gpio: tc358762: fix reset gpio handling
      ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity

 .../boot/dts/st/stm32mp15xx-dhsom-overlay-panel-dsi-rpi7inch.dtsi  | 2 +-
 drivers/gpio/gpiolib-of.c                                          | 7 +++++++
 drivers/gpu/drm/bridge/tc358762.c                                  | 6 +++---
 3 files changed, 11 insertions(+), 4 deletions(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
change-id: 20261124-tc3-reset-e68e91bc1638

Best regards,
--  
Andreas Kemnade <andreas@kemnade.info>


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

* [PATCH v2 1/2] gpio: tc358762: fix reset gpio handling
  2026-11-25 11:37 [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling Andreas Kemnade
@ 2026-11-25 11:37 ` Andreas Kemnade
  2026-11-26 19:38   ` Luca Ceresoli
  2026-11-25 11:37 ` [PATCH v2 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity Andreas Kemnade
  2026-11-26 16:31 ` [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling Luca Ceresoli
  2 siblings, 1 reply; 8+ messages in thread
From: Andreas Kemnade @ 2026-11-25 11:37 UTC (permalink / raw)
  To: Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Christoph Niedermaier,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Tomi Valkeinen,
	Linus Walleij, Bartosz Golaszewski
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	linux-gpio, Andreas Kemnade

Reset gpio is asserted when the chip should be active, deasserted when
the chip is enabled. That is the wrong way. Apparently users are working
around this by using GPIO_ACTIVE_HIGH to compensate for that bug but that
is not correcly describing the hardware.
Since this chip is used in a RPi Touchscreen hat, apparently with
devicetree overlays floating around, add a gpio quirk.
Also prepare for using the reset-gpio driver.

Fixes: 3355f4ee561d ("drm/bridge: tc358762: Add reset GPIO support")
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 drivers/gpio/gpiolib-of.c         | 7 +++++++
 drivers/gpu/drm/bridge/tc358762.c | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 8f8454d596046..6519be933db8d 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -241,6 +241,13 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np,
 		 */
 		{ "ti,tsc2005",		"reset-gpios",	false },
 #endif
+#if IS_ENABLED(CONFIG_DRM_TOSHIBA_TC358762)
+		/*
+		 * reset is active low, but RPi touchscreen overlays
+		 * specify this as active high
+		 */
+		{"toshiba,tc358762",	"reset-gpios",	false },
+#endif
 #if IS_ENABLED(CONFIG_SND_SOC_WSA881X)
 		/*
 		 * WSA881 powerdown is always active low, but some device trees
diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 76564d5e4f69f..63b02693c0b9b 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -164,7 +164,7 @@ static void tc358762_post_disable(struct drm_bridge *bridge,
 	ctx->pre_enabled = false;
 
 	if (ctx->reset_gpio)
-		gpiod_set_value_cansleep(ctx->reset_gpio, 0);
+		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
 
 	ret = regulator_disable(ctx->regulator);
 	if (ret < 0)
@@ -182,7 +182,7 @@ static void tc358762_pre_enable(struct drm_bridge *bridge,
 		dev_err(ctx->dev, "error enabling regulators (%d)\n", ret);
 
 	if (ctx->reset_gpio) {
-		gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+		gpiod_set_value_cansleep(ctx->reset_gpio, 0);
 		usleep_range(5000, 10000);
 	}
 
@@ -242,7 +242,7 @@ static int tc358762_parse_dt(struct tc358762 *ctx)
 	ctx->panel_bridge = panel_bridge;
 
 	/* Reset GPIO is optional */
-	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ctx->reset_gpio))
 		return PTR_ERR(ctx->reset_gpio);
 

-- 
2.47.3


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

* [PATCH v2 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity
  2026-11-25 11:37 [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling Andreas Kemnade
  2026-11-25 11:37 ` [PATCH v2 1/2] gpio: tc358762: fix reset gpio handling Andreas Kemnade
@ 2026-11-25 11:37 ` Andreas Kemnade
  2026-11-25 11:47   ` sashiko-bot
  2026-11-26 16:31 ` [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling Luca Ceresoli
  2 siblings, 1 reply; 8+ messages in thread
From: Andreas Kemnade @ 2026-11-25 11:37 UTC (permalink / raw)
  To: Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Christoph Niedermaier,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Tomi Valkeinen,
	Linus Walleij, Bartosz Golaszewski
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	linux-gpio, Andreas Kemnade

Reset is active low. It is apparently set to active high to work around
a driver bug but not to indicate an additional inverter in the signal
path. Correcly describe the hardware.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 arch/arm/boot/dts/st/stm32mp15xx-dhsom-overlay-panel-dsi-rpi7inch.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/st/stm32mp15xx-dhsom-overlay-panel-dsi-rpi7inch.dtsi b/arch/arm/boot/dts/st/stm32mp15xx-dhsom-overlay-panel-dsi-rpi7inch.dtsi
index 518c269a1dba1..6342a6e757c12 100644
--- a/arch/arm/boot/dts/st/stm32mp15xx-dhsom-overlay-panel-dsi-rpi7inch.dtsi
+++ b/arch/arm/boot/dts/st/stm32mp15xx-dhsom-overlay-panel-dsi-rpi7inch.dtsi
@@ -35,7 +35,7 @@ &dsi {
 	bridge@0 {
 		compatible = "toshiba,tc358762";
 		reg = <0>;
-		reset-gpios = <&attiny 0 GPIO_ACTIVE_HIGH>;
+		reset-gpios = <&attiny 0 GPIO_ACTIVE_LOW>;
 		vddc-supply = <&attiny>;
 		status = "okay";
 

-- 
2.47.3


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

* Re: [PATCH v2 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity
  2026-11-25 11:37 ` [PATCH v2 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity Andreas Kemnade
@ 2026-11-25 11:47   ` sashiko-bot
  0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-11-25 11:47 UTC (permalink / raw)
  To: Andreas Kemnade; +Cc: dri-devel, devicetree, linux-gpio, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ARM: dts: st: missing Fixes: trailer for tc358762 bridge reset
  GPIO polarity fix
--

commit ed072d08151b8622793e548d3a5ea860d378e59d
Author: Andreas Kemnade <andreas@kemnade.info>

> ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity
>
> Reset is active low. It is apparently set to active high to work around
> a driver bug but not to indicate an additional inverter in the signal
> path. Correcly describe the hardware.
>
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>

[Severity: Low]
Should this include a Fixes: tag for the commit that introduced the DT
overlay with the active-high reset polarity?

  Fixes: 77a5fde00b9a ("ARM: dts: stm32: Add DT overlays for DH STM32MP13xx/STM32MP15xx DHSOM")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-tc3-reset-v2-0-32eefcaf1460@kemnade.info?part=2

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

* Re: [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling
  2026-11-25 11:37 [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling Andreas Kemnade
  2026-11-25 11:37 ` [PATCH v2 1/2] gpio: tc358762: fix reset gpio handling Andreas Kemnade
  2026-11-25 11:37 ` [PATCH v2 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity Andreas Kemnade
@ 2026-11-26 16:31 ` Luca Ceresoli
  2026-11-26 18:34   ` Andreas Kemnade
  2 siblings, 1 reply; 8+ messages in thread
From: Luca Ceresoli @ 2026-11-26 16:31 UTC (permalink / raw)
  To: Andreas Kemnade, Neil Armstrong, Dmitry Baryshkov, Robert Foss,
	Laurent Pinchart, Jernej Skrabec, Luca Ceresoli,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Christoph Niedermaier, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Tomi Valkeinen, Linus Walleij,
	Bartosz Golaszewski
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	linux-gpio

Hello Andreas,

On Wed Nov 25, 2026 at 12:37 PM CET, Andreas Kemnade wrote:
> The bridge driver desserts reset after disable and asserts that
> upon enbale. That requires users to workaround that by declaring
> the reset gpio wrongfully active high.
>
> Fix polarity in the one device tree actually declaring
> a reset line. That patch has to go in after the bridge fix.
>
> The issue came to sight during experiments with reset lines on the
> Epson Moverio BT-200. There are two of these chips with a shared reset
> line, so also prepare for future conversion to use a reset controller.
>
> To avoid having GPIO maintainers spammed with a bunch of patches for
> BT200 support, do that fix separately and now, so it can go in more
> fast-track way.
>
> The devicetree change is only compile tested and is more
> a cleanup, not an urgent fix.

Can you test it and report back? I guess it just means applyint patch 2
without patch 1 and checking whether it works.

Other than that the patches look OK.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling
  2026-11-26 16:31 ` [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling Luca Ceresoli
@ 2026-11-26 18:34   ` Andreas Kemnade
  2026-11-26 19:37     ` Luca Ceresoli
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Kemnade @ 2026-11-26 18:34 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Christoph Niedermaier,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Tomi Valkeinen,
	Linus Walleij, Bartosz Golaszewski, dri-devel, devicetree, kernel,
	linux-stm32, linux-arm-kernel, linux-gpio

On Thu, 26 Nov 2026 17:31:09 +0100
"Luca Ceresoli" <luca.ceresoli@bootlin.com> wrote:

> Hello Andreas,
> 
> On Wed Nov 25, 2026 at 12:37 PM CET, Andreas Kemnade wrote:
> > The bridge driver desserts reset after disable and asserts that
> > upon enbale. That requires users to workaround that by declaring
> > the reset gpio wrongfully active high.
> >
> > Fix polarity in the one device tree actually declaring
> > a reset line. That patch has to go in after the bridge fix.
> >
> > The issue came to sight during experiments with reset lines on the
> > Epson Moverio BT-200. There are two of these chips with a shared reset
> > line, so also prepare for future conversion to use a reset controller.
> >
> > To avoid having GPIO maintainers spammed with a bunch of patches for
> > BT200 support, do that fix separately and now, so it can go in more
> > fast-track way.
> >
> > The devicetree change is only compile tested and is more
> > a cleanup, not an urgent fix.  
> 
> Can you test it and report back? I guess it just means applyint patch 2
> without patch 1 and checking whether it works.
> 
No, I cannot test that. What I can confirm is that BT200 reset with a single
chip works with GPIO_ACTIVE_HIGH without Patch 1, with Patch 1 it works with
both GPIO_ACTIVE_LOW (which is the correct descrption of the hardware) and HIGH.

Patch 2 is based on the assumption that things are working in the state it
is in right now, and only corrects the description of the hardware.
I expect to break things if it goes in without patch 1, so probably the
best strategy. would be if patch 1 goes to v7.n, then patch 2 should
go into v7.n+1.

BTW: BT200 support depends on the stack of patches from Tomi + my RFC +
reset wire up.

Regards,
Andreas

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

* Re: [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling
  2026-11-26 18:34   ` Andreas Kemnade
@ 2026-11-26 19:37     ` Luca Ceresoli
  0 siblings, 0 replies; 8+ messages in thread
From: Luca Ceresoli @ 2026-11-26 19:37 UTC (permalink / raw)
  To: Andreas Kemnade, Luca Ceresoli
  Cc: Neil Armstrong, Dmitry Baryshkov, Robert Foss, Laurent Pinchart,
	Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Christoph Niedermaier,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Tomi Valkeinen,
	Linus Walleij, Bartosz Golaszewski, dri-devel, devicetree, kernel,
	linux-stm32, linux-arm-kernel, linux-gpio

On Thu Nov 26, 2026 at 7:34 PM CET, Andreas Kemnade wrote:
> On Thu, 26 Nov 2026 17:31:09 +0100
> "Luca Ceresoli" <luca.ceresoli@bootlin.com> wrote:
>
>> Hello Andreas,
>>
>> On Wed Nov 25, 2026 at 12:37 PM CET, Andreas Kemnade wrote:
>> > The bridge driver desserts reset after disable and asserts that
>> > upon enbale. That requires users to workaround that by declaring
>> > the reset gpio wrongfully active high.
>> >
>> > Fix polarity in the one device tree actually declaring
>> > a reset line. That patch has to go in after the bridge fix.
>> >
>> > The issue came to sight during experiments with reset lines on the
>> > Epson Moverio BT-200. There are two of these chips with a shared reset
>> > line, so also prepare for future conversion to use a reset controller.
>> >
>> > To avoid having GPIO maintainers spammed with a bunch of patches for
>> > BT200 support, do that fix separately and now, so it can go in more
>> > fast-track way.
>> >
>> > The devicetree change is only compile tested and is more
>> > a cleanup, not an urgent fix.
>>
>> Can you test it and report back? I guess it just means applyint patch 2
>> without patch 1 and checking whether it works.
>>
> No, I cannot test that. What I can confirm is that BT200 reset with a single
> chip works with GPIO_ACTIVE_HIGH without Patch 1, with Patch 1 it works with
> both GPIO_ACTIVE_LOW (which is the correct descrption of the hardware) and HIGH.

Ah, after re-reading the details I think I got what you mean: your hardware
should work with patch 2 + the part of patch 1 changing tc358762.c (even
without the gpiolib-of.c changes), right?

So, well, nevermind.

> Patch 2 is based on the assumption that things are working in the state it
> is in right now, and only corrects the description of the hardware.
> I expect to break things if it goes in without patch 1, so probably the
> best strategy. would be if patch 1 goes to v7.n, then patch 2 should
> go into v7.n+1.

OK. I can apply patch 1 next week.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH v2 1/2] gpio: tc358762: fix reset gpio handling
  2026-11-25 11:37 ` [PATCH v2 1/2] gpio: tc358762: fix reset gpio handling Andreas Kemnade
@ 2026-11-26 19:38   ` Luca Ceresoli
  0 siblings, 0 replies; 8+ messages in thread
From: Luca Ceresoli @ 2026-11-26 19:38 UTC (permalink / raw)
  To: Andreas Kemnade, Neil Armstrong, Dmitry Baryshkov, Robert Foss,
	Laurent Pinchart, Jernej Skrabec, Luca Ceresoli,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Christoph Niedermaier, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Tomi Valkeinen, Linus Walleij,
	Bartosz Golaszewski
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	linux-gpio

On Wed Nov 25, 2026 at 12:37 PM CET, Andreas Kemnade wrote:
> Reset gpio is asserted when the chip should be active, deasserted when
> the chip is enabled. That is the wrong way. Apparently users are working
> around this by using GPIO_ACTIVE_HIGH to compensate for that bug but that
> is not correcly describing the hardware.
> Since this chip is used in a RPi Touchscreen hat, apparently with
> devicetree overlays floating around, add a gpio quirk.
> Also prepare for using the reset-gpio driver.
>
> Fixes: 3355f4ee561d ("drm/bridge: tc358762: Add reset GPIO support")
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2026-11-26 19:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 11:37 [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling Andreas Kemnade
2026-11-25 11:37 ` [PATCH v2 1/2] gpio: tc358762: fix reset gpio handling Andreas Kemnade
2026-11-26 19:38   ` Luca Ceresoli
2026-11-25 11:37 ` [PATCH v2 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity Andreas Kemnade
2026-11-25 11:47   ` sashiko-bot
2026-11-26 16:31 ` [PATCH v2 0/2] drm/bridge: tc358762: fix reset handling Luca Ceresoli
2026-11-26 18:34   ` Andreas Kemnade
2026-11-26 19:37     ` Luca Ceresoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox