RFC: [PATCH] Change VDD2 setopp to use bus throughput

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following patch changes setopp to use bus throughput as its input instead
of the OPP number. The bus throughput to OPP mapping table is part of the
vdd2_opp resource, which makes it difficult to do this mapping on a higher
level. Comments on other/better approaches welcome !

Cheers,

Peter.

Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@xxxxxxxxx>
---
 arch/arm/mach-omap2/resource34xx.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c
index 6364818..857cb14 100644
--- a/arch/arm/mach-omap2/resource34xx.c
+++ b/arch/arm/mach-omap2/resource34xx.c
@@ -164,6 +164,7 @@ int set_opp(struct shared_resource *resp, u32 target_level)
 	unsigned long mpu_freq, mpu_old_freq, l3_freq, t_opp;
 	int ind;
 	struct cpufreq_freqs freqs_notify;
+	struct bus_throughput_db *tput;
 
 	if (resp->curr_level == target_level)
 		return 0;
@@ -199,15 +200,23 @@ int set_opp(struct shared_resource *resp, u32 target_level)
 		cpufreq_notify_transition(&freqs_notify, CPUFREQ_POSTCHANGE);
 #endif
 	} else if (strcmp(resp->name, "vdd2_opp") == 0) {
+		int target_opp;
+
+		tput = (struct bus_throughput_db *)(resp->resource_data);
+		for(target_opp=0; target_opp < MAX_VDD2_OPP; target_opp++) {
+			if (tput->throughput[target_opp] >= target_level)
+				break;
+		}
+
 		l3_freq = get_freq(l3_opps + MAX_VDD2_OPP,
-					target_level);
+					target_opp);
 		t_opp = ID_VDD(PRCM_VDD2) |
-				ID_OPP_NO(l3_opps[target_level].opp_id);
-		if (resp->curr_level > target_level) {
+				ID_OPP_NO(l3_opps[target_opp].opp_id);
+		if (resp->curr_level > target_opp) {
 			/* Scale Frequency and then voltage */
 			clk_set_rate(vdd2_clk, l3_freq);
 			sr_voltagescale_vcbypass(t_opp,
-						l3_opps[target_level].vsel);
+						l3_opps[target_opp].vsel);
 		} else {
 			/* Scale Voltage and then frequency */
 			sr_voltagescale_vcbypass(t_opp,
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux