linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Mike Turquette <mturquette@linaro.org>,
	Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-tegra@vger.kernel.org,
	Mikko Perttunen <mikko.perttunen@kapsi.fi>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Prashant Gaikwad <pgaikwad@nvidia.com>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 3/8] clk: tegra: Have EMC clock implement determine_rate()
Date: Tue, 24 Mar 2015 11:38:35 +0100	[thread overview]
Message-ID: <20150324103834.GF18115@ulmo.nvidia.com> (raw)
In-Reply-To: <1426584991-11110-4-git-send-email-tomeu.vizoso@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 2426 bytes --]

On Tue, Mar 17, 2015 at 10:36:13AM +0100, Tomeu Vizoso wrote:
> instead of round_rate, so we can take rate constraints into account when
> choosing the best rate.
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> ---
>  drivers/clk/tegra/clk-emc.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)

Mike, Stephen,

I'd like to take this into the Tegra tree because other patches depend
on this (albeit as far as I can tell it's only a runtime dependency).
This patch also depends on the EMC frequency scaling patches (that Mike
Acked) that I have in a separate branch. Alternatively I can provide a
stable branch with my current stash of patches that you can pull into
the clk tree.

Thanks,
Thierry

> diff --git a/drivers/clk/tegra/clk-emc.c b/drivers/clk/tegra/clk-emc.c
> index 704fff7..615da43 100644
> --- a/drivers/clk/tegra/clk-emc.c
> +++ b/drivers/clk/tegra/clk-emc.c
> @@ -117,8 +117,11 @@ static unsigned long emc_recalc_rate(struct clk_hw *hw,
>   * safer since things have EMC rate floors. Also don't touch parent_rate
>   * since we don't want the CCF to play with our parent clocks.
>   */
> -static long emc_round_rate(struct clk_hw *hw, unsigned long rate,
> -		    unsigned long *parent_rate)
> +static long emc_determine_rate(struct clk_hw *hw, unsigned long rate,
> +			       unsigned long min_rate,
> +			       unsigned long max_rate,
> +			       unsigned long *best_parent_rate,
> +			       struct clk_hw **best_parent_hw)
>  {
>  	struct tegra_clk_emc *tegra;
>  	u8 ram_code = tegra_read_ram_code();
> @@ -133,7 +136,15 @@ static long emc_round_rate(struct clk_hw *hw, unsigned long rate,
>  
>                  timing = tegra->timings + i;
>  
> -                if (timing->rate >= rate)
> +		if (timing->rate > max_rate) {
> +			i = min(i, 1);
> +			return tegra->timings[i - 1].rate;
> +		}
> +
> +		if (timing->rate < min_rate)
> +			continue;
> +
> +		if (timing->rate >= rate)
>                          return timing->rate;
>          }
>  
> @@ -452,7 +463,7 @@ static int load_timings_from_dt(struct tegra_clk_emc *tegra,
>  
>  static const struct clk_ops tegra_clk_emc_ops = {
>  	.recalc_rate = emc_recalc_rate,
> -	.round_rate = emc_round_rate,
> +	.determine_rate = emc_determine_rate,
>  	.set_rate = emc_set_rate,
>  	.get_parent = emc_get_parent,
>  };
> -- 
> 2.1.0
> 

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-03-24 10:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17  9:36 [PATCH v6 0/8] Add support for Tegra Activity Monitor Tomeu Vizoso
2015-03-17  9:36 ` [PATCH v6 2/8] PM / devfreq: tegra: Update to v5 of the submitted patches Tomeu Vizoso
     [not found] ` <1426584991-11110-1-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-17  9:36   ` [PATCH v6 1/8] of: Add binding for NVIDIA Tegra ACTMON node Tomeu Vizoso
2015-03-17  9:36   ` [PATCH v6 3/8] clk: tegra: Have EMC clock implement determine_rate() Tomeu Vizoso
2015-03-24 10:38     ` Thierry Reding [this message]
2015-04-11  1:48       ` Michael Turquette
2015-03-17  9:36   ` [PATCH v6 5/8] PM / devfreq: tegra: remove operating-points Tomeu Vizoso
2015-03-17  9:36 ` [PATCH v6 4/8] PM / devfreq: tegra: Use clock rate constraints Tomeu Vizoso
2015-03-17  9:36 ` [PATCH v6 6/8] PM / devfreq: tegra: Set drvdata before enabling the irq Tomeu Vizoso
2015-03-17  9:36 ` [PATCH v6 7/8] PM / devfreq: tegra: Enable interrupts after resuming the devfreq monitor Tomeu Vizoso
2015-03-17  9:36 ` [PATCH v6 8/8] ARM: tegra: Add Tegra124 ACTMON support Tomeu Vizoso
     [not found]   ` <1426584991-11110-9-git-send-email-tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2015-03-24 10:32     ` Thierry Reding

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=20150324103834.GF18115@ulmo.nvidia.com \
    --to=thierry.reding@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mikko.perttunen@kapsi.fi \
    --cc=mturquette@linaro.org \
    --cc=pdeschrijver@nvidia.com \
    --cc=pgaikwad@nvidia.com \
    --cc=sboyd@codeaurora.org \
    --cc=swarren@wwwdotorg.org \
    --cc=tomeu.vizoso@collabora.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).