dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/bridge: tc358762: fix reset handling
@ 2026-11-24 11:54 Andreas Kemnade
  2026-11-24 11:54 ` [PATCH 1/2] drm/bridge: tc358762: fix reset gpio handling Andreas Kemnade
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andreas Kemnade @ 2026-11-24 11:54 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
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	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. As an interim solution,
ignore polarity, until things have settled to fix it afterwards.
That will break setups with an additional inverter in the signal
patch but those should be uncommon, at least not seen in in-tree
devicetrees. 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.

The devicetree change is only compile tested.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
Andreas Kemnade (2):
      drm/bridge: tc358762: fix reset gpio handling
      ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity

 .../arm/boot/dts/st/stm32mp15xx-dhsom-overlay-panel-dsi-rpi7inch.dtsi | 2 +-
 drivers/gpu/drm/bridge/tc358762.c                                     | 4 ++--
 2 files changed, 3 insertions(+), 3 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] 7+ messages in thread

* [PATCH 1/2] drm/bridge: tc358762: fix reset gpio handling
  2026-11-24 11:54 [PATCH 0/2] drm/bridge: tc358762: fix reset handling Andreas Kemnade
@ 2026-11-24 11:54 ` Andreas Kemnade
  2026-11-24 12:06   ` sashiko-bot
  2026-11-24 11:54 ` [PATCH 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity Andreas Kemnade
  2026-11-24 13:44 ` [PATCH 0/2] drm/bridge: tc358762: fix reset handling Tomi Valkeinen
  2 siblings, 1 reply; 7+ messages in thread
From: Andreas Kemnade @ 2026-11-24 11:54 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
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	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. Ignore GPIO polarity for now
to ease transition hoping that nobody has an inverter in the signal path.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 drivers/gpu/drm/bridge/tc358762.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 76564d5e4f69f..404420c7b517e 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_raw_value_cansleep(ctx->reset_gpio, 0);
 
 	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_raw_value_cansleep(ctx->reset_gpio, 1);
 		usleep_range(5000, 10000);
 	}
 

-- 
2.47.3


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

* [PATCH 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity
  2026-11-24 11:54 [PATCH 0/2] drm/bridge: tc358762: fix reset handling Andreas Kemnade
  2026-11-24 11:54 ` [PATCH 1/2] drm/bridge: tc358762: fix reset gpio handling Andreas Kemnade
@ 2026-11-24 11:54 ` Andreas Kemnade
  2026-11-24 12:03   ` sashiko-bot
  2026-11-24 13:44 ` [PATCH 0/2] drm/bridge: tc358762: fix reset handling Tomi Valkeinen
  2 siblings, 1 reply; 7+ messages in thread
From: Andreas Kemnade @ 2026-11-24 11:54 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
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	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] 7+ messages in thread

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

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ARM: dts: stm32: GPIO_ACTIVE_LOW reset breaks attiny power
  sequencing
--

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

ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity

This commit changes the TC358762 bridge reset GPIO polarity from
GPIO_ACTIVE_HIGH to GPIO_ACTIVE_LOW in the Raspberry Pi 7-inch DSI panel
devicetree overlay.

> 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";

[Severity: High]
Does changing reset-gpios to GPIO_ACTIVE_LOW break power sequencing on the
attiny regulator and leave the panel unpowered?

During probe, tc358762_parse_dt() requests the reset GPIO using logical
GPIOD_OUT_LOW before vddc-supply is enabled:

drivers/gpu/drm/bridge/tc358762.c:tc358762_parse_dt() {
	...
	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
	...
}

With GPIO_ACTIVE_LOW, GPIOD_OUT_LOW drives a physical 1 on &attiny GPIO 0
(RST_BRIDGE_N).  In attiny_gpio_set(), driving RST_BRIDGE_N high sets
PC_RST_BRIDGE_N | PC_RST_LCD_N in REG_PORTC and writes the TC358762
registers over I2C while main power (PB_LCD_MAIN) is still off.

Because attiny_lcd_power_is_enabled() checks whether the regulator is
enabled by testing data & PC_RST_BRIDGE_N in REG_PORTC, the subsequent
regulator_enable() call sees the regulator as already enabled and skips
attiny_lcd_power_enable(), leaving PB_LCD_MAIN and PC_LED_EN turned off.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-tc3-reset-v1-0-a5d27fe4b5de@kemnade.info?part=2

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

* Re: [PATCH 1/2] drm/bridge: tc358762: fix reset gpio handling
  2026-11-24 11:54 ` [PATCH 1/2] drm/bridge: tc358762: fix reset gpio handling Andreas Kemnade
@ 2026-11-24 12:06   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-11-24 12:06 UTC (permalink / raw)
  To: Andreas Kemnade; +Cc: dri-devel, devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/bridge: tc358762: logical GPIOD_OUT_LOW in
  tc358762_parse_dt() breaks reset
- [Low] drm/bridge: tc358762: missing Fixes trailer and unclear commit
  message wording
--

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

> drm/bridge: tc358762: fix reset gpio handling
>
> 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. Ignore GPIO polarity for now
> to ease transition hoping that nobody has an inverter in the signal path.
>
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>

[Severity: Low]
Should this bug fix include a Fixes tag:

  Fixes: 3355f4ee561d ("drm/bridge: tc358762: Add reset GPIO support")

Also, the first sentence says "asserted when the chip should be active,
deasserted when the chip is enabled", where both clauses describe the
active/enabled state rather than enabling vs. disabling the chip.

> diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
> index 76564d5e4f69f..404420c7b517e 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_raw_value_cansleep(ctx->reset_gpio, 0);
>  
>  	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_raw_value_cansleep(ctx->reset_gpio, 1);
>  		usleep_range(5000, 10000);
>  	}

[Severity: High]
Does requesting ctx->reset_gpio with logical GPIOD_OUT_LOW in
tc358762_parse_dt() drive the physical reset pin high during probe when the
Device Tree specifies GPIO_ACTIVE_LOW?

drivers/gpu/drm/bridge/tc358762.c:tc358762_parse_dt() {
	...
	/* Reset GPIO is optional */
	ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
	if (IS_ERR(ctx->reset_gpio))
		return PTR_ERR(ctx->reset_gpio);
	...
}

With GPIO_ACTIVE_LOW in Device Tree, GPIOD_OUT_LOW (logical 0) is inverted
by gpiolib to physical 1 at probe time while vddc-supply is still disabled.
On standalone reset GPIOs, the bridge is not held in reset during power-up
and gpiod_set_raw_value_cansleep(ctx->reset_gpio, 1) in
tc358762_pre_enable() becomes a 1-to-1 no-op.  On the Raspberry Pi 7-inch
panel unit (drivers/regulator/rpi-panel-attiny-regulator.c), driving the
reset line to physical 1 at probe sets PC_RST_BRIDGE_N in REG_PORTC, which
causes attiny_lcd_power_is_enabled() to report the regulator as already
enabled so regulator_enable(ctx->regulator) in tc358762_pre_enable() skips
enabling panel and bridge power.

Instead of using raw GPIO accessors, should tc358762 use logical active-low
reset values (GPIOD_OUT_HIGH at probe, 0 in tc358762_pre_enable(), and 1 in
tc358762_post_disable()) and add a polarity quirk for "toshiba,tc358762"
"reset-gpios" in of_gpio_try_fixup_polarity() to handle older Device Trees?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-tc3-reset-v1-0-a5d27fe4b5de@kemnade.info?part=1

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

* Re: [PATCH 0/2] drm/bridge: tc358762: fix reset handling
  2026-11-24 11:54 [PATCH 0/2] drm/bridge: tc358762: fix reset handling Andreas Kemnade
  2026-11-24 11:54 ` [PATCH 1/2] drm/bridge: tc358762: fix reset gpio handling Andreas Kemnade
  2026-11-24 11:54 ` [PATCH 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity Andreas Kemnade
@ 2026-11-24 13:44 ` Tomi Valkeinen
  2026-11-24 14:23   ` Andreas Kemnade
  2 siblings, 1 reply; 7+ messages in thread
From: Tomi Valkeinen @ 2026-11-24 13:44 UTC (permalink / raw)
  To: Andreas Kemnade
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	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

Hi,

On 24/11/2026 13:54, 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. As an interim solution,
> ignore polarity, until things have settled to fix it afterwards.
> That will break setups with an additional inverter in the signal
> patch but those should be uncommon, at least not seen in in-tree
> devicetrees. 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.
Indeed, the driver has it the wrong way... But what is the way to fix 
this? Fixing it will always break the backward compatibility with dtbs.

Is it worth it? Or is it easier to just adjust the bindings doc to 
mention about it, and add a note to the driver that the gpio is set the 
wrong way "on purpose".

Or, if this is to be merged, I think the code around the 
gpiod_set_raw_value_cansleep calls should have a comment to highlight 
why it's calling raw funcs and what the plan is.

  Tomi


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

* Re: [PATCH 0/2] drm/bridge: tc358762: fix reset handling
  2026-11-24 13:44 ` [PATCH 0/2] drm/bridge: tc358762: fix reset handling Tomi Valkeinen
@ 2026-11-24 14:23   ` Andreas Kemnade
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Kemnade @ 2026-11-24 14:23 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: dri-devel, devicetree, kernel, linux-stm32, linux-arm-kernel,
	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

On Tue, 24 Nov 2026 15:44:40 +0200
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> wrote:

> Hi,
> 
> On 24/11/2026 13:54, 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. As an interim solution,
> > ignore polarity, until things have settled to fix it afterwards.
> > That will break setups with an additional inverter in the signal
> > patch but those should be uncommon, at least not seen in in-tree
> > devicetrees. 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.  
> Indeed, the driver has it the wrong way... But what is the way to fix 
> this? Fixing it will always break the backward compatibility with dtbs.
> 
> Is it worth it? Or is it easier to just adjust the bindings doc to 
> mention about it, and add a note to the driver that the gpio is set the 
> wrong way "on purpose".
> 
I am a bit wondering whether to use the reset-gpio driver as aux device,
and then we would need correct dts. There are two chips sharing a single
reset line, so I have to deal with shared gpios. It seems not to work
that well directly. But first I try to have things working with well-defined
boot state.
That reset-gpio stuff was invented exactly for that case, see commit
cee544a40e4426040946e685988b1489f13e6600.

> Or, if this is to be merged, I think the code around the 
> gpiod_set_raw_value_cansleep calls should have a comment to highlight 
> why it's calling raw funcs and what the plan is.
> 
Yes, the comment should be there.
Sashiko suggested to add an entry to 
of_gpio_try_fixup_polarity()

to have fixups.

Regards,
Andreas

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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 11:54 [PATCH 0/2] drm/bridge: tc358762: fix reset handling Andreas Kemnade
2026-11-24 11:54 ` [PATCH 1/2] drm/bridge: tc358762: fix reset gpio handling Andreas Kemnade
2026-11-24 12:06   ` sashiko-bot
2026-11-24 11:54 ` [PATCH 2/2] ARM: dts: st: stm32mp15xx-dhsom: fix bridge reset polarity Andreas Kemnade
2026-11-24 12:03   ` sashiko-bot
2026-11-24 13:44 ` [PATCH 0/2] drm/bridge: tc358762: fix reset handling Tomi Valkeinen
2026-11-24 14:23   ` Andreas Kemnade

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