20100903+0m5
[sgx.git] / pvr / power.h
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 #ifndef POWER_H
28 #define POWER_H
29
30 struct PVRSRV_POWER_DEV {
31         enum PVRSRV_ERROR (*pfnPrePower)(void *, enum PVR_POWER_STATE,
32                               enum PVR_POWER_STATE);
33         enum PVRSRV_ERROR (*pfnPostPower)(void *, enum PVR_POWER_STATE,
34                                enum PVR_POWER_STATE);
35         enum PVRSRV_ERROR (*pfnPreClockSpeedChange)(void *, IMG_BOOL,
36                                           enum PVR_POWER_STATE);
37         enum PVRSRV_ERROR (*pfnPostClockSpeedChange)(void *, IMG_BOOL,
38                                            enum PVR_POWER_STATE);
39         void *hDevCookie;
40         u32 ui32DeviceIndex;
41         enum PVR_POWER_STATE eDefaultPowerState;
42         enum PVR_POWER_STATE eCurrentPowerState;
43         struct PVRSRV_POWER_DEV *psNext;
44
45 };
46
47 enum PVRSRV_INIT_SERVER_STATE {
48         PVRSRV_INIT_SERVER_Unspecified = -1,
49         PVRSRV_INIT_SERVER_RUNNING = 0,
50         PVRSRV_INIT_SERVER_RAN = 1,
51         PVRSRV_INIT_SERVER_SUCCESSFUL = 2,
52         PVRSRV_INIT_SERVER_NUM = 3,
53         PVRSRV_INIT_SERVER_FORCE_I32 = 0x7fffffff
54 };
55
56 IMG_BOOL PVRSRVGetInitServerState(enum PVRSRV_INIT_SERVER_STATE
57                 eInitServerState);
58
59 enum PVRSRV_ERROR PVRSRVSetInitServerState(enum PVRSRV_INIT_SERVER_STATE
60                 eInitServerState,
61                 IMG_BOOL bState);
62
63 enum PVRSRV_ERROR PVRSRVPowerLock(u32 ui32CallerID,
64                 IMG_BOOL bSystemPowerEvent);
65 void PVRSRVPowerUnlock(u32 ui32CallerID);
66 void PVRSRVDvfsLock(void);
67 void PVRSRVDvfsUnlock(void);
68
69 enum PVRSRV_ERROR PVRSRVSetDevicePowerStateKM(u32 ui32DeviceIndex,
70                 enum PVR_POWER_STATE eNewPowerState, u32 ui32CallerID,
71                 IMG_BOOL bRetainMutex);
72
73 enum PVRSRV_ERROR PVRSRVSystemPrePowerStateKM(
74                 enum PVR_POWER_STATE eNewPowerState);
75 enum PVRSRV_ERROR PVRSRVSystemPostPowerStateKM(
76                 enum PVR_POWER_STATE eNewPowerState);
77
78 enum PVRSRV_ERROR PVRSRVSetPowerStateKM(enum PVR_POWER_STATE ePVRState);
79
80 enum PVRSRV_ERROR PVRSRVRegisterPowerDevice(u32 ui32DeviceIndex,
81                 enum PVRSRV_ERROR (*pfnPrePower)(void *, enum PVR_POWER_STATE,
82                                             enum PVR_POWER_STATE),
83                 enum PVRSRV_ERROR (*pfnPostPower)(void *, enum PVR_POWER_STATE,
84                                              enum PVR_POWER_STATE),
85                 enum PVRSRV_ERROR (*pfnPreClockSpeedChange)(void *, IMG_BOOL,
86                                                        enum PVR_POWER_STATE),
87                 enum PVRSRV_ERROR (*pfnPostClockSpeedChange)(void *, IMG_BOOL,
88                                                         enum PVR_POWER_STATE),
89                 void *hDevCookie, enum PVR_POWER_STATE eCurrentPowerState,
90                 enum PVR_POWER_STATE eDefaultPowerState);
91
92 enum PVRSRV_ERROR PVRSRVRemovePowerDevice(u32 ui32DeviceIndex);
93
94 IMG_BOOL PVRSRVIsDevicePowered(u32 ui32DeviceIndex);
95
96 enum PVRSRV_ERROR PVRSRVDevicePreClockSpeedChange(u32 ui32DeviceIndex,
97                 IMG_BOOL bIdleDevice,
98                 void *pvInfo);
99
100 void PVRSRVDevicePostClockSpeedChange(u32 ui32DeviceIndex,
101                 IMG_BOOL bIdleDevice,
102                 void *pvInfo);
103
104 #endif