drivers/power/sequencing/pwrseq-pcie-m2.c
Source file repositories/reference/linux-study-clean/drivers/power/sequencing/pwrseq-pcie-m2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/sequencing/pwrseq-pcie-m2.c- Extension
.c- Size
- 16125 bytes
- Lines
- 607
- Domain
- Driver Families
- Bucket
- drivers/power
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/delay.hlinux/gpio/consumer.hlinux/list.hlinux/mod_devicetable.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/of_platform.hlinux/pci.hlinux/platform_device.hlinux/pwrseq/provider.hlinux/regulator/consumer.hlinux/serdev.hlinux/slab.h
Detected Declarations
struct pwrseq_pci_devstruct pwrseq_pcie_m2_pdatastruct pwrseq_pcie_m2_ctxfunction pwrseq_pcie_m2_vregs_enablefunction pwrseq_pcie_m2_vregs_disablefunction pwrseq_pci_m2_e_uart_enablefunction pwrseq_pci_m2_e_uart_disablefunction pwrseq_pci_m2_e_pcie_enablefunction pwrseq_pci_m2_e_pcie_disablefunction pwrseq_pcie_m2_e_pwup_delayfunction pwrseq_pcie_m2_matchfunction pwrseq_pcie_m2_create_bt_nodefunction pwrseq_pcie_m2_create_serdev_onefunction list_for_each_entryfunction __pwrseq_pcie_m2_remove_serdevfunction pwrseq_pcie_m2_remove_serdevfunction pwrseq_pcie_m2_notifyfunction pwrseq_pcie_m2_check_remote_nodefunction pwrseq_pcie_m2_register_notifierfunction pwrseq_pcie_m2_create_serdevfunction pwrseq_pcie_m2_probefunction pwrseq_pcie_m2_remove
Annotated Snippet
struct pwrseq_pci_dev {
struct serdev_device *serdev;
struct of_changeset *ocs;
struct pci_dev *pdev;
struct list_head list;
};
struct pwrseq_pcie_m2_pdata {
const struct pwrseq_target_data **targets;
};
struct pwrseq_pcie_m2_ctx {
struct pwrseq_device *pwrseq;
struct device_node *of_node;
const struct pwrseq_pcie_m2_pdata *pdata;
struct regulator_bulk_data *regs;
size_t num_vregs;
struct notifier_block nb;
struct gpio_desc *w_disable1_gpio;
struct gpio_desc *w_disable2_gpio;
struct device *dev;
struct list_head pci_devices;
struct mutex list_lock;
};
static int pwrseq_pcie_m2_vregs_enable(struct pwrseq_device *pwrseq)
{
struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
return regulator_bulk_enable(ctx->num_vregs, ctx->regs);
}
static int pwrseq_pcie_m2_vregs_disable(struct pwrseq_device *pwrseq)
{
struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
return regulator_bulk_disable(ctx->num_vregs, ctx->regs);
}
static const struct pwrseq_unit_data pwrseq_pcie_m2_vregs_unit_data = {
.name = "regulators-enable",
.enable = pwrseq_pcie_m2_vregs_enable,
.disable = pwrseq_pcie_m2_vregs_disable,
};
static const struct pwrseq_unit_data *pwrseq_pcie_m2_unit_deps[] = {
&pwrseq_pcie_m2_vregs_unit_data,
NULL
};
static int pwrseq_pci_m2_e_uart_enable(struct pwrseq_device *pwrseq)
{
struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
return gpiod_set_value_cansleep(ctx->w_disable2_gpio, 0);
}
static int pwrseq_pci_m2_e_uart_disable(struct pwrseq_device *pwrseq)
{
struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
return gpiod_set_value_cansleep(ctx->w_disable2_gpio, 1);
}
static const struct pwrseq_unit_data pwrseq_pcie_m2_e_uart_unit_data = {
.name = "uart-enable",
.deps = pwrseq_pcie_m2_unit_deps,
.enable = pwrseq_pci_m2_e_uart_enable,
.disable = pwrseq_pci_m2_e_uart_disable,
};
static int pwrseq_pci_m2_e_pcie_enable(struct pwrseq_device *pwrseq)
{
struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
return gpiod_set_value_cansleep(ctx->w_disable1_gpio, 0);
}
static int pwrseq_pci_m2_e_pcie_disable(struct pwrseq_device *pwrseq)
{
struct pwrseq_pcie_m2_ctx *ctx = pwrseq_device_get_drvdata(pwrseq);
return gpiod_set_value_cansleep(ctx->w_disable1_gpio, 1);
}
static const struct pwrseq_unit_data pwrseq_pcie_m2_e_pcie_unit_data = {
.name = "pcie-enable",
.deps = pwrseq_pcie_m2_unit_deps,
.enable = pwrseq_pci_m2_e_pcie_enable,
.disable = pwrseq_pci_m2_e_pcie_disable,
Annotation
- Immediate include surface: `linux/device.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/list.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`.
- Detected declarations: `struct pwrseq_pci_dev`, `struct pwrseq_pcie_m2_pdata`, `struct pwrseq_pcie_m2_ctx`, `function pwrseq_pcie_m2_vregs_enable`, `function pwrseq_pcie_m2_vregs_disable`, `function pwrseq_pci_m2_e_uart_enable`, `function pwrseq_pci_m2_e_uart_disable`, `function pwrseq_pci_m2_e_pcie_enable`, `function pwrseq_pci_m2_e_pcie_disable`, `function pwrseq_pcie_m2_e_pwup_delay`.
- Atlas domain: Driver Families / drivers/power.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.