mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +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. Change-Id: I482ee5d2ce20f114041347110c63d140d47e7da5 Signed-off-by: Rob Herring <rob.herring@calxeda.com>
This commit is contained in:
parent
1b912a8c40
commit
4a3cf85432
1 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,7 @@ struct clock_data {
|
|||
u64 epoch_ns;
|
||||
u32 epoch_cyc;
|
||||
u32 epoch_cyc_copy;
|
||||
unsigned long rate;
|
||||
u32 mult;
|
||||
u32 shift;
|
||||
bool suspended;
|
||||
|
@ -111,11 +112,14 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
|
|||
u64 res, wrap;
|
||||
char r_unit;
|
||||
|
||||
if (cd.rate > rate)
|
||||
return;
|
||||
|
||||
BUG_ON(bits > 32);
|
||||
WARN_ON(!irqs_disabled());
|
||||
WARN_ON(read_sched_clock != jiffy_sched_clock_read);
|
||||
read_sched_clock = read;
|
||||
sched_clock_mask = (1 << bits) - 1;
|
||||
cd.rate = rate;
|
||||
|
||||
/* calculate the mult/shift to convert counter ticks to ns. */
|
||||
clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 0);
|
||||
|
|
Loading…
Reference in a new issue