Commit 586e9d78 authored by Martin Kepplinger's avatar Martin Kepplinger

power_key: use 25Mhz devfreq when screen off when not on Linux 5.3

As on Linux 5.6 this is totally stable for me on Birch, I'd like to use 25Mhz
instead of 100 when the screen is off.

I ran "stress -c 2 -vm 2" while using the phone on the console and
turning on the screen, browsing the web and the system kept usable
the whole time.

With this, the device cools down more quickly when the screen is
off and improves battery time.

For Linux 5.3 (only), we keep the current behaviour as 25Mhz doesn't seem
to be stable there.
Signed-off-by: Martin Kepplinger's avatarMartin Kepplinger <>
parent 54750b69
......@@ -27,10 +27,13 @@ def set_dram_freq(freq):
def get_low_freq():
with open("/proc/version") as f:
return ["25000000", "100000000"]['version 5.3.' in]
def main(args):
powerkeyname = '30370000.snvs:snvs-powerkey'
# low_speed = "25000000"
med_speed = "100000000"
hi_speed = "800000000"
path = [path for path in evdev.list_devices() if evdev.InputDevice(path).name == powerkeyname]
......@@ -49,7 +52,7 @@ def main(args):
blank = False
blank = True
# wait for the key release event so that we can differentiate
# between long and short press
......@@ -79,7 +82,7 @@ def main(args):
if event.code == ecodes.KEY_POWER and delta < power_wait_time:
# short power key press blanks the screen so change the DDR freq
blank = True
# os.system("systemctl suspend -q")
del state[event.code]
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment