Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qcom-camss-mainline

Fixes the camera on Xiaomi Redmi Note 9 Pro (joyeuse) and other SM7125 (Atoll) phones running postmarketOS / mainline Linux. Upstream qcom-camss ships a malformed CSIPHY v1.2.2 lane register table — sensors stream, but no frames reach /dev/video0. This swaps the table and adds the two missing PHY-enable writes.

GNOME Snapshot showing live camera preview on Redmi Note 9 Pro
After install: GNOME Snapshot opens the front camera, shows live preview, captures photos and records video.

Quick install

Boot into your phone, then:

KREL=$(uname -r)
[ "$KREL" = "6.14.7-sm7125" ] || { echo "wrong kernel: $KREL"; exit 1; }

# fetch + verify
curl -fLO https://github.com/asidko/qcom-camss-mainline/releases/latest/download/qcom-camss.ko
strings qcom-camss.ko | grep '^vermagic'    # must contain: 6.14.7-sm7125

# backup + install
KO=/lib/modules/$KREL/kernel/drivers/media/platform/qcom/camss/qcom-camss.ko
sudo cp "$KO" /root/qcom-camss.ko.orig
sudo install -m644 qcom-camss.ko "$KO"
sudo depmod -a "$KREL"
sudo reboot

Or one-shot:

curl -fL https://github.com/asidko/qcom-camss-mainline/releases/latest/download/install.sh | sudo bash
sudo reboot

After reboot

Open Snapshot (GNOME's camera app). Live preview, photos, video capture all work.

ls /dev/media0 /dev/video0           # both should exist
sudo dmesg | grep camss              # no -ENXIO errors

Rollback

sudo install -m644 /root/qcom-camss.ko.orig \
  /lib/modules/$(uname -r)/kernel/drivers/media/platform/qcom/camss/qcom-camss.ko
sudo depmod -a && sudo reboot

The patch never touches /boot, DTBs, or any persistent device state. Rollback is byte-clean.

Why reboot? Why not modprobe?

The driver leaks IRQ state on hot reload (modprobe -r then modprobe fails with IRQ csiphy0 not found — even the original .ko). Cold boot avoids it. Build off-device, then reboot once.

What this fixes

  • Patch 1 (patches/0001-…): replaces lane_regs_sc7180[5][23] with the verbatim v1.2.2 2-phase table from downstream cam_csiphy_1_2_2_hwreg.h::csiphy_2ph_v1_2_2_reg[5][19].
  • Patch 2 (patches/0002-…): adds CTRL0 = 0x02 (v1.2.2 PHY-enable) and CTRLn(33) = 0x01 (terminator strobe) to csiphy_lanes_enable(). v0.2.0: provenance comment expanded with downstream source citations + cross-rev context (v1.2.1 sm8250 / v1.2.3 sm6350 packaging).
  • Patch 3 (patches/0003-…) (v0.2.0+): clears stale output->buf[] references and resets gen2 active_num in vfe_flush_buffers(). Defensive fix: closes a use-after-recycle hazard reachable from the STREAMON-rollback path (next probe trips WARN_ON at videobuf2-core.c:1187). Not reachable on normal-path STREAMON/STREAMOFF; only fires when a failing STREAMON walks the flush path. Gated to gen2 VFE variants (VFE-170 / VFE-480) to avoid corrupting the gen1 union arm.

Background, register-level breakdown, and silicon ID details: docs/DESIGN_DECISIONS.md.

Build from source

For any kernel other than 6.14.7-sm7125 you must rebuild against your tree. Full recipe (including Docker + OrbStack tuning for macOS hosts): docs/BUILD_FROM_SOURCE.md.

Verified hardware

  • Xiaomi Redmi Note 9 Pro (joyeuse, Snapdragon 720G / SM7125)
  • postmarketOS edge, linux-postmarketos-qcom-sm7125 6.14.7-r0
  • Sensors: OV16A1Q (16 MP front, 4-lane D-PHY) + S5K5E9 (5 MP macro, 2-lane D-PHY)
  • GNOME 47 + Snapshot 50

Should apply to other Atoll-family devices (curtana, gram) — silicon and DT are family-shared. Untested.

Credits

Downstream register tables: MiCode/Xiaomi_Kernel_OpenSource@curtana-q-oss. Upstream driver: Linaro (Robert Foss, Todor Tomov, Bryan O'Donoghue).

License

GPL-2.0-only. See LICENSE.

About

Working camera fix for Xiaomi Redmi Note 9 Pro (joyeuse) and SM7125 (Atoll) phones on mainline Linux / postmarketOS. Replaces malformed CSIPHY v1.2.2 lane table + adds missing PHY-enable writes in qcom-camss.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages