mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
sh: Support rate rounding for SH7722 FRQCR clocks.
Now that the round_rate() op is supported, hook it up on SH7722 for the FRQCR (CPU, PCLK, etc.) clocks. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
f6991b0456
commit
fe04d7798f
1 changed files with 15 additions and 0 deletions
|
@ -387,9 +387,24 @@ static int sh7722_frqcr_set_rate(struct clk *clk, unsigned long rate,
|
|||
return err;
|
||||
}
|
||||
|
||||
static long sh7722_frqcr_round_rate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk->parent->rate;
|
||||
int div;
|
||||
|
||||
/* look for multiplier/divisor pair */
|
||||
div = sh7722_find_divisors(parent_rate, rate);
|
||||
if (div < 0)
|
||||
return clk->rate;
|
||||
|
||||
/* calculate new value of clock rate */
|
||||
return parent_rate * 2 / div;
|
||||
}
|
||||
|
||||
static struct clk_ops sh7722_frqcr_clk_ops = {
|
||||
.recalc = sh7722_frqcr_recalc,
|
||||
.set_rate = sh7722_frqcr_set_rate,
|
||||
.round_rate = sh7722_frqcr_round_rate,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue