Skip to contentSkip to conversation

media: ipu6: Keep psys out of direct-complete on system suspend

media.git/next [email protected] 1 participant 1 message Nov 18

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 32 lines · Chris Simpson

Since commit a1fa010b3c9f ("driver core: auxiliary bus: Drop auxiliary_dev_pm_ops"), the auxiliary bus has no dev_pm_ops. The psys auxiliary device has no driver in mainline, and its PM domain, ipu6_bus_pm_domain, has only runtime PM callbacks. So device_pm_check_callbacks() now sets power.no_pm_callbacks for psys, and device_prepare() puts it in direct-complete.

A runtime-suspended psys in direct-complete gets its runtime PM disabled in device_suspend(). Runtime PM is enabled again only in psys's own device_resume(), which in practice runs after the PCI device's. Before, it came back in device_resume_early(). ipu6_resume(), the system resume callback of the PCI device, runtime-resumes psys before the firmware authentication. That now fails with -EACCES on every resume:

auxiliary intel_ipu6.psys.40: Failed to get runtime PM

and ipu6_resume() returns early, skipping ipu6_buttress_authenticate(). In secure mode the firmware is then not re-authenticated after resume, which matters whenever the IPU has lost power. On s2idle on a Surface Pro 9 the cameras still work, and the error is logged on every resume.

Add suspend and resume callbacks to ipu6_bus_pm_domain that forward to the driver. That is what the PM core does without them, so isys is unaffected, but psys has PM callbacks again and is not left in direct-complete. This restores the behaviour from before the auxiliary bus change.

The fix is kept local rather than in the auxiliary bus or the PM core:
it is this driver that runtime-resumes a driverless child from its parent's ->resume().

Quoted 6 lines
Fixes a1fa010b3c9f ("driver core: auxiliary bus: Drop auxiliary_dev_pm_ops")
Cc Rafael J. Wysocki <[email protected]>

Patch committed.

Thanks,
Sakari Ailus

 drivers/media/pci/intel/ipu6/ipu6-bus.c | 8 ++++++++
 1 file changed, 8 insertions(+)

---

drivers/media/pci/intel/ipu6/ipu6-bus.c +8 -0
index 173616381f62..1b06e581edbd 100644
@@ -63,8 +63,16 @@ out_err:
 	return -EBUSY;
 }
 
+/*
+ * The driverless psys device needs system sleep callbacks, or it is put in
+ * direct-complete and its runtime PM is normally still disabled when
+ * ipu6_resume() tries to runtime-resume it. These only forward to the driver,
+ * as the PM core would do without them.
+ */
 static struct dev_pm_domain ipu6_bus_pm_domain = {
 	.ops = {
+		.suspend = pm_generic_suspend,
+		.resume = pm_generic_resume,
 		.runtime_suspend = bus_pm_runtime_suspend,
 		.runtime_resume = bus_pm_runtime_resume,
 	},