Skip to content

Commit fc8f502

Browse files
committed
Merge tag 'pmdomain-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm
Pull pmdomain updates from Ulf Hansson: "pmdomain core: - Leave powered-on genpds on until ->sync_state() or late_initcall_sync - Export a common ->sync_state() helper for genpd providers - Add generic ->sync_state() support - Add a bus/driver for genpd provider-devices - Introduce dev_pm_genpd_is_on() for consumers pmdomain providers: - cpuidle-psci: Drop redundant ->sync_state() support - cpuidle-riscv-sbi: Drop redundant ->sync_state() support - imx: Set ISI panic write for imx8m-blk-ctrl - qcom: Add support for Glymur and Milos RPMh power-domains - qcom: Use of_genpd_sync_state() for power-domains - rockchip: Add support for the RK3528 variant - samsung: Fix splash-screen handover by enforcing a ->sync_state() - sunxi: Add support for Allwinner A523's PCK600 power-controller - tegra: Opt-out from genpd's common ->sync_state() support for pmc - thead: Instantiate a GPU power sequencer via the auxiliary bus - renesas: Move init to postcore_initcalls - xilinx: Move ->sync_state() support to firmware driver - xilinx: Use of_genpd_sync_state() for power-domains pmdomain consumers: - remoteproc: imx_rproc: Fixup the detect/attach procedure for pre-booted cores" * tag 'pmdomain-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm: (44 commits) pmdomain: qcom: rpmhpd: Add Glymur RPMh Power Domains dt-bindings: power: rpmpd: Add Glymur power domains remoteproc: imx_rproc: detect and attach to pre-booted remote cores remoteproc: imx_rproc: skip clock enable when M-core is managed by the SCU pmdomain: core: introduce dev_pm_genpd_is_on() pmdomain: ti: Select PM_GENERIC_DOMAINS pmdomain: sunxi: sun20i-ppu: change to tristate and enable for ARCH_SUNXI pmdomain: sunxi: add driver for Allwinner A523's PCK-600 power controller pmdomain: sunxi: sun20i-ppu: add A523 support pmdomain: samsung: Fix splash-screen handover by enforcing a sync_state cpuidle: riscv-sbi: Drop redundant sync_state support cpuidle: psci: Drop redundant sync_state support pmdomain: core: Leave powered-on genpds on until sync_state pmdomain: core: Leave powered-on genpds on until late_initcall_sync pmdomain: core: Default to use of_genpd_sync_state() for genpd providers driver core: Add dev_set_drv_sync_state() pmdomain: core: Add common ->sync_state() support for genpd providers driver core: Export get_dev_from_fwnode() firmware: xilinx: Use of_genpd_sync_state() firmware: xilinx: Don't share zynqmp_pm_init_finalize() ...
2 parents 0ae982d + 05e35bd commit fc8f502

31 files changed

Lines changed: 858 additions & 173 deletions

File tree

Documentation/devicetree/bindings/power/qcom,rpmpd.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ properties:
1717
compatible:
1818
oneOf:
1919
- enum:
20+
- qcom,glymur-rpmhpd
2021
- qcom,mdm9607-rpmpd
2122
- qcom,milos-rpmhpd
2223
- qcom,msm8226-rpmpd

drivers/base/core.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,8 +1881,6 @@ static void fw_devlink_unblock_consumers(struct device *dev)
18811881
device_links_write_unlock();
18821882
}
18831883

1884-
#define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev)
1885-
18861884
static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
18871885
{
18881886
struct device *dev;
@@ -5281,6 +5279,12 @@ void device_set_node(struct device *dev, struct fwnode_handle *fwnode)
52815279
}
52825280
EXPORT_SYMBOL_GPL(device_set_node);
52835281

5282+
struct device *get_dev_from_fwnode(struct fwnode_handle *fwnode)
5283+
{
5284+
return get_device((fwnode)->dev);
5285+
}
5286+
EXPORT_SYMBOL_GPL(get_dev_from_fwnode);
5287+
52845288
int device_match_name(struct device *dev, const void *name)
52855289
{
52865290
return sysfs_streq(dev_name(dev), name);

drivers/cpuidle/cpuidle-psci-domain.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ struct psci_pd_provider {
2828
};
2929

3030
static LIST_HEAD(psci_pd_providers);
31-
static bool psci_pd_allow_domain_state;
3231

3332
static int psci_pd_power_off(struct generic_pm_domain *pd)
3433
{
@@ -38,9 +37,6 @@ static int psci_pd_power_off(struct generic_pm_domain *pd)
3837
if (!state->data)
3938
return 0;
4039

41-
if (!psci_pd_allow_domain_state)
42-
return -EBUSY;
43-
4440
/* OSI mode is enabled, set the corresponding domain state. */
4541
pd_state = state->data;
4642
psci_set_domain_state(pd, pd->state_idx, *pd_state);
@@ -126,15 +122,6 @@ static void psci_pd_remove(void)
126122
}
127123
}
128124

129-
static void psci_cpuidle_domain_sync_state(struct device *dev)
130-
{
131-
/*
132-
* All devices have now been attached/probed to the PM domain topology,
133-
* hence it's fine to allow domain states to be picked.
134-
*/
135-
psci_pd_allow_domain_state = true;
136-
}
137-
138125
static const struct of_device_id psci_of_match[] = {
139126
{ .compatible = "arm,psci-1.0" },
140127
{}
@@ -195,7 +182,6 @@ static struct platform_driver psci_cpuidle_domain_driver = {
195182
.driver = {
196183
.name = "psci-cpuidle-domain",
197184
.of_match_table = psci_of_match,
198-
.sync_state = psci_cpuidle_domain_sync_state,
199185
},
200186
};
201187

drivers/cpuidle/cpuidle-riscv-sbi.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ static DEFINE_PER_CPU_READ_MOSTLY(struct sbi_cpuidle_data, sbi_cpuidle_data);
4444
static DEFINE_PER_CPU(struct sbi_domain_state, domain_state);
4545
static bool sbi_cpuidle_use_osi;
4646
static bool sbi_cpuidle_use_cpuhp;
47-
static bool sbi_cpuidle_pd_allow_domain_state;
4847

4948
static inline void sbi_set_domain_state(u32 state)
5049
{
@@ -345,15 +344,6 @@ static int sbi_cpuidle_init_cpu(struct device *dev, int cpu)
345344
return ret;
346345
}
347346

348-
static void sbi_cpuidle_domain_sync_state(struct device *dev)
349-
{
350-
/*
351-
* All devices have now been attached/probed to the PM domain
352-
* topology, hence it's fine to allow domain states to be picked.
353-
*/
354-
sbi_cpuidle_pd_allow_domain_state = true;
355-
}
356-
357347
#ifdef CONFIG_DT_IDLE_GENPD
358348

359349
static int sbi_cpuidle_pd_power_off(struct generic_pm_domain *pd)
@@ -364,9 +354,6 @@ static int sbi_cpuidle_pd_power_off(struct generic_pm_domain *pd)
364354
if (!state->data)
365355
return 0;
366356

367-
if (!sbi_cpuidle_pd_allow_domain_state)
368-
return -EBUSY;
369-
370357
/* OSI mode is enabled, set the corresponding domain state. */
371358
pd_state = state->data;
372359
sbi_set_domain_state(*pd_state);
@@ -564,7 +551,6 @@ static struct platform_driver sbi_cpuidle_driver = {
564551
.probe = sbi_cpuidle_probe,
565552
.driver = {
566553
.name = "sbi-cpuidle",
567-
.sync_state = sbi_cpuidle_domain_sync_state,
568554
},
569555
};
570556

drivers/firmware/xilinx/zynqmp.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/of.h>
2121
#include <linux/of_platform.h>
2222
#include <linux/platform_device.h>
23+
#include <linux/pm_domain.h>
2324
#include <linux/slab.h>
2425
#include <linux/uaccess.h>
2526
#include <linux/hashtable.h>
@@ -1299,11 +1300,10 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_bootmode_write);
12991300
* This API function is to be used for notify the power management controller
13001301
* about the completed power management initialization.
13011302
*/
1302-
int zynqmp_pm_init_finalize(void)
1303+
static int zynqmp_pm_init_finalize(void)
13031304
{
13041305
return zynqmp_pm_invoke_fn(PM_PM_INIT_FINALIZE, NULL, 0);
13051306
}
1306-
EXPORT_SYMBOL_GPL(zynqmp_pm_init_finalize);
13071307

13081308
/**
13091309
* zynqmp_pm_set_suspend_mode() - Set system suspend mode
@@ -2100,6 +2100,19 @@ 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+
struct device_node *np = dev->of_node;
2106+
2107+
if (!of_device_is_compatible(np, "xlnx,zynqmp-firmware"))
2108+
return;
2109+
2110+
of_genpd_sync_state(np);
2111+
2112+
if (zynqmp_pm_init_finalize())
2113+
dev_warn(dev, "failed to release power management to firmware\n");
2114+
}
2115+
21032116
static const struct of_device_id zynqmp_firmware_of_match[] = {
21042117
{.compatible = "xlnx,zynqmp-firmware"},
21052118
{.compatible = "xlnx,versal-firmware"},
@@ -2112,6 +2125,7 @@ static struct platform_driver zynqmp_firmware_driver = {
21122125
.name = "zynqmp_firmware",
21132126
.of_match_table = zynqmp_firmware_of_match,
21142127
.dev_groups = zynqmp_firmware_groups,
2128+
.sync_state = zynqmp_firmware_sync_state,
21152129
},
21162130
.probe = zynqmp_firmware_probe,
21172131
.remove = zynqmp_firmware_remove,

drivers/pmdomain/amlogic/meson-secure-pwrc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,32 +342,32 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev)
342342
return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate);
343343
}
344344

345-
static struct meson_secure_pwrc_domain_data meson_secure_a1_pwrc_data = {
345+
static const struct meson_secure_pwrc_domain_data meson_secure_a1_pwrc_data = {
346346
.domains = a1_pwrc_domains,
347347
.count = ARRAY_SIZE(a1_pwrc_domains),
348348
};
349349

350-
static struct meson_secure_pwrc_domain_data amlogic_secure_a4_pwrc_data = {
350+
static const struct meson_secure_pwrc_domain_data amlogic_secure_a4_pwrc_data = {
351351
.domains = a4_pwrc_domains,
352352
.count = ARRAY_SIZE(a4_pwrc_domains),
353353
};
354354

355-
static struct meson_secure_pwrc_domain_data amlogic_secure_a5_pwrc_data = {
355+
static const struct meson_secure_pwrc_domain_data amlogic_secure_a5_pwrc_data = {
356356
.domains = a5_pwrc_domains,
357357
.count = ARRAY_SIZE(a5_pwrc_domains),
358358
};
359359

360-
static struct meson_secure_pwrc_domain_data amlogic_secure_c3_pwrc_data = {
360+
static const struct meson_secure_pwrc_domain_data amlogic_secure_c3_pwrc_data = {
361361
.domains = c3_pwrc_domains,
362362
.count = ARRAY_SIZE(c3_pwrc_domains),
363363
};
364364

365-
static struct meson_secure_pwrc_domain_data meson_secure_s4_pwrc_data = {
365+
static const struct meson_secure_pwrc_domain_data meson_secure_s4_pwrc_data = {
366366
.domains = s4_pwrc_domains,
367367
.count = ARRAY_SIZE(s4_pwrc_domains),
368368
};
369369

370-
static struct meson_secure_pwrc_domain_data amlogic_secure_t7_pwrc_data = {
370+
static const struct meson_secure_pwrc_domain_data amlogic_secure_t7_pwrc_data = {
371371
.domains = t7_pwrc_domains,
372372
.count = ARRAY_SIZE(t7_pwrc_domains),
373373
};

drivers/pmdomain/apple/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ config APPLE_PMGR_PWRSTATE
99
select MFD_SYSCON
1010
select PM_GENERIC_DOMAINS
1111
select RESET_CONTROLLER
12-
default ARCH_APPLE
1312
help
1413
The PMGR block in Apple SoCs provides high-level power state
1514
controls for SoC devices. This driver manages them through the

drivers/pmdomain/arm/scmi_pm_domain.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,21 @@ struct scmi_pm_domain {
2222

2323
#define to_scmi_pd(gpd) container_of(gpd, struct scmi_pm_domain, genpd)
2424

25-
static int scmi_pd_power(struct generic_pm_domain *domain, bool power_on)
25+
static int scmi_pd_power(struct generic_pm_domain *domain, u32 state)
2626
{
27-
u32 state;
2827
struct scmi_pm_domain *pd = to_scmi_pd(domain);
2928

30-
if (power_on)
31-
state = SCMI_POWER_STATE_GENERIC_ON;
32-
else
33-
state = SCMI_POWER_STATE_GENERIC_OFF;
34-
3529
return power_ops->state_set(pd->ph, pd->domain, state);
3630
}
3731

3832
static int scmi_pd_power_on(struct generic_pm_domain *domain)
3933
{
40-
return scmi_pd_power(domain, true);
34+
return scmi_pd_power(domain, SCMI_POWER_STATE_GENERIC_ON);
4135
}
4236

4337
static int scmi_pd_power_off(struct generic_pm_domain *domain)
4438
{
45-
return scmi_pd_power(domain, false);
39+
return scmi_pd_power(domain, SCMI_POWER_STATE_GENERIC_OFF);
4640
}
4741

4842
static int scmi_pm_domain_probe(struct scmi_device *sdev)

0 commit comments

Comments
 (0)