]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00274473-4 mxc: gpu-viv: support regulator on/off
authorAnson Huang <b20788@freescale.com>
Thu, 8 Aug 2013 21:19:08 +0000 (17:19 -0400)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:14 +0000 (10:06 +0200)
Support PU regulator dynamical on/off on kernel v3.10.

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

index 84a3c5e61ed6188dcfb0cba7db4b385fdf68b890..ad6fe9dcfeef55b519dc6b659e76756dcb6cfed0 100644 (file)
@@ -371,6 +371,10 @@ gckGALDEVICE_Construct(
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
     /*get gpu regulator*/
     device->gpu_regulator = regulator_get(pdev, "cpu_vddgpu");
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+    device->gpu_regulator = regulator_get(pdev, "vddpu");
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
     if (IS_ERR(device->gpu_regulator)) {
        gcmkTRACE_ZONE(gcvLEVEL_ERROR, gcvZONE_DRIVER,
                "%s(%d): Failed to get gpu regulator  %s/%s \n",
@@ -1111,7 +1115,7 @@ gckGALDEVICE_Destroy(
             pm_runtime_disable(Device->pmdev);
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
         if (Device->gpu_regulator) {
            regulator_put(Device->gpu_regulator);
            Device->gpu_regulator = NULL;
index 0347a81d76230321850fee5f46af7024c2e92d0f..c5d67884274b469a53efa1ff2e143bcc7e06f671 100644 (file)
@@ -100,7 +100,7 @@ typedef struct _gckGALDEVICE
     struct clk         *clk_2d_axi;
     struct clk         *clk_vg_axi;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
     /*Power management.*/
     struct regulator      *gpu_regulator;
 #endif
index 5366c08ef47a0f55de172ebce5d106088c2f408a..ed374370a9e464a3fe8def06e7ebbde0e45be9c0 100644 (file)
@@ -6854,6 +6854,9 @@ gckOS_SetGPUPower(
     struct clk *clk_2dcore = Os->device->clk_2d_core;
     struct clk *clk_2d_axi = Os->device->clk_2d_axi;
     struct clk *clk_vg_axi = Os->device->clk_vg_axi;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+    int ret;
+#endif
 
     gctBOOL oldClockState = gcvFALSE;
     gctBOOL oldPowerState = gcvFALSE;
@@ -6879,9 +6882,13 @@ gckOS_SetGPUPower(
     }
        if((Power == gcvTRUE) && (oldPowerState == gcvFALSE))
        {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
-        if(!IS_ERR(Os->device->gpu_regulator))
-            regulator_enable(Os->device->gpu_regulator);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+        if(!IS_ERR(Os->device->gpu_regulator)) {
+            ret = regulator_enable(Os->device->gpu_regulator);
+            if (ret != 0)
+                gckOS_Print("%s(%d): fail to enable pu regulator %d!\n",
+                    __FUNCTION__, __LINE__, ret);
+        }
 #else
         imx_gpc_power_up_pu(true);
 #endif
@@ -6996,7 +7003,7 @@ gckOS_SetGPUPower(
                pm_runtime_put_sync(Os->device->pmdev);
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) || LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
         if(!IS_ERR(Os->device->gpu_regulator))
             regulator_disable(Os->device->gpu_regulator);
 #else