Merge tag 'opp-updates-6.11' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/vireshk/pm into pm-opp
Merge OPP Updates for 6.11 from Viresh Kumar: "- Introduce an OF helper function to inform if required-opps is used (Ulf Hansson). - Generic cleanups (Ulf Hansson and Viresh Kumar)." * tag 'opp-updates-6.11' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/vireshk/pm: OPP: Introduce an OF helper function to inform if required-opps is used OPP: Drop a redundant in-parameter to _set_opp_level() OPP: Fix missing cleanup on error in _opp_attach_genpd()
This commit is contained in:
+8
-7
@@ -1102,8 +1102,7 @@ static int _set_required_opps(struct device *dev, struct opp_table *opp_table,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _set_opp_level(struct device *dev, struct opp_table *opp_table,
|
||||
struct dev_pm_opp *opp)
|
||||
static int _set_opp_level(struct device *dev, struct dev_pm_opp *opp)
|
||||
{
|
||||
unsigned int level = 0;
|
||||
int ret = 0;
|
||||
@@ -1171,7 +1170,7 @@ static int _disable_opp_table(struct device *dev, struct opp_table *opp_table)
|
||||
if (opp_table->regulators)
|
||||
regulator_disable(opp_table->regulators[0]);
|
||||
|
||||
ret = _set_opp_level(dev, opp_table, NULL);
|
||||
ret = _set_opp_level(dev, NULL);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
@@ -1220,7 +1219,7 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = _set_opp_level(dev, opp_table, opp);
|
||||
ret = _set_opp_level(dev, opp);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -1267,7 +1266,7 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = _set_opp_level(dev, opp_table, opp);
|
||||
ret = _set_opp_level(dev, opp);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -2443,8 +2442,10 @@ static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev,
|
||||
* Cross check it again and fix if required.
|
||||
*/
|
||||
gdev = dev_to_genpd_dev(virt_dev);
|
||||
if (IS_ERR(gdev))
|
||||
return PTR_ERR(gdev);
|
||||
if (IS_ERR(gdev)) {
|
||||
ret = PTR_ERR(gdev);
|
||||
goto err;
|
||||
}
|
||||
|
||||
genpd_table = _find_opp_table(gdev);
|
||||
if (!IS_ERR(genpd_table)) {
|
||||
|
||||
@@ -1443,6 +1443,38 @@ put_required_np:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_get_required_opp_performance_state);
|
||||
|
||||
/**
|
||||
* dev_pm_opp_of_has_required_opp - Find out if a required-opps exists.
|
||||
* @dev: The device to investigate.
|
||||
*
|
||||
* Returns true if the device's node has a "operating-points-v2" property and if
|
||||
* the corresponding node for the opp-table describes opp nodes that uses the
|
||||
* "required-opps" property.
|
||||
*
|
||||
* Return: True if a required-opps is present, else false.
|
||||
*/
|
||||
bool dev_pm_opp_of_has_required_opp(struct device *dev)
|
||||
{
|
||||
struct device_node *opp_np, *np;
|
||||
int count;
|
||||
|
||||
opp_np = _opp_of_get_opp_desc_node(dev->of_node, 0);
|
||||
if (!opp_np)
|
||||
return false;
|
||||
|
||||
np = of_get_next_available_child(opp_np, NULL);
|
||||
of_node_put(opp_np);
|
||||
if (!np) {
|
||||
dev_warn(dev, "Empty OPP table\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
count = of_count_phandle_with_args(np, "required-opps", NULL);
|
||||
of_node_put(np);
|
||||
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp
|
||||
* @opp: opp for which DT node has to be returned for
|
||||
|
||||
@@ -474,6 +474,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpuma
|
||||
struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev);
|
||||
struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp);
|
||||
int of_get_required_opp_performance_state(struct device_node *np, int index);
|
||||
bool dev_pm_opp_of_has_required_opp(struct device *dev);
|
||||
int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_table *opp_table);
|
||||
int dev_pm_opp_of_register_em(struct device *dev, struct cpumask *cpus);
|
||||
int dev_pm_opp_calc_power(struct device *dev, unsigned long *uW,
|
||||
@@ -552,6 +553,11 @@ static inline int of_get_required_opp_performance_state(struct device_node *np,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline bool dev_pm_opp_of_has_required_opp(struct device *dev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_table *opp_table)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
Reference in New Issue
Block a user