diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2023-07-21 11:11:20 +0300 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2023-07-24 10:52:39 +0300 |
commit | a5893928bb179d67ca1d44a8f66c990480ba541d (patch) | |
tree | 0c8dfbfc01aa49a82da7b7732eb257a7c30f0d6b /drivers/opp | |
parent | 5f756d03e2c7db63c1df7148d7b1739f29ff1532 (diff) | |
download | linux-a5893928bb179d67ca1d44a8f66c990480ba541d.tar.xz |
OPP: Add dev_pm_opp_find_freq_exact_indexed()
The indexed version of the API is added for other floor and ceil, add
the same for exact as well for completeness.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/opp')
-rw-r--r-- | drivers/opp/core.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 07341050d57f..2af958dc17ba 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -646,6 +646,34 @@ struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, } EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_exact); +/** + * dev_pm_opp_find_freq_exact_indexed() - Search for an exact freq for the + * clock corresponding to the index + * @dev: Device for which we do this operation + * @freq: frequency to search for + * @index: Clock index + * @available: true/false - match for available opp + * + * Search for the matching exact OPP for the clock corresponding to the + * specified index from a starting freq for a device. + * + * Return: matching *opp , else returns ERR_PTR in case of error and should be + * handled using IS_ERR. Error return values can be: + * EINVAL: for bad pointer + * ERANGE: no match found for search + * ENODEV: if device not found in list of registered devices + * + * The callers are required to call dev_pm_opp_put() for the returned OPP after + * use. + */ +struct dev_pm_opp * +dev_pm_opp_find_freq_exact_indexed(struct device *dev, unsigned long freq, + u32 index, bool available) +{ + return _find_key_exact(dev, freq, index, available, _read_freq, NULL); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_exact_indexed); + static noinline struct dev_pm_opp *_find_freq_ceil(struct opp_table *opp_table, unsigned long *freq) { |