summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap/dvfs/0010-OMAP-Voltage-layer-changes-to-support-DVFS.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap/dvfs/0010-OMAP-Voltage-layer-changes-to-support-DVFS.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap/dvfs/0010-OMAP-Voltage-layer-changes-to-support-DVFS.patch134
1 files changed, 134 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap/dvfs/0010-OMAP-Voltage-layer-changes-to-support-DVFS.patch b/extras/recipes-kernel/linux/linux-omap/dvfs/0010-OMAP-Voltage-layer-changes-to-support-DVFS.patch
new file mode 100644
index 00000000..ead9cbba
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap/dvfs/0010-OMAP-Voltage-layer-changes-to-support-DVFS.patch
@@ -0,0 +1,134 @@
1From 96ee5b07e3162056169689b363f4c0edae7d7303 Mon Sep 17 00:00:00 2001
2From: Thara Gopinath <thara@ti.com>
3Date: Fri, 29 Oct 2010 20:43:34 +0530
4Subject: [PATCH 10/20] OMAP: Voltage layer changes to support DVFS.
5
6This patch introduces an API to take in the voltage domain and the
7new voltage as parameter and to scale all the scalable devices
8associated with the the voltage domain to the rate corresponding to the
9new voltage and scale the voltage domain to the new voltage.
10
11Signed-off-by: Thara Gopinath <thara@ti.com>
12---
13 arch/arm/mach-omap2/voltage.c | 69 +++++++++++++++++++++++++++++
14 arch/arm/plat-omap/include/plat/voltage.h | 7 +++
15 2 files changed, 76 insertions(+), 0 deletions(-)
16
17diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
18index 7381fa6..9adf9d1 100644
19--- a/arch/arm/mach-omap2/voltage.c
20+++ b/arch/arm/mach-omap2/voltage.c
21@@ -27,9 +27,11 @@
22 #include <linux/spinlock.h>
23 #include <linux/plist.h>
24 #include <linux/slab.h>
25+#include <linux/opp.h>
26
27 #include <plat/common.h>
28 #include <plat/voltage.h>
29+#include <plat/omap_device.h>
30
31 #include "prm-regbits-34xx.h"
32 #include "prm-regbits-44xx.h"
33@@ -1656,6 +1658,73 @@ struct voltagedomain *omap_voltage_domain_lookup(char *name)
34 }
35
36 /**
37+ * omap_voltage_scale : API to scale the devices associated with a
38+ * voltage domain vdd voltage.
39+ * @volt_domain : the voltage domain to be scaled
40+ * @volt : the new voltage for the voltage domain
41+ *
42+ * This API runs through the list of devices associated with the
43+ * voltage domain and scales the device rates to those corresponding
44+ * to the new voltage of the voltage domain. This API also scales
45+ * the voltage domain voltage to the new value. Returns 0 on success
46+ * else the error value.
47+ */
48+int omap_voltage_scale(struct voltagedomain *voltdm, unsigned long volt)
49+{
50+ unsigned long curr_volt;
51+ int is_volt_scaled = 0;
52+ struct omap_vdd_info *vdd;
53+ struct omap_vdd_dev_list *temp_dev;
54+
55+ if (!voltdm || IS_ERR(voltdm)) {
56+ pr_warning("%s: VDD specified does not exist!\n", __func__);
57+ return -EINVAL;
58+ }
59+
60+ vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
61+
62+ mutex_lock(&vdd->scaling_mutex);
63+
64+ curr_volt = omap_voltage_get_nom_volt(voltdm);
65+
66+ if (curr_volt == volt) {
67+ is_volt_scaled = 1;
68+ } else if (curr_volt < volt) {
69+ omap_voltage_scale_vdd(voltdm, volt);
70+ is_volt_scaled = 1;
71+ }
72+
73+ list_for_each_entry(temp_dev, &vdd->dev_list, node) {
74+ struct device *dev;
75+ struct opp *opp;
76+ unsigned long freq;
77+
78+ dev = temp_dev->dev;
79+
80+ opp = opp_find_voltage(dev, volt);
81+ if (IS_ERR(opp))
82+ continue;
83+
84+ freq = opp_get_freq(opp);
85+
86+ if (freq == omap_device_get_rate(dev)) {
87+ dev_warn(dev, "%s: Already at the requested"
88+ "rate %ld\n", __func__, freq);
89+ continue;
90+ }
91+
92+ omap_device_set_rate(dev, freq);
93+ }
94+
95+ if (!is_volt_scaled)
96+ omap_voltage_scale_vdd(voltdm, volt);
97+
98+ mutex_unlock(&vdd->scaling_mutex);
99+
100+ return 0;
101+}
102+
103+/**
104 * omap_voltage_late_init() - Init the various voltage parameters
105 *
106 * This API is to be called in the later stages of the
107diff --git a/arch/arm/plat-omap/include/plat/voltage.h b/arch/arm/plat-omap/include/plat/voltage.h
108index adbc6af..6782c5e 100644
109--- a/arch/arm/plat-omap/include/plat/voltage.h
110+++ b/arch/arm/plat-omap/include/plat/voltage.h
111@@ -135,6 +135,7 @@ int omap_voltage_late_init(void);
112 int omap_voltage_add_request(struct voltagedomain *voltdm, struct device *dev,
113 unsigned long *volt);
114 int omap_voltage_add_dev(struct voltagedomain *voltdm, struct device *dev);
115+int omap_voltage_scale(struct voltagedomain *voltdm, unsigned long volt);
116 #else
117 static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
118 struct omap_volt_pmic_info *pmic_info) {}
119@@ -154,6 +155,12 @@ static inline int omap_voltage_add_dev(struct voltagedomain *voltdm,
120 {
121 return -EINVAL;
122 }
123+
124+static inline int omap_voltage_scale(struct voltagedomain *voltdm,
125+ unsigned long volt)
126+{
127+ return -EINVAL;
128+}
129 #endif
130
131 #endif
132--
1331.6.6.1
134