Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andreas Kemnade" <andreas@kemnade.info>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 1/2] drm/bridge: tc358762: fix reset gpio handling
Date: Tue, 24 Nov 2026 12:06:49 +0000	[thread overview]
Message-ID: <sashiko-outbox-231098@kernel.org> (raw)
In-Reply-To: <20261124-tc3-reset-v1-1-a5d27fe4b5de@kemnade.info>

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

  reply	other threads:[~2026-11-24 12:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-231098@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=andreas@kemnade.info \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox