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

This commit is contained in:
shenlei
2026-11-18 01:39:26 +09:00
parent 5a50a8264c
commit 8d12d341bf
43 changed files with 6850 additions and 229 deletions
+43 -25
View File
@@ -1,37 +1,55 @@
# Shutdown buttons and screen
# Power buttons, status screen, offline charger and standby
The tested Mi 8 Lite uses **Power + Volume Up** for an orderly Linux shutdown.
The OpenRC service `platina-power-chord` is enabled in newly built images.
The Mi 8 Lite (`platina`) supports lightweight server power management via
`platina-power-chord` and `platina-status-screen` using the physical PMIC power
button (`pm8941_pwrkey`), along with the legacy **Power + Volume Up** chord.
1. Disconnect USB/the charger so the phone runs on its battery.
2. Hold Power and Volume Up together for at least three seconds.
3. Release both buttons. The Platina logo, version and Power off screen appear
while Linux shuts down. On battery, the tested phone stays off.
## Button controls (`power_key_mode=yes`)
With USB power attached, shutdown still runs, but the bootloader starts the phone
again in charger mode and Linux boots normally. This is an accepted limitation.
Reconnecting a charger can also start the phone. There is no automatic waiting
for cable removal and no separate charging-only operating mode.
1. **Short-press Power** (`< 3s`): Restores full CPU frequencies (`2.21 GHz` /
`1.84 GHz`), wakes the Tianma `1080×2280` panel (`FBIOBLANK=0`), and renders
a live OLED status dashboard (clock, uptime, battery `%`/voltage/temp and 80%
guard status, 4G LTE carrier/signal/IP, Wi-Fi/USB/EasyTier routes, CPU clock
limits, load, and RAM usage). Refreshes every `2s` and auto-blanks to
`FB_BLANK_POWERDOWN` after `12s`, or immediately on a second short press.
2. **Hold Power `>= 3s`** (fires right at `3s`, below the PMIC hard-reset timer):
- **On battery (`online == 0`)**: Shows the `Power off` screen for `3s` and
runs `/usr/local/sbin/platina-poweroff --force` -> `/usr/sbin/poweroff`.
- **With external charger/USB attached (`online == 1`)**: Enters **Offline
Charger Mode** (brings down cellular data, blanks display, clamps all CPU
clusters to `300 MHz`, and keeps the 50–80% battery guard active).
3. **Offline Charger Mode** (also entered automatically on boot when
`/proc/cmdline` contains `androidboot.mode=charger` or
`androidboot.bootreason=usb_chg`):
- **Short-press Power**: Shows the large battery charging percentage screen
for `5s`, then turns the panel off.
- **Unplug external power**: Automatically powers off cleanly via
`/usr/sbin/poweroff`.
- **Hold Power `>= 3s`**: Restores CPU clocks, exits charger mode into normal
server operation, and starts `platina-cellular --auto`.
The service uses both evdev inputs. Short combinations, individual keys, repeats
and lost input events do not request shutdown. It acts only after both keys have
been released. This requires a running kernel and userspace service; it is not
an independent emergency power cut for a frozen phone. Existing long-Power reset
and bootloader key combinations are unchanged.
## Crash-free runtime DVFS + panel-powerdown standby
The screen indicates shutdown is in progress. Physical darkness alone is not
proof that the phone is fully off. The shutdown behavior was physically verified
in 0.3.0; the 0.3.1 in-place update passed screen-preview and restart checks with
the same button policy. Fresh full-image packaging is audited separately.
On mainline kernel `7.2.12-sdm660`, system-wide kernel `s2idle` (`freeze`)
causes WCN3990 (`ath10k_snoc`) `wlan_process` fatal crashes, post-SSR MPSS
`ipa_bam.c` assertions (dropping 4G), and `mdss_ahb_clk` warnings on resume.
Therefore `/etc/local.d/disable-suspend.start` keeps `/sys/power/state` locked
(`chmod 000`) while `platina-power-chord` implements crash-free runtime standby
using hardware `cpuidle` (`pwr-power-collapse`), panel powerdown
(`FB_BLANK_POWERDOWN`, `fb0/blank=4`), modem `RRC_IDLE`, and cluster DVFS
clamping after `idle_suspend_seconds` (`60s` default):
For diagnosis on a phone running a newly built 0.3.1 image:
- Big cluster (`policy0`): clamped to `300 MHz` (`scaling_min_freq`)
- Little cluster (`policy1`): clamped to `633.6 MHz`
- 4G LTE, Wi-Fi, EasyTier, and SSH remain online with zero baseband resets and
restore full `2.21 GHz / 1.84 GHz` immediately when the Power key is tapped.
## Diagnostics
```sh
rc-service platina-power-chord status
sudo platina-status-screen --json
sudo platina-status-screen --once --seconds 5
sudo platina-poweroff --preview
sudo python3 /usr/local/libexec/platina-image-runtime audit
```
Preview only shows the screen for five seconds. The audit reads installed files
and checksums without accessing display/input hardware or requesting shutdown.
The image runtime contains no experimental PMIC module or PMIC autoload rule.