Skip to content

Commit 76e65f7

Browse files
MrVansudeep-holla
authored andcommitted
firmware: arm_scmi: Add power management operations to SCMI bus
Introduce suspend and resume power management callbacks for `scmi_bus_type`, modeled after `platform_pm_ops`. This enables SCMI devices on the bus to implement their own suspend and resume behavior, allowing for more fine-grained power control at the device level. Signed-off-by: Peng Fan <peng.fan@nxp.com> Message-Id: <20250704-scmi-pm-v2-1-9316cec2f9cc@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
1 parent f8e6563 commit 76e65f7

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

  • drivers/firmware/arm_scmi

drivers/firmware/arm_scmi/bus.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,39 @@ static struct attribute *scmi_device_attributes_attrs[] = {
323323
};
324324
ATTRIBUTE_GROUPS(scmi_device_attributes);
325325

326+
static int scmi_pm_suspend(struct device *dev)
327+
{
328+
const struct device_driver *drv = dev->driver;
329+
330+
if (drv && drv->pm && drv->pm->suspend)
331+
return drv->pm->suspend(dev);
332+
333+
return 0;
334+
}
335+
336+
static int scmi_pm_resume(struct device *dev)
337+
{
338+
const struct device_driver *drv = dev->driver;
339+
340+
if (drv && drv->pm && drv->pm->resume)
341+
return drv->pm->resume(dev);
342+
343+
return 0;
344+
}
345+
346+
static const struct dev_pm_ops scmi_dev_pm_ops = {
347+
.suspend = pm_sleep_ptr(scmi_pm_suspend),
348+
.resume = pm_sleep_ptr(scmi_pm_resume),
349+
};
350+
326351
const struct bus_type scmi_bus_type = {
327352
.name = "scmi_protocol",
328353
.match = scmi_dev_match,
329354
.probe = scmi_dev_probe,
330355
.remove = scmi_dev_remove,
331356
.uevent = scmi_device_uevent,
332357
.dev_groups = scmi_device_attributes_groups,
358+
.pm = &scmi_dev_pm_ops,
333359
};
334360
EXPORT_SYMBOL_GPL(scmi_bus_type);
335361

0 commit comments

Comments
 (0)