RK3368 GPU version Rogue M 1.28
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / services / server / include / power.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          Power Management Functions
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Main APIs for power management functions
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 #ifndef POWER_H
44 #define POWER_H
45
46
47 #include "pvrsrv_device.h"
48
49 /*!
50  *****************************************************************************
51  *      Power management
52  *****************************************************************************/
53  
54 typedef struct _PVRSRV_POWER_DEV_TAG_
55 {
56         PFN_PRE_POWER                                   pfnDevicePrePower;
57         PFN_POST_POWER                                  pfnDevicePostPower;
58         PFN_SYS_DEV_PRE_POWER                   pfnSystemPrePower;
59         PFN_SYS_DEV_POST_POWER                  pfnSystemPostPower;
60         PFN_PRE_CLOCKSPEED_CHANGE               pfnPreClockSpeedChange;
61         PFN_POST_CLOCKSPEED_CHANGE              pfnPostClockSpeedChange;
62         PFN_FORCED_IDLE_REQUEST                 pfnForcedIdleRequest;
63         PFN_FORCED_IDLE_CANCEL_REQUEST          pfnForcedIdleCancelRequest;
64         PFN_DUST_COUNT_REQUEST                  pfnDustCountRequest;
65         IMG_HANDLE                                              hDevCookie;
66         IMG_UINT32                                              ui32DeviceIndex;
67         PVRSRV_DEV_POWER_STATE                  eDefaultPowerState;
68         PVRSRV_DEV_POWER_STATE                  eCurrentPowerState;
69         struct _PVRSRV_POWER_DEV_TAG_   *psNext;
70         struct _PVRSRV_POWER_DEV_TAG_   **ppsThis;
71
72 } PVRSRV_POWER_DEV;
73
74 typedef enum _PVRSRV_INIT_SERVER_STATE_
75 {
76         PVRSRV_INIT_SERVER_Unspecified          = -1,   
77         PVRSRV_INIT_SERVER_RUNNING                      = 0,    
78         PVRSRV_INIT_SERVER_RAN                          = 1,    
79         PVRSRV_INIT_SERVER_SUCCESSFUL           = 2,    
80         PVRSRV_INIT_SERVER_NUM                          = 3,    
81         PVRSRV_INIT_SERVER_FORCE_I32 = 0x7fffffff
82
83 } PVRSRV_INIT_SERVER_STATE, *PPVRSRV_INIT_SERVER_STATE;
84
85 typedef IMG_BOOL (*PFN_SYS_DEV_IS_DEFAULT_STATE_OFF)(PVRSRV_POWER_DEV *psPowerDevice);
86
87 IMG_IMPORT
88 IMG_BOOL PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_STATE      eInitServerState);
89
90 IMG_IMPORT
91 PVRSRV_ERROR PVRSRVSetInitServerState(PVRSRV_INIT_SERVER_STATE  eInitServerState, IMG_BOOL bState);
92
93
94
95 IMG_IMPORT PVRSRV_ERROR PVRSRVPowerLock(IMG_VOID);
96 IMG_IMPORT IMG_VOID PVRSRVForcedPowerLock(IMG_VOID);
97 IMG_IMPORT IMG_VOID PVRSRVPowerUnlock(IMG_VOID);
98
99 IMG_BOOL PVRSRVDeviceIsDefaultStateOFF(PVRSRV_POWER_DEV *psPowerDevice);
100
101 IMG_IMPORT
102 PVRSRV_ERROR PVRSRVSetDevicePowerStateKM(IMG_UINT32                             ui32DeviceIndex,
103                                                                                  PVRSRV_DEV_POWER_STATE eNewPowerState,
104                                                                                  IMG_BOOL                               bForced);
105
106 IMG_IMPORT
107 PVRSRV_ERROR PVRSRVSetPowerStateKM (PVRSRV_SYS_POWER_STATE ePVRState, IMG_BOOL bForced);
108
109 /* Type PFN_DC_REGISTER_POWER */
110 IMG_IMPORT
111 PVRSRV_ERROR PVRSRVRegisterPowerDevice(IMG_UINT32                                       ui32DeviceIndex,
112                                                                            PFN_PRE_POWER                                pfnDevicePrePower,
113                                                                            PFN_POST_POWER                               pfnDevicePostPower,
114                                                                            PFN_SYS_DEV_PRE_POWER                pfnSystemPrePower,
115                                                                            PFN_SYS_DEV_POST_POWER               pfnSystemPostPower,
116                                                                            PFN_PRE_CLOCKSPEED_CHANGE    pfnPreClockSpeedChange,
117                                                                            PFN_POST_CLOCKSPEED_CHANGE   pfnPostClockSpeedChange,
118                                                                            PFN_FORCED_IDLE_REQUEST              pfnForcedIdleRequest,
119                                                                            PFN_FORCED_IDLE_CANCEL_REQUEST       pfnForcedIdleCancelRequest,
120                                                                            PFN_DUST_COUNT_REQUEST       pfnDustCountRequest,
121                                                                            IMG_HANDLE                                   hDevCookie,
122                                                                            PVRSRV_DEV_POWER_STATE               eCurrentPowerState,
123                                                                            PVRSRV_DEV_POWER_STATE               eDefaultPowerState);
124
125 IMG_IMPORT
126 PVRSRV_ERROR PVRSRVRemovePowerDevice (IMG_UINT32 ui32DeviceIndex);
127
128 IMG_IMPORT
129 PVRSRV_ERROR PVRSRVGetDevicePowerState(IMG_UINT32 ui32DeviceIndex, PPVRSRV_DEV_POWER_STATE pePowerState);
130
131 IMG_IMPORT
132 IMG_BOOL PVRSRVIsDevicePowered(IMG_UINT32 ui32DeviceIndex);
133
134 IMG_IMPORT
135 PVRSRV_ERROR PVRSRVDevicePreClockSpeedChange(IMG_UINT32 ui32DeviceIndex,
136                                                                                          IMG_BOOL       bIdleDevice,
137                                                                                          IMG_VOID       *pvInfo);
138
139 IMG_IMPORT
140 IMG_VOID PVRSRVDevicePostClockSpeedChange(IMG_UINT32    ui32DeviceIndex,
141                                                                                   IMG_BOOL              bIdleDevice,
142                                                                                   IMG_VOID              *pvInfo);
143
144 PVRSRV_ERROR PVRSRVDeviceIdleRequestKM(IMG_BOOL                                 bAllDevices,
145                                         IMG_UINT32                              ui32DeviceIndex,
146                                         PFN_SYS_DEV_IS_DEFAULT_STATE_OFF        pfnCheckIdleReq,
147                                         IMG_BOOL                                bDeviceOffPermitted);
148
149 PVRSRV_ERROR PVRSRVDeviceIdleCancelRequestKM(IMG_BOOL                   bAllDevices,
150                                                 IMG_UINT32              ui32DeviceIndex);
151
152 PVRSRV_ERROR PVRSRVDeviceDustCountChange(IMG_UINT32     ui32DeviceIndex,
153                                                 IMG_UINT32      ui32DustCount);
154
155
156 #endif /* POWER_H */
157
158 /******************************************************************************
159  End of file (power.h)
160 ******************************************************************************/