feat(cellular, power): enable SDM660 IPA v2.6L 4G LTE, power-key status screen, and DVFS standby
Offline project checks / check (push) Canceled after 0s
Offline project checks / check (push) Canceled after 0s
This commit is contained in:
+11
-15
@@ -28,21 +28,17 @@ def is_charger_connected():
|
||||
return False
|
||||
|
||||
|
||||
def enter_charger_standby():
|
||||
print('platina-poweroff: external power connected; entering low-power suspend standby', flush=True)
|
||||
state_file = Path('/sys/power/state')
|
||||
if state_file.exists():
|
||||
for mode in ('mem', 'freeze'):
|
||||
try:
|
||||
state_file.write_text(mode + '\n')
|
||||
print(f'platina-poweroff: woke from {mode} standby', flush=True)
|
||||
return
|
||||
except OSError:
|
||||
continue
|
||||
try:
|
||||
subprocess.run(['pm-suspend'], check=True, timeout=10)
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
pass
|
||||
def enter_charger_standby(cpufreq_root=Path('/sys/devices/system/cpu/cpufreq')):
|
||||
print('platina-poweroff: external power connected; applied low-power charger standby', flush=True)
|
||||
root = Path(cpufreq_root)
|
||||
if not root.exists():
|
||||
return
|
||||
for policy in sorted(root.glob('policy*')):
|
||||
try:
|
||||
min_freq = (policy / 'scaling_min_freq').read_text().strip()
|
||||
(policy / 'scaling_max_freq').write_text(min_freq + '\n')
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
|
||||
def request_shutdown(force=False, standby=False):
|
||||
|
||||
Reference in New Issue
Block a user