drivers/soc/xilinx/zynqmp_power.c
Source file repositories/reference/linux-study-clean/drivers/soc/xilinx/zynqmp_power.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/xilinx/zynqmp_power.c- Extension
.c- Size
- 11398 bytes
- Lines
- 413
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/mailbox_client.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/reboot.hlinux/suspend.hlinux/firmware/xlnx-zynqmp.hlinux/firmware/xlnx-event-manager.hlinux/mailbox/zynqmp-ipi-message.h
Detected Declarations
struct zynqmp_pm_work_structstruct zynqmp_pm_event_infoenum pm_suspend_modefunction zynqmp_pm_get_callback_datafunction subsystem_restart_event_callbackfunction suspend_event_callbackfunction zynqmp_pm_isrfunction ipi_receive_callbackfunction zynqmp_pm_subsystem_restart_work_fnfunction zynqmp_pm_init_suspend_work_fnfunction suspend_mode_showfunction suspend_mode_storefunction unregister_eventfunction register_eventfunction zynqmp_pm_probefunction zynqmp_pm_remove
Annotated Snippet
struct zynqmp_pm_work_struct {
struct work_struct callback_work;
u32 args[CB_ARG_CNT];
};
/**
* struct zynqmp_pm_event_info - event related information
* @cb_fun: Function pointer to store the callback function.
* @cb_type: Type of callback from pm_api_cb_id,
* PM_NOTIFY_CB - for Error Events,
* PM_INIT_SUSPEND_CB - for suspend callback.
* @node_id: Node-Id related to event.
* @event: Event Mask for the Error Event.
* @wake: Flag specifying whether the subsystem should be woken upon
* event notification.
*/
struct zynqmp_pm_event_info {
event_cb_func_t cb_fun;
enum pm_api_cb_id cb_type;
u32 node_id;
u32 event;
bool wake;
};
static struct zynqmp_pm_work_struct *zynqmp_pm_init_suspend_work, *zynqmp_pm_init_restart_work;
static struct mbox_chan *rx_chan;
enum pm_suspend_mode {
PM_SUSPEND_MODE_FIRST = 0,
PM_SUSPEND_MODE_STD = PM_SUSPEND_MODE_FIRST,
PM_SUSPEND_MODE_POWER_OFF,
};
#define PM_SUSPEND_MODE_FIRST PM_SUSPEND_MODE_STD
static const char *const suspend_modes[] = {
[PM_SUSPEND_MODE_STD] = "standard",
[PM_SUSPEND_MODE_POWER_OFF] = "power-off",
};
static enum pm_suspend_mode suspend_mode = PM_SUSPEND_MODE_STD;
static void zynqmp_pm_get_callback_data(u32 *buf)
{
zynqmp_pm_invoke_fn(GET_CALLBACK_DATA, buf, 0);
}
static void subsystem_restart_event_callback(const u32 *payload, void *data)
{
/* First element is callback API ID, others are callback arguments */
if (work_pending(&zynqmp_pm_init_restart_work->callback_work))
return;
/* Copy callback arguments into work's structure */
memcpy(zynqmp_pm_init_restart_work->args, &payload[0],
sizeof(zynqmp_pm_init_restart_work->args));
queue_work(system_dfl_wq, &zynqmp_pm_init_restart_work->callback_work);
}
static void suspend_event_callback(const u32 *payload, void *data)
{
/* First element is callback API ID, others are callback arguments */
if (work_pending(&zynqmp_pm_init_suspend_work->callback_work))
return;
/* Copy callback arguments into work's structure */
memcpy(zynqmp_pm_init_suspend_work->args, &payload[1],
sizeof(zynqmp_pm_init_suspend_work->args));
queue_work(system_dfl_wq, &zynqmp_pm_init_suspend_work->callback_work);
}
static irqreturn_t zynqmp_pm_isr(int irq, void *data)
{
u32 payload[CB_PAYLOAD_SIZE];
zynqmp_pm_get_callback_data(payload);
/* First element is callback API ID, others are callback arguments */
if (payload[0] == PM_INIT_SUSPEND_CB) {
switch (payload[1]) {
case SUSPEND_SYSTEM_SHUTDOWN:
orderly_poweroff(true);
break;
case SUSPEND_POWER_REQUEST:
pm_suspend(PM_SUSPEND_MEM);
break;
default:
pr_err("%s Unsupported InitSuspendCb reason code %d\n",
Annotation
- Immediate include surface: `linux/mailbox_client.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/reboot.h`, `linux/suspend.h`, `linux/firmware/xlnx-zynqmp.h`, `linux/firmware/xlnx-event-manager.h`.
- Detected declarations: `struct zynqmp_pm_work_struct`, `struct zynqmp_pm_event_info`, `enum pm_suspend_mode`, `function zynqmp_pm_get_callback_data`, `function subsystem_restart_event_callback`, `function suspend_event_callback`, `function zynqmp_pm_isr`, `function ipi_receive_callback`, `function zynqmp_pm_subsystem_restart_work_fn`, `function zynqmp_pm_init_suspend_work_fn`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.