From: David Heidelberg <[email protected]>

Recently we documented, there is more than vddio regulator, adapt the
driver to work with VCI and POC regulator.

Signed-off-by: David Heidelberg <[email protected]>
---
 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 28 ++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c 
b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
index c88574ea66e1c..3097040e6bfa0 100644
--- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c
+++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
@@ -20,10 +20,16 @@
 struct sofef00_panel {
        struct drm_panel panel;
        struct mipi_dsi_device *dsi;
-       struct regulator *supply;
+       struct regulator_bulk_data *supplies;
        struct gpio_desc *reset_gpio;
 };
 
+static const struct regulator_bulk_data sofef00_supplies[] = {
+       { .supply = "vddio" },
+       { .supply = "vci" },
+       { .supply = "poc" },
+};
+
 static inline
 struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel)
 {
@@ -86,20 +92,18 @@ static int sofef00_panel_off(struct sofef00_panel *ctx)
 static int sofef00_panel_prepare(struct drm_panel *panel)
 {
        struct sofef00_panel *ctx = to_sofef00_panel(panel);
-       struct device *dev = &ctx->dsi->dev;
        int ret;
 
-       ret = regulator_enable(ctx->supply);
-       if (ret < 0) {
-               dev_err(dev, "Failed to enable regulator: %d\n", ret);
+       ret = regulator_bulk_enable(ARRAY_SIZE(sofef00_supplies), 
ctx->supplies);
+       if (ret < 0)
                return ret;
-       }
 
        sofef00_panel_reset(ctx);
 
        ret = sofef00_panel_on(ctx);
        if (ret < 0) {
                gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+               regulator_bulk_disable(ARRAY_SIZE(sofef00_supplies), 
ctx->supplies);
                return ret;
        }
 
@@ -111,7 +115,7 @@ static int sofef00_panel_unprepare(struct drm_panel *panel)
        struct sofef00_panel *ctx = to_sofef00_panel(panel);
 
        sofef00_panel_off(ctx);
-       regulator_disable(ctx->supply);
+       regulator_bulk_disable(ARRAY_SIZE(sofef00_supplies), ctx->supplies);
 
        return 0;
 }
@@ -197,10 +201,12 @@ static int sofef00_panel_probe(struct mipi_dsi_device 
*dsi)
        if (IS_ERR(ctx))
                return PTR_ERR(ctx);
 
-       ctx->supply = devm_regulator_get(dev, "vddio");
-       if (IS_ERR(ctx->supply))
-               return dev_err_probe(dev, PTR_ERR(ctx->supply),
-                                    "Failed to get vddio regulator\n");
+       ret = devm_regulator_bulk_get_const(dev,
+                                           ARRAY_SIZE(sofef00_supplies),
+                                           sofef00_supplies,
+                                           &ctx->supplies);
+       if (ret)
+               return dev_err_probe(dev, ret, "Failed to get regulators\n");
 
        ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(ctx->reset_gpio))

-- 
2.51.0


Reply via email to