Merge tag 'pmdomain-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm

Pull pmdomain updates from Ulf Hansson:
 "pmdomain core:
   - Add OF helpers for parsing the power-domains-child-ids property
   - Extend the power domain DT binding with power-domains-child-ids
   - Switch to use the dynamic root device

  pmdomain providers:
   - arm: Add support for domain hierarchies to SCMI power domains
   - qcom: Add power domains for the Shikra and Nord SoCs
   - sunxi: Fix GPU support on Radxa Cubie A7Z by keeping power domain on"

* tag 'pmdomain-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm:
  pmdomain: core: fix unused variable warning with !PM_GENERIC_DOMAINS_OF
  pmdomain: core: fix early domain registration
  pmdomain: mediatek: mfg: move __packed after struct name to fix kernel-doc
  pmdomain: qcom: rpmpd: Add Shikra RPM Power Domains
  pmdomain: qcom: rpmhpd: Add power domains for Nord SoC
  dt-bindings: power: qcom,rpmpd: document the Shikra RPM Power Domains
  pmdomain: sunxi: support power domain flags for pck600
  pmdomain: core: switch to dynamic root device
  pmdomain: qcom: Unify user-visible "Qualcomm" name
  dt-bindings: power: qcom,rpmhpd: Add RPMh power domain for Nord SoC
  dt-bindings: power: qcom,rpmhpd: Fix whitespace in RPMHPD defines
  pmdomain: arm_scmi: add support for domain hierarchies
  pmdomain: core: add support for power-domains-child-ids
  dt-bindings: power: Add power-domains-child-ids property
This commit is contained in:
Linus Torvalds
2026-06-18 16:18:33 -07:00
11 changed files with 318 additions and 35 deletions

View File

@@ -68,6 +68,21 @@ properties:
by the given provider should be subdomains of the domain specified
by this binding.
power-domains-child-ids:
$ref: /schemas/types.yaml#/definitions/uint32-array
description:
An array of child domain IDs that correspond to the power-domains
property. This property is only applicable to power domain providers
with "#power-domain-cells" > 0 (i.e., providers that supply multiple
power domains). It specifies which of the provider's child domains
should be associated with each parent domain listed in the power-domains
property. The number of elements in this array must match the number of
phandles in the power-domains property. Each element specifies the child
domain ID (index) that should be made a child domain of the corresponding
parent domain. This enables hierarchical power domain structures where
different child domains from the same provider can have different
parent domains.
required:
- "#power-domain-cells"
@@ -133,3 +148,22 @@ examples:
min-residency-us = <7000>;
};
};
- |
// Example: SCMI domain 15 -> MAIN_PD, SCMI domain 19 -> WKUP_PD
MAIN_PD: power-controller-main {
compatible = "foo,power-controller";
#power-domain-cells = <0>;
};
WKUP_PD: power-controller-wkup {
compatible = "foo,power-controller";
#power-domain-cells = <0>;
};
scmi_pds: power-controller-scmi {
compatible = "foo,power-controller";
#power-domain-cells = <1>;
power-domains = <&MAIN_PD>, <&WKUP_PD>;
power-domains-child-ids = <15>, <19>;
};

View File

@@ -35,6 +35,7 @@ properties:
- qcom,msm8994-rpmpd
- qcom,msm8996-rpmpd
- qcom,msm8998-rpmpd
- qcom,nord-rpmhpd
- qcom,qcm2290-rpmpd
- qcom,qcs404-rpmpd
- qcom,qcs615-rpmhpd
@@ -55,6 +56,7 @@ properties:
- qcom,sdx55-rpmhpd
- qcom,sdx65-rpmhpd
- qcom,sdx75-rpmhpd
- qcom,shikra-rpmpd
- qcom,sm4450-rpmhpd
- qcom,sm6115-rpmpd
- qcom,sm6125-rpmpd

View File

@@ -113,6 +113,15 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
goto err_rm_genpds;
dev_set_drvdata(dev, scmi_pd_data);
/*
* Parse (optional) power-domains-child-ids property to establish
* parent-child relationships.
*/
ret = of_genpd_add_child_ids(np, scmi_pd_data);
if (ret < 0)
dev_err(dev, "Failed to add child domain hierarchy: %d\n", ret);
dev_info(dev, "Initialized %d power domains", num_domains);
return 0;
@@ -130,9 +139,13 @@ static void scmi_pm_domain_remove(struct scmi_device *sdev)
struct device *dev = &sdev->dev;
struct device_node *np = dev->of_node;
scmi_pd_data = dev_get_drvdata(dev);
/* Remove any parent-child relationships established at probe time */
of_genpd_remove_child_ids(np, scmi_pd_data);
of_genpd_del_provider(np);
scmi_pd_data = dev_get_drvdata(dev);
for (i = 0; i < scmi_pd_data->num_domains; i++) {
if (!scmi_pd_data->domains[i])
continue;

View File

@@ -32,11 +32,6 @@ static const struct bus_type genpd_provider_bus_type = {
.name = "genpd_provider",
};
/* The parent for genpd_provider devices. */
static struct device genpd_provider_bus = {
.init_name = "genpd_provider",
};
#define GENPD_RETRY_MAX_MS 250 /* Approximate */
#define GENPD_DEV_CALLBACK(genpd, type, callback, dev) \
@@ -2325,7 +2320,6 @@ static int genpd_alloc_data(struct generic_pm_domain *genpd)
device_initialize(&genpd->dev);
genpd->dev.release = genpd_provider_release;
genpd->dev.bus = &genpd_provider_bus_type;
genpd->dev.parent = &genpd_provider_bus;
if (!genpd_is_dev_name_fw(genpd)) {
dev_set_name(&genpd->dev, "%s", genpd->name);
@@ -2569,6 +2563,10 @@ struct of_genpd_provider {
static LIST_HEAD(of_genpd_providers);
/* Mutex to protect the list above. */
static DEFINE_MUTEX(of_genpd_mutex);
/* The parent for genpd_provider devices. */
static struct device *genpd_provider_bus;
/* Used to prevent registering devices before the bus. */
static bool genpd_bus_registered;
@@ -2690,6 +2688,7 @@ int of_genpd_add_provider_simple(struct device_node *np,
if (!genpd_present(genpd))
return -EINVAL;
genpd->dev.parent = genpd_provider_bus;
genpd->dev.of_node = np;
fwnode = of_fwnode_handle(np);
@@ -2784,6 +2783,7 @@ int of_genpd_add_provider_onecell(struct device_node *np,
if (!genpd_present(genpd))
goto error;
genpd->dev.parent = genpd_provider_bus;
genpd->dev.of_node = np;
if (sync_state && !genpd_is_no_sync_state(genpd)) {
@@ -2924,6 +2924,173 @@ static struct generic_pm_domain *genpd_get_from_provider(
return genpd;
}
/**
* of_genpd_add_child_ids() - Parse power-domains-child-ids property
* @np: Device node pointer associated with the PM domain provider.
* @data: Pointer to the onecell data associated with the PM domain provider.
*
* Parse the power-domains and power-domains-child-ids properties to establish
* parent-child relationships for PM domains. The power-domains property lists
* parent domains, and power-domains-child-ids lists which child domain IDs
* should be associated with each parent.
*
* Uses "all or nothing" semantics: either all relationships are established
* successfully, or none are (any partially-added relationships are unwound
* on error).
*
* Returns the number of parent-child relationships established on success,
* 0 if the properties don't exist, or a negative error code on failure.
*/
int of_genpd_add_child_ids(struct device_node *np,
struct genpd_onecell_data *data)
{
struct of_phandle_args parent_args;
struct generic_pm_domain *parent_genpd, *child_genpd;
struct generic_pm_domain **pairs; /* pairs[2*i]=parent, pairs[2*i+1]=child */
u32 child_id;
int i, ret, count, child_count, added = 0;
/* Check if both properties exist */
count = of_count_phandle_with_args(np, "power-domains", "#power-domain-cells");
if (count <= 0)
return 0;
child_count = of_property_count_u32_elems(np, "power-domains-child-ids");
if (child_count < 0)
return 0;
if (child_count != count)
return -EINVAL;
/* Allocate tracking array for error unwind (parent/child pairs) */
pairs = kmalloc_array(count * 2, sizeof(*pairs), GFP_KERNEL);
if (!pairs)
return -ENOMEM;
for (i = 0; i < count; i++) {
ret = of_property_read_u32_index(np, "power-domains-child-ids",
i, &child_id);
if (ret)
goto err_unwind;
/* Validate child ID is within bounds */
if (child_id >= data->num_domains) {
pr_err("Child ID %u out of bounds (max %u) for %pOF\n",
child_id, data->num_domains - 1, np);
ret = -EINVAL;
goto err_unwind;
}
/* Get the child domain */
child_genpd = data->domains[child_id];
if (!child_genpd) {
pr_err("Child domain %u is NULL for %pOF\n", child_id, np);
ret = -EINVAL;
goto err_unwind;
}
ret = of_parse_phandle_with_args(np, "power-domains",
"#power-domain-cells", i,
&parent_args);
if (ret)
goto err_unwind;
/* Get the parent domain */
parent_genpd = genpd_get_from_provider(&parent_args);
of_node_put(parent_args.np);
if (IS_ERR(parent_genpd)) {
pr_err("Failed to get parent domain for %pOF: %ld\n",
np, PTR_ERR(parent_genpd));
ret = PTR_ERR(parent_genpd);
goto err_unwind;
}
/* Establish parent-child relationship */
ret = pm_genpd_add_subdomain(parent_genpd, child_genpd);
if (ret) {
pr_err("Failed to add child domain %u to parent in %pOF: %d\n",
child_id, np, ret);
goto err_unwind;
}
/* Track for potential unwind */
pairs[2 * added] = parent_genpd;
pairs[2 * added + 1] = child_genpd;
added++;
pr_debug("Added child domain %u (%s) to parent %s for %pOF\n",
child_id, child_genpd->name, parent_genpd->name, np);
}
kfree(pairs);
return count;
err_unwind:
/* Reverse all previously established relationships */
while (added-- > 0)
pm_genpd_remove_subdomain(pairs[2 * added], pairs[2 * added + 1]);
kfree(pairs);
return ret;
}
EXPORT_SYMBOL_GPL(of_genpd_add_child_ids);
/**
* of_genpd_remove_child_ids() - Remove parent-child PM domain relationships
* @np: Device node pointer associated with the PM domain provider.
* @data: Pointer to the onecell data associated with the PM domain provider.
*
* Reverses the effect of of_genpd_add_child_ids() by parsing the same
* power-domains and power-domains-child-ids properties and calling
* pm_genpd_remove_subdomain() for each established relationship.
*
* Returns 0 on success, -ENOENT if properties don't exist, or negative error
* code on failure.
*/
int of_genpd_remove_child_ids(struct device_node *np,
struct genpd_onecell_data *data)
{
struct of_phandle_args parent_args;
struct generic_pm_domain *parent_genpd, *child_genpd;
u32 child_id;
int i, ret, count, child_count;
/* Check if both properties exist */
count = of_count_phandle_with_args(np, "power-domains", "#power-domain-cells");
if (count <= 0)
return -ENOENT;
child_count = of_property_count_u32_elems(np, "power-domains-child-ids");
if (child_count < 0)
return -ENOENT;
if (child_count != count)
return -EINVAL;
for (i = 0; i < count; i++) {
if (of_property_read_u32_index(np, "power-domains-child-ids",
i, &child_id))
continue;
if (child_id >= data->num_domains || !data->domains[child_id])
continue;
ret = of_parse_phandle_with_args(np, "power-domains",
"#power-domain-cells", i,
&parent_args);
if (ret)
continue;
parent_genpd = genpd_get_from_provider(&parent_args);
of_node_put(parent_args.np);
if (IS_ERR(parent_genpd))
continue;
child_genpd = data->domains[child_id];
pm_genpd_remove_subdomain(parent_genpd, child_genpd);
}
return 0;
}
EXPORT_SYMBOL_GPL(of_genpd_remove_child_ids);
/**
* of_genpd_add_device() - Add a device to an I/O PM domain
* @genpdspec: OF phandle args to use for look-up PM domain
@@ -3575,11 +3742,9 @@ static int __init genpd_bus_init(void)
{
int ret;
ret = device_register(&genpd_provider_bus);
if (ret) {
put_device(&genpd_provider_bus);
return ret;
}
genpd_provider_bus = root_device_register("genpd_provider");
if (IS_ERR(genpd_provider_bus))
return PTR_ERR(genpd_provider_bus);
ret = bus_register(&genpd_provider_bus_type);
if (ret)
@@ -3601,7 +3766,7 @@ static int __init genpd_bus_init(void)
err_prov_bus:
bus_unregister(&genpd_provider_bus_type);
err_dev:
device_unregister(&genpd_provider_bus);
root_device_unregister(genpd_provider_bus);
return ret;
}
core_initcall(genpd_bus_init);

View File

@@ -236,14 +236,14 @@ struct __packed mtk_mfg_ipi_sleep_msg {
*
* This struct is part of the ABI with the EB firmware. Do not change it.
*/
struct __packed mtk_mfg_opp_entry {
struct mtk_mfg_opp_entry {
__le32 freq_khz;
__le32 voltage_core;
__le32 voltage_sram;
__le32 posdiv;
__le32 voltage_margin;
__le32 power_mw;
};
} __packed;
struct mtk_mfg_mbox {
struct mbox_client cl;

View File

@@ -2,7 +2,7 @@
menu "Qualcomm PM Domains"
config QCOM_CPR
tristate "QCOM Core Power Reduction (CPR) support"
tristate "Qualcomm Core Power Reduction (CPR) support"
depends on (ARCH_QCOM || COMPILE_TEST) && HAS_IOMEM
select PM_OPP
select REGMAP

View File

@@ -122,6 +122,11 @@ static struct rpmhpd gfx = {
.res_name = "gfx.lvl",
};
static struct rpmhpd gfx1 = {
.pd = { .name = "gfx1", },
.res_name = "gfx1.lvl",
};
static struct rpmhpd lcx = {
.pd = { .name = "lcx", },
.res_name = "lcx.lvl",
@@ -217,6 +222,11 @@ static struct rpmhpd nsp2 = {
.res_name = "nsp2.lvl",
};
static struct rpmhpd nsp3 = {
.pd = { .name = "nsp3", },
.res_name = "nsp3.lvl",
};
static struct rpmhpd qphy = {
.pd = { .name = "qphy", },
.res_name = "qphy.lvl",
@@ -308,6 +318,30 @@ static const struct rpmhpd_desc sa8775p_desc = {
.num_pds = ARRAY_SIZE(sa8775p_rpmhpds),
};
/* Nord RPMH powerdomains */
static struct rpmhpd *nord_rpmhpds[] = {
[RPMHPD_CX] = &cx,
[RPMHPD_CX_AO] = &cx_ao,
[RPMHPD_EBI] = &ebi,
[RPMHPD_GFX] = &gfx,
[RPMHPD_GFX1] = &gfx1,
[RPMHPD_MX] = &mx,
[RPMHPD_MX_AO] = &mx_ao,
[RPMHPD_MMCX] = &mmcx,
[RPMHPD_MMCX_AO] = &mmcx_ao,
[RPMHPD_MXC] = &mxc,
[RPMHPD_MXC_AO] = &mxc_ao,
[RPMHPD_NSP0] = &nsp0,
[RPMHPD_NSP1] = &nsp1,
[RPMHPD_NSP2] = &nsp2,
[RPMHPD_NSP3] = &nsp3,
};
static const struct rpmhpd_desc nord_desc = {
.rpmhpds = nord_rpmhpds,
.num_pds = ARRAY_SIZE(nord_rpmhpds),
};
/* SAR2130P RPMH powerdomains */
static struct rpmhpd *sar2130p_rpmhpds[] = {
[RPMHPD_CX] = &cx,
@@ -856,6 +890,7 @@ static const struct of_device_id rpmhpd_match_table[] = {
{ .compatible = "qcom,hawi-rpmhpd", .data = &hawi_desc },
{ .compatible = "qcom,kaanapali-rpmhpd", .data = &kaanapali_desc },
{ .compatible = "qcom,milos-rpmhpd", .data = &milos_desc },
{ .compatible = "qcom,nord-rpmhpd", .data = &nord_desc },
{ .compatible = "qcom,qcs615-rpmhpd", .data = &qcs615_desc },
{ .compatible = "qcom,qcs8300-rpmhpd", .data = &qcs8300_desc },
{ .compatible = "qcom,qdu1000-rpmhpd", .data = &qdu1000_desc },

View File

@@ -895,6 +895,12 @@ static const struct rpmpd_desc sm6125_desc = {
.max_state = RPM_SMD_LEVEL_BINNING,
};
static const struct rpmpd_desc shikra_desc = {
.rpmpds = sm6125_rpmpds,
.num_pds = ARRAY_SIZE(sm6125_rpmpds),
.max_state = RPM_SMD_LEVEL_TURBO_NO_CPR,
};
static struct rpmpd *sm6375_rpmpds[] = {
[SM6375_VDDCX] = &cx_rwcx0_lvl,
[SM6375_VDDCX_AO] = &cx_rwcx0_lvl_ao,
@@ -949,6 +955,7 @@ static const struct of_device_id rpmpd_match_table[] = {
{ .compatible = "qcom,qcs404-rpmpd", .data = &qcs404_desc },
{ .compatible = "qcom,qm215-rpmpd", .data = &qm215_desc },
{ .compatible = "qcom,sdm660-rpmpd", .data = &sdm660_desc },
{ .compatible = "qcom,shikra-rpmpd", .data = &shikra_desc },
{ .compatible = "qcom,sm6115-rpmpd", .data = &sm6115_desc },
{ .compatible = "qcom,sm6125-rpmpd", .data = &sm6125_desc },
{ .compatible = "qcom,sm6375-rpmpd", .data = &sm6375_desc },

View File

@@ -41,8 +41,13 @@
#define PPU_REG_SIZE 0x1000
struct sunxi_pck600_pd_desc {
const char *name;
unsigned int flags;
};
struct sunxi_pck600_desc {
const char * const *pd_names;
const struct sunxi_pck600_pd_desc *pd_descs;
unsigned int num_domains;
u32 logic_power_switch0_delay_offset;
u32 logic_power_switch1_delay_offset;
@@ -164,10 +169,12 @@ static int sunxi_pck600_probe(struct platform_device *pdev)
for (i = 0; i < desc->num_domains; i++) {
struct sunxi_pck600_pd *pd = &pck->pds[i];
const struct sunxi_pck600_pd_desc *pd_desc = &desc->pd_descs[i];
pd->genpd.name = desc->pd_names[i];
pd->genpd.name = pd_desc->name;
pd->genpd.power_off = sunxi_pck600_power_off;
pd->genpd.power_on = sunxi_pck600_power_on;
pd->genpd.flags = pd_desc->flags;
pd->base = base + PPU_REG_SIZE * i;
sunxi_pck600_pd_setup(pd, desc);
@@ -195,13 +202,14 @@ static int sunxi_pck600_probe(struct platform_device *pdev)
return ret;
}
static const char * const sun55i_a523_pck600_pd_names[] = {
"VE", "GPU", "VI", "VO0", "VO1", "DE", "NAND", "PCIE"
static const struct sunxi_pck600_pd_desc sun55i_a523_pck600_pds[] = {
{ "VE", }, { "GPU", }, { "VI", }, { "VO0", }, { "VO1", },
{ "DE", }, { "NAND", }, { "PCIE", },
};
static const struct sunxi_pck600_desc sun55i_a523_pck600_desc = {
.pd_names = sun55i_a523_pck600_pd_names,
.num_domains = ARRAY_SIZE(sun55i_a523_pck600_pd_names),
.pd_descs = sun55i_a523_pck600_pds,
.num_domains = ARRAY_SIZE(sun55i_a523_pck600_pds),
.logic_power_switch0_delay_offset = 0xc00,
.logic_power_switch1_delay_offset = 0xc04,
.off2on_delay_offset = 0xc10,
@@ -213,14 +221,15 @@ static const struct sunxi_pck600_desc sun55i_a523_pck600_desc = {
.has_rst_clk = true,
};
static const char * const sun60i_a733_pck600_pd_names[] = {
"VI", "DE_SYS", "VE_DEC", "VE_ENC", "NPU",
"GPU_TOP", "GPU_CORE", "PCIE", "USB2", "VO", "VO1"
static const struct sunxi_pck600_pd_desc sun60i_a733_pck600_pds[] = {
{ "VI", }, { "DE_SYS", }, { "VE_DEC", }, { "VE_ENC", }, { "NPU", },
{ "GPU_TOP", }, { "GPU_CORE", GENPD_FLAG_ALWAYS_ON },
{ "PCIE", }, { "USB2", }, { "VO", }, { "VO1", },
};
static const struct sunxi_pck600_desc sun60i_a733_pck600_desc = {
.pd_names = sun60i_a733_pck600_pd_names,
.num_domains = ARRAY_SIZE(sun60i_a733_pck600_pd_names),
.pd_descs = sun60i_a733_pck600_pds,
.num_domains = ARRAY_SIZE(sun60i_a733_pck600_pds),
.logic_power_switch0_delay_offset = 0xc00,
.logic_power_switch1_delay_offset = 0xc04,
.off2on_delay_offset = 0xc10,

View File

@@ -7,7 +7,7 @@
#define _DT_BINDINGS_POWER_QCOM_RPMHPD_H
/* Generic RPMH Power Domain Indexes */
#define RPMHPD_CX 0
#define RPMHPD_CX 0
#define RPMHPD_CX_AO 1
#define RPMHPD_EBI 2
#define RPMHPD_GFX 3
@@ -19,17 +19,19 @@
#define RPMHPD_MX_AO 9
#define RPMHPD_MXC 10
#define RPMHPD_MXC_AO 11
#define RPMHPD_MSS 12
#define RPMHPD_MSS 12
#define RPMHPD_NSP 13
#define RPMHPD_NSP0 14
#define RPMHPD_NSP1 15
#define RPMHPD_QPHY 16
#define RPMHPD_DDR 17
#define RPMHPD_XO 18
#define RPMHPD_NSP2 19
#define RPMHPD_NSP0 14
#define RPMHPD_NSP1 15
#define RPMHPD_QPHY 16
#define RPMHPD_DDR 17
#define RPMHPD_XO 18
#define RPMHPD_NSP2 19
#define RPMHPD_GMXC 20
#define RPMHPD_DCX 21
#define RPMHPD_GBX 22
#define RPMHPD_NSP3 23
#define RPMHPD_GFX1 24
/* RPMh Power Domain performance levels */
#define RPMH_REGULATOR_LEVEL_RETENTION 16

View File

@@ -467,6 +467,10 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np);
int of_genpd_parse_idle_states(struct device_node *dn,
struct genpd_power_state **states, int *n);
void of_genpd_sync_state(struct device_node *np);
int of_genpd_add_child_ids(struct device_node *np,
struct genpd_onecell_data *data);
int of_genpd_remove_child_ids(struct device_node *np,
struct genpd_onecell_data *data);
int genpd_dev_pm_attach(struct device *dev);
struct device *genpd_dev_pm_attach_by_id(struct device *dev,
@@ -536,6 +540,18 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
{
return ERR_PTR(-EOPNOTSUPP);
}
static inline int of_genpd_add_child_ids(struct device_node *np,
struct genpd_onecell_data *data)
{
return -EOPNOTSUPP;
}
static inline int of_genpd_remove_child_ids(struct device_node *np,
struct genpd_onecell_data *data)
{
return -EOPNOTSUPP;
}
#endif /* CONFIG_PM_GENERIC_DOMAINS_OF */
#ifdef CONFIG_PM