RK3368 GPU: Rogue N Init.
[firefly-linux-kernel-4.4.55.git] / drivers / staging / imgtec / rogue / rgxtimecorr.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          RGX time correlation and calibration header file
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Header for the RGX time correlation and calibration routines
6 @License        Dual MIT/GPLv2
7
8 The contents of this file are subject to the MIT license as set out below.
9
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
23
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
31
32 This License is also included in this distribution in the file called
33 "MIT-COPYING".
34
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
43
44 #if !defined(__RGXTIMECORR_H__)
45 #define __RGXTIMECORR_H__
46
47 #include "img_types.h"
48 #include "device.h"
49
50 typedef enum {
51     RGXTIMECORR_CLOCK_MONO,
52     RGXTIMECORR_CLOCK_MONO_RAW,
53     RGXTIMECORR_CLOCK_SCHED,
54
55     RGXTIMECORR_CLOCK_LAST
56 } RGXTIMECORR_CLOCK_TYPE;
57
58 /*!
59 ******************************************************************************
60
61  @Function    RGXGPUFreqCalibratePrePowerOff
62
63  @Description Manage GPU frequency and timer correlation data
64               before a power off.
65
66  @Input       hDevHandle : RGX Device Node
67
68  @Return      void
69
70 ******************************************************************************/
71 void RGXGPUFreqCalibratePrePowerOff(IMG_HANDLE hDevHandle);
72
73 /*!
74 ******************************************************************************
75
76  @Function    RGXGPUFreqCalibratePostPowerOn
77
78  @Description Manage GPU frequency and timer correlation data
79               after a power on.
80
81  @Input       hDevHandle : RGX Device Node
82
83  @Return      void
84
85 ******************************************************************************/
86 void RGXGPUFreqCalibratePostPowerOn(IMG_HANDLE hDevHandle);
87
88 /*!
89 ******************************************************************************
90
91  @Function    RGXGPUFreqCalibratePreClockSpeedChange
92
93  @Description Manage GPU frequency and timer correlation data
94               before a DVFS transition.
95
96  @Input       hDevHandle : RGX Device Node
97
98  @Return      void
99
100 ******************************************************************************/
101 void RGXGPUFreqCalibratePreClockSpeedChange(IMG_HANDLE hDevHandle);
102
103 /*!
104 ******************************************************************************
105
106  @Function    RGXGPUFreqCalibratePostClockSpeedChange
107
108  @Description Manage GPU frequency and timer correlation data
109               after a DVFS transition.
110
111  @Input       hDevHandle        : RGX Device Node
112  @Input       ui32NewClockSpeed : GPU clock speed after the DVFS transition
113
114  @Return      IMG_UINT32 : Calibrated GPU clock speed after the DVFS transition
115
116 ******************************************************************************/
117 IMG_UINT32 RGXGPUFreqCalibratePostClockSpeedChange(IMG_HANDLE hDevHandle, IMG_UINT32 ui32NewClockSpeed);
118
119 /*!
120 ******************************************************************************
121
122  @Function    RGXGPUFreqCalibratePeriodic
123
124  @Description Calibrate the GPU clock speed and correlate the timers
125               at regular intervals.
126
127  @Input       hDevHandle : RGX Device Node
128
129  @Return      void
130
131 ******************************************************************************/
132 void RGXGPUFreqCalibrateCorrelatePeriodic(IMG_HANDLE hDevHandle);
133
134 /*!
135 ******************************************************************************
136
137  @Function    RGXGPUFreqCalibrateClockns64
138
139  @Description Returns value of currently selected clock (in ns).
140
141  @Return      clock value from currently selected clock source
142
143 ******************************************************************************/
144 IMG_UINT64 RGXGPUFreqCalibrateClockns64(void);
145
146 /*!
147 ******************************************************************************
148
149  @Function    RGXGPUFreqCalibrateClockns64
150
151  @Description Returns value of currently selected clock (in us).
152
153  @Return      clock value from currently selected clock source
154
155 ******************************************************************************/
156 IMG_UINT64 RGXGPUFreqCalibrateClockus64(void);
157
158 /*!
159 ******************************************************************************
160
161  @Function    RGXGPUFreqCalibrateClockSource
162
163  @Description Returns currently selected clock source
164
165  @Return      clock source type
166
167 ******************************************************************************/
168 RGXTIMECORR_CLOCK_TYPE RGXGPUFreqCalibrateGetClockSource(void);
169
170 /*!
171 ******************************************************************************
172
173  @Function    RGXGPUFreqCalibrateSetClockSource
174
175  @Description Sets clock source for correlation data.
176
177  @Input       psDeviceNode : RGX Device Node
178  @Input       eClockType : clock source type
179
180  @Return      error code
181
182 ******************************************************************************/
183 PVRSRV_ERROR RGXGPUFreqCalibrateSetClockSource(PVRSRV_DEVICE_NODE *psDeviceNode,
184                                              RGXTIMECORR_CLOCK_TYPE eClockType);
185
186 void RGXGPUFreqCalibrationInitAppHintCallbacks(
187                                         const PVRSRV_DEVICE_NODE *psDeviceNode);
188
189 #endif /* __RGXTIMECORR_H__ */