From: Nicolas Boichat <drinkcat@chromium.org>
To: Yongqiang Niu <yongqiang.niu@mediatek.com>
Cc: CK Hu <ck.hu@mediatek.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Rob Herring <robh+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Mark Rutland <mark.rutland@arm.com>,
Devicetree List <devicetree@vger.kernel.org>,
David Airlie <airlied@linux.ie>,
lkml <linux-kernel@vger.kernel.org>,
dri-devel <dri-devel@lists.freedesktop.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@lists.infradead.org>,
Daniel Vetter <daniel@ffwll.ch>,
linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2, 07/17] drm/mediatek: add disp config and mm 26mhz clock into mutex device
Date: Tue, 15 Dec 2020 21:37:55 +0800 [thread overview]
Message-ID: <CANMq1KCbmW4kbY5rbuogr9JJD5c5=-qatFs-EaWbuAxSzWmnLQ@mail.gmail.com> (raw)
In-Reply-To: <1607746317-4696-8-git-send-email-yongqiang.niu@mediatek.com>
On Sat, Dec 12, 2020 at 12:12 PM Yongqiang Niu
<yongqiang.niu@mediatek.com> wrote:
>
> there are 2 more clock need enable for display.
> parser these clock when mutex device probe,
> enable and disable when mutex on/off
>
> Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 49 ++++++++++++++++++++++++++++------
> 1 file changed, 41 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
> index 60788c1..de618a1 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
> @@ -118,7 +118,7 @@ struct mtk_ddp_data {
>
> struct mtk_ddp {
> struct device *dev;
> - struct clk *clk;
> + struct clk *clk[3];
> void __iomem *regs;
> struct mtk_disp_mutex mutex[10];
> const struct mtk_ddp_data *data;
> @@ -257,14 +257,39 @@ int mtk_disp_mutex_prepare(struct mtk_disp_mutex *mutex)
> {
> struct mtk_ddp *ddp = container_of(mutex, struct mtk_ddp,
> mutex[mutex->id]);
> - return clk_prepare_enable(ddp->clk);
> + int ret;
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(ddp->clk); i++) {
> + if (IS_ERR(ddp->clk[i]))
> + continue;
> + ret = clk_prepare_enable(ddp->clk[i]);
> + if (ret) {
> + pr_err("failed to enable clock, err %d. i:%d\n",
> + ret, i);
> + goto err;
> + }
> + }
> +
> + return 0;
> +
> +err:
> + while (--i >= 0)
> + clk_disable_unprepare(ddp->clk[i]);
> + return ret;
> }
>
> void mtk_disp_mutex_unprepare(struct mtk_disp_mutex *mutex)
> {
> struct mtk_ddp *ddp = container_of(mutex, struct mtk_ddp,
> mutex[mutex->id]);
> - clk_disable_unprepare(ddp->clk);
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(ddp->clk); i++) {
> + if (IS_ERR(ddp->clk[i]))
> + continue;
> + clk_disable_unprepare(ddp->clk[i]);
> + }
> }
>
> void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
> @@ -415,11 +440,19 @@ static int mtk_ddp_probe(struct platform_device *pdev)
> ddp->data = of_device_get_match_data(dev);
>
> if (!ddp->data->no_clk) {
> - ddp->clk = devm_clk_get(dev, NULL);
> - if (IS_ERR(ddp->clk)) {
> - if (PTR_ERR(ddp->clk) != -EPROBE_DEFER)
> - dev_err(dev, "Failed to get clock\n");
> - return PTR_ERR(ddp->clk);
> + int ret;
> +
> + for (i = 0; i < ARRAY_SIZE(ddp->clk); i++) {
> + ddp->clk[i] = of_clk_get(dev->of_node, i);
> +
> + if (IS_ERR(ddp->clk[i])) {
> + ret = PTR_ERR(ddp->clk[i]);
> + if (ret != EPROBE_DEFER)
> + dev_err(dev, "Failed to get clock %d\n",
> + ret);
> +
> + return ret;
> + }
Use of_clk_bulk_get_all instead?
ddp->num_clks = of_clk_bulk_get_all(dev->of_node, &ddp->clks);
...
Then the calls above can be clk_bulk_enable/clk_bulk_disable using
num_clks and clks.
> }
> }
>
> --
> 1.8.1.1.dirty
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
next prev parent reply other threads:[~2020-12-15 13:40 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-12 4:11 [PATCH v2, 00/17] drm/mediatek: add support for mediatek SOC MT8192 Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 01/17] dt-bindings: mediatek: add description for postmask Yongqiang Niu
2020-12-15 14:49 ` Chun-Kuang Hu
2020-12-23 1:16 ` Yongqiang Niu
2020-12-15 16:20 ` Rob Herring
2020-12-12 4:11 ` [PATCH v2, 02/17] dt-bindings: mediatek: add CLK_MM_DISP_CONFIG control description for mt8192 display Yongqiang Niu
2020-12-16 15:17 ` Chun-Kuang Hu
2020-12-23 1:19 ` Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 03/17] dt-bindings: mediatek: add " Yongqiang Niu
2020-12-13 15:58 ` Chun-Kuang Hu
2020-12-15 16:23 ` Rob Herring
2020-12-12 4:11 ` [PATCH v2, 04/17] drm/mediatek: add component OVL_2L2 Yongqiang Niu
2020-12-13 1:15 ` Chun-Kuang Hu
2020-12-23 1:21 ` Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 05/17] drm/mediatek: add component POSTMASK Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 06/17] drm/mediatek: add component RDMA4 Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 07/17] drm/mediatek: add disp config and mm 26mhz clock into mutex device Yongqiang Niu
2020-12-15 13:37 ` Nicolas Boichat [this message]
2020-12-23 1:23 ` Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 08/17] drm/mediatek: enable OVL_LAYER_SMI_ID_EN for multi-layer usecase Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 09/17] drm/mediatek: check if fb is null Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 10/17] drm/mediatek: fix aal size config Yongqiang Niu
2020-12-16 15:10 ` Chun-Kuang Hu
2020-12-23 1:36 ` Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 11/17] drm/mediatek: fix dither " Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 12/17] drm/mediatek: fix gamma " Yongqiang Niu
2020-12-14 23:40 ` Chun-Kuang Hu
2020-12-23 1:37 ` Yongqiang Niu
2020-12-23 15:48 ` Chun-Kuang Hu
2020-12-12 4:11 ` [PATCH v2, 13/17] drm/mediatek: fix ccorr " Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 14/17] soc: mediatek: mmsys: Use function call for setting mmsys ovl mout register Yongqiang Niu
2020-12-15 13:42 ` Nicolas Boichat
2020-12-23 1:41 ` Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 15/17] soc: mediatek: mmsys: add mt8192 mmsys support Yongqiang Niu
2020-12-13 16:02 ` Chun-Kuang Hu
2020-12-14 0:39 ` Yongqiang Niu
2020-12-15 14:44 ` Chun-Kuang Hu
2020-12-12 4:11 ` [PATCH v2, 16/17] drm/mediatek: add support for mediatek SOC MT8192 Yongqiang Niu
2020-12-12 4:11 ` [PATCH v2, 17/17] arm64: dts: mt8192: add display node Yongqiang Niu
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='CANMq1KCbmW4kbY5rbuogr9JJD5c5=-qatFs-EaWbuAxSzWmnLQ@mail.gmail.com' \
--to=drinkcat@chromium.org \
--cc=airlied@linux.ie \
--cc=ck.hu@mediatek.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=yongqiang.niu@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;
as well as URLs for NNTP newsgroup(s).