From b35b5f0d329c73d49b9c143b8e29c711fbcc3769 Mon Sep 17 00:00:00 2001 From: Finley Xiao Date: Mon, 24 Apr 2017 19:52:01 +0800 Subject: [PATCH] cpufreq: rockchip: parse 'leakage-scaling-sel' Change-Id: Ia473f960dbf0d1cc6c68fdd0e67b1d5cd8ddfa17 Signed-off-by: Finley Xiao --- drivers/cpufreq/rockchip-cpufreq.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c index c2f7b1c61319..136c0d04fcec 100644 --- a/drivers/cpufreq/rockchip-cpufreq.c +++ b/drivers/cpufreq/rockchip-cpufreq.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -24,6 +25,8 @@ #include #include +#include "../clk/rockchip/clk.h" + #define MAX_CLUSTERS 2 #define MAX_PROP_NAME_LEN 3 #define LEAKAGE_TABLE_END ~1 @@ -186,7 +189,8 @@ static int rockchip_cpufreq_of_parse_dt(struct device *dev, int (*get_soc_version)(struct device_node *np, int *soc_version); const struct of_device_id *match; struct device_node *node, *np; - int ret; + struct clk *clk; + int ret, lkg_scaling_sel = -1; np = of_parse_phandle(dev->of_node, "operating-points-v2", 0); if (!np) { @@ -221,6 +225,25 @@ static int rockchip_cpufreq_of_parse_dt(struct device *dev, return ret; } + ret = rockchip_get_leakage_sel(np, "leakage-scaling-sel", + cluster->leakage, + &lkg_scaling_sel); + if (ret) { + dev_err(dev, "Failed to get scaling-sel\n"); + return ret; + } else if (lkg_scaling_sel >= 0) { + clk = of_clk_get_by_name(np, NULL); + if (IS_ERR(clk)) { + dev_err(dev, "Failed to get opp clk"); + return PTR_ERR(clk); + } + ret = rockchip_pll_clk_adaptive_scaling(clk, lkg_scaling_sel); + if (ret) { + dev_err(dev, "Failed to adaptive scaling\n"); + return ret; + } + } + return 0; } -- 2.34.1