All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@csie.org>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Maxime Ripard <mripard@kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 2/2] drm/sun4i: drc: Make sure we enforce the clock rate
Date: Tue, 7 Jan 2020 22:12:54 +0800	[thread overview]
Message-ID: <CAGb2v654ZSVKsKD2ndcXmbmdc57YtSMMBF1EaxY4+TPV5=Mz_A@mail.gmail.com> (raw)
In-Reply-To: <20191219092000.949052-2-maxime@cerno.tech>

On Thu, Dec 19, 2019 at 5:20 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
> The DRC needs to run at 300MHz to be functional. This was done so far
> using assigned-clocks in the device tree, but that is easy to forget, and
> dosen't provide any other guarantee than the rate is going to be roughly
> the one requested at probe time.
>
> Therefore it's pretty fragile, so let's just use the exclusive clock API to
> enforce it.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/gpu/drm/sun4i/sun6i_drc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/sun4i/sun6i_drc.c b/drivers/gpu/drm/sun4i/sun6i_drc.c
> index f7ab72244796..ddb52da90103 100644
> --- a/drivers/gpu/drm/sun4i/sun6i_drc.c
> +++ b/drivers/gpu/drm/sun4i/sun6i_drc.c
> @@ -57,6 +57,7 @@ static int sun6i_drc_bind(struct device *dev, struct device *master,
>                 goto err_disable_bus_clk;
>         }
>         clk_prepare_enable(drc->mod_clk);
> +       clk_set_rate_exclusive(drc->mod_clk, 300000000);

I wonder what would happen if this fails...
>
>         return 0;
>
> @@ -72,6 +73,7 @@ static void sun6i_drc_unbind(struct device *dev, struct device *master,
>  {
>         struct sun6i_drc *drc = dev_get_drvdata(dev);
>
> +       clk_rate_exclusive_put(drc->mod_clk);

and we try to do the put regardless...

ChenYu

>         clk_disable_unprepare(drc->mod_clk);
>         clk_disable_unprepare(drc->bus_clk);
>         reset_control_assert(drc->reset);
> --
> 2.23.0
>

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

WARNING: multiple messages have this Message-ID (diff)
From: Chen-Yu Tsai <wens@csie.org>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 2/2] drm/sun4i: drc: Make sure we enforce the clock rate
Date: Tue, 7 Jan 2020 22:12:54 +0800	[thread overview]
Message-ID: <CAGb2v654ZSVKsKD2ndcXmbmdc57YtSMMBF1EaxY4+TPV5=Mz_A@mail.gmail.com> (raw)
In-Reply-To: <20191219092000.949052-2-maxime@cerno.tech>

On Thu, Dec 19, 2019 at 5:20 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
> The DRC needs to run at 300MHz to be functional. This was done so far
> using assigned-clocks in the device tree, but that is easy to forget, and
> dosen't provide any other guarantee than the rate is going to be roughly
> the one requested at probe time.
>
> Therefore it's pretty fragile, so let's just use the exclusive clock API to
> enforce it.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  drivers/gpu/drm/sun4i/sun6i_drc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/sun4i/sun6i_drc.c b/drivers/gpu/drm/sun4i/sun6i_drc.c
> index f7ab72244796..ddb52da90103 100644
> --- a/drivers/gpu/drm/sun4i/sun6i_drc.c
> +++ b/drivers/gpu/drm/sun4i/sun6i_drc.c
> @@ -57,6 +57,7 @@ static int sun6i_drc_bind(struct device *dev, struct device *master,
>                 goto err_disable_bus_clk;
>         }
>         clk_prepare_enable(drc->mod_clk);
> +       clk_set_rate_exclusive(drc->mod_clk, 300000000);

I wonder what would happen if this fails...
>
>         return 0;
>
> @@ -72,6 +73,7 @@ static void sun6i_drc_unbind(struct device *dev, struct device *master,
>  {
>         struct sun6i_drc *drc = dev_get_drvdata(dev);
>
> +       clk_rate_exclusive_put(drc->mod_clk);

and we try to do the put regardless...

ChenYu

>         clk_disable_unprepare(drc->mod_clk);
>         clk_disable_unprepare(drc->bus_clk);
>         reset_control_assert(drc->reset);
> --
> 2.23.0
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-01-07 14:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19  9:19 [PATCH 1/2] drm/sun4i: backend: Make sure we enforce the clock rate Maxime Ripard
2019-12-19  9:19 ` Maxime Ripard
2019-12-19  9:20 ` [PATCH 2/2] drm/sun4i: drc: " Maxime Ripard
2019-12-19  9:20   ` Maxime Ripard
2020-01-07 13:40   ` Chen-Yu Tsai
2020-01-07 13:40     ` Chen-Yu Tsai
2020-01-07 14:12   ` Chen-Yu Tsai [this message]
2020-01-07 14:12     ` Chen-Yu Tsai
2020-01-07 13:37 ` [PATCH 1/2] drm/sun4i: backend: " Chen-Yu Tsai
2020-01-07 13:37   ` Chen-Yu Tsai

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='CAGb2v654ZSVKsKD2ndcXmbmdc57YtSMMBF1EaxY4+TPV5=Mz_A@mail.gmail.com' \
    --to=wens@csie.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maxime@cerno.tech \
    --cc=mripard@kernel.org \
    --cc=paul.kocialkowski@bootlin.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.