Some NT36672E panel modules generate their positive and negative bias
supplies on the module, and expose only a bias enable signal instead of
the AVDD and AVEE supply inputs, add support of such bias enable GPIO.

Signed-off-by: Vladimir Zapolskiy <[email protected]>
---
 drivers/gpu/drm/panel/panel-novatek-nt36672e.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c 
b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
index 80934c6bf250..0a2d54ee8069 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672e.c
@@ -37,6 +37,7 @@ struct nt36672e_panel {
        struct drm_panel panel;
        struct mipi_dsi_device *dsi;
        struct gpio_desc *reset_gpio;
+       struct gpio_desc *enable_gpio;
        struct regulator_bulk_data *supplies;
        struct regulator_bulk_data *bias_supplies;
        const struct panel_desc *desc;
@@ -377,6 +378,8 @@ static int nt36672e_power_on(struct nt36672e_panel *ctx)
                }
        }
 
+       gpiod_set_value_cansleep(ctx->enable_gpio, 1);
+
        /*
         * 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.
@@ -397,6 +400,7 @@ static int nt36672e_power_off(struct nt36672e_panel *ctx)
        int ret = 0;
 
        gpiod_set_value(ctx->reset_gpio, 0);
+       gpiod_set_value_cansleep(ctx->enable_gpio, 0);
 
        if (ctx->bias_supplies) {
                ret = regulator_bulk_disable(ARRAY_SIZE(nt36672e_bias_supplies),
@@ -577,6 +581,16 @@ static int nt36672e_panel_probe(struct mipi_dsi_device 
*dsi)
        if (IS_ERR(ctx->reset_gpio))
                return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), "Failed to 
get reset-gpios\n");
 
+       ctx->enable_gpio = devm_gpiod_get_optional(dev, "enable", 
GPIOD_OUT_LOW);
+       if (IS_ERR(ctx->enable_gpio))
+               return dev_err_probe(dev, PTR_ERR(ctx->enable_gpio),
+                                    "Failed to get enable-gpios\n");
+
+       /* The bias is either supplied to or generated on the panel module */
+       if (ctx->enable_gpio && ctx->bias_supplies)
+               return dev_err_probe(dev, -EINVAL,
+                                    "enable-gpios and bias supplies are 
mutually exclusive\n");
+
        ctx->dsi = dsi;
        mipi_dsi_set_drvdata(dsi, ctx);
 
-- 
2.51.0

Reply via email to