- Extend 0012 standby optimizations with removable-SD-only MMC_CAP_AGGRESSIVE_PM | MMC_CAP2_FULL_PWR_CYCLE in sdhci-msm, proxy mem clock and BIMC XO re-parenting + 0x45000 BIT(2) early-vote clear in qcom_q6v5_mss / gcc-msm8909, 100 MHz opp-99999975 floor across qcom-msm8909.dtsi and all 6 device DTS/DTBs, disabled-by-default Bluetooth with bt_enabled persistence, NM ipv6.method=ignore + standby wlan0/disable_ipv6 muting, and post-park DSDS signal hysteresis - Add ABI-preserving system-core keypad debouncer patch 0014 (drivers/input/input.c key_debounce_ms + pm8941-pwrkey press/release chatter holdoff), replace ignored col-scan-delay-ms with col-scan-delay-us = <0x32> and raise DT debounce intervals across all 6 DTS/DTBs, configure per-target key_debounce_ms at boot and xset r rate 300 25, and add C/DTS verification in scripts/test-keypad-debouncer.py - Isolate Nokia 8000 4G (nokia-sparkler / nokia-leo) media playback from the shared 157 Hz SPK_DRV vibrator channel via dynamic Speaker-only filtering in music.so, files.so, and ringtones.so, explicit RX3/SPK mixer zeroing on Earpiece/Headphones/Bluetooth routes in sxmo_audio.sh and preview plugins, and Sparkler/Leo-only /etc/mpv/mpv.conf provisioning - Register upcoming build a1125 (ampere) in scripts/version.sh, scripts/check-rebuild.sh, AGENTS.md, and CHANGELOG.md, fix --for-rebuild pre-rebuild stale output checks in check-rebuild.sh/test-cover-dt.py, rebuild vmlinuz/DTBs/plugins and all 4 --mkinitfs target images stamped a1125 (ampere), and pin their verified SHA-256 checksums
196 lines
8.7 KiB
Python
Executable File
196 lines
8.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Host validation for the 2720 Flip external panel DT wiring.
|
|
|
|
The shipping DTB must stay on the verified single-panel layout: a live test
|
|
showed that registering the external panel darkens the main panel. The
|
|
two-panel wiring is therefore an opt-in source, validated here in detail so
|
|
it is ready for the gpio13/reset/DC hardware sign-off. Also checks the
|
|
firmware/initramfs lists, mux modules and Xorg pin shared by both layouts.
|
|
"""
|
|
import hashlib
|
|
import pathlib
|
|
import struct
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
|
|
BASE = pathlib.Path(__file__).resolve().parent.parent
|
|
DTS = BASE / "devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts"
|
|
DTB = BASE / "devices/nokia-beatles/qcom-msm8905-nokia-beatles.dtb"
|
|
OPTIN_DTS = BASE / "devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts"
|
|
DTB_COPIES = (
|
|
BASE / "overlay/rootfs/boot/qcom-msm8905-nokia-beatles.dtb",
|
|
BASE / "prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-beatles.dtb",
|
|
)
|
|
FIRMWARE = BASE / "overlay/rootfs/lib/firmware/nokia,beatles-gc9305-ext-panel.bin"
|
|
FW_LIST = "/lib/firmware/nokia,beatles-gc9305-ext-panel.bin"
|
|
INITRAMFS_LISTS = (
|
|
BASE / "overlay/rootfs/usr/share/mkinitfs/files/00-nokia-argon-display.files",
|
|
BASE / "devices/nokia-beatles/00-nokia-beatles-display.files",
|
|
)
|
|
XORG = BASE / "overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf"
|
|
KCONFIG = BASE / "patches/kernel/config-bananarchy-msm8909.armv7"
|
|
MODULES_LOAD = BASE / "overlay/rootfs/etc/modules-load.d/bananarchy-hardware.conf"
|
|
LOCAL_START = BASE / "overlay/rootfs/etc/local.d/10-bananarchy-hardware.start"
|
|
BOOT_IMAGE = BASE / "images/boot-bananarchy-nokia-beatles.img"
|
|
|
|
|
|
def fail(message):
|
|
sys.stderr.write("FAIL: %s\n" % message)
|
|
return 1
|
|
|
|
|
|
def node(text, opening):
|
|
start = text.find(opening)
|
|
if start < 0:
|
|
return ""
|
|
depth = 0
|
|
for pos in range(start, len(text)):
|
|
if text[pos] == "{":
|
|
depth += 1
|
|
elif text[pos] == "}":
|
|
depth -= 1
|
|
if depth == 0:
|
|
return text[start:pos + 1]
|
|
return ""
|
|
|
|
|
|
def appended_dtb_matches(dtb_bytes):
|
|
if "--for-rebuild" in sys.argv:
|
|
return True, "skipped (--for-rebuild)"
|
|
if not BOOT_IMAGE.is_file():
|
|
return True, "skipped (local build output absent)"
|
|
data = BOOT_IMAGE.read_bytes()
|
|
if data[:8] != b"ANDROID!":
|
|
return False, "boot image has no Android header"
|
|
page = struct.unpack_from("<I", data, 36)[0]
|
|
kernel_size = struct.unpack_from("<I", data, 8)[0]
|
|
dtb_rel = struct.unpack_from("<I", data, page + 0x2c)[0]
|
|
dtb_abs = page + dtb_rel
|
|
if not 0 < dtb_rel < kernel_size or data[dtb_abs:dtb_abs + 4] != b"\xd0\x0d\xfe\xed":
|
|
return False, "kernel+0x2c does not point at an FDT"
|
|
embedded = data[dtb_abs:page + kernel_size]
|
|
if embedded[:len(dtb_bytes)] != dtb_bytes:
|
|
return False, "appended DTB is stale"
|
|
return True, "ok"
|
|
|
|
|
|
def decompile(dtb, target):
|
|
proc = subprocess.run(["dtc", "-I", "dtb", "-O", "dts", "-o", str(target),
|
|
str(dtb)], capture_output=True, text=True)
|
|
if proc.returncode:
|
|
return None
|
|
return target.read_text(encoding="utf-8", errors="replace").replace(r"\0", '", "')
|
|
|
|
|
|
def main():
|
|
for path in (DTS, DTB, OPTIN_DTS, FIRMWARE, XORG, KCONFIG, MODULES_LOAD,
|
|
LOCAL_START, *DTB_COPIES, *INITRAMFS_LISTS):
|
|
if not path.is_file():
|
|
return fail("missing %s" % path.relative_to(BASE))
|
|
with tempfile.TemporaryDirectory(prefix="bananarchy-cover-dt-") as tmp:
|
|
root = pathlib.Path(tmp)
|
|
built = root / "built.dtb"
|
|
dec = root / "decompiled.dts"
|
|
build = subprocess.run(["dtc", "-I", "dts", "-O", "dtb", "-o", str(built),
|
|
str(DTS)], capture_output=True, text=True)
|
|
if build.returncode:
|
|
return fail("shipping DTS does not compile: %s" % build.stderr.strip())
|
|
if built.read_bytes() != DTB.read_bytes():
|
|
return fail("the shipping DTB is stale; recompile it from the DTS")
|
|
print("[ok] shipping DTB matches the shipping DTS")
|
|
for copy in DTB_COPIES:
|
|
if hashlib.sha256(copy.read_bytes()).digest() != \
|
|
hashlib.sha256(DTB.read_bytes()).digest():
|
|
return fail("%s drifted from devices/" % copy.relative_to(BASE))
|
|
print("[ok] overlay/prebuilt DTB copies are in sync")
|
|
ok, detail = appended_dtb_matches(DTB.read_bytes())
|
|
if not ok:
|
|
return fail("2720 boot image: %s" % detail)
|
|
print("[ok] standalone boot.img appended DTB: %s" % detail)
|
|
|
|
text = decompile(DTB, dec)
|
|
if text is None:
|
|
return fail("cannot decompile the shipping DTB")
|
|
for token in ('qcom,msm-id = <0x14b 0x00>;',
|
|
'qcom,board-id = <0x1000b 0x100>;',
|
|
'qcom,pmic-id = <0x1000d 0x00 0x00 0x00>;',
|
|
'reg = <0x80000000 0x20000000>;'):
|
|
if token not in text:
|
|
return fail("shipping DTB lost %s" % token)
|
|
if 'compatible = "spi-mux"' in text or 'display@1 {' in text:
|
|
return fail("shipping DTB must keep the verified single-panel layout")
|
|
if 'status = "okay";' not in node(text, "spidev@1 {"):
|
|
return fail("shipping DTB lost the spidev@1 diagnostic fallback")
|
|
print("[ok] shipping DTB keeps the verified single-panel layout")
|
|
|
|
optin = root / "optin.dtb"
|
|
optin_dec = root / "optin.dts"
|
|
build = subprocess.run(["dtc", "-I", "dts", "-O", "dtb", "-o", str(optin),
|
|
str(OPTIN_DTS)], capture_output=True, text=True)
|
|
if build.returncode:
|
|
return fail("opt-in cover DTS does not compile: %s" % build.stderr.strip())
|
|
opt = decompile(optin, optin_dec)
|
|
if opt is None:
|
|
return fail("cannot decompile the opt-in cover DTB")
|
|
mux = node(opt, "spi-mux@0 {")
|
|
internal = node(mux, "display@0 {")
|
|
external = node(mux, "display@1 {")
|
|
if 'compatible = "spi-mux";' not in mux or \
|
|
'compatible = "gpio-mux";' not in node(opt, "spi-panel-mux {") or \
|
|
not internal or not external:
|
|
return fail("opt-in DT lost the two-panel spi-mux wiring")
|
|
if 'nokia,beatles-gc9305-panel' not in internal or \
|
|
"spi-max-frequency = <0x17d7840>;" not in internal or \
|
|
"dc-gpios = <0x27 0x6e 0x00>;" not in internal:
|
|
return fail("opt-in DT changed the verified main panel path")
|
|
if 'nokia,beatles-gc9305-ext-panel' not in external or \
|
|
"spi-max-frequency = <0x17d7840>;" not in external or \
|
|
"dc-gpios = <0x27 0x15 0x00>;" not in external or \
|
|
"reset-gpios = <0x27 0x17 0x00>;" not in external or \
|
|
"write-only;" not in external or "vactive = <0xf0>;" not in external:
|
|
return fail("opt-in external panel node lost its 8-bit/240x240 wiring")
|
|
cover_pins = node(opt, "cover-panel-gpios-default-state {")
|
|
mux_pins = node(opt, "cover-mux-gpio-default-state {")
|
|
if "gpio13" in cover_pins or 'pins = "gpio21", "gpio23";' not in cover_pins:
|
|
return fail("opt-in external panel pinctrl still steals gpio13")
|
|
if 'pins = "gpio13";' not in mux_pins or "bias-pull-down;" not in mux_pins:
|
|
return fail("opt-in gpio13 has no dedicated pull-down pinctrl state")
|
|
if 'status = "disabled";' not in node(opt, "spidev@1 {"):
|
|
return fail("opt-in spidev@1 still owns chip select 1")
|
|
print("[ok] opt-in two-panel DT validated (hardware sign-off still required)")
|
|
|
|
if 'Option "kmsdev" "/dev/dri/card0"' not in XORG.read_text():
|
|
return fail("Xorg no longer pins the main DRM card")
|
|
if not FIRMWARE.read_bytes().startswith(b"MIPI DBI"):
|
|
return fail("external panel firmware is not a MIPI DBI command stream")
|
|
for lst in INITRAMFS_LISTS:
|
|
if FW_LIST not in lst.read_text().splitlines():
|
|
return fail("%s does not ship the cover firmware in the initramfs" %
|
|
lst.relative_to(BASE))
|
|
kernel_config = KCONFIG.read_text().splitlines()
|
|
for opt_name in ("CONFIG_MULTIPLEXER=m", "CONFIG_MUX_GPIO=m", "CONFIG_SPI_MUX=m"):
|
|
if opt_name not in kernel_config:
|
|
return fail("kernel config lost %s" % opt_name)
|
|
initfs_modules = (BASE / "devices/nokia-beatles/modules-initfs").read_text().splitlines()
|
|
for mod in ("mux-core", "mux-gpio", "spi-mux", "panel-mipi-dbi"):
|
|
if mod not in initfs_modules:
|
|
return fail("devices/nokia-beatles/modules-initfs lost %s" % mod)
|
|
for ko in ("overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/mux/mux-core.ko.zst",
|
|
"overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/mux/mux-gpio.ko.zst",
|
|
"overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/spi/spi-mux.ko.zst"):
|
|
if not (BASE / ko).is_file():
|
|
return fail("missing initramfs module artifact %s" % ko)
|
|
for script in (MODULES_LOAD, LOCAL_START):
|
|
body = script.read_text()
|
|
for mod in ("mux-core", "mux-gpio", "spi-mux"):
|
|
if mod not in body:
|
|
return fail("%s no longer loads %s" % (script.name, mod))
|
|
print("[ok] Xorg pin, initramfs firmware and mux modules are provisioned")
|
|
print("2720 Flip DT wiring: all checks passed")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|