CachyOS / CachyOS/linux-cachyos
Patch: fix IPU7 s2idle suspend on Panther Lake (Dell XPS 16, ThinkPad X9, Latitude 9440)
- Dominant language
- Shell
- Stars
- 4.5k
- Forks
- 160
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 1
Description
## Summary
Two-patch fix for s2idle suspend on Intel Panther Lake systems with the IPU7 camera stack. Without these, suspend fails (cleanly with stock kernel; with kernel oopses or hard-freezes various combinations) on every PTL laptop after the first camera use.
Reproducer (current upstream linux-cachyos kernel + intel/ipu7-drivers):
```
sudo timeout 4 cam -c 1 --capture=4 --file=/tmp/r.raw # use camera once
sudo systemctl suspend # fails or freezes
```
## The two patches
### 1. `drivers/staging/media/ipu7/ipu7.c` — `ipu7_pci_remove` ordering fix
Reorder so `ipu7_bus_del_devices()` runs BEFORE `ipu7_mmu_cleanup()`. Otherwise `isys_remove` calls `ipu7_dma_free → find_iova(&mmu->dmap->iovad, ...)` after `mmu->dmap` is NULL → kernel oops at `_raw_spin_lock_irqsave+0x27`.
3-line diff:
```diff
@@ -2643,11 +2643,11 @@ static void ipu7_pci_remove(struct pci_dev *pdev)
if (!IS_ERR_OR_NULL(isp->fw_code_region))
vfree(isp->fw_code_region);
+ ipu7_bus_del_devices(pdev);
+
ipu7_mmu_cleanup(isp->isys->mmu);
ipu7_mmu_cleanup(isp->psys->mmu);
- ipu7_bus_del_devices(pdev);
-
pm_runtime_forbid(&pdev->dev);
pm_runtime_get_noresume(&pdev->dev);
```
I'll be submitting this to linux-media for kernel staging tree. Including here so CachyOS can carry it as a downstream patch in the meantime.
### 2. `intel/ipu7-drivers` (DKMS) — `psys_suspend` graceful teardown
Replace `return -EBUSY` (when `psys->ready=1`) with `return psys_runtime_pm_suspend(dev)`. PR open at https://github.com/intel/ipu7-drivers/pull/66.
## Verification
- Hardware: Dell XPS 16 PB16250 (Panther Lake) + Synaptics SVP7500 CVS bridge + ov08x40 sensor
- Before: `PM: dpm_run_callback(): psys_suspend [intel_ipu7_psys] returns -16` then suspend abort. With cosmic-comp, GUI sometimes hard-freezes.
- After both patches: clean `PM: suspend entry (s2idle)` → `PM: suspend exit` (5s cycle), camera survives the cycle.
Test cycle:
```
$ sudo systemctl suspend # closes display, system sleeps
$ # power button to wake
$ sudo timeout 4 cam --list # camera enumerates fine
1: Internal front camera
```
## Affected hardware (likely all PTL laptops with IPU7+CVS bridge)
- Dell XPS 16 PB16250
- Lenovo ThinkPad X9
- Dell Latitude 9440
- Other Panther Lake systems with Synaptics SVP7500 CVS bridge
Happy to submit the patches as PRs to linux-cachyos PKGBUILD if that's the preferred ingestion route.
Contributor guide
Research direction
Read drivers/staging/media/ipu7/ipu7.c at ipu7_pci_remove and psys_suspend in intel/ipu7-drivers, then compare the proposed changes with PR #66. Run the camera-use and systemctl suspend reproducer on affected Panther Lake hardware; done means s2idle completes and the camera enumerates after wake.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100