Commit 1c056ad8 authored by Jagan Teki's avatar Jagan Teki Committed by Maxime Ripard

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: default avatarMerlijn Wajer <merlijn@wizzup.org>
Reviewed-by: default avatarChen-Yu Tsai <wens@csie.org>
Signed-off-by: default avatarJagan Teki <jagan@amarulasolutions.com>
Signed-off-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191003064527.15128-6-jagan@amarulasolutions.com
parent 8a317f22
......@@ -16,6 +16,7 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/slab.h>
......@@ -1099,6 +1100,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
return PTR_ERR(base);
}
dsi->regulator = devm_regulator_get(dev, "vcc-dsi");
if (IS_ERR(dsi->regulator)) {
dev_err(dev, "Couldn't get VCC-DSI supply\n");
return PTR_ERR(dsi->regulator);
}
dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base,
&sun6i_dsi_regmap_config);
if (IS_ERR(dsi->regs)) {
......@@ -1172,6 +1179,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev)
static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev)
{
struct sun6i_dsi *dsi = dev_get_drvdata(dev);
int err;
err = regulator_enable(dsi->regulator);
if (err) {
dev_err(dsi->dev, "failed to enable VCC-DSI supply: %d\n", err);
return err;
}
reset_control_deassert(dsi->reset);
clk_prepare_enable(dsi->mod_clk);
......@@ -1204,6 +1218,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev)
clk_disable_unprepare(dsi->mod_clk);
reset_control_assert(dsi->reset);
regulator_disable(dsi->regulator);
return 0;
}
......
......@@ -23,6 +23,7 @@ struct sun6i_dsi {
struct clk *bus_clk;
struct clk *mod_clk;
struct regmap *regs;
struct regulator *regulator;
struct reset_control *reset;
struct phy *dphy;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment