From: Jagan Teki <jagan@amarulasolutions.com>
To: Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>
Cc: michael@amarulasolutions.com, Icenowy Zheng <icenowy@aosc.io>,
linux-sunxi <linux-sunxi@googlegroups.com>,
dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Jagan Teki <jagan@amarulasolutions.com>
Subject: [PATCH v11 5/7] drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support
Date: Thu, 3 Oct 2019 12:15:25 +0530 [thread overview]
Message-ID: <20191003064527.15128-6-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20191003064527.15128-1-jagan@amarulasolutions.com>
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>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 ++++++++++++++
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 2 ++
2 files changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 446dc56cc44b..fe9a3667f3a1 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1110,6 +1110,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)) {
@@ -1183,6 +1189,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);
@@ -1215,6 +1228,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;
}
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
index 5c3ad5be0690..a01d44e9e461 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
@@ -12,6 +12,7 @@
#include <drm/drm_connector.h>
#include <drm/drm_encoder.h>
#include <drm/drm_mipi_dsi.h>
+#include <linux/regulator/consumer.h>
#define SUN6I_DSI_TCON_DIV 4
@@ -23,6 +24,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;
--
2.18.0.321.gffc6fa0e3
next prev parent reply other threads:[~2019-10-03 6:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-03 6:45 [PATCH v11 0/7] drm/sun4i: dsi: Fixes/updates (A33 reworked!) Jagan Teki
2019-10-03 6:45 ` [PATCH v11 1/7] drm/sun4i: dsi: Fix TCON DRQ set bits Jagan Teki
2019-10-03 6:51 ` Icenowy Zheng
2019-10-03 6:55 ` [linux-sunxi] " Jagan Teki
2019-10-03 13:17 ` Maxime Ripard
2019-10-03 15:16 ` Jagan Teki
2019-10-07 11:19 ` Maxime Ripard
2019-10-03 6:45 ` [PATCH v11 2/7] drm/sun4i: dsi: Update start value in video start delay Jagan Teki
2019-10-03 6:52 ` Icenowy Zheng
2019-10-03 6:45 ` [PATCH v11 3/7] drm/sun4i: dsi: Fix video start delay computation Jagan Teki
2019-10-03 6:45 ` [PATCH v11 4/7] dt-bindings: sun6i-dsi: Add VCC-DSI supply property Jagan Teki
2019-10-03 11:47 ` Maxime Ripard
2019-10-03 13:04 ` Icenowy Zheng
2019-10-03 13:30 ` Maxime Ripard
2019-10-03 6:45 ` Jagan Teki [this message]
2019-10-03 6:55 ` [PATCH v11 5/7] drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support Chen-Yu Tsai
2019-10-03 7:01 ` Jagan Teki
2019-10-03 11:46 ` Maxime Ripard
2019-10-03 6:45 ` [PATCH v11 6/7] drm/panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge Jagan Teki
2019-10-03 6:50 ` Jagan Teki
2019-10-03 6:45 ` [PATCH v11 7/7] ARM: dts: sun8i: bananapi-m2m: Enable Bananapi S070WV20-CT16 DSI panel Jagan Teki
2019-10-03 6:50 ` Jagan Teki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191003064527.15128-6-jagan@amarulasolutions.com \
--to=jagan@amarulasolutions.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=icenowy@aosc.io \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=michael@amarulasolutions.com \
--cc=mripard@kernel.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).