Commit bc0d0b1d authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge back new PM domains material for v5.15.

parents 3c5a2722 65616418
...@@ -786,6 +786,8 @@ i2c0: i2c@880000 { ...@@ -786,6 +786,8 @@ i2c0: i2c@880000 {
<&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -838,6 +840,8 @@ i2c1: i2c@884000 { ...@@ -838,6 +840,8 @@ i2c1: i2c@884000 {
<&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -890,6 +894,8 @@ i2c2: i2c@888000 { ...@@ -890,6 +894,8 @@ i2c2: i2c@888000 {
<&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -924,6 +930,8 @@ i2c3: i2c@88c000 { ...@@ -924,6 +930,8 @@ i2c3: i2c@88c000 {
<&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -976,6 +984,8 @@ i2c4: i2c@890000 { ...@@ -976,6 +984,8 @@ i2c4: i2c@890000 {
<&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -1010,6 +1020,8 @@ i2c5: i2c@894000 { ...@@ -1010,6 +1020,8 @@ i2c5: i2c@894000 {
<&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>; <&aggre1_noc MASTER_QUP_0 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -1075,6 +1087,8 @@ i2c6: i2c@a80000 { ...@@ -1075,6 +1087,8 @@ i2c6: i2c@a80000 {
<&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -1127,6 +1141,8 @@ i2c7: i2c@a84000 { ...@@ -1127,6 +1141,8 @@ i2c7: i2c@a84000 {
<&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -1161,6 +1177,8 @@ i2c8: i2c@a88000 { ...@@ -1161,6 +1177,8 @@ i2c8: i2c@a88000 {
<&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -1213,6 +1231,8 @@ i2c9: i2c@a8c000 { ...@@ -1213,6 +1231,8 @@ i2c9: i2c@a8c000 {
<&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -1247,6 +1267,8 @@ i2c10: i2c@a90000 { ...@@ -1247,6 +1267,8 @@ i2c10: i2c@a90000 {
<&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
...@@ -1299,6 +1321,8 @@ i2c11: i2c@a94000 { ...@@ -1299,6 +1321,8 @@ i2c11: i2c@a94000 {
<&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>; <&aggre2_noc MASTER_QUP_1 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "qup-core", "qup-config", interconnect-names = "qup-core", "qup-config",
"qup-memory"; "qup-memory";
power-domains = <&rpmhpd SC7180_CX>;
required-opps = <&rpmhpd_opp_low_svs>;
status = "disabled"; status = "disabled";
}; };
......
...@@ -2604,6 +2604,12 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off) ...@@ -2604,6 +2604,12 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
dev_dbg(dev, "removing from PM domain %s\n", pd->name); dev_dbg(dev, "removing from PM domain %s\n", pd->name);
/* Drop the default performance state */
if (dev_gpd_data(dev)->default_pstate) {
dev_pm_genpd_set_performance_state(dev, 0);
dev_gpd_data(dev)->default_pstate = 0;
}
for (i = 1; i < GENPD_RETRY_MAX_MS; i <<= 1) { for (i = 1; i < GENPD_RETRY_MAX_MS; i <<= 1) {
ret = genpd_remove_device(pd, dev); ret = genpd_remove_device(pd, dev);
if (ret != -EAGAIN) if (ret != -EAGAIN)
...@@ -2643,6 +2649,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev, ...@@ -2643,6 +2649,7 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
{ {
struct of_phandle_args pd_args; struct of_phandle_args pd_args;
struct generic_pm_domain *pd; struct generic_pm_domain *pd;
int pstate;
int ret; int ret;
ret = of_parse_phandle_with_args(dev->of_node, "power-domains", ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
...@@ -2681,10 +2688,29 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev, ...@@ -2681,10 +2688,29 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
genpd_unlock(pd); genpd_unlock(pd);
} }
if (ret) if (ret) {
genpd_remove_device(pd, dev); genpd_remove_device(pd, dev);
return -EPROBE_DEFER;
}
return ret ? -EPROBE_DEFER : 1; /* Set the default performance state */
pstate = of_get_required_opp_performance_state(dev->of_node, index);
if (pstate < 0 && pstate != -ENODEV && pstate != -EOPNOTSUPP) {
ret = pstate;
goto err;
} else if (pstate > 0) {
ret = dev_pm_genpd_set_performance_state(dev, pstate);
if (ret)
goto err;
dev_gpd_data(dev)->default_pstate = pstate;
}
return 1;
err:
dev_err(dev, "failed to set required performance state for power-domain %s: %d\n",
pd->name, ret);
genpd_remove_device(pd, dev);
return ret;
} }
/** /**
......
...@@ -95,15 +95,7 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table, ...@@ -95,15 +95,7 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table,
static struct device_node *of_parse_required_opp(struct device_node *np, static struct device_node *of_parse_required_opp(struct device_node *np,
int index) int index)
{ {
struct device_node *required_np; return of_parse_phandle(np, "required-opps", index);
required_np = of_parse_phandle(np, "required-opps", index);
if (unlikely(!required_np)) {
pr_err("%s: Unable to parse required-opps: %pOF, index: %d\n",
__func__, np, index);
}
return required_np;
} }
/* The caller must call dev_pm_opp_put_opp_table() after the table is used */ /* The caller must call dev_pm_opp_put_opp_table() after the table is used */
...@@ -1328,7 +1320,7 @@ int of_get_required_opp_performance_state(struct device_node *np, int index) ...@@ -1328,7 +1320,7 @@ int of_get_required_opp_performance_state(struct device_node *np, int index)
required_np = of_parse_required_opp(np, index); required_np = of_parse_required_opp(np, index);
if (!required_np) if (!required_np)
return -EINVAL; return -ENODEV;
opp_table = _find_table_of_opp_np(required_np); opp_table = _find_table_of_opp_np(required_np);
if (IS_ERR(opp_table)) { if (IS_ERR(opp_table)) {
......
...@@ -198,6 +198,7 @@ struct generic_pm_domain_data { ...@@ -198,6 +198,7 @@ struct generic_pm_domain_data {
struct notifier_block *power_nb; struct notifier_block *power_nb;
int cpu; int cpu;
unsigned int performance_state; unsigned int performance_state;
unsigned int default_pstate;
unsigned int rpm_pstate; unsigned int rpm_pstate;
ktime_t next_wakeup; ktime_t next_wakeup;
void *data; void *data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment