From 979271f803c1578087a965a2a4b845c87e7d922f Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sun, 7 Aug 2022 19:14:21 -0500 Subject: [PATCH 108/117] drm: panel: cwd686: Add regulators Signed-off-by: Samuel Holland --- .../gpu/drm/panel/panel-clockwork-cwd686.c | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/panel/panel-clockwork-cwd686.c +++ b/drivers/gpu/drm/panel/panel-clockwork-cwd686.c @@ -20,7 +20,8 @@ struct cwd686 { struct device *dev; struct drm_panel panel; - struct regulator *supply; + struct regulator *iovcc; + struct regulator *vci; struct gpio_desc *enable_gpio; struct gpio_desc *reset_gpio; struct backlight_device *backlight; @@ -279,6 +280,9 @@ static int cwd686_unprepare(struct drm_p gpiod_set_value_cansleep(ctx->reset_gpio, 1); + regulator_disable(ctx->vci); + regulator_disable(ctx->iovcc); + ctx->prepared = false; return 0; @@ -293,6 +297,18 @@ static int cwd686_prepare(struct drm_pan if (ctx->prepared) return 0; + err = regulator_enable(ctx->iovcc); + if (err) { + dev_err(ctx->dev, "failed to enable iovcc (%d)\n", err); + return err; + } + + err = regulator_enable(ctx->vci); + if (err) { + dev_err(ctx->dev, "failed to enable vci (%d)\n", err); + return err; + } + gpiod_set_value_cansleep(ctx->reset_gpio, 1); /* T2 */ msleep(10); @@ -402,6 +418,14 @@ static int cwd686_probe(struct mipi_dsi_ return err; } + ctx->iovcc = devm_regulator_get(dev, "iovcc"); + if (IS_ERR(ctx->iovcc)) + return PTR_ERR(ctx->iovcc); + + ctx->vci = devm_regulator_get(dev, "vci"); + if (IS_ERR(ctx->vci)) + return PTR_ERR(ctx->vci); + ctx->backlight = devm_of_find_backlight(dev); if (IS_ERR(ctx->backlight)) return PTR_ERR(ctx->backlight);