PINE64
Pilotlight, a way to save power during long audio playback - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+--- Thread: Pilotlight, a way to save power during long audio playback (/showthread.php?tid=19608)



Pilotlight, a way to save power during long audio playback - biketool - 01-04-2025

keeping the pilotlight lit, normally when listening to an audiobook or music playlist the Pinephone locks it's screen after a minute and suspends the OS after a few more minutes as set by the user.
This suspend action makes it possible to carry a pinephone all day ready ro receive incoming telephone calls and still have battery if the phone is not used for more than 45min to an hour a day.
Every time the system suspends the audio stream is killed, even after wakeup most of the time the audio playback app needs to be killed and restarted for it to output audio.
I want a way to keep a tightly controlled and minimized audio app running while using minimal CPU waste power, and without the bloat of the system processes.
I only want the pilotlight lit, not the whole furnace.

I have several ideas that might be able to be implemented with only scripts, but I will need a LOT of help making this work if I run into bugs.
The idea works like this:
1- when an audio app is running we get the audio pause/skip controls on the lockscreen, there are already processes which load when audio is started
2- when audio mode is detected a special suspend mode is activated or enabled
   A- an exception is made to the suspend mode script, perhaps an alternate suspend mode
       a- the process running the audio is moved to one awake cpu core and the lowest voltage and mhz possible is engaged, only enough to allow for the audio stream to continue
       b- if possible audio is buffered into hardware audio acceleration chip and even the audio app CPU is suspended until 10-20 sec before the buffer runs out,
       c- buffer refills, suspend special audio process, repeating
    B- when system is taken out of suspend the audio app and special settings for single CPU are ended

An alternative would be to add an audio buffer playback system to the programs running on the modem module, perhaps a virtual serial audio device fed over the data connection line.  The modem module has its own Android based no-GUI OS, memory, and CPU, it is always awake and waiting for incoming calls and texts, which results in it sending a de-suspend command to the Pinephone, as running its own OS processes.

Currently unless there is USB power in the Pinephone pro can get at most around two hours of audio playback even though the the screen is dark and locked as all processes continue to run at full power.


RE: Pilotlight, a way to save power during long audio playback - biketool - 01-09-2025

This article goes into how Maemo Linux (Nokia N900 and N9 Linux phones) vs android do power management.
https://felipec.wordpress.com/2012/01/04/android-vs-maemo-power-managment-static-vs-dynamic/
we have an excellent operating system to crib hints from in Maemo, a fully Debian based pre-systemd gnu-linux OS, we can also learn from Jolla/Sailfish which is a linux phone company and OS started by foremer Nokia/Maemo team members as well as Maemo community members..
https://wiki.maemo.org/N900_Software_Power_management
http://maemo.org/community/maemo-users/power_management/
https://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Architecture/System_Software#Power_Management
https://wiki.maemo.org/Make_your_battery_last_longer
Some of these are common sense though the Maemo team worked hard on dynamic scaling, verifying power usage of system programs, and generally keeping power waste to a minimum, to the point where dimming the screen and limiting Bluetooth, Wifi, nd modem made a big difference on battery life for a N900 user.


RE: Pilotlight, a way to save power during long audio playback - mikehenson - 01-09-2025

(01-09-2025, 03:33 PM)biketool Wrote: Some of these are common sense though the Maemo team worked hard on dynamic scaling, verifying power usage of system programs, and generally keeping power waste to a minimum, to the point where dimming the screen and limiting Bluetooth, Wifi, nd modem made a big difference on battery life for a N900 user.

Thank you! I am always looking for better ways to save battery life.
In Phosh, the standard settings will only let me set the screen timeout to 60 seconds. I found the gsettings and I set it to 30 seconds.

Code:
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 30



RE: Pilotlight, a way to save power during long audio playback - biketool - 01-10-2025

(01-09-2025, 04:02 PM)mikehenson Wrote: gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 30
[/code]

Nice, we need a new page on the wiki for power tweaks like this.
But the most important things are getting CPU scaling optimized beyond Debian AMD64 Laptop standard settings and universal use of video and audio hardware acceleration(setting up a hardware abstraction layer like the N900 had to force HW acceleration use); the hardware tools are already present for an Android equivalent or better power budgeting.  Once we are exploiting the hardware we have paid for as a standard in the mobile OSs these user level power budgeting tweaks will pay off, we know an Android user could get at least 8-12 hours of screen-on games and web browsing where we can get 45-75minutes to a dead battery,we can even get this on 12 year old hardware.
(edit)
more especially DSP(hardware multimedia acceleration)
https://wiki.maemo.org/Smartreflex
https://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Architecture/Multimedia_Domain
https://code.google.com/archive/p/gst-dsp