gpu: update gcdENABLE_AUTO_FREQ
author杜坤明 <dkm@rockchip.com>
Thu, 9 Jun 2011 02:54:52 +0000 (10:54 +0800)
committer杜坤明 <dkm@rockchip.com>
Thu, 9 Jun 2011 02:54:52 +0000 (10:54 +0800)
arch/arm/mach-rk29/board-rk29-ddr3sdk.c
arch/arm/mach-rk29/board-rk29sdk.c
drivers/staging/rk29/vivante/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c [changed mode: 0644->0755]
drivers/staging/rk29/vivante/hal/os/linux/kernel/gc_hal_kernel_driver.c [changed mode: 0644->0755]

index a723e625b37cd5589afd80cfa7bf1957b0ee253f..ddfbfae228130bd27b8b4b0ca23e7fd1f11f9936 100755 (executable)
@@ -1258,6 +1258,8 @@ static struct platform_device rk29sdk_rfkill = {
 
 
 #ifdef CONFIG_VIVANTE
+#define GPU_HIGH_CLOCK        552
+#define GPU_LOW_CLOCK         300
 static struct resource resources_gpu[] = {
     [0] = {
                .name   = "gpu_irq",
@@ -1266,17 +1268,23 @@ static struct resource resources_gpu[] = {
         .flags  = IORESOURCE_IRQ,
     },
     [1] = {
-               .name = "gpu_base",
+               .name   = "gpu_base",
         .start  = RK29_GPU_PHYS,
         .end    = RK29_GPU_PHYS + RK29_GPU_SIZE,
         .flags  = IORESOURCE_MEM,
     },
     [2] = {
-               .name = "gpu_mem",
+               .name   = "gpu_mem",
         .start  = PMEM_GPU_BASE,
         .end    = PMEM_GPU_BASE + PMEM_GPU_SIZE,
         .flags  = IORESOURCE_MEM,
     },
+    [3] = {
+               .name   = "gpu_clk",
+        .start         = GPU_LOW_CLOCK,
+        .end    = GPU_HIGH_CLOCK,
+        .flags  = IORESOURCE_IO,
+    },
 };
 static struct platform_device rk29_device_gpu = {
     .name             = "galcore",
@@ -1285,6 +1293,7 @@ static struct platform_device rk29_device_gpu = {
     .resource         = resources_gpu,
 };
 #endif
+
 #ifdef CONFIG_KEYS_RK29
 extern struct rk29_keys_platform_data rk29_keys_pdata;
 static struct platform_device rk29_device_keys = {
index 57bd9012399090159ad793a795de794f7c1fb488..8369793f73bf7199bc6988566343dbc20e4de082 100755 (executable)
@@ -1264,6 +1264,8 @@ static struct platform_device rk29sdk_rfkill = {
 
 
 #ifdef CONFIG_VIVANTE
+#define GPU_HIGH_CLOCK        552
+#define GPU_LOW_CLOCK         300
 static struct resource resources_gpu[] = {
     [0] = {
                .name   = "gpu_irq",
@@ -1272,17 +1274,23 @@ static struct resource resources_gpu[] = {
         .flags  = IORESOURCE_IRQ,
     },
     [1] = {
-               .name = "gpu_base",
+               .name   = "gpu_base",
         .start  = RK29_GPU_PHYS,
         .end    = RK29_GPU_PHYS + RK29_GPU_SIZE,
         .flags  = IORESOURCE_MEM,
     },
     [2] = {
-               .name = "gpu_mem",
+               .name   = "gpu_mem",
         .start  = PMEM_GPU_BASE,
         .end    = PMEM_GPU_BASE + PMEM_GPU_SIZE,
         .flags  = IORESOURCE_MEM,
     },
+    [3] = {
+               .name   = "gpu_clk",
+        .start         = GPU_LOW_CLOCK,
+        .end    = GPU_HIGH_CLOCK,
+        .flags  = IORESOURCE_IO,
+    },
 };
 static struct platform_device rk29_device_gpu = {
     .name             = "galcore",
@@ -1291,6 +1299,7 @@ static struct platform_device rk29_device_gpu = {
     .resource         = resources_gpu,
 };
 #endif
+
 #ifdef CONFIG_KEYS_RK29
 extern struct rk29_keys_platform_data rk29_keys_pdata;
 static struct platform_device rk29_device_keys = {
old mode 100644 (file)
new mode 100755 (executable)
index 9bfaa9a..bb7c3d1
@@ -96,18 +96,21 @@ inline void cal_run_idle(gceCHIPPOWERSTATE State)
 gceCHIPPOWERSTATE lastState = gcvPOWER_IDLE;
 int lasthighfreq = 0;
 extern int needhighfreq;
+extern int lowfreq;
+extern int highfreq;
 struct clk *clk_gpu = NULL;
 inline void get_idle_change(gceCHIPPOWERSTATE State)
 {
     if(gcvPOWER_ON!=lastState && gcvPOWER_ON==State)  //gcvPOWER_IDLE->gcvPOWER_ON
     {
         if(lasthighfreq != needhighfreq) {
-            int gpufreq = needhighfreq ? 552 : 360;
+            int gpufreq = needhighfreq ? highfreq : lowfreq;
+            if(gpufreq<24)      gpufreq = 24;
+            if(gpufreq>600)     gpufreq = 600;
+            
             clk_gpu = clk_get(NULL, "gpu");
-            clk_set_parent(clk_gpu, clk_get(NULL, "general_pll"));
-            clk_set_rate(clk_get(NULL, "codec_pll"), gpufreq*1000000);
             clk_set_rate(clk_gpu, gpufreq*1000000);
-            clk_set_parent(clk_gpu, clk_get(NULL, "codec_pll"));
+            
             lasthighfreq = needhighfreq;
             
             printk("gpu: change freq to %d \n", gpufreq); 
old mode 100644 (file)
new mode 100755 (executable)
index 0e0fd06..4a2b195
@@ -244,6 +244,8 @@ void gputimer_callback(unsigned long arg)
 #include <linux/timer.h>
 struct timer_list gpu_timer;
 int needhighfreq = 0;
+int lowfreq = 300;
+int highfreq = 552;
 void mod_gpu_timer(void)
 {
     mod_timer(&gpu_timer, jiffies + 3*HZ);
@@ -1042,14 +1044,14 @@ static int __devinit gpu_probe(struct platform_device *pdev)
 {
        int ret = -ENODEV;
        struct resource *res;
-       res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,"gpu_irq");
+       res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "gpu_irq");
        if (!res) {
                printk(KERN_ERR "%s: No irq line supplied.\n",__FUNCTION__);
                goto gpu_probe_fail;
        }
        irqLine = res->start;
 
-       res = platform_get_resource_byname(pdev, IORESOURCE_MEM,"gpu_base");
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpu_base");
        if (!res) {
                printk(KERN_ERR "%s: No register base supplied.\n",__FUNCTION__);
                goto gpu_probe_fail;
@@ -1058,7 +1060,7 @@ static int __devinit gpu_probe(struct platform_device *pdev)
     // dkm: ²»ÄÜ+1
        registerMemSize = res->end - res->start;
 
-       res = platform_get_resource_byname(pdev, IORESOURCE_MEM,"gpu_mem");
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpu_mem");
        if (!res) {
                printk(KERN_ERR "%s: No memory base supplied.\n",__FUNCTION__);
                goto gpu_probe_fail;
@@ -1067,6 +1069,18 @@ static int __devinit gpu_probe(struct platform_device *pdev)
     // dkm: ²»ÄÜ+1
        contiguousSize  = res->end - res->start;
 
+       res = platform_get_resource_byname(pdev, IORESOURCE_IO, "gpu_clk");
+       if (!res) {
+               printk(KERN_ERR "%s: No gpu clk supplied, use default!\n", __FUNCTION__);
+       } else {
+           coreClock = res->end * 1000000;
+// dkm: gcdENABLE_AUTO_FREQ
+#if (2==gcdENABLE_AUTO_FREQ)
+        lowfreq = res->start;
+        highfreq = res->end;
+#endif
+    }
+
 // dkm: gcdENABLE_AUTO_FREQ
 #if (1==gcdENABLE_AUTO_FREQ)
     init_timer(&gpu_timer);