From: Anson Huang Date: Thu, 8 Aug 2013 21:19:08 +0000 (-0400) Subject: ENGR00274473-4 mxc: gpu-viv: support regulator on/off X-Git-Tag: KARO-TX6-2014-07-10~318 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3a917537a33cac22555e069233ea9e3eb2b80ca1;p=karo-tx-linux.git ENGR00274473-4 mxc: gpu-viv: support regulator on/off Support PU regulator dynamical on/off on kernel v3.10. Acked-by: Jason Liu Signed-off-by: Anson Huang --- diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c index 84a3c5e61ed6..ad6fe9dcfeef 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c @@ -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; diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h index 0347a81d7623..c5d67884274b 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h @@ -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 diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c index 5366c08ef47a..ed374370a9e4 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c @@ -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