Skip to content

Commit e0cb0c7

Browse files
committed
drm/panel: visionox-vtdr6130: switch to devm_regulator_bulk_get_const
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. Reviewed-by: Douglas Anderson <[email protected]> Link: https://lore.kernel.org/r/20240828-topic-sm8x50-upstream-vtdr6130-multi-v1-2-0cae20d4c55d@linaro.org Signed-off-by: Neil Armstrong <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20240828-topic-sm8x50-upstream-vtdr6130-multi-v1-2-0cae20d4c55d@linaro.org
1 parent 175d648 commit e0cb0c7

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

drivers/gpu/drm/panel/panel-visionox-vtdr6130.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ struct visionox_vtdr6130 {
1919
struct drm_panel panel;
2020
struct mipi_dsi_device *dsi;
2121
struct gpio_desc *reset_gpio;
22-
struct regulator_bulk_data supplies[3];
22+
struct regulator_bulk_data *supplies;
23+
};
24+
25+
static const struct regulator_bulk_data visionox_vtdr6130_supplies[] = {
26+
{ .supply = "vddio" },
27+
{ .supply = "vci" },
28+
{ .supply = "vdd" },
2329
};
2430

2531
static inline struct visionox_vtdr6130 *to_visionox_vtdr6130(struct drm_panel *panel)
@@ -139,7 +145,7 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel)
139145
struct visionox_vtdr6130 *ctx = to_visionox_vtdr6130(panel);
140146
int ret;
141147

142-
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies),
148+
ret = regulator_bulk_enable(ARRAY_SIZE(visionox_vtdr6130_supplies),
143149
ctx->supplies);
144150
if (ret < 0)
145151
return ret;
@@ -149,7 +155,8 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel)
149155
ret = visionox_vtdr6130_on(ctx);
150156
if (ret < 0) {
151157
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
152-
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
158+
regulator_bulk_disable(ARRAY_SIZE(visionox_vtdr6130_supplies),
159+
ctx->supplies);
153160
return ret;
154161
}
155162

@@ -164,7 +171,8 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel)
164171

165172
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
166173

167-
regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
174+
regulator_bulk_disable(ARRAY_SIZE(visionox_vtdr6130_supplies),
175+
ctx->supplies);
168176

169177
return 0;
170178
}
@@ -244,12 +252,10 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi)
244252
if (!ctx)
245253
return -ENOMEM;
246254

247-
ctx->supplies[0].supply = "vddio";
248-
ctx->supplies[1].supply = "vci";
249-
ctx->supplies[2].supply = "vdd";
250-
251-
ret = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(ctx->supplies),
252-
ctx->supplies);
255+
ret = devm_regulator_bulk_get_const(&dsi->dev,
256+
ARRAY_SIZE(visionox_vtdr6130_supplies),
257+
visionox_vtdr6130_supplies,
258+
&ctx->supplies);
253259
if (ret < 0)
254260
return ret;
255261

0 commit comments

Comments
 (0)