diff options
author | John Stultz <john.stultz@linaro.org> | 2013-01-21 20:00:11 -0500 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2013-03-22 19:19:59 -0400 |
commit | 90adda98b89aaf68b06014ecf805b6c477daa19b (patch) | |
tree | c50d47c4c344774205569ce42e13d16a8174b02e /kernel/hrtimer.c | |
parent | 1ff3c9677bff7e468e0c487d0ffefe4e901d33f4 (diff) |
hrtimer: Add hrtimer support for CLOCK_TAI
Add hrtimer support for CLOCK_TAI, as well as posix timer interfaces.
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r-- | kernel/hrtimer.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index cc47812d3feb..258720741d3e 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -83,6 +83,12 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = | |||
83 | .get_time = &ktime_get_boottime, | 83 | .get_time = &ktime_get_boottime, |
84 | .resolution = KTIME_LOW_RES, | 84 | .resolution = KTIME_LOW_RES, |
85 | }, | 85 | }, |
86 | { | ||
87 | .index = HRTIMER_BASE_TAI, | ||
88 | .clockid = CLOCK_TAI, | ||
89 | .get_time = &ktime_get_clocktai, | ||
90 | .resolution = KTIME_LOW_RES, | ||
91 | }, | ||
86 | } | 92 | } |
87 | }; | 93 | }; |
88 | 94 | ||
@@ -90,6 +96,7 @@ static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = { | |||
90 | [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME, | 96 | [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME, |
91 | [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC, | 97 | [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC, |
92 | [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME, | 98 | [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME, |
99 | [CLOCK_TAI] = HRTIMER_BASE_TAI, | ||
93 | }; | 100 | }; |
94 | 101 | ||
95 | static inline int hrtimer_clockid_to_base(clockid_t clock_id) | 102 | static inline int hrtimer_clockid_to_base(clockid_t clock_id) |
@@ -106,8 +113,10 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) | |||
106 | { | 113 | { |
107 | ktime_t xtim, mono, boot; | 114 | ktime_t xtim, mono, boot; |
108 | struct timespec xts, tom, slp; | 115 | struct timespec xts, tom, slp; |
116 | s32 tai_offset; | ||
109 | 117 | ||
110 | get_xtime_and_monotonic_and_sleep_offset(&xts, &tom, &slp); | 118 | get_xtime_and_monotonic_and_sleep_offset(&xts, &tom, &slp); |
119 | tai_offset = timekeeping_get_tai_offset(); | ||
111 | 120 | ||
112 | xtim = timespec_to_ktime(xts); | 121 | xtim = timespec_to_ktime(xts); |
113 | mono = ktime_add(xtim, timespec_to_ktime(tom)); | 122 | mono = ktime_add(xtim, timespec_to_ktime(tom)); |
@@ -115,6 +124,8 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) | |||
115 | base->clock_base[HRTIMER_BASE_REALTIME].softirq_time = xtim; | 124 | base->clock_base[HRTIMER_BASE_REALTIME].softirq_time = xtim; |
116 | base->clock_base[HRTIMER_BASE_MONOTONIC].softirq_time = mono; | 125 | base->clock_base[HRTIMER_BASE_MONOTONIC].softirq_time = mono; |
117 | base->clock_base[HRTIMER_BASE_BOOTTIME].softirq_time = boot; | 126 | base->clock_base[HRTIMER_BASE_BOOTTIME].softirq_time = boot; |
127 | base->clock_base[HRTIMER_BASE_TAI].softirq_time = | ||
128 | ktime_add(xtim, ktime_set(tai_offset, 0)); | ||
118 | } | 129 | } |
119 | 130 | ||
120 | /* | 131 | /* |
@@ -651,8 +662,9 @@ static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base) | |||
651 | { | 662 | { |
652 | ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset; | 663 | ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset; |
653 | ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME].offset; | 664 | ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME].offset; |
665 | ktime_t *offs_tai = &base->clock_base[HRTIMER_BASE_TAI].offset; | ||
654 | 666 | ||
655 | return ktime_get_update_offsets(offs_real, offs_boot); | 667 | return ktime_get_update_offsets(offs_real, offs_boot, offs_tai); |
656 | } | 668 | } |
657 | 669 | ||
658 | /* | 670 | /* |