1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2024 Linaro Ltd.
6 #ifndef __PCI_PWRCTL_H__
7 #define __PCI_PWRCTL_H__
9 #include <linux/notifier.h>
15 * This is a simple framework for solving the issue of PCI devices that require
16 * certain resources (regulators, GPIOs, clocks) to be enabled before the
17 * device can actually be detected on the PCI bus.
19 * The idea is to reuse the platform bus to populate OF nodes describing the
20 * PCI device and its resources, let these platform devices probe and enable
21 * relevant resources and then trigger a rescan of the PCI bus allowing for the
22 * same device (with a second associated struct device) to be registered with
25 * To preserve a correct hierarchy for PCI power management and device reset,
26 * we create a device link between the power control platform device (parent)
27 * and the supplied PCI device (child).
31 * struct pci_pwrctl - PCI device power control context.
32 * @dev: Address of the power controlling device.
34 * An object of this type must be allocated by the PCI power control device and
35 * passed to the pwrctl subsystem to trigger a bus rescan and setup a device
36 * link with the device once it's up.
41 /* Private: don't use. */
42 struct notifier_block nb;
43 struct device_link *link;
46 int pci_pwrctl_device_set_ready(struct pci_pwrctl *pwrctl);
47 void pci_pwrctl_device_unset_ready(struct pci_pwrctl *pwrctl);
48 int devm_pci_pwrctl_device_set_ready(struct device *dev,
49 struct pci_pwrctl *pwrctl);
51 #endif /* __PCI_PWRCTL_H__ */