1 /*************************************************************************/ /*!
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
8 The contents of this file are subject to the MIT license as set out below.
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:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
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.
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.
32 This License is also included in this distribution in the file called
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 */ /**************************************************************************/
47 #include "pvrsrv_device.h"
50 *****************************************************************************
52 *****************************************************************************/
54 typedef struct _PVRSRV_POWER_DEV_TAG_
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;
74 typedef enum _PVRSRV_INIT_SERVER_STATE_
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
83 } PVRSRV_INIT_SERVER_STATE, *PPVRSRV_INIT_SERVER_STATE;
85 typedef IMG_BOOL (*PFN_SYS_DEV_IS_DEFAULT_STATE_OFF)(PVRSRV_POWER_DEV *psPowerDevice);
88 IMG_BOOL PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_STATE eInitServerState);
91 PVRSRV_ERROR PVRSRVSetInitServerState(PVRSRV_INIT_SERVER_STATE eInitServerState, IMG_BOOL bState);
95 IMG_IMPORT PVRSRV_ERROR PVRSRVPowerLock(IMG_VOID);
96 IMG_IMPORT IMG_VOID PVRSRVForcedPowerLock(IMG_VOID);
97 IMG_IMPORT IMG_VOID PVRSRVPowerUnlock(IMG_VOID);
99 IMG_BOOL PVRSRVDeviceIsDefaultStateOFF(PVRSRV_POWER_DEV *psPowerDevice);
102 PVRSRV_ERROR PVRSRVSetDevicePowerStateKM(IMG_UINT32 ui32DeviceIndex,
103 PVRSRV_DEV_POWER_STATE eNewPowerState,
107 PVRSRV_ERROR PVRSRVSetPowerStateKM (PVRSRV_SYS_POWER_STATE ePVRState, IMG_BOOL bForced);
109 /* Type PFN_DC_REGISTER_POWER */
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);
126 PVRSRV_ERROR PVRSRVRemovePowerDevice (IMG_UINT32 ui32DeviceIndex);
129 PVRSRV_ERROR PVRSRVGetDevicePowerState(IMG_UINT32 ui32DeviceIndex, PPVRSRV_DEV_POWER_STATE pePowerState);
132 IMG_BOOL PVRSRVIsDevicePowered(IMG_UINT32 ui32DeviceIndex);
135 PVRSRV_ERROR PVRSRVDevicePreClockSpeedChange(IMG_UINT32 ui32DeviceIndex,
136 IMG_BOOL bIdleDevice,
140 IMG_VOID PVRSRVDevicePostClockSpeedChange(IMG_UINT32 ui32DeviceIndex,
141 IMG_BOOL bIdleDevice,
144 PVRSRV_ERROR PVRSRVDeviceIdleRequestKM(IMG_BOOL bAllDevices,
145 IMG_UINT32 ui32DeviceIndex,
146 PFN_SYS_DEV_IS_DEFAULT_STATE_OFF pfnCheckIdleReq,
147 IMG_BOOL bDeviceOffPermitted);
149 PVRSRV_ERROR PVRSRVDeviceIdleCancelRequestKM(IMG_BOOL bAllDevices,
150 IMG_UINT32 ui32DeviceIndex);
152 PVRSRV_ERROR PVRSRVDeviceDustCountChange(IMG_UINT32 ui32DeviceIndex,
153 IMG_UINT32 ui32DustCount);
158 /******************************************************************************
159 End of file (power.h)
160 ******************************************************************************/