]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00274056-4 mxc: gpu-viv: add gpu freq throttle
authorAnson Huang <b20788@freescale.com>
Thu, 8 Aug 2013 18:11:30 +0000 (14:11 -0400)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:54:28 +0000 (09:54 +0800)
add gpu freq throttle to protect SOC, when temperature
is too high, lower gpu freq to 4/64, and gpu freq will
restore when SOC cool down.

Acked-by: Jason Liu
Signed-off-by: Anson Huang <b20788@freescale.com>
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c

index 8e7c5e23095268231e75e4d0d27020e6c3dbf0e9..64cb08a0bb039c0c3ca4c9841e649524c3408a7d 100644 (file)
@@ -1,7 +1,7 @@
 /****************************************************************************
 *
 *    Copyright (C) 2005 - 2013 by Vivante Corp.
-*    Copyright (C) 2011-2012 Freescale Semiconductor, Inc.
+*    Copyright (C) 2011-2013 Freescale Semiconductor, Inc.
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
@@ -80,17 +80,14 @@ task_notify_func(struct notifier_block *self, unsigned long val, void *data)
 
 #if gcdENABLE_FSCALE_VAL_ADJUST
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
-static inline int register_thermal_notifier(struct notifier_block *nb)
-{
-       return 0;
-}
-static inline int unregister_thermal_notifier(struct notifier_block *nb)
-{
-       return 0;
-}
+#include <linux/device_cooling.h>
+#define REG_THERMAL_NOTIFIER(a) register_devfreq_cooling_notifier(a);
+#define UNREG_THERMAL_NOTIFIER(a) unregister_devfreq_cooling_notifier(a);
 #else
 extern int register_thermal_notifier(struct notifier_block *nb);
 extern int unregister_thermal_notifier(struct notifier_block *nb);
+#define REG_THERMAL_NOTIFIER(a) register_thermal_notifier(a);
+#define UNREG_THERMAL_NOTIFIER(a) unregister_thermal_notifier(a);
 #endif
 #endif
 
@@ -1153,14 +1150,14 @@ static int __devinit gpu_probe(struct platform_device *pdev)
         platform_set_drvdata(pdev, galDevice);
 
 #if gcdENABLE_FSCALE_VAL_ADJUST
-        if(galDevice->kernels[gcvCORE_MAJOR])
-            register_thermal_notifier(&thermal_hot_pm_notifier);
+        if (galDevice->kernels[gcvCORE_MAJOR])
+            REG_THERMAL_NOTIFIER(&thermal_hot_pm_notifier);
 #endif
         gcmkFOOTER_NO();
         return ret;
     }
 #if gcdENABLE_FSCALE_VAL_ADJUST
-    unregister_thermal_notifier(&thermal_hot_pm_notifier);
+    UNREG_THERMAL_NOTIFIER(&thermal_hot_pm_notifier);
 #endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
        dma_free_attrs(&pdev->dev, pool->size, pool->virt, pool->phys,
@@ -1183,7 +1180,7 @@ static int __devexit gpu_remove(struct platform_device *pdev)
     gcmkHEADER();
 #if gcdENABLE_FSCALE_VAL_ADJUST
     if(galDevice->kernels[gcvCORE_MAJOR])
-        unregister_thermal_notifier(&thermal_hot_pm_notifier);
+        UNREG_THERMAL_NOTIFIER(&thermal_hot_pm_notifier);
 #endif
     drv_exit();
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)