From e6259ad8ab55121946b6889f18c7d964407351a1 Mon Sep 17 00:00:00 2001
From: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
Date: Thu, 16 Mar 2023 00:14:12 +0100
Subject: [PATCH] defaults: librem5-pm: Enable simple_ondemand governor for
 DRAM

I did a simple test with a USB power meter to see the power draw over
5 minutes since running gnome-software in service mode using both
`powersave` and `simple_ondemand` governor with screen off.

With `powersave`, packagekitd was keeping one CPU busy at 100% for
slightly above 4 minutes. At the end of the 5 minutes period the power
meter reading was 125mWh.

With `simple_ondemand`, packagekitd was done after slightly above one
minute already, so the phone was idling rest of the time. Power meter
reading was 109mWh (it was at about 45mWh at the moment when packagekitd
finished its work).

I've also recorded two minutes of idling (nothing but kgx running):
the result was the same for both governors - 28mWh; and two minutes of
keeping all CPU cores busy with compressing random data: 61mWh for
`powersave` and 99mWh for `simple_ondemand`.

This is consistent with my anecdata - `simple_ondemand` appears to save
battery and makes the phone cooler. It also makes the UX much better when
using the phone over ssh. The one case where it makes things
worse - a rogue process constantly consuming 100% CPU in
the background - is already a pathological case with poor results on both
governors. When the process actually does some sensible and finite work,
it's going to finish it *much faster* with simple_ondemand, saving plenty
of power. Therefore, I'm going to merge this.

To go back to previous behavior, users can always use this udev rule:
```
SUBSYSTEM=="devfreq", TEST=="governor", ATTR{governor}="powersave"
```
---
 debian/librem5-base-defaults.librem5-pm.udev | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/librem5-base-defaults.librem5-pm.udev b/debian/librem5-base-defaults.librem5-pm.udev
index cad668e..06ac29f 100644
--- a/debian/librem5-base-defaults.librem5-pm.udev
+++ b/debian/librem5-base-defaults.librem5-pm.udev
@@ -1,7 +1,7 @@
 ACTION!="add", GOTO="librem5_pm_end"
 
-# Enable the powersave governor for devfreq. other requirements come from interconnect
-SUBSYSTEM=="devfreq", TEST=="governor", ATTR{governor}="powersave"
+# Enable the simple_ondemand governor for devfreq. other requirements come from interconnect
+SUBSYSTEM=="devfreq", TEST=="governor", ATTR{governor}="simple_ondemand"
 
 # Enable power management for external USB bus
 DEVPATH=="/devices/platform/soc@0/38100000.usb", TEST=="power/control", ATTR{power/control}="auto"
-- 
GitLab