power: wakeup_reason: fix suspend time reporting
authorAmit Pundir <amit.pundir@linaro.org>
Mon, 13 Apr 2015 21:08:20 +0000 (02:38 +0530)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:53:41 +0000 (13:53 -0800)
commit45e6e572720eed8a105adf59f5c236fd64301b2b
treefa47b6eb8407ec191dcaa3e98f7d1cfe407abf4f
parentb100279a6d50ea3d8b23a7c0ee65b4080d6ae0d8
power: wakeup_reason: fix suspend time reporting

Suspend time reporting Change-Id: I2cb9a9408a5fd12166aaec11b935a0fd6a408c63
(Power: Report suspend times from last_suspend_time), is broken on 3.16+
kernels because get_xtime_and_monotonic_and_sleep_offset() hrtimer helper
routine is removed from kernel timekeeping.

The replacement helper routines ktime_get_update_offsets_{tick,now}()
are private to core kernel timekeeping so we can't use them, hence using
ktime_get() and ktime_get_boottime() instead and sampling the time twice.

Idea is to use Monotonic boottime offset to calculate total time spent
in last suspend state and CLOCK_MONOTONIC to calculate time spent in
last suspend-resume process.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
kernel/power/wakeup_reason.c