a0759e68bc47e720f3190a287ff7b6be79d66213
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-tiger / deepsleep_drvapi.h
1 /******************************************************************************
2  ** File Name:      deepsleep_drvapi.h                                               *
3  ** Author:         Richard Yang                                              *
4  ** DATE:           08/25/2003                                                *
5  ** Copyright:      2003 Spreatrum, Incoporated. All Rights Reserved.         *
6  ** Description:    This file defines the basic operation interfaces of       *
7  **                 DSP and MCU for deep sleep.                               *
8  ******************************************************************************
9
10  ******************************************************************************
11  **                        Edit History                                       *
12  ** ------------------------------------------------------------------------- *
13  ** DATE           NAME             DESCRIPTION                               *
14  ** 08/25/2003     Richard.Yang     Create.                                   *
15  ******************************************************************************/
16 #ifndef _DEEPSLEEP_DRVAPI_H_
17 #define _DEEPSLEEP_DRVAPI_H_
18
19 /**---------------------------------------------------------------------------*
20  **                         Dependencies                                      *
21  **---------------------------------------------------------------------------*/
22
23 /**---------------------------------------------------------------------------*
24  **                         Compiler Flag                                     *
25  **---------------------------------------------------------------------------*/
26 #ifdef   __cplusplus
27 extern   "C"
28 {
29 #endif
30
31 /**---------------------------------------------------------------------------*
32  **                         Constant Variables                                *
33  **---------------------------------------------------------------------------*/
34 #define ENABLE_DEEP_SLEEP       1
35 #define DISABLE_DEEP_SLEEP      0
36
37 #define ENABLE_AHB_SLEEP        1
38 #define DISABLE_AHB_SLEEP       0
39
40 typedef enum
41 {
42     UART0_E = 0,
43     UART1_E,
44     UART2_E,
45     UART3_E,
46     UART_MAX
47 }
48 UART_PORT_ID_E;
49
50 typedef enum
51 {
52     DISABLE_APB_SLEEP = 0,
53     ENABLE_APB_SLEEP
54 } UART_DSLP_CTRL_E;
55 /**---------------------------------------------------------------------------*
56  **                         Function Definitions                              *
57  **---------------------------------------------------------------------------*/
58 PUBLIC void SCI_UPM_EnableDeepSleep (uint32 mode);
59 PUBLIC void SLEEP_Init (void);
60 //@CR97469 jiexia.yu add to protect DMA transfer when in deepsleep
61 PUBLIC void SCI_DMA_EnableDeepSleep (uint32 mode);
62 //@CR97469 end
63 PUBLIC void DPSLP_PWM_EnableApbSleep (PWM_PORT_ID_E port_id, uint32 mode);
64 /*****************************************************************************/
65 //  Description:    This function is used to config the apb clk request of uart.
66 //  Author:         Zhengjiang.Lei
67 //  Note:
68 //****************************************************************************/
69 PUBLIC void DPSLP_UART_EnableApbSleep(
70         UART_PORT_ID_E port_id, 
71         uint32 mode
72         );
73 // Enable Audio deep sleep
74 PUBLIC void SCI_AUD_EnableDeepSleep (uint32 mode);
75 /*****************************************************************************/
76 //  Description:    This function is dsp fiq handler
77 //  Author:
78 //  Note:
79 //****************************************************************************/
80 PUBLIC void DSP_FiqHandler (
81     uint32 fiq_num      // fiq number
82 );
83
84 uint32 SLEEP_GetAHBModuleStatus (void);
85 uint32 SLEEP_GetAPBModuleStatus (void);
86
87
88 PUBLIC void SCI_TPC_EnableDeepSleep (uint32 mode);
89
90 // Enable MMI deep sleep
91
92 #if defined(PLATFORM_SC6600L) || defined(PLATFORM_SC6800H)
93 // Enable LCD backlight brightless deep sleep.
94 // For the brightless is controlled by PWM, if enter deepsleep, the mcu clk stop,
95 // and the PWM also stop.
96 PUBLIC void SCI_LCDBacklightBrightless_EnableDeepSleep (uint32 mode);
97
98 //
99 // Set charge deepsleep mode
100 //
101 PUBLIC void SCI_CHR_EnableDeepSleep (uint32 mode);
102 //enable tv deepsleep
103 PUBLIC void SCI_TV_EnableDeepSleep (uint32 mode);
104 PUBLIC void SCI_MMI_EnableDeepSleep (uint32 mode);
105 // Enable SIM deep sleep
106 PUBLIC void SCI_SIM_EnableDeepSleep (uint32 mode);
107 // Enable Layer1 deeep sleep
108 PUBLIC void SCI_L1_EnableDeepSleep (uint32 mode);
109 // Enable Bluetooth deep sleep
110 PUBLIC void SCI_BT_EnableDeepSleep (uint32 mode);
111 // Get DSP absolute time
112 PUBLIC uint32 SCI_GetDSPAbsoluteTime (void);
113
114 // Init delta time between DSP and MCU
115 PUBLIC void SCI_InitDSPDeltaTime (void);
116
117 // Check if enter deep sleep
118 PUBLIC void SCI_EnterDeepSleep (void);
119
120
121 PUBLIC void DS_CreateAbsoluteTimer (uint32 abs_time);
122
123 PUBLIC void deep_sleep_delay (uint32 count);
124
125 PUBLIC void SCI_PCM_EnableDeepSleep (uint32 mode);
126
127 PUBLIC void SCI_BTCLK_EnableDeepSleep (uint32 mode);
128
129 PUBLIC void SCI_DCAM_EnableDeepSleep (uint32 mode);
130
131 PUBLIC void SCI_Calibration_EnableDeepSleep (uint32 mode);
132
133 PUBLIC void SCI_SDIO_EnableDeepSleep (uint32 mode);
134 PUBLIC void SCI_UPM_EnableDeepSleep (uint32 mode);
135 /*****************************************************************************/
136 //  Description:    This function is used to config the apb clk request of pwm.
137 //  Author:         Younger.Yang
138 //  Note:
139 //****************************************************************************/
140 PUBLIC void DPSLP_Lcdc_EnableAhbSleep (uint32 mode);
141 PUBLIC void DPSLP_MpegEnc_EnableAhbSleep (uint32 mode);
142 PUBLIC void DPSLP_MpegDec_EnableAhbSleep (uint32 mode);
143 PUBLIC void DPSLP_ISP_EnableAhbSleep (uint32 mode);//just used for PLATFORM_SC6800H and PLATFORM_SC8800H
144 PUBLIC void DPSLP_DMA_EnableAhbSleep (uint32 mode);
145 PUBLIC void DPSLP_SetBklight_Sts (BOOLEAN bklight_on);
146
147
148 /*****************************************************************************/
149 // Description :    This function is used to get the val of sleepmode.
150 // Global resource dependence :sleep_mode
151 // Author :         kevin.wang
152 // Note :
153 /*****************************************************************************/
154 PUBLIC uint32 SCI_Getsleepmode (void);
155
156 /*****************************************************************************/
157 // Description :    This function is used to set the flag which indicate if xtl need open in deepsleep
158 // Global resource dependence :s_sleep_xtl_open_cnt
159 // Author :         yuhua.shi
160 // Note :
161 /*****************************************************************************/
162 PUBLIC void DPSLP_XTLOpenInSleep (
163     BOOLEAN is_open                         //indicate if xtl need open in deepsleep,
164     //SCI_TRUE: need open xtl in deepsleep; SCI_FALSE: can close xtl in deepsleep
165 );
166
167 /*****************************************************************************/
168 // Description :    This function is used to enable or disable rf
169 // Global resource dependence :
170 // Author :
171 // Note :
172 /*****************************************************************************/
173 PUBLIC void DSLP_RFLDOControl (
174     BOOLEAN enable          // TRUE:enable, FALSE:disable
175 );
176
177 /*****************************************************************************/
178 // Description :    This function is used to get rf enable flag
179 // Global resource dependence :
180 // Author :
181 // Note :
182 /*****************************************************************************/
183 PUBLIC uint32 DSLP_GetRFEnableFlag (void);
184
185 #elif defined(PLATFORM_SC8800H)
186 /**---------------------------------------------------------------------------*
187  **                         Function Definitions                              *
188  **---------------------------------------------------------------------------*/
189 // Enable LCD backlight brightless deep sleep.
190 // For the brightless is controlled by PWM, if enter deepsleep, the mcu clk stop,
191 // and the PWM also stop.
192 PUBLIC void SCI_LCDBacklightBrightless_EnableDeepSleep (uint32 mode);
193
194 //
195 // Set charge deepsleep mode
196 //
197 PUBLIC void SCI_CHR_EnableDeepSleep (uint32 mode);
198
199 // Enable Audio deep sleep
200 PUBLIC void SCI_AUD_EnableDeepSleep (uint32 mode);
201 // Enable MMI deep sleep
202 PUBLIC void SCI_MMI_EnableDeepSleep (uint32 mode);
203 // Enable SIM deep sleep
204 PUBLIC void SCI_SIM_EnableDeepSleep (uint32 mode);
205 // Enable Layer1 deeep sleep
206 PUBLIC void SCI_L1_EnableDeepSleep (uint32 mode);
207 // Enable Bluetooth deep sleep
208 PUBLIC void SCI_BT_EnableDeepSleep (uint32 mode);
209 // Get DSP absolute time
210 PUBLIC uint32 SCI_GetDSPAbsoluteTime (void);
211
212 // Init delta time between DSP and MCU
213 PUBLIC void SCI_InitDSPDeltaTime (void);
214
215 // Check if enter deep sleep
216 PUBLIC void SCI_EnterDeepSleep (void);
217
218
219
220 // RTC handler
221 PUBLIC void SCI_RTC_TimerHandler (void);
222
223 PUBLIC void DS_CreateAbsoluteTimer (uint32 abs_time);
224
225 PUBLIC void deep_sleep_delay (uint32 count);
226
227 PUBLIC void SCI_PCM_EnableDeepSleep (uint32 mode);
228
229 PUBLIC void SCI_BTCLK_EnableDeepSleep (uint32 mode);
230
231 PUBLIC void SCI_AP_EnableDeepSleep (uint32 mode);
232
233
234 PUBLIC void SCI_Calibration_EnableDeepSleep (uint32 mode);
235
236 /*****************************************************************************/
237 //  Description:    This function is used to config the apb clk request of pwm.
238 //  Author:         Younger.Yang
239 //  Note:
240 //****************************************************************************/
241 PUBLIC void DPSLP_PWM_EnableApbSleep (PWM_PORT_ID_E port_id, uint32 mode);
242 PUBLIC void DPSLP_Lcdc_EnableAhbSleep (uint32 mode);
243 PUBLIC void DPSLP_MpegEnc_EnableAhbSleep (uint32 mode);
244 PUBLIC void DPSLP_MpegDec_EnableAhbSleep (uint32 mode);
245 PUBLIC void DPSLP_ISP_EnableAhbSleep (uint32 mode);//just used for PLATFORM_SC6800H and PLATFORM_SC8800H
246 PUBLIC void DPSLP_DCAM_EnableAhbSleep (uint32 mode);
247 PUBLIC void DPSLP_DMA_EnableAhbSleep (uint32 mode);
248
249 /*****************************************************************************/
250 // Description :    This function is used to get the val of sleepmode.
251 // Global resource dependence : sleep_mode
252 // Author :         kevin.wang
253 // Note :
254 /*****************************************************************************/
255 PUBLIC uint32 SCI_Getsleepmode (void);
256 /*****************************************************************************/
257 // Description :    This function is used to Enable
258 // LDO_RF power down when enter deepsleep
259 // Global resource dependence :
260 // Author :
261 // Note :
262 /*****************************************************************************/
263 PUBLIC void DSSLP_EnableLDORFAutoPD (void);
264 /*****************************************************************************/
265 //  Description:    This function is used to config the ahb clk request of dma.
266 //  Author:         Zhengjiang.Lei
267 //  Note:
268 //****************************************************************************/
269 PUBLIC void SCI_SDIO_EnableDeepSleep (uint32 mode);
270
271 /*****************************************************************************/
272 // Description :    This function is used to enable arm CEVAX matrix to sleep.
273 // Global resource dependence :
274 // Author :
275 // Note :
276 /*****************************************************************************/
277 PUBLIC void DSLP_ARM_DAHB_SleepEn (void);
278
279 /*****************************************************************************/
280 // Description :    This function is used to enable or disable rf
281 // Global resource dependence :
282 // Author :
283 // Note :
284 /*****************************************************************************/
285 PUBLIC void DSLP_RFLDOControl (
286     BOOLEAN enable          // TRUE:enable, FALSE:disable
287 );
288 /*****************************************************************************/
289 // Description :    This function is used to set sleep flag.
290 // Global resource dependence :
291 // Author :
292 // Note :
293 /*****************************************************************************/
294 PUBLIC void DSLP_SetEnableSleepFlag (void);
295
296
297 /*****************************************************************************/
298 //  Description:    This function is dsp semaphore fiq handler
299 //  Author:
300 //  Note:
301 //****************************************************************************/
302 PUBLIC void DSP_SEMA_Handler (
303     uint32 fiq_num      // fiq number
304 );
305
306 /*****************************************************************************/
307 //  Description:    This function is used to init dsp amr share memeory
308 //  Author:
309 //  Note:
310 //****************************************************************************/
311 PUBLIC void SCI_InitDSP_MCU_SHR (void);
312
313 /*****************************************************************************/
314 // Description :    This function is used to clear DSP semaphore0.
315 // Global resource dependence :
316 // Author :
317 // Note :
318 /*****************************************************************************/
319 PUBLIC void SCI_DSPSEMA0_Clear (void);
320
321 /*****************************************************************************/
322 // Description :    This function is used to set the flag which indicate if xtl need open in deepsleep
323 // Global resource dependence :s_sleep_xtl_open_cnt
324 // Author :         yuhua.shi
325 // Note :
326 /*****************************************************************************/
327 PUBLIC void DPSLP_XTLOpenInSleep (
328     BOOLEAN is_open                         //indicated if xtl need open in deepsleep,
329     //SCI_TRUE: need open xtl in deepsleep; SCI_FALSE: can close xtl in deepsleep
330 );
331 PUBLIC void SCI_Deep_Sleep_Test (void);
332 #endif
333
334 /**---------------------------------------------------------------------------*
335  **                         Compiler Flag                                     *
336  **---------------------------------------------------------------------------*/
337 #ifdef   __cplusplus
338 }
339 #endif //
340
341
342
343
344 #endif // _DEEPSLEEP_DRVAPI_H_