[PATCH 0/4] PCI/pwrctrl: Rework pwrctrl driver integration and add driver for PCI slot

Manivannan Sadhasivam via B4 Relay
2024-12-10T09:55:55Z

Hi,

This series reworks the PCI pwrctrl integration (again) by moving the creation
and removal of pwrctrl devices to pci_scan_device() and pci_destroy_dev() APIs.
This is based on the suggestion provided by Lukas Wunner [1][2]. With this
change, it is now possible to create pwrctrl devices for PCI bridges as well.
This is required to control the power state of the PCI slots in a system. Since
the PCI slots are not explicitly defined in devicetree, the agreement is to
define the supplies for PCI slots in PCI bridge nodes itself [3].

Based on this, a pwrctrl driver to control the supplies of PCI slots are also
added in patch 4. With this driver, it is now possible to control the voltage
regulators powering the PCI slots defined in PCI bridge nodes as below:

```
pcie@0 {
compatible "pciclass,0604"
...

vpcie12v-supply = <&vpcie12v_reg>;
vpcie3v3-supply = <&vpcie3v3_reg>;
vpcie3v3aux-supply = <&vpcie3v3aux_reg>;
};
```

To make use of this driver, the PCI bridge DT node should also have the
compatible "pciclass,0604". But adding this compatible triggers the following
checkpatch warning:

WARNING: DT compatible string vendor "pciclass" appears un-documented --
check ./Documentation/devicetree/bindings/vendor-prefixes.yaml

For fixing it, I added patch 3. But due to some reason, checkpatch is not
picking the 'pciclass' vendor prefix alone, and requires adding the full
compatible 'pciclass,0604' in the vendor-prefixes list. Since my perl skills are
not great, I'm leaving it in the hands of Rob to fix the checkpatch script.

[1] https://lore.kernel.org/linux-pci/Z0yLDBMAsh0yKWf2@wunner.de
[2] https://lore.kernel.org/linux-pci/Z0xAdQ2ozspEnV5g@wunner.de
[3] https://github.com/devicetree-org/dt-schema/issues/145

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Manivannan Sadhasivam (4):
PCI/pwrctrl: Move creation of pwrctrl devices to pci_scan_device()
PCI/pwrctrl: Move pci_pwrctrl_unregister() to pci_destroy_dev()
dt-bindings: vendor-prefixes: Document the 'pciclass' prefix
PCI/pwrctrl: Add pwrctrl driver for PCI Slots

.../devicetree/bindings/vendor-prefixes.yaml | 2 +-
drivers/pci/bus.c | 43 ----------
drivers/pci/probe.c | 34 ++++++++
drivers/pci/pwrctrl/Kconfig | 11 +++
drivers/pci/pwrctrl/Makefile | 3 +
drivers/pci/pwrctrl/core.c | 2 +-
drivers/pci/pwrctrl/slot.c | 93 ++++++++++++++++++++++
drivers/pci/remove.c | 2 +-
8 files changed, 144 insertions(+), 46 deletions(-)
---
base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
change-id: 20241210-pci-pwrctrl-slot-02c0ec63172f

Best regards,
--
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>