mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-07 04:09:21 +00:00
ARM: sched_clock: allow changing to higher frequency counter
Allow multiple calls to setup_sched_clock and switch to the new counter if it is higher frequency. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
This commit is contained in:
parent
3d5a965823
commit
c115739da8
1 changed files with 5 additions and 1 deletions
|
@ -20,6 +20,7 @@ struct clock_data {
|
||||||
u64 epoch_ns;
|
u64 epoch_ns;
|
||||||
u32 epoch_cyc;
|
u32 epoch_cyc;
|
||||||
u32 epoch_cyc_copy;
|
u32 epoch_cyc_copy;
|
||||||
|
unsigned long rate;
|
||||||
u32 mult;
|
u32 mult;
|
||||||
u32 shift;
|
u32 shift;
|
||||||
bool suspended;
|
bool suspended;
|
||||||
|
@ -113,11 +114,14 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
|
||||||
u64 res, wrap;
|
u64 res, wrap;
|
||||||
char r_unit;
|
char r_unit;
|
||||||
|
|
||||||
|
if (cd.rate > rate)
|
||||||
|
return;
|
||||||
|
|
||||||
BUG_ON(bits > 32);
|
BUG_ON(bits > 32);
|
||||||
WARN_ON(!irqs_disabled());
|
WARN_ON(!irqs_disabled());
|
||||||
WARN_ON(read_sched_clock != jiffy_sched_clock_read);
|
|
||||||
read_sched_clock = read;
|
read_sched_clock = read;
|
||||||
sched_clock_mask = (1 << bits) - 1;
|
sched_clock_mask = (1 << bits) - 1;
|
||||||
|
cd.rate = rate;
|
||||||
|
|
||||||
/* calculate the mult/shift to convert counter ticks to ns. */
|
/* calculate the mult/shift to convert counter ticks to ns. */
|
||||||
clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 0);
|
clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 0);
|
||||||
|
|
Loading…
Reference in a new issue