1 /*
2  * pwr.h
3  *
4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5  *
6  * Copyright (C) 2005-2006 Texas Instruments, Inc.
7  *
8  * This package is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15  */
16 
17 #ifndef PWR_
18 #define PWR_
19 
20 #include <dspbridge/dbdefs.h>
21 #include <dspbridge/mbx_sh.h>
22 
23 /* valid sleep command codes that can be sent by GPP via mailbox: */
24 #define PWR_DEEPSLEEP           MBX_PM_DSPIDLE
25 #define PWR_EMERGENCYDEEPSLEEP  MBX_PM_EMERGENCYSLEEP
26 #define PWR_WAKEUP              MBX_PM_DSPWAKEUP
27 
28 
29 /*
30  *  ======== pwr_sleep_dsp ========
31  *      Signal the DSP to go to sleep.
32  *
33  *  Parameters:
34  *      sleep_code:          New sleep state for DSP.  (Initially, valid codes
35  *                          are PWR_DEEPSLEEP or PWR_EMERGENCYDEEPSLEEP; both of
36  *                          these codes will simply put the DSP in deep sleep.)
37  *
38  *	timeout:            Maximum time (msec) that PWR should wait for
39  *                          confirmation that the DSP sleep state has been
40  *                          reached.  If PWR should simply send the command to
41  *                          the DSP to go to sleep and then return (i.e.,
42  *                          asynchrounous sleep), the timeout should be
43  *                          specified as zero.
44  *
45  *  Returns:
46  *      0:            Success.
47  *      0: Success, but the DSP was already asleep.
48  *      -EINVAL:    The specified sleep_code is not supported.
49  *      -ETIME:       A timeout occurred while waiting for DSP sleep
50  *                          confirmation.
51  *      -EPERM:          General failure, unable to send sleep command to
52  *                          the DSP.
53  */
54 extern int pwr_sleep_dsp(const u32 sleep_code, const u32 timeout);
55 
56 /*
57  *  ======== pwr_wake_dsp ========
58  *    Signal the DSP to wake from sleep.
59  *
60  *  Parameters:
61  *	timeout:            Maximum time (msec) that PWR should wait for
62  *                          confirmation that the DSP is awake.  If PWR should
63  *                          simply send a command to the DSP to wake and then
64  *                          return (i.e., asynchrounous wake), timeout should
65  *                          be specified as zero.
66  *
67  *  Returns:
68  *      0:            Success.
69  *      0:  Success, but the DSP was already awake.
70  *      -ETIME:       A timeout occurred while waiting for wake
71  *                          confirmation.
72  *      -EPERM:          General failure, unable to send wake command to
73  *                          the DSP.
74  */
75 extern int pwr_wake_dsp(const u32 timeout);
76 
77 /*
78  *  ======== pwr_pm_pre_scale ========
79  *    Prescale notification to DSP.
80  *
81  *  Parameters:
82  *	voltage_domain:   The voltage domain for which notification is sent
83  *    level:			The level of voltage domain
84  *
85  *  Returns:
86  *      0:            Success.
87  *      0:  Success, but the DSP was already awake.
88  *      -ETIME:       A timeout occurred while waiting for wake
89  *                          confirmation.
90  *      -EPERM:          General failure, unable to send wake command to
91  *                          the DSP.
92  */
93 extern int pwr_pm_pre_scale(u16 voltage_domain, u32 level);
94 
95 /*
96  *  ======== pwr_pm_post_scale ========
97  *    PostScale notification to DSP.
98  *
99  *  Parameters:
100  *	voltage_domain:   The voltage domain for which notification is sent
101  *    level:			The level of voltage domain
102  *
103  *  Returns:
104  *      0:            Success.
105  *      0:  Success, but the DSP was already awake.
106  *      -ETIME:       A timeout occurred while waiting for wake
107  *                          confirmation.
108  *      -EPERM:          General failure, unable to send wake command to
109  *                          the DSP.
110  */
111 extern int pwr_pm_post_scale(u16 voltage_domain, u32 level);
112 
113 #endif /* PWR_ */
114