Lines Matching +full:pm +full:- +full:api

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2014-2019 Xilinx, Inc.
18 #include <linux/firmware/xlnx-zynqmp.h>
19 #include <linux/firmware/xlnx-event-manager.h>
20 #include <linux/mailbox/zynqmp-ipi-message.h>
23 * struct zynqmp_pm_work_struct - Wrapper for struct work_struct
46 [PM_SUSPEND_MODE_POWER_OFF] = "power-off",
58 /* First element is callback API ID, others are callback arguments */ in suspend_event_callback()
59 if (work_pending(&zynqmp_pm_init_suspend_work->callback_work)) in suspend_event_callback()
63 memcpy(zynqmp_pm_init_suspend_work->args, &payload[1], in suspend_event_callback()
64 sizeof(zynqmp_pm_init_suspend_work->args)); in suspend_event_callback()
66 queue_work(system_unbound_wq, &zynqmp_pm_init_suspend_work->callback_work); in suspend_event_callback()
75 /* First element is callback API ID, others are callback arguments */ in zynqmp_pm_isr()
99 memcpy(payload, msg->data, sizeof(msg->len)); in ipi_receive_callback()
100 /* First element is callback API ID, others are callback arguments */ in ipi_receive_callback()
102 if (work_pending(&zynqmp_pm_init_suspend_work->callback_work)) in ipi_receive_callback()
106 memcpy(zynqmp_pm_init_suspend_work->args, &payload[1], in ipi_receive_callback()
107 sizeof(zynqmp_pm_init_suspend_work->args)); in ipi_receive_callback()
110 &zynqmp_pm_init_suspend_work->callback_work); in ipi_receive_callback()
120 * zynqmp_pm_init_suspend_work_fn - Initialize suspend
123 * Bottom-half of PM callback IRQ handler.
130 if (pm_work->args[0] == SUSPEND_SYSTEM_SHUTDOWN) { in zynqmp_pm_init_suspend_work_fn()
132 } else if (pm_work->args[0] == SUSPEND_POWER_REQUEST) { in zynqmp_pm_init_suspend_work_fn()
136 __func__, pm_work->args[0]); in zynqmp_pm_init_suspend_work_fn()
156 *(s - 1) = '\n'; in suspend_mode_show()
157 return (s - buf); in suspend_mode_show()
164 int md, ret = -EINVAL; in suspend_mode_store()
192 /* Check PM API version number */ in zynqmp_pm_probe()
194 return -ENODEV; in zynqmp_pm_probe()
199 * If xlnx_register_event() returns -EACCES (Xilinx Event Manager in zynqmp_pm_probe()
200 * is not available to use) or -ENODEV(Xilinx Event Manager not compiled), in zynqmp_pm_probe()
201 * then use ipi-mailbox or interrupt method. in zynqmp_pm_probe()
206 zynqmp_pm_init_suspend_work = devm_kzalloc(&pdev->dev, in zynqmp_pm_probe()
212 return -ENOMEM; in zynqmp_pm_probe()
216 INIT_WORK(&zynqmp_pm_init_suspend_work->callback_work, in zynqmp_pm_probe()
218 } else if (ret != -EACCES && ret != -ENODEV) { in zynqmp_pm_probe()
219 dev_err(&pdev->dev, "Failed to Register with Xilinx Event manager %d\n", ret); in zynqmp_pm_probe()
221 } else if (of_find_property(pdev->dev.of_node, "mboxes", NULL)) { in zynqmp_pm_probe()
223 devm_kzalloc(&pdev->dev, in zynqmp_pm_probe()
227 return -ENOMEM; in zynqmp_pm_probe()
229 INIT_WORK(&zynqmp_pm_init_suspend_work->callback_work, in zynqmp_pm_probe()
231 client = devm_kzalloc(&pdev->dev, sizeof(*client), GFP_KERNEL); in zynqmp_pm_probe()
233 return -ENOMEM; in zynqmp_pm_probe()
235 client->dev = &pdev->dev; in zynqmp_pm_probe()
236 client->rx_callback = ipi_receive_callback; in zynqmp_pm_probe()
240 dev_err(&pdev->dev, "Failed to request rx channel\n"); in zynqmp_pm_probe()
243 } else if (of_find_property(pdev->dev.of_node, "interrupts", NULL)) { in zynqmp_pm_probe()
246 return -ENXIO; in zynqmp_pm_probe()
248 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, in zynqmp_pm_probe()
251 dev_name(&pdev->dev), in zynqmp_pm_probe()
252 &pdev->dev); in zynqmp_pm_probe()
254 dev_err(&pdev->dev, "devm_request_threaded_irq '%d' " in zynqmp_pm_probe()
259 dev_err(&pdev->dev, "Required property not found in DT node\n"); in zynqmp_pm_probe()
260 return -ENOENT; in zynqmp_pm_probe()
263 ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_suspend_mode.attr); in zynqmp_pm_probe()
270 dev_err(&pdev->dev, "unable to create sysfs interface\n"); in zynqmp_pm_probe()
279 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_suspend_mode.attr); in zynqmp_pm_remove()
290 { .compatible = "xlnx,zynqmp-power", },