Skip to content

Commit 3e83c63

Browse files
committed
fixup! drivers/gpu: panel: Add support for Tianma TD4310 panel
1 parent 659c66c commit 3e83c63

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/gpu/drm/panel/panel-tianma-td4310.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/gpio/consumer.h>
88
#include <linux/mod_devicetable.h>
99
#include <linux/module.h>
10+
#include <linux/regulator/consumer.h>
1011

1112
#include <video/mipi_display.h>
1213

@@ -19,6 +20,13 @@ struct td4310_tianma {
1920
struct drm_panel panel;
2021
struct mipi_dsi_device *dsi;
2122
struct gpio_desc *reset_gpio;
23+
struct regulator_bulk_data *supplies;
24+
};
25+
26+
static const struct regulator_bulk_data td4310_tianma_supplies[] = {
27+
{ .supply = "vddio" },
28+
{ .supply = "vsn" },
29+
{ .supply = "vsp" },
2230
};
2331

2432
static inline struct td4310_tianma *to_td4310_tianma(struct drm_panel *panel)
@@ -87,12 +95,19 @@ static int td4310_tianma_prepare(struct drm_panel *panel)
8795
struct device *dev = &ctx->dsi->dev;
8896
int ret;
8997

98+
ret = regulator_bulk_enable(ARRAY_SIZE(td4310_tianma_supplies), ctx->supplies);
99+
if (ret < 0) {
100+
dev_err(dev, "Failed to enable regulators: %d\n", ret);
101+
return ret;
102+
}
103+
90104
td4310_tianma_reset(ctx);
91105

92106
ret = td4310_tianma_on(ctx);
93107
if (ret < 0) {
94108
dev_err(dev, "Failed to initialize panel: %d\n", ret);
95109
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
110+
regulator_bulk_disable(ARRAY_SIZE(td4310_tianma_supplies), ctx->supplies);
96111
return ret;
97112
}
98113

@@ -110,6 +125,7 @@ static int td4310_tianma_unprepare(struct drm_panel *panel)
110125
dev_err(dev, "Failed to un-initialize panel: %d\n", ret);
111126

112127
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
128+
regulator_bulk_disable(ARRAY_SIZE(td4310_tianma_supplies), ctx->supplies);
113129

114130
return 0;
115131
}
@@ -151,6 +167,11 @@ static int td4310_tianma_probe(struct mipi_dsi_device *dsi)
151167
if (!ctx)
152168
return -ENOMEM;
153169

170+
ret = devm_regulator_bulk_get_const(dev,
171+
ARRAY_SIZE(td4310_tianma_supplies),
172+
td4310_tianma_supplies,
173+
&ctx->supplies);
174+
154175
ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
155176
if (IS_ERR(ctx->reset_gpio))
156177
return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),

0 commit comments

Comments
 (0)