gpu: vithar: Enable GPU frequency/voltage scaling
authorAbhilash Kesavan <a.kesavan@samsung.com>
Sun, 22 Jul 2012 05:49:00 +0000 (11:19 +0530)
committerGerrit <chrome-bot@google.com>
Mon, 27 Aug 2012 19:42:53 +0000 (12:42 -0700)
Enable support for GPU DVFS; it supports the following frequencies:
533, 450, 400, 266, 160, 100 MHz.

BUG=chrome-os-partner:11795
TEST=Build and boot Snow. Check voltage variation when the
GPU DVFS is functioning.
Build with MALI_DVFS_DEBUG define enabled, boot and check
GPU DVFS debug prints

Change-Id: Ifd4ea158e12ff15285529808e590196ec88fe776
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
[dianders removed unneeded CSTD_UNUSED]
Reviewed-on: https://gerrit.chromium.org/gerrit/27976
Reviewed-by: Prashanth Godrehal <prashanth.g@samsung.com>
Tested-by: Arjun.K.V <arjun.kv@samsung.com>
Reviewed-by: Sam Leffler <sleffler@chromium.org>
drivers/gpu/arm/t6xx/kbase/src/common/mali_kbase_pm.h
drivers/gpu/arm/t6xx/kbase/src/common/mali_kbase_pm_metrics.c
drivers/gpu/arm/t6xx/kbase/src/linux/config/tpip/mali_kbase_config_exynos5.c

index 6c98e07..d1926f8 100644 (file)
@@ -876,4 +876,20 @@ void kbase_pm_request_l2_caches(struct kbase_device *kbdev);
  */
 void kbase_pm_release_l2_caches(struct kbase_device *kbdev);
 
+/** Queue mali_dvfs_work which performs GPU voltage/frequency scaling in mali_dvfs_event_proc
+ *
+ * @param kbdev    The kbase device structure for the device (must be a valid pointer)
+ *
+ * @return MALI_TRUE on success (currently no error handling present)
+ */
+int kbase_platform_dvfs_event(struct kbase_device *kbdev);
+
+/**  Get the GPU utilisation. Used to determine if the frequency/voltage needs to be scaled.
+ *
+ * @param kbdev    The kbase device structure for the device (must be a valid pointer)
+ *
+ * @return The current GPU utilisation
+ */
+int kbase_pm_get_dvfs_utilisation(struct kbase_device *kbdev);
+
 #endif /* _KBASE_PM_H_ */
index c2391aa..20b0adc 100644 (file)
@@ -37,18 +37,7 @@ static void dvfs_callback(void *data)
        OSK_ASSERT(data != NULL);
 
        kbdev = (kbase_device*)data;
-       action = kbase_pm_get_dvfs_action(kbdev);
-
-       switch(action) {
-               case KBASE_PM_DVFS_NOP:
-                       break;
-               case KBASE_PM_DVFS_CLOCK_UP:
-                       /* Do whatever is required to increase the clock frequency */
-                       break;
-               case KBASE_PM_DVFS_CLOCK_DOWN:
-                       /* Do whatever is required to decrease the clock frequency */
-                       break;
-       }
+       kbase_platform_dvfs_event(kbdev);
 
        osk_spinlock_irq_lock(&kbdev->pm.metrics.lock);
        if (kbdev->pm.metrics.timer_active)
index 8401a6b..8ac02c7 100644 (file)
@@ -86,9 +86,7 @@ void kbase_platform_dvfs_set_clock(kbase_device *kbdev, int freq);
 #ifdef CONFIG_T6XX_DVFS
 int kbase_platform_dvfs_init(kbase_device *kbdev);
 void kbase_platform_dvfs_term(void);
-int kbase_platform_dvfs_event(kbase_device *kbdev, u32 utilisation);
 int kbase_platform_dvfs_get_control_status(void);
-int kbase_pm_get_dvfs_utilisation(kbase_device *kbdev);
 #ifdef CONFIG_T6XX_DVFS_FREQ_LOCK
 static int mali_get_dvfs_upper_locked_freq(void);
 static int mali_get_dvfs_under_locked_freq(void);
@@ -1543,8 +1541,11 @@ static void mali_dvfs_event_proc(struct work_struct *w)
 
 static DECLARE_WORK(mali_dvfs_work, mali_dvfs_event_proc);
 
-int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation)
+int kbase_platform_dvfs_event(struct kbase_device *kbdev)
 {
+#ifdef CONFIG_T6XX_DVFS
+       int utilisation = kbase_pm_get_dvfs_utilisation(kbdev);
+
        trace_mali_dvfs_event(utilisation);
 
        osk_spinlock_lock(&mali_dvfs_spinlock);
@@ -1554,6 +1555,9 @@ int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation)
 
        /*add error handle here*/
        return MALI_TRUE;
+#else
+       return MALI_FALSE;
+#endif
 }
 
 int kbase_platform_dvfs_get_control_status(void)
@@ -1804,7 +1808,7 @@ void kbase_platform_dvfs_set_clock(kbase_device *kbdev, int freq)
  * instead of:
  *    action = kbase_pm_get_dvfs_action(kbdev);
  * use this:
- *    kbase_platform_dvfs_event(kbdev, kbase_pm_get_dvfs_utilisation(kbdev));
+ *    kbase_platform_dvfs_event(kbdev);
  */
 
 #ifdef CONFIG_T6XX_DVFS