On Wed, 04 May 2022 04:36:02 +0100, Hector Martin <marcan@xxxxxxxxx> wrote: [...] > > So it'd go something like this: > > - apcie driver, on slot activation, sees a pwren gpio/reg and powers it > on prior to bringing up the link (and marks that port as d3cold supported) > - sdhci-pci driver, on probe, sees an external card detect GPIO declared > and considers that license to call pci_d3cold_enable and enable > runtime-pm (since it won't need the internal card detect IRQ/GPIO) > - No SD card is inserted, so SD driver goes into runtime suspend and > saves whatever controller state it needs > - PCI core saves whatever config space stuff it needs to save, SD > controller is powered down via GPIO I haven't quite found yet how this goes, but I can't say I tried in anger. I guess that the root port device has to provide some standard PM callbacks that would further tickle the regulator? > - SD card is inserted, SMC GPIO IRQ notifies SD driver > - SD driver goes out of runtime suspend > - PCI core powers on controller, re-establishes link, restores config space > - SD driver restores host controller registers and discovers the new card > > No new APIs, this is all existing kernel stuff. PCI manages slot power > same as it does on ACPI systems (that support it), driver interacts with > it via runtime-pm and the d3cold control stuff. > > I'm tempted to prototype this today and see how it goes... Well, let us know how that goes. Thanks, M. -- Without deviation from the norm, progress is not possible.