]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/panel: sw43408: Switch to devm_regulator_bulk_get_const
authorDavid Heidelberg <david@ixit.cz>
Sun, 14 Dec 2025 14:51:22 +0000 (15:51 +0100)
committerNeil Armstrong <neil.armstrong@linaro.org>
Tue, 16 Dec 2025 10:21:34 +0000 (11:21 +0100)
Switch to devm_regulator_bulk_get_const() to stop setting the supplies
list in probe(), and move the regulator_bulk_data struct in static const.

Cosmetic: adjust comment for regulator from 1.88V to 1.8 V.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20251214-pixel-3-v7-6-b1c0cf6f224d@ixit.cz
drivers/gpu/drm/panel/panel-lg-sw43408.c

index f9ec6e9b02c702a3edf9742a50a1c47006cc101d..a5708c7d04192b8f345e6706e5013a038419c6d0 100644 (file)
 #include <drm/display/drm_dsc.h>
 #include <drm/display/drm_dsc_helper.h>
 
-#define NUM_SUPPLIES 2
+static const struct regulator_bulk_data sw43408_supplies[] = {
+       { .supply = "vddi", /* 1.8 V */
+         .init_load_uA = 62000 },
+       { .supply = "vpnl", /* 3.0 V */
+         .init_load_uA = 857000 },
+};
 
 struct sw43408_panel {
        struct drm_panel base;
        struct mipi_dsi_device *link;
 
-       struct regulator_bulk_data supplies[NUM_SUPPLIES];
+       struct regulator_bulk_data *supplies;
 
        struct gpio_desc *reset_gpio;
 
@@ -52,7 +57,7 @@ static int sw43408_unprepare(struct drm_panel *panel)
 
        gpiod_set_value(sw43408->reset_gpio, 1);
 
-       ret = regulator_bulk_disable(ARRAY_SIZE(sw43408->supplies), sw43408->supplies);
+       ret = regulator_bulk_disable(ARRAY_SIZE(sw43408_supplies), sw43408->supplies);
 
        return ret ? : ctx.accum_err;
 }
@@ -134,7 +139,7 @@ static int sw43408_prepare(struct drm_panel *panel)
        struct sw43408_panel *ctx = to_panel_info(panel);
        int ret;
 
-       ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
+       ret = regulator_bulk_enable(ARRAY_SIZE(sw43408_supplies), ctx->supplies);
        if (ret < 0)
                return ret;
 
@@ -150,7 +155,7 @@ static int sw43408_prepare(struct drm_panel *panel)
 
 poweroff:
        gpiod_set_value(ctx->reset_gpio, 1);
-       regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
+       regulator_bulk_disable(ARRAY_SIZE(sw43408_supplies), ctx->supplies);
        return ret;
 }
 
@@ -230,13 +235,10 @@ static int sw43408_add(struct sw43408_panel *ctx)
        struct device *dev = &ctx->link->dev;
        int ret;
 
-       ctx->supplies[0].supply = "vddi"; /* 1.88 V */
-       ctx->supplies[0].init_load_uA = 62000;
-       ctx->supplies[1].supply = "vpnl"; /* 3.0 V */
-       ctx->supplies[1].init_load_uA = 857000;
-
-       ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),
-                                     ctx->supplies);
+       ret = devm_regulator_bulk_get_const(dev,
+                                           ARRAY_SIZE(sw43408_supplies),
+                                           sw43408_supplies,
+                                           &ctx->supplies);
        if (ret < 0)
                return ret;