Re: [PATCH] cpufreq: dbx500: Round to closest available freq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 10, 2013 at 3:06 PM, Ulf Hansson <ulf.hansson@xxxxxxxxxxxxxx> wrote:

> From: Mats Fagerstrom <mats.fagerstrom@xxxxxxxxxxxxxx>
>
> When reading the cpu speed, round it to the closest available
> frequency from the table.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> Signed-off-by: Mats Fagerstrom <mats.fagerstrom@xxxxxxxxxxxxxx>

(...)
> +       /* The value is rounded to closest frequency in the defined table. */
> +       while (freq_table[i + 1].frequency != CPUFREQ_TABLE_END) {
> +               if (freq < freq_table[i].frequency +
> +                  (freq_table[i + 1].frequency - freq_table[i].frequency) / 2)
>                         return freq_table[i].frequency;

Oh that works, clever.

Acked-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux