Skip to content

Commit 1c056ad

Browse files
openedevmripard
authored andcommitted
drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support
Allwinner MIPI DSI controllers are supplied with SoC DSI power rails via VCC-DSI pin. Add support for this supply pin by adding voltage regulator handling code to MIPI DSI driver. Tested-by: Merlijn Wajer <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Jagan Teki <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 8a317f2 commit 1c056ad

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/platform_device.h>
1717
#include <linux/pm_runtime.h>
1818
#include <linux/regmap.h>
19+
#include <linux/regulator/consumer.h>
1920
#include <linux/reset.h>
2021
#include <linux/slab.h>
2122

@@ -1099,6 +1100,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
10991100
return PTR_ERR(base);
11001101
}
11011102

1103+
dsi->regulator = devm_regulator_get(dev, "vcc-dsi");
1104+
if (IS_ERR(dsi->regulator)) {
1105+
dev_err(dev, "Couldn't get VCC-DSI supply\n");
1106+
return PTR_ERR(dsi->regulator);
1107+
}
1108+
11021109
dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base,
11031110
&sun6i_dsi_regmap_config);
11041111
if (IS_ERR(dsi->regs)) {
@@ -1172,6 +1179,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev)
11721179
static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev)
11731180
{
11741181
struct sun6i_dsi *dsi = dev_get_drvdata(dev);
1182+
int err;
1183+
1184+
err = regulator_enable(dsi->regulator);
1185+
if (err) {
1186+
dev_err(dsi->dev, "failed to enable VCC-DSI supply: %d\n", err);
1187+
return err;
1188+
}
11751189

11761190
reset_control_deassert(dsi->reset);
11771191
clk_prepare_enable(dsi->mod_clk);
@@ -1204,6 +1218,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev)
12041218

12051219
clk_disable_unprepare(dsi->mod_clk);
12061220
reset_control_assert(dsi->reset);
1221+
regulator_disable(dsi->regulator);
12071222

12081223
return 0;
12091224
}

drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct sun6i_dsi {
2323
struct clk *bus_clk;
2424
struct clk *mod_clk;
2525
struct regmap *regs;
26+
struct regulator *regulator;
2627
struct reset_control *reset;
2728
struct phy *dphy;
2829

0 commit comments

Comments
 (0)