alarmtimer: Minimize wakeup time
Alarmtimer sets its wakeup timeout to 2s no matter the actual time to nearest timer expiration. This can cause device to be awake for more than needed. To fix this set wakeup timeout to min + 1 ms for safety margin. Tests revealed that average timer expiration is 1150ms in the future which suggests there is a room avilable to minimize wakeup times. Before this change device would enter sleep not earlier than 2s after alarmtimer suspend error (-EBUSY). With this change average suspend after alarmtimer suspend error time went down to 1.5s with a minimum of 0.248ms (after filtering results higher than 2.6s). This should lead to noticeable power savings as Android uses alarmtimer quite frequently. Signed-off-by: Andrzej Perczak <linux@andrzejperczak.com> Signed-off-by: Zlatan Radovanovic <zlatan.radovanovic@fet.ba>
This commit is contained in:
parent
5afb8f94f1
commit
5d3ff5040f
1 changed files with 1 additions and 1 deletions
|
@ -288,7 +288,7 @@ static int alarmtimer_suspend(struct device *dev)
|
|||
return 0;
|
||||
|
||||
if (ktime_to_ns(min) < 2 * NSEC_PER_SEC) {
|
||||
pm_wakeup_event(dev, 2 * MSEC_PER_SEC);
|
||||
pm_wakeup_event(dev, ktime_to_ms(min) + 1);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue