diff options
| author | Hemant Hariyani <hemanthariyani@ti.com> | 2011-05-31 09:24:59 +0100 |
|---|---|---|
| committer | Andy Green <andy.green@linaro.org> | 2011-05-31 11:06:30 +0100 |
| commit | 7c25862838c4b525102d2dd3f3973d3480f43f63 (patch) | |
| tree | 426bbbb53c713f1fa4361410dddaf4dd33ec4381 /drivers | |
| parent | 790d937b1dccdff0a3ab8fc0b8023727d37872dd (diff) | |
SGX-KM: hwmod and pm_runtime adaptation
Adding pm_runtime and hwmod support. Device registration happens as a
part of omap_device_build in omap_init_gpu (mach-omap2/devices.c) and
is not required here in the driver.
pm_runtime calls are required to enable and disable required clocks.
This patch does not use hwmod base address - a separate patch will
be provided for that.
Signed-off-by: Hemant Hariyani <hemanthariyani@ti.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/pvr/module.c | 45 | ||||
| -rw-r--r-- | drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c | 11 |
2 files changed, 24 insertions, 32 deletions
diff --git a/drivers/gpu/pvr/module.c b/drivers/gpu/pvr/module.c index 43a3a27adae..a4620662e17 100644 --- a/drivers/gpu/pvr/module.c +++ b/drivers/gpu/pvr/module.c @@ -47,6 +47,8 @@ #include <linux/version.h> #include <linux/fs.h> #include <linux/proc_fs.h> +#include <linux/pm_runtime.h> +#include <plat/gpu.h> #if defined(SUPPORT_DRI_DRM) #include <drm/drmP.h> @@ -197,24 +199,9 @@ static LDM_DRV powervr_driver = { .shutdown = PVRSRVDriverShutdown, }; +struct gpu_platform_data *gpsSgxPlatformData; LDM_DEV *gpsPVRLDMDev; -#if defined(MODULE) && defined(PVR_LDM_PLATFORM_MODULE) - -static IMG_VOID PVRSRVDeviceRelease(struct device *pDevice) -{ - PVR_UNREFERENCED_PARAMETER(pDevice); -} - -static struct platform_device powervr_device = { - .name = DEVNAME, - .id = -1, - .dev = { - .release = PVRSRVDeviceRelease - } -}; - -#endif #if defined(PVR_LDM_PLATFORM_MODULE) static IMG_INT PVRSRVDriverProbe(LDM_DEV *pDevice) @@ -234,7 +221,15 @@ static IMG_INT __devinit PVRSRVDriverProbe(LDM_DEV *pDevice, const struct pci_de return -EINVAL; } #endif + + gpsSgxPlatformData = pDevice->dev.platform_data; + if(!gpsSgxPlatformData) + { + PVR_TRACE(("No SGX platform device data.")); + } + pm_runtime_enable(&pDevice->dev); + psSysData = SysAcquireDataNoCheck(); if ( psSysData == IMG_NULL) { @@ -273,6 +268,8 @@ static IMG_VOID __devexit PVRSRVDriverRemove(LDM_DEV *pDevice) } #endif (IMG_VOID)SysDeinitialise(psSysData); + + pm_runtime_disable(&pDevice->dev); gpsPVRLDMDev = IMG_NULL; @@ -544,16 +541,6 @@ static IMG_INT __init PVRCore_Init(IMG_VOID) goto init_failed; } -#if defined(MODULE) - if ((error = platform_device_register(&powervr_device)) != 0) - { - platform_driver_unregister(&powervr_driver); - - PVR_DPF((PVR_DBG_ERROR, "PVRCore_Init: unable to register platform device (%d)", error)); - - goto init_failed; - } -#endif #endif #if defined(PVR_LDM_PCI_MODULE) @@ -636,9 +623,6 @@ sys_deinit: #endif #if defined (PVR_LDM_PLATFORM_MODULE) -#if defined (MODULE) - platform_device_unregister(&powervr_device); -#endif platform_driver_unregister(&powervr_driver); #endif @@ -705,9 +689,6 @@ static IMG_VOID __exit PVRCore_Cleanup(IMG_VOID) #endif #if defined (PVR_LDM_PLATFORM_MODULE) -#if defined (MODULE) - platform_device_unregister(&powervr_device); -#endif platform_driver_unregister(&powervr_driver); #endif diff --git a/drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c b/drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c index fa0cc696f80..6d9687a648c 100644 --- a/drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c +++ b/drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c @@ -30,6 +30,9 @@ #include <linux/hardirq.h> #include <linux/mutex.h> +#include <plat/gpu.h> +#include <plat/omap-pm.h> +#include <linux/pm_runtime.h> #include "sgxdefs.h" #include "services_headers.h" #include "sysinfo.h" @@ -45,6 +48,11 @@ #define ONE_MHZ 1000000 #define HZ_TO_MHZ(m) ((m) / ONE_MHZ) +#define LDM_DEV struct platform_device +extern LDM_DEV *gpsPVRLDMDev; +extern struct gpu_platform_data *gpsSgxPlatformData; + + #if defined(SUPPORT_OMAP3430_SGXFCLK_96M) #define SGX_PARENT_CLOCK "cm_96m_fck" #else @@ -124,6 +132,7 @@ PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData) PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks")); + pm_runtime_get_sync(&gpsPVRLDMDev->dev); atomic_set(&psSysSpecData->sSGXClocksEnabled, 1); @@ -147,6 +156,8 @@ IMG_VOID DisableSGXClocks(SYS_DATA *psSysData) PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks")); + pm_runtime_put_sync(&gpsPVRLDMDev->dev); + atomic_set(&psSysSpecData->sSGXClocksEnabled, 0); #else |
