]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/panel: sofef00: Handle all regulators
authorDavid Heidelberg <david@ixit.cz>
Wed, 19 Nov 2025 14:21:29 +0000 (15:21 +0100)
committerNeil Armstrong <neil.armstrong@linaro.org>
Wed, 19 Nov 2025 16:13:37 +0000 (17:13 +0100)
Recently we documented, there is more than vddio regulator, adapt the
driver to work with VCI and POC regulator.

Signed-off-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20251119-sofef00-rebuild-v3-4-6cd55471e84e@ixit.cz
drivers/gpu/drm/panel/panel-samsung-sofef00.c

index c88574ea66e1c3cba86c2dc84281ec301b33c684..3097040e6bfa00bcf4fa30a4ddfb17b75eee24ce 100644 (file)
 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))