diff options
author | Hemant Hariyani <hemanthariyani@ti.com> | 2013-07-25 17:44:29 -0500 |
---|---|---|
committer | Hemant Hariyani <hemanthariyani@ti.com> | 2013-07-25 17:44:29 -0500 |
commit | 12a51f01def3f941316e2feda32d56921f2f015f (patch) | |
tree | 79b8512b0f3d753b56f73bc0bad8a7ee62bf8dd5 | |
parent | ba006b660ca16c864fcfe041805ddb5e65e8f3d8 (diff) | |
download | proprietary-open-12a51f01def3f941316e2feda32d56921f2f015f.tar.gz |
SGX-BIN: Binaries/KM source with GPU thermal integration
DDK 1.9@2291151
Branch: origin/1.9/2291151_k3.8
Change-Id: Ic498f3a10f93763f74fd96b25335704dce7aab17
Signed-off-by: Hemant Hariyani <hemanthariyani@ti.com>
-rw-r--r-- | jacinto6/README.SGX | 4 | ||||
-rw-r--r-- | jacinto6/sgx.tgz | bin | 2649848 -> 2651780 bytes | |||
-rw-r--r-- | jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq.c | 8 | ||||
-rw-r--r-- | jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq_cool.c | 87 | ||||
-rw-r--r-- | jacinto6/sgx_src/eurasia_km/services4/system/omap4/sysutils.c | 2 |
5 files changed, 94 insertions, 7 deletions
diff --git a/jacinto6/README.SGX b/jacinto6/README.SGX index 839ab3a..4c83268 100644 --- a/jacinto6/README.SGX +++ b/jacinto6/README.SGX @@ -17,9 +17,9 @@ now a wrapper which detects the current processor and loads the corresponding core specific pvrsrvinit. [DDK Version] - 1.9@2166536 + 1.9/2291151 [DDK commit ID] - 6708c05 build: Add jacinto6 gralloc binary + 2f85c98 SGX-KM: GPU thermal integration for k3.8 [Branch] origin/1.9/2291151_k3.8 [Kernel modules built against] diff --git a/jacinto6/sgx.tgz b/jacinto6/sgx.tgz Binary files differindex 42da719..c62bc19 100644 --- a/jacinto6/sgx.tgz +++ b/jacinto6/sgx.tgz diff --git a/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq.c b/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq.c index 11e1238..0285d00 100644 --- a/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq.c +++ b/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq.c @@ -78,7 +78,7 @@ static unsigned long _idle_prev_time; static unsigned long _active_curr_time; static unsigned long _active_prev_time; -#if defined(CONFIG_THERMAL_FRAMEWORK) +#if (defined(CONFIG_THERMAL) || defined(CONFIG_THERMAL_FRAMEWORK)) int cool_init(void); void cool_deinit(void); #endif @@ -491,8 +491,8 @@ int sgxfreq_init(struct device *dev) return ret; } -#if defined(CONFIG_THERMAL_FRAMEWORK) - //cool_init(); +#if (defined(CONFIG_THERMAL) || defined(CONFIG_THERMAL_FRAMEWORK)) + cool_init(); #endif for (i = 0; sgxfreq_gov_init[i] != NULL; i++) @@ -517,7 +517,7 @@ int sgxfreq_deinit(void) sgxfreq_set_freq_request(sfd.freq_list[0]); -#if defined(CONFIG_THERMAL_FRAMEWORK) +#if (defined(CONFIG_THERMAL) || defined(CONFIG_THERMAL_FRAMEWORK)) cool_deinit(); #endif diff --git a/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq_cool.c b/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq_cool.c index 9233def..a58eb39 100644 --- a/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq_cool.c +++ b/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq_cool.c @@ -14,6 +14,92 @@ * this program. If not, see <http://www.gnu.org/licenses/>. */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) + +#include <linux/thermal.h> + +static struct cool_data { + int freq_cnt; + unsigned long *freq_list; + unsigned long state; + struct thermal_cooling_device *cdev; +} cd; + +static int sgxfreq_get_max_state(struct thermal_cooling_device *cdev, + unsigned long *state) +{ + *state = cd.freq_cnt - 1; + return 0; +} + +static int sgxfreq_get_cur_state(struct thermal_cooling_device *cdev, + unsigned long *state) +{ + *state = cd.state; + return 0; +} + +static int sgxfreq_set_cur_state(struct thermal_cooling_device *cdev, + unsigned long state) +{ + int freq_max_index, freq_limit_index; + + freq_max_index = cd.freq_cnt - 1; + + freq_limit_index = freq_max_index - (unsigned int)state; + + if (freq_limit_index < 0) + freq_limit_index = 0; + + sgxfreq_set_freq_limit(cd.freq_list[freq_limit_index]); + + cd.state = state; + return 0; +} + + +static const struct thermal_cooling_device_ops sgxfreq_cooling_ops = { + .get_max_state = sgxfreq_get_max_state, + .get_cur_state = sgxfreq_get_cur_state, + .set_cur_state = sgxfreq_set_cur_state, +}; + +int cool_init(void) +{ + int ret; + struct thermal_zone_device *tz; + + cd.freq_cnt = sgxfreq_get_freq_list(&cd.freq_list); + if (!cd.freq_cnt || !cd.freq_list) + return -EINVAL; + + cd.cdev = thermal_cooling_device_register("gpu", (void *)NULL, &sgxfreq_cooling_ops); + + if(IS_ERR(cd.cdev)) { + pr_err("sgxfreq: Error while regeistering cooling device: %ld\n", PTR_ERR(cd.cdev)); + return -1; + } + + tz = thermal_zone_get_zone_by_name("gpu"); + if(IS_ERR(tz)) { + pr_err("sgxfreq: Error while trying to obtain zone device: %ld\n", PTR_ERR(tz)); + return -1; + } + + ret = thermal_zone_bind_cooling_device(tz, 0, cd.cdev, THERMAL_NO_LIMIT, THERMAL_NO_LIMIT); + if (ret) + { + pr_err("sgxfreq: Error binding cooling device: %d\n", ret); + } + + return 0; +} + +void cool_deinit(void) +{ + thermal_cooling_device_unregister(cd.cdev); +} +#else //if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) #include <linux/thermal_framework.h> static int cool_device(struct thermal_dev *dev, int cooling_level); @@ -102,3 +188,4 @@ static int cool_device(struct thermal_dev *dev, int cooling_level) return 0; } +#endif //if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) diff --git a/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sysutils.c b/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sysutils.c index 20baad2..fef97c2 100644 --- a/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sysutils.c +++ b/jacinto6/sgx_src/eurasia_km/services4/system/omap4/sysutils.c @@ -50,7 +50,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sgxfreq_activeidle.c" #include "sgxfreq_on3demand.c" #include "sgxfreq_userspace.c" -#if defined(CONFIG_THERMAL_FRAMEWORK) +#if (defined(CONFIG_THERMAL) || defined(CONFIG_THERMAL_FRAMEWORK)) #include "sgxfreq_cool.c" #endif #endif |