mirror of https://github.com/torvalds/linux.git
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
This commit is contained in:
parent
c237dbbc1f
commit
3da405ead6
|
|
@ -2100,6 +2100,15 @@ static void zynqmp_firmware_remove(struct platform_device *pdev)
|
||||||
platform_device_unregister(em_dev);
|
platform_device_unregister(em_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void zynqmp_firmware_sync_state(struct device *dev)
|
||||||
|
{
|
||||||
|
if (!of_device_is_compatible(dev->of_node, "xlnx,zynqmp-firmware"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (zynqmp_pm_init_finalize())
|
||||||
|
dev_warn(dev, "failed to release power management to firmware\n");
|
||||||
|
}
|
||||||
|
|
||||||
static const struct of_device_id zynqmp_firmware_of_match[] = {
|
static const struct of_device_id zynqmp_firmware_of_match[] = {
|
||||||
{.compatible = "xlnx,zynqmp-firmware"},
|
{.compatible = "xlnx,zynqmp-firmware"},
|
||||||
{.compatible = "xlnx,versal-firmware"},
|
{.compatible = "xlnx,versal-firmware"},
|
||||||
|
|
@ -2112,6 +2121,7 @@ static struct platform_driver zynqmp_firmware_driver = {
|
||||||
.name = "zynqmp_firmware",
|
.name = "zynqmp_firmware",
|
||||||
.of_match_table = zynqmp_firmware_of_match,
|
.of_match_table = zynqmp_firmware_of_match,
|
||||||
.dev_groups = zynqmp_firmware_groups,
|
.dev_groups = zynqmp_firmware_groups,
|
||||||
|
.sync_state = zynqmp_firmware_sync_state,
|
||||||
},
|
},
|
||||||
.probe = zynqmp_firmware_probe,
|
.probe = zynqmp_firmware_probe,
|
||||||
.remove = zynqmp_firmware_remove,
|
.remove = zynqmp_firmware_remove,
|
||||||
|
|
|
||||||
|
|
@ -153,14 +153,8 @@ static int zynqmp_gpd_attach_dev(struct generic_pm_domain *domain,
|
||||||
struct device *dev)
|
struct device *dev)
|
||||||
{
|
{
|
||||||
struct zynqmp_pm_domain *pd = to_zynqmp_pm_domain(domain);
|
struct zynqmp_pm_domain *pd = to_zynqmp_pm_domain(domain);
|
||||||
struct device_link *link;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
link = device_link_add(dev, &domain->dev, DL_FLAG_SYNC_STATE_ONLY);
|
|
||||||
if (!link)
|
|
||||||
dev_dbg(&domain->dev, "failed to create device link for %s\n",
|
|
||||||
dev_name(dev));
|
|
||||||
|
|
||||||
/* If this is not the first device to attach there is nothing to do */
|
/* If this is not the first device to attach there is nothing to do */
|
||||||
if (domain->device_count)
|
if (domain->device_count)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -298,19 +292,9 @@ static void zynqmp_gpd_remove(struct platform_device *pdev)
|
||||||
of_genpd_del_provider(pdev->dev.parent->of_node);
|
of_genpd_del_provider(pdev->dev.parent->of_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zynqmp_gpd_sync_state(struct device *dev)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = zynqmp_pm_init_finalize();
|
|
||||||
if (ret)
|
|
||||||
dev_warn(dev, "failed to release power management to firmware\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct platform_driver zynqmp_power_domain_driver = {
|
static struct platform_driver zynqmp_power_domain_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "zynqmp_power_controller",
|
.name = "zynqmp_power_controller",
|
||||||
.sync_state = zynqmp_gpd_sync_state,
|
|
||||||
},
|
},
|
||||||
.probe = zynqmp_gpd_probe,
|
.probe = zynqmp_gpd_probe,
|
||||||
.remove = zynqmp_gpd_remove,
|
.remove = zynqmp_gpd_remove,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue