Skip to content

Commit 3da405e

Browse files
author
Ulf Hansson
committed
firmware/pmdomain: xilinx: Move ->sync_state() support to firmware driver
Rather than having the genpd provider to add device_links for each device that gets attached, to implement the ->sync_state() support, let's rely on fw_devlink to do this for us. In this way, we can simplify the code by moving the ->sync_state() callback into the firmware driver, so let's do that. Cc: Michael Tretter <m.tretter@pengutronix.de> Cc: Michal Simek <michal.simek@amd.com> Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Colibri iMX8X Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> # TI AM62A,Xilinx ZynqMP ZCU106 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250701114733.636510-15-ulf.hansson@linaro.org
1 parent c237dbb commit 3da405e

2 files changed

Lines changed: 10 additions & 16 deletions

File tree

drivers/firmware/xilinx/zynqmp.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,6 +2100,15 @@ static void zynqmp_firmware_remove(struct platform_device *pdev)
21002100
platform_device_unregister(em_dev);
21012101
}
21022102

2103+
static void zynqmp_firmware_sync_state(struct device *dev)
2104+
{
2105+
if (!of_device_is_compatible(dev->of_node, "xlnx,zynqmp-firmware"))
2106+
return;
2107+
2108+
if (zynqmp_pm_init_finalize())
2109+
dev_warn(dev, "failed to release power management to firmware\n");
2110+
}
2111+
21032112
static const struct of_device_id zynqmp_firmware_of_match[] = {
21042113
{.compatible = "xlnx,zynqmp-firmware"},
21052114
{.compatible = "xlnx,versal-firmware"},
@@ -2112,6 +2121,7 @@ static struct platform_driver zynqmp_firmware_driver = {
21122121
.name = "zynqmp_firmware",
21132122
.of_match_table = zynqmp_firmware_of_match,
21142123
.dev_groups = zynqmp_firmware_groups,
2124+
.sync_state = zynqmp_firmware_sync_state,
21152125
},
21162126
.probe = zynqmp_firmware_probe,
21172127
.remove = zynqmp_firmware_remove,

drivers/pmdomain/xilinx/zynqmp-pm-domains.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,8 @@ static int zynqmp_gpd_attach_dev(struct generic_pm_domain *domain,
153153
struct device *dev)
154154
{
155155
struct zynqmp_pm_domain *pd = to_zynqmp_pm_domain(domain);
156-
struct device_link *link;
157156
int ret;
158157

159-
link = device_link_add(dev, &domain->dev, DL_FLAG_SYNC_STATE_ONLY);
160-
if (!link)
161-
dev_dbg(&domain->dev, "failed to create device link for %s\n",
162-
dev_name(dev));
163-
164158
/* If this is not the first device to attach there is nothing to do */
165159
if (domain->device_count)
166160
return 0;
@@ -298,19 +292,9 @@ static void zynqmp_gpd_remove(struct platform_device *pdev)
298292
of_genpd_del_provider(pdev->dev.parent->of_node);
299293
}
300294

301-
static void zynqmp_gpd_sync_state(struct device *dev)
302-
{
303-
int ret;
304-
305-
ret = zynqmp_pm_init_finalize();
306-
if (ret)
307-
dev_warn(dev, "failed to release power management to firmware\n");
308-
}
309-
310295
static struct platform_driver zynqmp_power_domain_driver = {
311296
.driver = {
312297
.name = "zynqmp_power_controller",
313-
.sync_state = zynqmp_gpd_sync_state,
314298
},
315299
.probe = zynqmp_gpd_probe,
316300
.remove = zynqmp_gpd_remove,

0 commit comments

Comments
 (0)