Linus, Bartosz,

On 11/26/26 15:45, Vladimir Zapolskiy wrote:
The RESET_N pin of NT36672E panels is an active low signal, however
the driver drives the reset GPIO with inverted logical values, thus
the reset GPIO has to be described as active high in device trees,
which contradicts the panel hardware as well as the panel-common.yaml
convention.

Fix the driver to assert the reset GPIO to put the panel into reset,
and to deassert it to release the panel from reset along with adding
a gpiolib-of quirk, which enforces the active low polarity of the
NT36672E panel reset GPIO. With the quirk the reset signal levels
remain unchanged for dtbs, which describe the reset GPIO as active
high, and device trees, which describe it as active low, start to work.

To: Linus Walleij <[email protected]>
To: Bartosz Golaszewski <[email protected]>
Cc: [email protected]
Signed-off-by: Vladimir Zapolskiy <[email protected]>

can you please ack or better take this change to Linux GPIO tree?

Thank you in advance.

---
  drivers/gpio/gpiolib-of.c                      | 9 +++++++++
  drivers/gpu/drm/panel/panel-novatek-nt36672e.c | 8 ++++----
  2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 8bc4562608e1..2e14173196e9 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -248,6 +248,15 @@ static void of_gpio_try_fixup_polarity(const struct 
device_node *np,
                 * compatible.
                 */
                { "sdw10217201000",   "powerdown-gpios", false },
+#endif
+#if IS_ENABLED(CONFIG_DRM_PANEL_NOVATEK_NT36672E)
+               /*
+                * The RESET_N pin of Novatek NT36672E panels is an active low
+                * signal, however the panel driver and the device trees used
+                * the inverted polarity and described the reset GPIO as
+                * active high.
+                */
+               { "novatek,nt36672e", "reset-gpios",        false },
  #endif
        };
        unsigned int i;
diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c 
b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
index 85902338f10d..364e0855280f 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
@@ -372,12 +372,12 @@ static int nt36672e_power_on(struct nt36672e_panel *ctx)
         * Reset sequence of nt36672e panel requires the panel to be out of 
reset
         * for 10ms, followed by being held in reset for 10ms and then out 
again.
         */
-       gpiod_set_value(ctx->reset_gpio, 1);
-       usleep_range(10000, 20000);
        gpiod_set_value(ctx->reset_gpio, 0);
        usleep_range(10000, 20000);
        gpiod_set_value(ctx->reset_gpio, 1);
        usleep_range(10000, 20000);
+       gpiod_set_value(ctx->reset_gpio, 0);
+       usleep_range(10000, 20000);
return 0;
  }
@@ -387,7 +387,7 @@ static int nt36672e_power_off(struct nt36672e_panel *ctx)
        struct mipi_dsi_device *dsi = ctx->dsi;
        int ret = 0;
- gpiod_set_value(ctx->reset_gpio, 0);
+       gpiod_set_value(ctx->reset_gpio, 1);
ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
        if (ret)
@@ -544,7 +544,7 @@ static int nt36672e_panel_probe(struct mipi_dsi_device *dsi)
        if (ret < 0)
                return ret;
- ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+       ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(ctx->reset_gpio))
                return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), "Failed to get 
reset-gpios\n");

--
Best wishes,
Vladimir

Reply via email to