SGX-BIN: Binaries/KM source with GPU thermal integration
authorHemant Hariyani <hemanthariyani@ti.com>
Thu, 25 Jul 2013 22:44:29 +0000 (17:44 -0500)
committerHemant Hariyani <hemanthariyani@ti.com>
Thu, 25 Jul 2013 22:44:29 +0000 (17:44 -0500)
DDK 1.9@2291151
Branch: origin/1.9/2291151_k3.8

Change-Id: Ic498f3a10f93763f74fd96b25335704dce7aab17
Signed-off-by: Hemant Hariyani <hemanthariyani@ti.com>
jacinto6/README.SGX
jacinto6/sgx.tgz
jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq.c
jacinto6/sgx_src/eurasia_km/services4/system/omap4/sgxfreq_cool.c
jacinto6/sgx_src/eurasia_km/services4/system/omap4/sysutils.c

index 839ab3af23f031df5a8367e3e61c6187bc914e73..4c832683b79e62ce24a6a6c90ce2f78302dbe236 100644 (file)
@@ -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]
index 42da719f0c9137cd2186f069c63fa7261ab1253e..c62bc197ebf3e2bebe02318a7ed281de3f3ebc18 100644 (file)
Binary files a/jacinto6/sgx.tgz and b/jacinto6/sgx.tgz differ
index 11e1238fc7e76ff95ebcb8292b5fa84729ccab15..0285d00d63c77e1cd86cad79c1f6d1fed83225fa 100644 (file)
@@ -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
 
index 9233defd35249ce36d4cc8bcf96c8ee19edc7304..a58eb390a5369806bd594a821f90416f58b92b4e 100644 (file)
  * 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))
index 20baad2a7d55f3f05f8ad9985aed63dcc95cb415..fef97c2339016721386204b5b14906a72bbbba5f 100644 (file)
@@ -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