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:
+23
-4
@@ -74,6 +74,24 @@ static void opp_debug_create_bw(struct dev_pm_opp *opp,
|
||||
}
|
||||
}
|
||||
|
||||
static void opp_debug_create_clks(struct dev_pm_opp *opp,
|
||||
struct opp_table *opp_table,
|
||||
struct dentry *pdentry)
|
||||
{
|
||||
char name[12];
|
||||
int i;
|
||||
|
||||
if (opp_table->clk_count == 1) {
|
||||
debugfs_create_ulong("rate_hz", S_IRUGO, pdentry, &opp->rates[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < opp_table->clk_count; i++) {
|
||||
snprintf(name, sizeof(name), "rate_hz_%d", i);
|
||||
debugfs_create_ulong(name, S_IRUGO, pdentry, &opp->rates[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void opp_debug_create_supplies(struct dev_pm_opp *opp,
|
||||
struct opp_table *opp_table,
|
||||
struct dentry *pdentry)
|
||||
@@ -117,10 +135,11 @@ void opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table)
|
||||
* Get directory name for OPP.
|
||||
*
|
||||
* - Normally rate is unique to each OPP, use it to get unique opp-name.
|
||||
* - For some devices rate isn't available, use index instead.
|
||||
* - For some devices rate isn't available or there are multiple, use
|
||||
* index instead for them.
|
||||
*/
|
||||
if (likely(opp->rate))
|
||||
id = opp->rate;
|
||||
if (likely(opp_table->clk_count == 1 && opp->rates[0]))
|
||||
id = opp->rates[0];
|
||||
else
|
||||
id = _get_opp_count(opp_table);
|
||||
|
||||
@@ -134,7 +153,6 @@ void opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table)
|
||||
debugfs_create_bool("turbo", S_IRUGO, d, &opp->turbo);
|
||||
debugfs_create_bool("suspend", S_IRUGO, d, &opp->suspend);
|
||||
debugfs_create_u32("performance_state", S_IRUGO, d, &opp->pstate);
|
||||
debugfs_create_ulong("rate_hz", S_IRUGO, d, &opp->rate);
|
||||
debugfs_create_u32("level", S_IRUGO, d, &opp->level);
|
||||
debugfs_create_ulong("clock_latency_ns", S_IRUGO, d,
|
||||
&opp->clock_latency_ns);
|
||||
@@ -142,6 +160,7 @@ void opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table)
|
||||
opp->of_name = of_node_full_name(opp->np);
|
||||
debugfs_create_str("of_name", S_IRUGO, d, (char **)&opp->of_name);
|
||||
|
||||
opp_debug_create_clks(opp, opp_table, d);
|
||||
opp_debug_create_supplies(opp, opp_table, d);
|
||||
opp_debug_create_bw(opp, opp_table, d);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user