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 <merlijn@wizzup.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191003064527.15128-6-jagan@amarulasolutions.com
This commit is contained in:
Jagan Teki 2019-10-03 12:15:25 +05:30 committed by Maxime Ripard
parent 8a317f223b
commit 1c056ad871
No known key found for this signature in database
GPG Key ID: E3EF0D6F671851C5
2 changed files with 16 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/slab.h> #include <linux/slab.h>
@ -1099,6 +1100,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
return PTR_ERR(base); 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, dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base,
&sun6i_dsi_regmap_config); &sun6i_dsi_regmap_config);
if (IS_ERR(dsi->regs)) { 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) static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev)
{ {
struct sun6i_dsi *dsi = dev_get_drvdata(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); reset_control_deassert(dsi->reset);
clk_prepare_enable(dsi->mod_clk); 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); clk_disable_unprepare(dsi->mod_clk);
reset_control_assert(dsi->reset); reset_control_assert(dsi->reset);
regulator_disable(dsi->regulator);
return 0; return 0;
} }

View File

@ -23,6 +23,7 @@ struct sun6i_dsi {
struct clk *bus_clk; struct clk *bus_clk;
struct clk *mod_clk; struct clk *mod_clk;
struct regmap *regs; struct regmap *regs;
struct regulator *regulator;
struct reset_control *reset; struct reset_control *reset;
struct phy *dphy; struct phy *dphy;