1 /*************************************************************************/ /*!
3 @Title System level interface for DVFS
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description This file defined the API between services and system layer
6 required for Ion integration.
7 @License Dual MIT/GPLv2
9 The contents of this file are subject to the MIT license as set out below.
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is
16 furnished to do so, subject to the following conditions:
18 The above copyright notice and this permission notice shall be included in
19 all copies or substantial portions of the Software.
21 Alternatively, the contents of this file may be used under the terms of
22 the GNU General Public License Version 2 ("GPL") in which case the provisions
23 of GPL are applicable instead of those above.
25 If you wish to allow use of your version of this file only under the terms of
26 GPL, and not to allow others to use your version of this file under the terms
27 of the MIT license, indicate your decision by deleting the provisions above
28 and replace them with the notice and other provisions required by GPL as set
29 out in the file called "GPL-COPYING" included in this distribution. If you do
30 not delete the provisions above, a recipient may use your version of this file
31 under the terms of either the MIT license or GPL.
33 This License is also included in this distribution in the file called
36 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
37 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
38 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
39 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
40 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
41 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
42 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 */ /**************************************************************************/
48 #include "pvrsrv_error.h"
49 #include "img_types.h"
51 typedef IMG_VOID (*PFN_SYS_DEV_DVFS_SET_FREQUENCY)(IMG_UINT32 ui64Freq);
52 typedef IMG_VOID (*PFN_SYS_DEV_DVFS_SET_VOLTAGE)(IMG_UINT32 ui64Volt);
54 typedef struct _IMG_OPP_
60 typedef const IMG_OPP* IMG_OPP_TABLE;
62 typedef struct _IMG_DVFS_GOVERNOR_CFG_
64 IMG_UINT32 ui32UpThreshold;
65 IMG_UINT32 ui32DownDifferential;
66 } IMG_DVFS_GOVERNOR_CFG;
68 typedef struct _IMG_DVFS_DEVICE_CFG_
70 IMG_OPP_TABLE pasOPPTable;
71 IMG_UINT32 ui32OPPTableSize;
73 IMG_UINT32 ui32FreqMin;
74 IMG_UINT32 ui32FreqMax;
75 IMG_UINT32 ui32PollMs;
78 PFN_SYS_DEV_DVFS_SET_FREQUENCY pfnSetFrequency;
79 PFN_SYS_DEV_DVFS_SET_VOLTAGE pfnSetVoltage;
80 } IMG_DVFS_DEVICE_CFG;
82 typedef struct _IMG_DVFS_GOVERNOR_
87 #if defined(__linux__)
88 typedef struct _IMG_DVFS_DEVICE_
91 struct dev_pm_opp *psOPP;
92 struct devfreq *psDevFreq;
94 IMG_HANDLE hGpuUtilUserDVFS;
97 typedef struct _IMG_POWER_AVG_
100 IMG_UINT32 ui32Samples;
103 typedef struct _IMG_DVFS_PA_
105 IMG_UINT32 ui32AllocatedPower;
106 IMG_UINT32 *aui32ConversionTable;
109 IMG_UINT64 ui64StartTime;
110 IMG_UINT32 ui32Energy;
112 struct power_actor *psPowerActor;
113 IMG_POWER_AVG sPowerAvg;
116 typedef struct _IMG_DVFS_PA_CFG_
118 /* Coefficients for a curve defining power leakage due to temperature */
119 IMG_INT32 i32Ta; /* t^3 */
120 IMG_INT32 i32Tb; /* t^2 */
121 IMG_INT32 i32Tc; /* t^1 */
122 IMG_INT32 i32Td; /* const */
124 IMG_UINT32 ui32Other; /* Static losses unrelated to GPU */
125 IMG_UINT32 ui32Weight; /* Power actor weight */
128 typedef struct _IMG_DVFS_
130 IMG_DVFS_DEVICE sDVFSDevice;
131 IMG_DVFS_GOVERNOR sDVFSGovernor;
132 IMG_DVFS_DEVICE_CFG sDVFSDeviceCfg;
133 IMG_DVFS_GOVERNOR_CFG sDVFSGovernorCfg;
134 #if defined(PVR_POWER_ACTOR)
136 IMG_DVFS_PA_CFG sDVFSPACfg;
139 #endif/* (__linux__) */
141 #endif /* _PVR_DVFS_H_ */