OPP: Allow multiple clocks for a device

This patch adds support to allow multiple clocks for a device.

The design is pretty much similar to how this is done for regulators,
and platforms can supply their own version of the config_clks() callback
if they have multiple clocks for their device. The core manages the
calls via opp_table->config_clks() eventually.

We have kept both "clk" and "clks" fields in the OPP table structure and
the reason is provided as a comment in _opp_set_clknames(). The same
isn't done for "rates" though and we use rates[0] at most of the places
now.

Co-developed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
Viresh Kumar 2022-06-10 12:02:04 +05:30
parent 3cb16ad69b
commit 2083da24eb
5 changed files with 246 additions and 83 deletions

View file

@ -61,9 +61,13 @@ typedef int (*config_regulators_t)(struct device *dev,
struct dev_pm_opp *old_opp, struct dev_pm_opp *new_opp,
struct regulator **regulators, unsigned int count);
typedef int (*config_clks_t)(struct device *dev, struct opp_table *opp_table,
struct dev_pm_opp *opp, void *data, bool scaling_down);
/**
* struct dev_pm_opp_config - Device OPP configuration values
* @clk_names: Clk names, NULL terminated array, max 1 clock for now.
* @clk_names: Clk names, NULL terminated array.
* @config_clks: Custom set clk helper.
* @prop_name: Name to postfix to properties.
* @config_regulators: Custom set regulator helper.
* @supported_hw: Array of hierarchy of versions to match.
@ -78,6 +82,7 @@ typedef int (*config_regulators_t)(struct device *dev,
struct dev_pm_opp_config {
/* NULL terminated */
const char * const *clk_names;
config_clks_t config_clks;
const char *prop_name;
config_regulators_t config_regulators;
const unsigned int *supported_hw;