OPP/pmdomain core:

- Fix support for required OPPs for multiple PM domains
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmbaxy4XHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjClOvQ/9GsFWEg25GHhelpN9P4U5QNaB
 chKXrws/r8hSvwv55jVKTaPEefYhNyRi0lFdylupx3eFOFNwoBu2wZ0fkUVCgvCc
 AOYo2MtfsRg5kJWJ60CNW34r9EbCmq2mWGh+QxPgWBF9xc0h47vsVCzyslEsPW33
 mtoh2OFSIQREdtQ2UDeZd8YZLcV20USWSMG3zDxv3M36rL9gv6O2/VIqF6zqW4uw
 YK5ghjTgpahQD+PQP8y7jhyW23kqe8qxhKOlmJ/jGu1LbOO7jc0FbSUHawkZfBnW
 eAxaDIghArVoPdLesUyCeKv2hy+BTMBAetZtbPI6TmeHBU+fmKfPSZg3XyLUizQo
 XQiPQ0J9NDc2czmcpApxtUcnKKXf92irDnF2Zq+z9hcMO/N/N8spDkLNr81qdzj9
 p6HjwKubKzQCAgJx4lDalmYq0rxlZH9snMYUPkWdb/2xwZ/n+Tra5JbXowaD1JOq
 MvFzSxs/k45lSJ+83YvKF3oeVNF2DNE5UwxXi/TjgVO5EMcXu//fciG/imdfpUjL
 Wef9pAXZHpQVSnd6bijN3L4jJ381ious+cArlDVMW+FLriljFiKxjSjYzE5WrxLB
 csSLskdJtFhQ+/M1/asMauymHKsSFGdKmjYzP+HxTLhUoF6JQ7D0TL2YxkrnGoW7
 uRXt3p9R/Yyv2xfnMzo=
 =XXjD
 -----END PGP SIGNATURE-----

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

Pull pmdomain fix from Ulf Hansson:

 - Fix support for required OPPs for multiple PM domains

* tag 'pmdomain-v6.11-rc2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm:
  OPP: Fix support for required OPPs for multiple PM domains
This commit is contained in:
Linus Torvalds 2024-09-06 11:32:30 -07:00
commit 2125a72554

View File

@ -1061,6 +1061,27 @@ static int _set_opp_bw(const struct opp_table *opp_table,
return 0;
}
static int _set_opp_level(struct device *dev, struct dev_pm_opp *opp)
{
unsigned int level = 0;
int ret = 0;
if (opp) {
if (opp->level == OPP_LEVEL_UNSET)
return 0;
level = opp->level;
}
/* Request a new performance state through the device's PM domain. */
ret = dev_pm_domain_set_performance_state(dev, level);
if (ret)
dev_err(dev, "Failed to set performance state %u (%d)\n", level,
ret);
return ret;
}
/* This is only called for PM domain for now */
static int _set_required_opps(struct device *dev, struct opp_table *opp_table,
struct dev_pm_opp *opp, bool up)
@ -1091,7 +1112,7 @@ static int _set_required_opps(struct device *dev, struct opp_table *opp_table,
if (devs[index]) {
required_opp = opp ? opp->required_opps[index] : NULL;
ret = dev_pm_opp_set_opp(devs[index], required_opp);
ret = _set_opp_level(devs[index], required_opp);
if (ret)
return ret;
}
@ -1102,27 +1123,6 @@ static int _set_required_opps(struct device *dev, struct opp_table *opp_table,
return 0;
}
static int _set_opp_level(struct device *dev, struct dev_pm_opp *opp)
{
unsigned int level = 0;
int ret = 0;
if (opp) {
if (opp->level == OPP_LEVEL_UNSET)
return 0;
level = opp->level;
}
/* Request a new performance state through the device's PM domain. */
ret = dev_pm_domain_set_performance_state(dev, level);
if (ret)
dev_err(dev, "Failed to set performance state %u (%d)\n", level,
ret);
return ret;
}
static void _find_current_opp(struct device *dev, struct opp_table *opp_table)
{
struct dev_pm_opp *opp = ERR_PTR(-ENODEV);
@ -2457,18 +2457,6 @@ static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev,
}
}
/*
* Add the virtual genpd device as a user of the OPP table, so
* we can call dev_pm_opp_set_opp() on it directly.
*
* This will be automatically removed when the OPP table is
* removed, don't need to handle that here.
*/
if (!_add_opp_dev(virt_dev, opp_table->required_opp_tables[index])) {
ret = -ENOMEM;
goto err;
}
opp_table->required_devs[index] = virt_dev;
index++;
name++;