aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c')
-rw-r--r--drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c198
1 files changed, 0 insertions, 198 deletions
diff --git a/drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c b/drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c
deleted file mode 100644
index 5aa875d6895..00000000000
--- a/drivers/gpu/pvr/omap4/sysutils_linux_wqueue_compat.c
+++ /dev/null
@@ -1,198 +0,0 @@
1/**********************************************************************
2 *
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
20 *
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
24 *
25 ******************************************************************************/
26
27#include <linux/version.h>
28#include <linux/clk.h>
29#include <linux/err.h>
30#include <linux/hardirq.h>
31#include <linux/mutex.h>
32
33#include <plat/gpu.h>
34#include <plat/omap-pm.h>
35#include <linux/pm_runtime.h>
36#include <plat/omap_device.h>
37#include "sgxdefs.h"
38#include "services_headers.h"
39#include "sysinfo.h"
40#include "sgxapi_km.h"
41#include "sysconfig.h"
42#include "sgxinfokm.h"
43#include "syslocal.h"
44
45#if !defined(PVR_LINUX_USING_WORKQUEUES)
46#error "PVR_LINUX_USING_WORKQUEUES must be defined"
47#endif
48
49#define ONE_MHZ 1000000
50#define HZ_TO_MHZ(m) ((m) / ONE_MHZ)
51
52#define LDM_DEV struct platform_device
53extern LDM_DEV *gpsPVRLDMDev;
54extern struct gpu_platform_data *gpsSgxPlatformData;
55
56
57#if !defined(NO_HARDWARE)
58
59static struct pm_qos_request_list *qos_request;
60
61#endif
62
63PVRSRV_ERROR SysPowerLockWrap(SYS_DATA unref__ *psSysData)
64{
65 return PVRSRV_OK;
66}
67
68IMG_VOID SysPowerLockUnwrap(SYS_DATA unref__ *psSysData)
69{
70}
71
72IMG_BOOL WrapSystemPowerChange(SYS_SPECIFIC_DATA *psSysSpecData)
73{
74 return IMG_TRUE;
75}
76
77IMG_VOID UnwrapSystemPowerChange(SYS_SPECIFIC_DATA *psSysSpecData)
78{
79}
80
81static inline IMG_UINT32 scale_by_rate(IMG_UINT32 val, IMG_UINT32 rate1, IMG_UINT32 rate2)
82{
83 if (rate1 >= rate2)
84 {
85 return val * (rate1 / rate2);
86 }
87
88 return val / (rate2 / rate1);
89}
90
91static inline IMG_UINT32 scale_prop_to_SGX_clock(IMG_UINT32 val, IMG_UINT32 rate)
92{
93 return scale_by_rate(val, rate, SYS_SGX_CLOCK_SPEED);
94}
95
96static inline IMG_UINT32 scale_inv_prop_to_SGX_clock(IMG_UINT32 val, IMG_UINT32 rate)
97{
98 return scale_by_rate(val, SYS_SGX_CLOCK_SPEED, rate);
99}
100
101IMG_VOID SysGetSGXTimingInformation(SGX_TIMING_INFORMATION *psTimingInfo)
102{
103 IMG_UINT32 rate;
104
105#if defined(NO_HARDWARE)
106 rate = SYS_SGX_CLOCK_SPEED;
107#else
108 PVR_ASSERT(atomic_read(&gpsSysSpecificData->sSGXClocksEnabled) != 0);
109
110 rate = SYS_SGX_CLOCK_SPEED;
111 PVR_ASSERT(rate != 0);
112#endif
113 psTimingInfo->ui32CoreClockSpeed = rate;
114 psTimingInfo->ui32HWRecoveryFreq = scale_prop_to_SGX_clock(SYS_SGX_HWRECOVERY_TIMEOUT_FREQ, rate);
115 psTimingInfo->ui32uKernelFreq = scale_prop_to_SGX_clock(SYS_SGX_PDS_TIMER_FREQ, rate);
116#if defined(SUPPORT_ACTIVE_POWER_MANAGEMENT)
117 psTimingInfo->bEnableActivePM = IMG_TRUE;
118#else
119 psTimingInfo->bEnableActivePM = IMG_FALSE;
120#endif
121 psTimingInfo->ui32ActivePowManLatencyms = SYS_SGX_ACTIVE_POWER_LATENCY_MS;
122}
123
124PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData)
125{
126#if !defined(NO_HARDWARE)
127 SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
128
129 if (atomic_read(&psSysSpecData->sSGXClocksEnabled) != 0)
130 {
131 return PVRSRV_OK;
132 }
133 PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
134
135 pm_runtime_get_sync(&gpsPVRLDMDev->dev);
136 gpsSgxPlatformData->set_max_mpu_wakeup_lat(&qos_request, 0);
137 omap_device_set_rate(&gpsPVRLDMDev->dev,
138 &gpsPVRLDMDev->dev, SYS_SGX_CLOCK_SPEED);
139 atomic_set(&psSysSpecData->sSGXClocksEnabled, 1);
140
141#else
142 PVR_UNREFERENCED_PARAMETER(psSysData);
143#endif
144 return PVRSRV_OK;
145}
146
147
148IMG_VOID DisableSGXClocks(SYS_DATA *psSysData)
149{
150#if !defined(NO_HARDWARE)
151 SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
152
153
154 if (atomic_read(&psSysSpecData->sSGXClocksEnabled) == 0)
155 {
156 return;
157 }
158
159 PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks"));
160
161 pm_runtime_put_sync(&gpsPVRLDMDev->dev);
162 gpsSgxPlatformData->set_max_mpu_wakeup_lat(&qos_request, -1);
163 omap_device_set_rate(&gpsPVRLDMDev->dev, &gpsPVRLDMDev->dev, 0);
164 atomic_set(&psSysSpecData->sSGXClocksEnabled, 0);
165
166#else
167 PVR_UNREFERENCED_PARAMETER(psSysData);
168#endif
169}
170
171PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData)
172{
173 SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
174 PVRSRV_ERROR eError;
175
176 PVR_TRACE(("EnableSystemClocks: Enabling System Clocks"));
177
178 if (!psSysSpecData->bSysClocksOneTimeInit)
179 {
180 mutex_init(&psSysSpecData->sPowerLock);
181
182 atomic_set(&psSysSpecData->sSGXClocksEnabled, 0);
183 psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE;
184 }
185
186 eError = PVRSRV_OK;
187
188 return eError;
189}
190
191IMG_VOID DisableSystemClocks(SYS_DATA *psSysData)
192{
193
194 PVR_TRACE(("DisableSystemClocks: Disabling System Clocks"));
195
196 DisableSGXClocks(psSysData);
197
198}