linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: Maxime Ripard <maxime.ripard@bootlin.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Chen-Yu Tsai <wens@csie.org>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com,
	Jagan Teki <jagan@amarulasolutions.com>,
	michael@amarulasolutions.com, linux-amarula@amarulasolutions.com
Subject: [PATCH v10 09/11] drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support
Date: Mon, 20 May 2019 14:33:16 +0530	[thread overview]
Message-ID: <20190520090318.27570-10-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20190520090318.27570-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 |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 5584e9c2f8bd..a5d73a283ed7 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -1150,6 +1150,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)) {
@@ -1223,6 +1229,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);
@@ -1255,6 +1268,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 156523859d82..c76b71259d2e 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
@@ -13,6 +13,8 @@
 #include <drm/drm_encoder.h>
 #include <drm/drm_mipi_dsi.h>
 
+#include <linux/regulator/consumer.h>
+
 struct sun6i_dsi {
 	struct drm_connector	connector;
 	struct drm_encoder	encoder;
@@ -21,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;
 
-- 
2.18.0.321.gffc6fa0e3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-05-20  9:08 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20  9:03 [PATCH v10 00/11] drm/sun4i: dsi: Fixes/updates (A33 reworked!) Jagan Teki
2019-05-20  9:03 ` [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits Jagan Teki
2019-05-23 20:34   ` Maxime Ripard
2019-05-24 10:18     ` Jagan Teki
2019-05-29 14:54       ` Maxime Ripard
2019-05-29 18:14         ` Jagan Teki
2019-06-04 10:00           ` Maxime Ripard
2019-06-05  7:47             ` Jagan Teki
2019-06-13 12:56               ` Maxime Ripard
2019-06-14  6:33                 ` Jagan Teki
2019-06-14 14:45                   ` Maxime Ripard
2019-06-18 10:51                     ` Jagan Teki
2019-06-18 11:43                       ` [linux-sunxi] " Chen-Yu Tsai
2019-06-18 12:11                         ` Jagan Teki
2019-06-18 14:45                           ` Chen-Yu Tsai
2019-06-20 18:51                             ` Jagan Teki
2019-06-21  3:13                               ` Chen-Yu Tsai
2019-05-20  9:03 ` [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay Jagan Teki
2019-05-23 20:37   ` Maxime Ripard
2019-05-24 10:25     ` Jagan Teki
2019-05-30 10:42       ` Maxime Ripard
2019-06-13  8:04         ` Jagan Teki
2019-06-14 14:28           ` Maxime Ripard
2019-06-18 11:02             ` Jagan Teki
2019-06-24  9:34   ` Chen-Yu Tsai
2019-05-20  9:03 ` [PATCH v10 03/11] drm/sun4i: dsi: Fix video start delay computation Jagan Teki
2019-05-23 20:38   ` Maxime Ripard
2019-05-24 10:26     ` Jagan Teki
2019-06-21  8:35       ` [linux-sunxi] " Chen-Yu Tsai
2019-06-24  8:52         ` Jagan Teki
2019-05-20  9:03 ` [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes Jagan Teki
2019-05-23 20:48   ` Maxime Ripard
2019-05-24 10:07     ` Jagan Teki
2019-06-04 14:30       ` Maxime Ripard
2019-06-05  7:41         ` [linux-sunxi] " Jagan Teki
2019-06-13 13:16           ` Maxime Ripard
2019-06-14 12:03             ` Jagan Teki
2019-06-24 13:04               ` Maxime Ripard
2019-06-24 16:02                 ` Jagan Teki
2019-06-25 14:37                   ` Maxime Ripard
2019-07-01 19:00                     ` Jagan Teki
2019-07-02 15:29                       ` Maxime Ripard
2019-07-02 15:40                         ` Jagan Teki
2019-07-03 11:51                           ` Maxime Ripard
2019-05-20  9:03 ` [PATCH v10 05/11] drm/sun4i: tcon: Export get tcon0 routine Jagan Teki
2019-05-20  9:03 ` [PATCH v10 06/11] drm/sun4i: dsi: Probe tcon0 during dsi_bind Jagan Teki
2019-05-20  9:03 ` [PATCH v10 07/11] drm/sun4i: dsi: Get tcon0_div at runtime Jagan Teki
2019-05-20  9:03 ` [PATCH v10 08/11] dt-bindings: sun6i-dsi: Add VCC-DSI supply property Jagan Teki
2019-05-20  9:03 ` Jagan Teki [this message]
2019-06-03 13:49   ` [PATCH v10 09/11] drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support Maxime Ripard
2019-06-13  7:55     ` Jagan Teki
2019-06-13 13:14       ` Maxime Ripard
2019-05-20  9:03 ` [DO NOT MERGE] [PATCH v10 10/11] drm/panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge Jagan Teki
2019-05-20  9:03 ` [DO NOT MERGE] [PATCH v10 11/11] ARM: dts: sun8i: bananapi-m2m: Enable Bananapi S070WV20-CT16 DSI panel 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=20190520090318.27570-10-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --cc=airlied@linux.ie \
    --cc=bshah@mykolab.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=michael@amarulasolutions.com \
    --cc=powerpan@qq.com \
    --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).