Re: [PATCH V2 3/3] cpufreq: Tegra: implement intermediate frequency callbacks
From: Stephen Warren
Date: Fri May 16 2014 - 15:39:37 EST
On 05/16/2014 03:07 AM, Viresh Kumar wrote:
> Tegra had always been switching to intermediate frequency (pll_p_clk) since
> ever. CPUFreq core has better support for handling notifications for these
> frequencies and so we can adapt Tegra's driver to it.
You need to squash in the patch below in order for this series to work.
Once that's done,
Tested-by: Stephen Warren <swarren@xxxxxxxxxx>
> Signed-off-by: Stephen Warren <swarren@xxxxxxxxxx>
>
> diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c
> index 10b29ec99bdc..c04fec02ac6a 100644
> --- a/drivers/cpufreq/tegra-cpufreq.c
> +++ b/drivers/cpufreq/tegra-cpufreq.c
> @@ -49,13 +49,22 @@ static struct clk *emc_clk;
> static unsigned int
> tegra_get_intermediate(struct cpufreq_policy *policy, unsigned int index)
> {
> - return clk_get_rate(pll_p_clk);
> + return clk_get_rate(pll_p_clk) / 1000; /* kHz */
> }
>
> static int
> tegra_target_intermediate(struct cpufreq_policy *policy, unsigned int frequency)
> {
> + WARN_ON(frequency != clk_get_rate(pll_p_clk) / 1000);
> +
> + /*
> + * Take an extra reference to the main pll so it doesn't turn
> + * off when we move the cpu off of it
> + */
> + clk_prepare_enable(pll_x_clk);
> +
> return clk_set_parent(cpu_clk, pll_p_clk);
> + /* FIXME: if error, remove pll_x reference */
> }
>
> static int tegra_target(struct cpufreq_policy *policy, unsigned int index)
> @@ -74,16 +83,10 @@ static int tegra_target(struct cpufreq_policy *policy, unsigned int index)
> else
> clk_set_rate(emc_clk, 100000000); /* emc 50Mhz */
>
> - /*
> - * Take an extra reference to the main pll so it doesn't turn
> - * off when we move the cpu off of it
> - */
> - clk_prepare_enable(pll_x_clk);
> -
> if (rate == clk_get_rate(pll_p_clk))
> goto out;
>
> - ret = clk_set_rate(pll_x_clk, rate);
> + ret = clk_set_rate(pll_x_clk, rate * 1000);
> if (ret) {
> pr_err("Failed to change pll_x to %lu\n", rate);
> goto out;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/