Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Mergnat <amergnat@baylibre.com>
To: Daniel Vetter <daniel@ffwll.ch>, CK Hu <ck.hu@mediatek.com>,
	Jitao Shi <jitao.shi@mediatek.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Sam Ravnborg <sam@ravnborg.org>, Rob Herring <robh+dt@kernel.org>,
	Uwe Kleine-König <u.kleine-koenig@pengutronix.de>,
	Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	David Airlie <airlied@gmail.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Xinlei Lee <xinlei.lee@mediatek.com>
Cc: Guillaume La Roque <glaroque@baylibre.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Alexandre Mergnat <amergnat@baylibre.com>,
	dri-devel@lists.freedesktop.org,
	Fabien Parent <fparent@baylibre.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 19/21] drm/mediatek: dpi: add support for dpi clock
Date: Thu, 09 Mar 2023 15:23:08 +0100	[thread overview]
Message-ID: <20230220-display-v1-19-45cbc68e188b@baylibre.com> (raw)
In-Reply-To: <20230220-display-v1-0-45cbc68e188b@baylibre.com>

From: Fabien Parent <fparent@baylibre.com>

MT8365 requires an additional clock for DPI. Add support for that
additional clock.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 4317595a15d1..474c6e5bbf04 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -68,6 +68,7 @@ struct mtk_dpi {
 	struct device *dev;
 	struct clk *engine_clk;
 	struct clk *pixel_clk;
+	struct clk *dpi_clk;
 	struct clk *tvd_clk;
 	int irq;
 	struct drm_display_mode mode;
@@ -464,6 +465,7 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)
 	mtk_dpi_disable(dpi);
 	clk_disable_unprepare(dpi->pixel_clk);
 	clk_disable_unprepare(dpi->engine_clk);
+	clk_disable_unprepare(dpi->dpi_clk);
 }
 
 static int mtk_dpi_power_on(struct mtk_dpi *dpi)
@@ -473,10 +475,16 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)
 	if (++dpi->refcount != 1)
 		return 0;
 
+	ret = clk_prepare_enable(dpi->dpi_clk);
+	if (ret) {
+		dev_err(dpi->dev, "failed to enable dpi clock: %d\n", ret);
+		goto err_refcount;
+	}
+
 	ret = clk_prepare_enable(dpi->engine_clk);
 	if (ret) {
 		dev_err(dpi->dev, "Failed to enable engine clock: %d\n", ret);
-		goto err_refcount;
+		goto err_engine;
 	}
 
 	ret = clk_prepare_enable(dpi->pixel_clk);
@@ -489,6 +497,8 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)
 
 err_pixel:
 	clk_disable_unprepare(dpi->engine_clk);
+err_engine:
+	clk_disable_unprepare(dpi->dpi_clk);
 err_refcount:
 	dpi->refcount--;
 	return ret;
@@ -1044,6 +1054,12 @@ static int mtk_dpi_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	dpi->dpi_clk = devm_clk_get_optional(dev, "dpi");
+	if (IS_ERR(dpi->dpi_clk)) {
+		return dev_err_probe(dev, ret, "Failed to get dpi clock: %p\n",
+				     dpi->dpi_clk);
+	}
+
 	dpi->irq = platform_get_irq(pdev, 0);
 	if (dpi->irq <= 0)
 		return -EINVAL;

-- 
b4 0.10.1

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

  parent reply	other threads:[~2023-03-09 14:48 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 14:22 [PATCH 00/21] Add display support for the MT8365-EVK board Alexandre Mergnat
2023-03-09 14:22 ` [PATCH 01/21] dt-bindings: display: mediatek: aal: add binding for MT8365 SoC Alexandre Mergnat
2023-03-10  8:41   ` Krzysztof Kozlowski
2023-03-13 15:02   ` Chun-Kuang Hu
2023-03-31 14:55     ` Matthias Brugger
2023-04-03  3:25       ` Chun-Kuang Hu
2023-03-09 14:22 ` [PATCH 02/21] dt-bindings: display: mediatek: ccorr: " Alexandre Mergnat
2023-03-10  8:29   ` Krzysztof Kozlowski
2023-03-13 14:54   ` Chun-Kuang Hu
2023-03-09 14:22 ` [PATCH 03/21] dt-bindings: display: mediatek: color: " Alexandre Mergnat
2023-03-10  8:35   ` Krzysztof Kozlowski
2023-03-13 14:58   ` Chun-Kuang Hu
2023-03-09 14:22 ` [PATCH 04/21] dt-bindings: display: mediatek: dither: " Alexandre Mergnat
2023-03-10  8:35   ` Krzysztof Kozlowski
2023-03-13 14:59   ` Chun-Kuang Hu
2023-03-09 14:22 ` [PATCH 05/21] dt-bindings: display: mediatek: dsi: " Alexandre Mergnat
2023-03-10  8:35   ` Krzysztof Kozlowski
2023-03-13 15:00   ` Chun-Kuang Hu
2023-03-09 14:22 ` [PATCH 06/21] dt-bindings: display: mediatek: dpi: add power-domains property Alexandre Mergnat
2023-03-09 14:22 ` [PATCH 07/21] dt-bindings: display: mediatek: dpi: add binding for MT8365 Alexandre Mergnat
2023-03-10  8:38   ` Krzysztof Kozlowski
2023-03-13 15:17   ` Chun-Kuang Hu
2023-03-15  9:26     ` Alexandre Mergnat
2023-03-09 14:22 ` [PATCH 08/21] dt-bindings: display: mediatek: gamma: add binding for MT8365 SoC Alexandre Mergnat
2023-03-10  8:38   ` Krzysztof Kozlowski
2023-03-13 15:07   ` Chun-Kuang Hu
2023-03-09 14:22 ` [PATCH 09/21] dt-bindings: display: mediatek: ovl: " Alexandre Mergnat
2023-03-10  8:38   ` Krzysztof Kozlowski
2023-03-13 15:08   ` Chun-Kuang Hu
2023-03-09 14:22 ` [PATCH 10/21] dt-bindings: display: mediatek: rdma: " Alexandre Mergnat
2023-03-10  8:38   ` Krzysztof Kozlowski
2023-03-13 15:09   ` Chun-Kuang Hu
2023-03-09 14:23 ` [PATCH 11/21] dt-bindings: display: pannel: add startek kd070fhfid015 binding documentation Alexandre Mergnat
2023-03-09 14:23 ` [PATCH 12/21] dt-bindings: pwm: add power-domains property Alexandre Mergnat
2023-03-09 14:23 ` [PATCH 13/21] dt-bindings: pwm: add binding for mt8365 SoC Alexandre Mergnat
2023-03-10  8:38   ` Krzysztof Kozlowski
2023-03-09 14:23 ` [PATCH 14/21] dt-bindings: soc: mediatek: specify which compatible requires clocks property Alexandre Mergnat
2023-03-31 14:42   ` Matthias Brugger
2023-03-09 14:23 ` [PATCH 15/21] dt-bindings: soc: mediatek: add display mutex for MT8365 SoC Alexandre Mergnat
2023-03-10  8:39   ` Krzysztof Kozlowski
2023-03-15  8:01     ` Alexandre Mergnat
2023-03-15  8:17       ` Alexandre Mergnat
2023-03-15 13:17       ` Krzysztof Kozlowski
2023-03-15 13:22   ` Krzysztof Kozlowski
2023-03-31 17:51   ` Matthias Brugger
2023-03-09 14:23 ` [PATCH 16/21] arm64: dts: mediatek: add display blocks support for the " Alexandre Mergnat
2023-03-09 14:23 ` [PATCH 17/21] arm64: dts: mediatek: add display support for mt8365-evk Alexandre Mergnat
2023-03-09 14:23 ` [PATCH 18/21] drm/mediatek: dsi: Improves the DSI lane setup robustness Alexandre Mergnat
2023-03-27 15:37   ` Chun-Kuang Hu
2023-03-09 14:23 ` Alexandre Mergnat [this message]
2023-03-13 15:21   ` [PATCH 19/21] drm/mediatek: dpi: add support for dpi clock Chun-Kuang Hu
2023-03-15  9:35     ` Alexandre Mergnat
2023-03-15 14:17       ` Chun-Kuang Hu
2023-03-09 14:23 ` [PATCH 20/21] drm/mediatek: add MT8365 SoC support Alexandre Mergnat
2023-03-09 14:23 ` [PATCH 21/21] panel: startek-kd070fhfid015: add support of this display Alexandre Mergnat
2023-03-09 14:51   ` Neil Armstrong
2023-03-15 15:59     ` Alexandre Mergnat
2023-03-15 17:12       ` neil.armstrong

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=20230220-display-v1-19-45cbc68e188b@baylibre.com \
    --to=amergnat@baylibre.com \
    --cc=airlied@gmail.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=ck.hu@mediatek.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fparent@baylibre.com \
    --cc=glaroque@baylibre.com \
    --cc=jitao.shi@mediatek.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=xinlei.lee@mediatek.com \
    /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