lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1372951039-10375-4-git-send-email-k.krivyakin@samsung.com>
Date:	Thu, 04 Jul 2013 19:17:19 +0400
From:	Konstantin Krivyakin <k.krivyakin@...sung.com>
To:	k.krivyakin@...sung.com, i.zhbanov@...sung.com,
	e.voevodin@...sung.com, kyungmin.park@...sung.com,
	linux-kernel@...r.kernel.org
Subject: [PATCH RFC 3/3] Update current cpu power when cpu freq change for
 exynos.

Signed-off-by: Konstantin Krivyakin <k.krivyakin@...sung.com>
---
 drivers/cpufreq/exynos-cpufreq.c     |    2 ++
 drivers/cpufreq/exynos-cpufreq.h     |    1 +
 drivers/cpufreq/exynos4x12-cpufreq.c |   19 ++++++++++++++++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index 0d32f02..02f17bc 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -178,6 +178,8 @@ static int exynos_target(struct cpufreq_policy *policy,
 	}
 
 	new_freq = freq_table[index].frequency;
+	if (exynos_info->power_table)
+		policy->current_power = exynos_info->power_table[index];
 
 	ret = exynos_cpufreq_scale(new_freq);
 
diff --git a/drivers/cpufreq/exynos-cpufreq.h b/drivers/cpufreq/exynos-cpufreq.h
index 92b852e..64f964f 100644
--- a/drivers/cpufreq/exynos-cpufreq.h
+++ b/drivers/cpufreq/exynos-cpufreq.h
@@ -38,6 +38,7 @@ struct exynos_dvfs_info {
 	unsigned int	pll_safe_idx;
 	struct clk	*cpu_clk;
 	unsigned int	*volt_table;
+	u64		*power_table;
 	struct cpufreq_frequency_table	*freq_table;
 	void (*set_freq)(unsigned int, unsigned int);
 	bool (*need_apll_change)(unsigned int, unsigned int);
diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c b/drivers/cpufreq/exynos4x12-cpufreq.c
index 08b7477..8905f9b 100644
--- a/drivers/cpufreq/exynos4x12-cpufreq.c
+++ b/drivers/cpufreq/exynos4x12-cpufreq.c
@@ -219,6 +219,7 @@ static void exynos4x12_set_frequency(unsigned int old_index,
 int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
 {
 	unsigned long rate;
+	int freq_count;
 
 	cpu_clk = clk_get(NULL, "armclk");
 	if (IS_ERR(cpu_clk))
@@ -252,8 +253,24 @@ int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
 	info->set_freq = exynos4x12_set_frequency;
 	info->need_apll_change = exynos4x12_pms_change;
 
-	return 0;
+	freq_count = sizeof(exynos4x12_freq_table) /
+		sizeof(struct cpufreq_frequency_table);
+	info->power_table = kzalloc(sizeof(u64) * freq_count, GFP_KERNEL);
+	if (!info->power_table)
+		goto err_power_table;
+
+	for (i = 0; i <= freq_count; ++i) {
+		u64 freq = info->freq_table[i].frequency;
+		u64 volt = info->volt_table[i];
 
+		do_div(freq, 1000);
+		do_div(volt, 1000);
+		info->power_table[i] = freq * volt * volt;
+	}
+
+	return 0;
+err_power_table:
+	clk_put(mout_appl);
 err_mout_apll:
 	clk_put(mout_mpll);
 err_mout_mpll:
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ