History

sh: clkfwk: add clk_rate_mult_range_round()

This provides a clk_rate_mult_range_round() helper for use by some of the CPG PLL ranged multipliers, following the same approach as used by the div ranges.

Kuninori Morimoto committed 15 years ago

Commit dd2c0ca1 parent 1a67a572 files · +23 −0Browse files

Unified · Split

2 files
  1. drivers/sh/clk/core.c +20 −0
  2. include/linux/sh_clk.h +3 −0
drivers/sh/clk/core.c+20−0
@@ -173,6 +173,26 @@ long clk_rate_div_range_round(struct clk *clk, unsigned int div_min, · 172 unmodified lines
173 return clk_rate_round_helper(&div_range_round);173 return clk_rate_round_helper(&div_range_round);
174}174}
175 175
176static long clk_rate_mult_range_iter(unsigned int pos,
177 struct clk_rate_round_data *rounder)
178{
179 return clk_get_rate(rounder->arg) * pos;
180}
181
182long clk_rate_mult_range_round(struct clk *clk, unsigned int mult_min,
183 unsigned int mult_max, unsigned long rate)
184{
185 struct clk_rate_round_data mult_range_round = {
186 .min = mult_min,
187 .max = mult_max,
188 .func = clk_rate_mult_range_iter,
189 .arg = clk_get_parent(clk),
190 .rate = rate,
191 };
192
193 return clk_rate_round_helper(&mult_range_round);
194}
195
176int clk_rate_table_find(struct clk *clk,196int clk_rate_table_find(struct clk *clk,
177 struct cpufreq_frequency_table *freq_table,197 struct cpufreq_frequency_table *freq_table,
178 unsigned long rate)198 unsigned long rate)
include/linux/sh_clk.h+3−0
@@ -94,6 +94,9 @@ int clk_rate_table_find(struct clk *clk, · 93 unmodified lines
94long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,94long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
95 unsigned int div_max, unsigned long rate);95 unsigned int div_max, unsigned long rate);
96 96
97long clk_rate_mult_range_round(struct clk *clk, unsigned int mult_min,
98 unsigned int mult_max, unsigned long rate);
99
97long clk_round_parent(struct clk *clk, unsigned long target,100long clk_round_parent(struct clk *clk, unsigned long target,
98 unsigned long *best_freq, unsigned long *parent_freq,101 unsigned long *best_freq, unsigned long *parent_freq,
99 unsigned int div_min, unsigned int div_max);102 unsigned int div_min, unsigned int div_max);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t