diff --git a/packages/omamobile-device-panther/README.md b/packages/omamobile-device-panther/README.md index e375aeaa0..814e22d52 100644 --- a/packages/omamobile-device-panther/README.md +++ b/packages/omamobile-device-panther/README.md @@ -1,12 +1,13 @@ # omamobile-device-panther -Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panther, Tensor G2 / gs201). It hides the Android partitions from desktop tools, holds the USB address and brings USB back after a replug, and gives pacman the same `[omamobile]` repository as the Pixel 7 Pro. It does not drive the radio, the charger, or a camera, and it does not mark a boot slot successful. +Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panther, Tensor G2 / gs201). It hides the Android partitions from desktop tools, holds the USB address and brings USB back after a replug, and gives pacman the same `[omamobile]` repository as the Pixel 7 Pro. It loads the camera drivers after the boot has settled. It does not drive the radio or the charger, and it does not mark a boot slot successful. | Path | Installs to | What it does | | --- | --- | --- | | `vendor/udev/rules.d/10-omamobile-storage.rules` | `/usr/lib/udev/rules.d` | Hides `sda` and every Android partition except `userdata` from desktop tools. Same rule as the Pixel 7 Pro. The initramfs stops its guard loop before `switch_root`; the kernel's read-only flags are what remain | | `vendor/udev/rules.d/20-omamobile-gpu-always-on.rules` | `/usr/lib/udev/rules.d` | Keeps the Mali-G710 powered while Panthor drives it: powering its domain back up needs a secure call our kernel doesn't make yet. Same rule as the Pixel 7 Pro | | `vendor/udev/rules.d/72-omamobile-feedbackd.rules` | `/usr/lib/udev/rules.d` | Lets feedbackd drive the CS40L26 haptics (`cs40l26_vibra`). Same rule as the Pixel 7 Pro; the driver needs the phone's own `cs40l26.wmfw` (`tools/extract-vendor-firmware -d panther`) | +| `bin/omamobile-camera-start` + `vendor/systemd/system/omamobile-camera.{service,timer}` + `vendor/modprobe.d/omamobile-camera.conf` | `/usr/bin`, `/usr/lib/systemd/system` (the timer enabled by a vendor wants link), `/usr/lib/modprobe.d` | Loads the camera drivers 40 s into the boot (PMIC supplies, the three sensors and the main camera's lens, the DC-PHY and CSIS), skipping them on the next boot if a load never finished, and only when the DTB enables the camera receiver (`1a450000.csis`). The modules are blacklisted for autoload so only this guard (or a runbook) loads them. The Pixel 7 Pro's script, unit and list, with panther's CSIS and without the telephoto's `sem1215` | | `vendor/systemd/network/20-usb-gadget.network` | `/usr/lib/systemd/network` | Sets usb0 to 172.16.42.1/24 after handover | | `bin/omamobile-usb-rescue`, `vendor/systemd/system/omamobile-usb-rescue.service` | `/usr/bin`, `/usr/lib/systemd/system` (enabled for `multi-user.target`) | Brings USB back after a replug: the MAX77759 opens its USB2 data switch on unplug, and with no Type-C driver nothing closes it. While VBUS is valid, puts the switch back to 0x09 on the chip's I2C bus (USI13, which the board file enables). Reads two registers and writes that one; stands aside once a Type-C driver owns the chip. Same script and unit as the Pixel 7 Pro; needs `i2c-tools` | | `vendor/systemd/logind.conf.d/10-omamobile-power-key.conf` | `/usr/lib/systemd/logind.conf.d` | A short power press does not power the phone off. Same drop-in as the Pixel 7 Pro. The long press stays the PMIC reset | @@ -20,4 +21,4 @@ Omarchy Mobile's first userspace package for the Google Pixel 7 (codename panthe `./build [DIR]` compiles `reboot-to` from this directory, `./install DESTDIR [DIR]` stages the files, and `test/all` checks the copies when it is run from the repository. -Not in this package: the boot-success marker, Wi-Fi, the charger, cameras, and the slot-B image hook. Those stay out until each one has its own runbook. +Not in this package: the boot-success marker, Wi-Fi, the charger, and the slot-B image hook. Those stay out until each one has its own runbook. diff --git a/packages/omamobile-device-panther/bin/omamobile-camera-start b/packages/omamobile-device-panther/bin/omamobile-camera-start new file mode 100755 index 000000000..87c32be23 --- /dev/null +++ b/packages/omamobile-device-panther/bin/omamobile-camera-start @@ -0,0 +1,52 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Load the camera drivers once the system is up (device/cheetah/CAMERA-PLAN.md +# CAM5.4), hang-safe like omamobile-aoc-start. +# +# The modules stay blacklisted for autoload (modprobe.d/omamobile-camera.conf): +# this script is what loads them, from omamobile-camera.timer some time after +# boot, so nothing camera-related runs while the boot is still settling. Order: +# 1. the PMIC drivers behind the camera supplies (sec_acpm for LDO12S, +# gpio_s2mpg13 for the fixed supplies' enables, slg51002_regulator for +# the camera PMIC); +# 2. the sensors and lenses (each sensor powers up for its chip ID and off +# again; the lenses power up only while their subdev is open); +# 3. the DC-PHY and the CSIS driver, which registers the media graphs +# libcamera (and PipeWire's libcamera plugin) find. +# Nothing streams until an application asks. A marker is written and synced +# first and removed at the end: if a boot hangs here, the next boot leaves +# the cameras off; "omamobile-camera-start --retry" tries again. +set -uo pipefail + +marker=/var/lib/omamobile/camera-start-started +log() { echo "omamobile-camera: $*"; } + +[[ ${1:-} == --retry ]] && rm -f "$marker" +if [[ -e $marker ]]; then + log "the last start ($(cat "$marker" 2>/dev/null)) never finished; the cameras stay off this boot." + log "after checking the previous boot's log, retry with: omamobile-camera-start --retry" + exit 0 +fi +if [[ ! -e /sys/bus/platform/devices/1a450000.csis ]]; then + log "the camera receiver is not enabled in this DTB; nothing to do" + exit 0 +fi + +mkdir -p "${marker%/*}" +date -Is > "$marker" && sync -f "$marker" + +load() { + local m + for m; do + modprobe "$m" || log "modprobe $m failed" + done +} +load sec_acpm gpio_s2mpg13 slg51002_regulator +udevadm settle -t 10 +load imx386 s5kgn1 ak7375 phy_gs201_mipi_dcphy_rx gs201_csis +udevadm settle -t 10 + +rm -f "$marker" +sync -f "${marker%/*}" +n=$(ls -d /sys/bus/media/devices/media* 2>/dev/null | wc -l) +log "camera drivers loaded; $n media devices" diff --git a/packages/omamobile-device-panther/install b/packages/omamobile-device-panther/install index e8b009dc2..3582d6dd4 100755 --- a/packages/omamobile-device-panther/install +++ b/packages/omamobile-device-panther/install @@ -1,7 +1,9 @@ #!/bin/bash # SPDX-License-Identifier: MIT # Stage omamobile-device-panther into DESTDIR. Nothing is enabled that would -# mark a slot successful or start the radio, the charger, or a camera. +# mark a slot successful or start the radio or the charger. The camera +# drivers load only from omamobile-camera.timer, 40 s into the boot, behind +# a hang marker, and only on a DTB with the camera receiver enabled. # ./install DESTDIR [BUILDDIR] set -euo pipefail cd -- "$(dirname -- "${BASH_SOURCE[0]}")" @@ -28,6 +30,16 @@ install -Dm644 vendor/systemd/sleep.conf.d/10-omamobile.conf \ "$destination/usr/lib/systemd/sleep.conf.d/10-omamobile.conf" install -Dm644 vendor/modprobe.d/omamobile-display.conf \ "$destination/usr/lib/modprobe.d/omamobile-display.conf" +# The camera drivers never autoload; omamobile-camera-start loads them. +install -Dm644 vendor/modprobe.d/omamobile-camera.conf \ + "$destination/usr/lib/modprobe.d/omamobile-camera.conf" +install -Dm755 bin/omamobile-camera-start "$destination/usr/bin/omamobile-camera-start" +for unit in omamobile-camera.service omamobile-camera.timer; do + install -Dm644 "vendor/systemd/system/$unit" "$destination/usr/lib/systemd/system/$unit" +done +install -d "$destination/usr/lib/systemd/system/timers.target.wants" +ln -sfn ../omamobile-camera.timer \ + "$destination/usr/lib/systemd/system/timers.target.wants/omamobile-camera.timer" install -Dm644 vendor/NetworkManager/conf.d/10-omamobile-usb.conf \ "$destination/usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf" install -Dm644 device.conf \ diff --git a/packages/omamobile-device-panther/test/all b/packages/omamobile-device-panther/test/all index 338880eb3..9370c3ea0 100755 --- a/packages/omamobile-device-panther/test/all +++ b/packages/omamobile-device-panther/test/all @@ -81,6 +81,9 @@ for f in usr/bin/reboot-to \ usr/lib/systemd/logind.conf.d/10-omamobile-power-key.conf \ usr/lib/systemd/sleep.conf.d/10-omamobile.conf \ usr/lib/modprobe.d/omamobile-display.conf \ + usr/lib/modprobe.d/omamobile-camera.conf \ + usr/lib/systemd/system/omamobile-camera.service \ + usr/lib/systemd/system/omamobile-camera.timer \ usr/lib/NetworkManager/conf.d/10-omamobile-usb.conf \ usr/share/omamobile/device.conf \ usr/share/omamobile/device-panther/version \ @@ -121,11 +124,31 @@ grep -q '^PACKAGE=omamobile-device-panther$' "$tmp/root/usr/share/omamobile/devi for absent in usr/bin/omamobile-boot-success usr/bin/omamobile-bootctl \ usr/lib/systemd/system/omamobile-boot-success.service \ usr/bin/omamobile-wifi-start usr/bin/omamobile-charge-guard \ - usr/bin/omamobile-camera-start \ usr/lib/systemd/logind.conf.d/10-omamobile-lid.conf; do [[ ! -e $tmp/root/$absent ]] || fail "install includes $absent" done -pass "install stages the udev rules, the USB link and its rescue, and the mirrorlist, and nothing that marks a slot or starts hardware" +pass "install stages the udev rules, the USB link and its rescue, and the mirrorlist, and nothing that marks a slot or starts the radio or the charger" +# The cameras: drivers blacklisted, loaded only by omamobile-camera-start +# from the timer, on panther's CSIS (1a450000; cheetah's is 1a460000). +cam=$tmp/root/usr/bin/omamobile-camera-start +[[ -x $cam ]] || fail "omamobile-camera-start is executable" +[[ $(readlink "$tmp/root/usr/lib/systemd/system/timers.target.wants/omamobile-camera.timer") == ../omamobile-camera.timer ]] \ + || fail "the camera timer is enabled by a vendor wants link" +grep -qx 'OnBootSec=40s' "$tmp/root/usr/lib/systemd/system/omamobile-camera.timer" || fail "the cameras load 40 s into the boot" +grep -qx 'ConditionPathExists=/sys/bus/platform/devices/1a450000.csis' "$tmp/root/usr/lib/systemd/system/omamobile-camera.service" \ + || fail "the camera service waits for panther's CSIS" +grep -q '/sys/bus/platform/devices/1a450000.csis' "$cam" || fail "the script checks panther's CSIS" +grep -q '1a460000' "$cam" "$tmp/root/usr/lib/systemd/system/omamobile-camera.service" && fail "cheetah's CSIS address left in" +grep -q 'sem1215' "$cam" && fail "panther has no telephoto: sem1215 is not loaded" +for m in $(sed -n 's/^load //p' "$cam"); do + [[ $m == sec_acpm ]] && continue # the PMIC core, not in cheetah's list either + grep -qx "blacklist $m" "$tmp/root/usr/lib/modprobe.d/omamobile-camera.conf" \ + || fail "the camera driver $m must not autoload" +done +grep -q 'camera-start-started' "$cam" && grep -q 'sync -f "$marker"' "$cam" || fail "omamobile-camera-start writes and syncs a hang marker" +cmp -s vendor/modprobe.d/omamobile-camera.conf ../omamobile-device-cheetah/vendor/modprobe.d/omamobile-camera.conf 2>/dev/null \ + || [[ ! -d ../omamobile-device-cheetah ]] || fail "the camera blacklist drifted from the cheetah package" +pass "the camera drivers never autoload; omamobile-camera-start loads them from a timer, on panther's CSIS" # USB is the last gateway: its route outlives an unplug, so ahead of Wi-Fi # it sent IPv4 into a dead cable (seen on raven, 2026-10-28). net=vendor/systemd/network/20-usb-gadget.network diff --git a/packages/omamobile-device-panther/vendor/modprobe.d/omamobile-camera.conf b/packages/omamobile-device-panther/vendor/modprobe.d/omamobile-camera.conf new file mode 100644 index 000000000..8ce6984e2 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/modprobe.d/omamobile-camera.conf @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: MIT +# The camera drivers don't autoload: omamobile-camera-start (from +# omamobile-camera.timer, 40 s into the boot) loads them in order, and the +# bring-up runbooks (device/cheetah/CAMERA-PLAN.md) load them by hand. +# Explicit modprobe still works. +# +# S2MPG13 GPIOs: binding it lets the fixed camera supplies probe, which +# drives their enable pins low. +blacklist gpio_s2mpg13 +# SLG51002 camera PMIC: raises its chip select at probe. +blacklist slg51002_regulator +# Camera module power test driver (debugfs power-up and ID reads). +blacklist gs201_cam_power +# Read-only CSIS power and register probe (no DT node; never autoloads). +blacklist gs201_cam_probe +# Capture path (CAM3b/CAM4): the IMX386 sensor (powers the module at probe +# to read its ID), the DC-PHY receiver and the CSIS link + WDMA driver. +blacklist imx386 +blacklist phy_gs201_mipi_dcphy_rx +blacklist gs201_csis +# Main camera and the focus actuators (CAMERA-PLAN.md CAM-M, CAM5.3): the +# Samsung S5KGN1 sensor (powers the module at probe to read its ID; the +# same driver runs the front S5K3J1 and the telephoto S5KGM5, CAM7/CAM-T) +# and the AK7375-type VCM drivers of the main and ultrawide modules. +blacklist s5kgn1 +blacklist ak7375 +# The telephoto's SEM1215SA focus controller (CAM-T): powers it at probe +# to read the focus calibration, and whenever its subdev is open. +blacklist sem1215 diff --git a/packages/omamobile-device-panther/vendor/systemd/system/omamobile-camera.service b/packages/omamobile-device-panther/vendor/systemd/system/omamobile-camera.service new file mode 100644 index 000000000..9768f9860 --- /dev/null +++ b/packages/omamobile-device-panther/vendor/systemd/system/omamobile-camera.service @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: MIT +# Load the camera drivers (hang-safe script; device/cheetah/CAMERA-PLAN.md +# CAM5.4). Started by omamobile-camera.timer, after the boot has settled. +[Unit] +Description=Load the camera drivers (hang-safe) +After=multi-user.target omamobile-aoc.service +ConditionPathExists=/sys/bus/platform/devices/1a450000.csis + +[Service] +Type=oneshot +ExecStart=/usr/bin/omamobile-camera-start +RemainAfterExit=yes diff --git a/packages/omamobile-device-panther/vendor/systemd/system/omamobile-camera.timer b/packages/omamobile-device-panther/vendor/systemd/system/omamobile-camera.timer new file mode 100644 index 000000000..b72cb6f9f --- /dev/null +++ b/packages/omamobile-device-panther/vendor/systemd/system/omamobile-camera.timer @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: MIT +# The camera drivers load 40 s into the boot: after the regulator core's +# unused-supply clean-up (about 30 s after late init) and once the session is +# up, so a problem with them never holds up the boot. +[Unit] +Description=Load the camera drivers after the boot has settled + +[Timer] +OnBootSec=40s +AccuracySec=1s + +[Install] +WantedBy=timers.target