]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00221197-2 Update gpu driver to check Soc temperature
authorLoren HUANG <b02279@freescale.com>
Fri, 24 Aug 2012 02:05:30 +0000 (10:05 +0800)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:12:51 +0000 (14:12 +0200)
-Update gpu driver to check the SoC temperature, if the thermal_hot flag
is set by thermal driver. GPU3D clock will be slown down to the minimum
 value, the clock will be recovery when the flag is cleared by thermal driver.
-This patch depends on ENGR00220848, without it, kernel build can't pass.

Signed-off-by: Loren HUANG <b02279@freescale.com>
Acked-by: Lily Zhang
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c

index 8cf0509cfd9236b38be2a951e720ae5ebd2d96f8..e05a143f41c366804e8fc514a6e01e8836216acc 100644 (file)
@@ -30,6 +30,9 @@
 
 #define _GC_OBJ_ZONE            gcvZONE_COMMAND
 
+#if gcdENABLE_FSCALE_VAL_ADJUST
+extern int thermal_hot;
+#endif
 /******************************************************************************\
 ********************************* Support Code *********************************
 \******************************************************************************/
@@ -1080,6 +1083,24 @@ gckCOMMAND_Commit(
     /* Extract the gckHARDWARE and gckEVENT objects. */
     hardware = Command->kernel->hardware;
 
+#if gcdENABLE_FSCALE_VAL_ADJUST
+    if(hardware->core == gcvCORE_MAJOR){
+        static gctUINT orgFscale,minFscale,maxFscale;
+        static gctBOOL bAlreadyTooHot = gcvFALSE;
+        if((thermal_hot > 0) && (!bAlreadyTooHot)) {
+            gckHARDWARE_GetFscaleValue(hardware,&orgFscale,&minFscale, &maxFscale);
+            gckHARDWARE_SetFscaleValue(hardware, minFscale);
+            bAlreadyTooHot = gcvTRUE;
+            gckOS_Print("System is too hot. GPU3D will work at %d/64 clock.\n", minFscale);
+        } else if((!(thermal_hot > 0)) && bAlreadyTooHot) {
+            gckHARDWARE_SetFscaleValue(hardware, orgFscale);
+            gckOS_Print("Hot alarm is canceled. GPU3D clock will return to %d/64\n", orgFscale);
+            bAlreadyTooHot = gcvFALSE;
+        }
+
+    }
+#endif
+
     /* Check wehther we need to copy the structures or not. */
     gcmkONERROR(gckOS_QueryNeedCopy(Command->os, ProcessID, &needCopy));