[PATCH v2 1/2] gpio: tc358762: fix reset gpio handling
Andreas Kemnade
andreas at kemnade.info
Wed Nov 25 03:37:20 PST 2026
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 at 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
More information about the linux-arm-kernel
mailing list