Power management on mobile
So this is write up on the various power management tasks on mobile and what changes I plan to propose in powerdevil in upcoming days. From last two weeks I had been working on the various power management related tasks in powerdevil and have come up with several changes in powerdevil as well as the other repositories.
Default power key mode
In 57ba878c we changed the profile generator to use Suspend to RAM by default. This change while worked fine for one device, it did not work out for other devices. Case study of 3 different devices,
- Pinephone, currently is preferred to use the suspend using crust-firmware
- Librem 5, is preferred to use the runtime power management rather than full suspend
- Halium, is preferred to use the runtime power management
For all of 3 common bit of action is to turn the screen off
So changes I made are,
-
Change profile generator to switch turnoff mode when power key is pressed, and then suspend on timeout -
On devices which explicitly needs the suspend mode, they will ship a config using XDG_CONFIG_DIRS
Locking screen when it is turned off
Devices which uses the s2ram mode have a advantage of this working ootb as there's option in the lockscreen config to Autolock on resume, so when user turns screen on the screen lock kicks-in and screen is never in the unlocked state, however devices where powerdevil needs to be configured to just turn screen off, they are not so lucky.
-
Patch to add a action to turn screen off and lock it
Turn the screen off when it is locked using power key
kscreenlocker@98da04c6 was added to fix the issue of not being able to turn screen off when screen is already locked. But it is not working as expected. I need help to figure out what is wrong here.
-
Fix issue of power key not working when screen is locked (need help)
Periodic/scheduled wake up
There is issue that using periodic wakeup, something turns screen on which I don't want to happen. I have tried multiple bits and pieces,
- I have completely commented out code in https://invent.kde.org/plasma/powerdevil/-/blob/master/daemon/actions/bundled/dimdisplay.cpp#L51 as this seems to be only thing actually messing with brightness as far as I can tell.
- Disabled the systemd backlight restore service by passing kernel parameters
But still something is restoring backlight on the scheduled wakeup. Generally speaking this should be case only when the device needs to show notifications (call, alarm, SMS, IM message) or device is woke up using explicit user action (power key). For rest display should be off.
I need help in tracking down what could be thing which is responsible for turning screen on and preventing it. I am 90% certain that it is not drivers as this happens on my laptop as well.
-
Upstream wake-up daemon -
Fix issue with "silent wakeup"
AC profile v/s battery profile
On mobile phone devices difference between AC profile v/s on-battery profile should be pretty much none. From configuration point of view it is bit awkward to write both profiles with exactly identical configuration options. It should probably be reduced into single "profile" config rather than being two different profile thing? Maybe introduce single mobile profile and completely ignore AC/On-battery concept when on mobile device?
Touchscreen behavior
On mobile devices where runtime power management is used, we simply switch off the display using dpms. But on some devices touchscreen is independently powered from display hardware and does not have a runtime power management. This results in a bug where touch-screen would wake the device up
-
kwin_wayland should suspend touchscreen device when dpms is toggled (?)(help wanted)