From: Neil Armstrong <narmstrong@baylibre.com>
To: Kevin Hilman <khilman@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-amlogic@lists.infradead.org
Subject: Re: [PATCH/RFT] soc: amlogic: meson-gx-pwrc-vpu: switch to clk_bulk
Date: Mon, 12 Aug 2019 09:18:34 +0200 [thread overview]
Message-ID: <fee37e05-183b-c764-4749-b71faa59b1eb@baylibre.com> (raw)
In-Reply-To: <20190809230904.28747-1-khilman@baylibre.com>
On 10/08/2019 01:09, Kevin Hilman wrote:
> Instead of expecting a specific number of clocks with specific clock
> names, switch to using the bulk clock API.
>
> This is a first step towards generalizing this driver to work with
> other domains.
>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Signed-off-by: Kevin Hilman <khilman@baylibre.com>
> ---
> Boot tested on meson-g12a-sei510 and verified that framebuffer console
> comes up and still works.
>
> drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 41 ++++++-------------------
> 1 file changed, 10 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> index 511b6856225d..5f6519f43a31 100644
> --- a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> +++ b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> @@ -34,8 +34,8 @@ struct meson_gx_pwrc_vpu {
> struct regmap *regmap_ao;
> struct regmap *regmap_hhi;
> struct reset_control *rstc;
> - struct clk *vpu_clk;
> - struct clk *vapb_clk;
> + struct clk_bulk_data *clks;
> + int num_clks;
> };
>
> static inline
> @@ -76,8 +76,7 @@ static int meson_gx_pwrc_vpu_power_off(struct generic_pm_domain *genpd)
>
> msleep(20);
>
> - clk_disable_unprepare(pd->vpu_clk);
> - clk_disable_unprepare(pd->vapb_clk);
> + clk_bulk_disable_unprepare(pd->num_clks, pd->clks);
>
> return 0;
> }
> @@ -119,25 +118,14 @@ static int meson_g12a_pwrc_vpu_power_off(struct generic_pm_domain *genpd)
>
> msleep(20);
>
> - clk_disable_unprepare(pd->vpu_clk);
> - clk_disable_unprepare(pd->vapb_clk);
> + clk_bulk_disable_unprepare(pd->num_clks, pd->clks);
>
> return 0;
> }
>
> static int meson_gx_pwrc_vpu_setup_clk(struct meson_gx_pwrc_vpu *pd)
> {
> - int ret;
> -
> - ret = clk_prepare_enable(pd->vpu_clk);
> - if (ret)
> - return ret;
> -
> - ret = clk_prepare_enable(pd->vapb_clk);
> - if (ret)
> - clk_disable_unprepare(pd->vpu_clk);
> -
> - return ret;
> + return clk_bulk_prepare_enable(pd->num_clks, pd->clks);
> }
>
> static int meson_gx_pwrc_vpu_power_on(struct generic_pm_domain *genpd)
> @@ -273,8 +261,6 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
> struct regmap *regmap_ao, *regmap_hhi;
> struct meson_gx_pwrc_vpu *vpu_pd;
> struct reset_control *rstc;
> - struct clk *vpu_clk;
> - struct clk *vapb_clk;
> bool powered_off;
> int ret;
>
> @@ -310,23 +296,16 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
> return PTR_ERR(rstc);
> }
>
> - vpu_clk = devm_clk_get(&pdev->dev, "vpu");
> - if (IS_ERR(vpu_clk)) {
> - dev_err(&pdev->dev, "vpu clock request failed\n");
> - return PTR_ERR(vpu_clk);
> - }
> -
> - vapb_clk = devm_clk_get(&pdev->dev, "vapb");
> - if (IS_ERR(vapb_clk)) {
> - dev_err(&pdev->dev, "vapb clock request failed\n");
> - return PTR_ERR(vapb_clk);
> + ret = devm_clk_bulk_get_all(&pdev->dev, &vpu_pd->clks);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "bulk clock request failed\n");
> + return ret;
> }
> + vpu_pd->num_clks = ret;
>
> vpu_pd->regmap_ao = regmap_ao;
> vpu_pd->regmap_hhi = regmap_hhi;
> vpu_pd->rstc = rstc;
> - vpu_pd->vpu_clk = vpu_clk;
> - vpu_pd->vapb_clk = vapb_clk;
>
> platform_set_drvdata(pdev, vpu_pd);
>
>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2019-08-12 7:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-09 23:09 Kevin Hilman
2019-08-12 7:18 ` Neil Armstrong [this message]
2019-08-13 22:47 ` Kevin Hilman
2019-08-14 7:45 ` Neil Armstrong
2019-08-14 14:12 ` Kevin Hilman
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=fee37e05-183b-c764-4749-b71faa59b1eb@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=martin.blumenstingl@googlemail.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
all inboxes | Powered by JetHome®