xref: /dflybsd-src/sys/sys/power.h (revision b5516a553a649d22c5fc69edf6d01122399d2529)
1bf3e6b54SDavid Rhodus /*-
2bf3e6b54SDavid Rhodus  * Copyright (c) 2001 Mitsuru IWASAKI
3bf3e6b54SDavid Rhodus  * All rights reserved.
4bf3e6b54SDavid Rhodus  *
5bf3e6b54SDavid Rhodus  * Redistribution and use in source and binary forms, with or without
6bf3e6b54SDavid Rhodus  * modification, are permitted provided that the following conditions
7bf3e6b54SDavid Rhodus  * are met:
8bf3e6b54SDavid Rhodus  * 1. Redistributions of source code must retain the above copyright
9bf3e6b54SDavid Rhodus  *    notice, this list of conditions and the following disclaimer.
10bf3e6b54SDavid Rhodus  * 2. Redistributions in binary form must reproduce the above copyright
11bf3e6b54SDavid Rhodus  *    notice, this list of conditions and the following disclaimer in the
12bf3e6b54SDavid Rhodus  *    documentation and/or other materials provided with the distribution.
13bf3e6b54SDavid Rhodus  *
14bf3e6b54SDavid Rhodus  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15bf3e6b54SDavid Rhodus  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16bf3e6b54SDavid Rhodus  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17bf3e6b54SDavid Rhodus  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18bf3e6b54SDavid Rhodus  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19bf3e6b54SDavid Rhodus  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20bf3e6b54SDavid Rhodus  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21bf3e6b54SDavid Rhodus  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22bf3e6b54SDavid Rhodus  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23bf3e6b54SDavid Rhodus  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24bf3e6b54SDavid Rhodus  * SUCH DAMAGE.
25bf3e6b54SDavid Rhodus  *
26bf3e6b54SDavid Rhodus  *	$FreeBSD: src/sys/sys/power.h,v 1.3.6.1 2003/08/18 20:22:23 jhb Exp $
27bf3e6b54SDavid Rhodus  */
28bf3e6b54SDavid Rhodus 
29bf3e6b54SDavid Rhodus #ifndef _SYS_POWER_H_
30bf3e6b54SDavid Rhodus #define _SYS_POWER_H_
31bf3e6b54SDavid Rhodus 
3203d6a592SMatthew Dillon #ifndef _KERNEL
3303d6a592SMatthew Dillon #error "This file should not be included by userland programs."
3497b3c8acSSascha Wildner #endif
3503d6a592SMatthew Dillon 
361bd40720SMatthew Dillon #ifndef _SYS_TYPES_H_
371bd40720SMatthew Dillon #include <sys/types.h>
381bd40720SMatthew Dillon #endif
391bd40720SMatthew Dillon #ifndef _SYS_EVENTHANDLER_H_
40bf3e6b54SDavid Rhodus #include <sys/eventhandler.h>
411bd40720SMatthew Dillon #endif
42bf3e6b54SDavid Rhodus 
43bf3e6b54SDavid Rhodus /* Power management system type */
44bf3e6b54SDavid Rhodus #define POWER_PM_TYPE_APM		0x00
45bf3e6b54SDavid Rhodus #define POWER_PM_TYPE_ACPI		0x01
46bf3e6b54SDavid Rhodus #define POWER_PM_TYPE_NONE		0xff
47bf3e6b54SDavid Rhodus 
48bf3e6b54SDavid Rhodus /* Commands for Power management function */
49bf3e6b54SDavid Rhodus #define POWER_CMD_SUSPEND		0x00
50bf3e6b54SDavid Rhodus 
51bf3e6b54SDavid Rhodus /* Sleep state */
52bf3e6b54SDavid Rhodus #define POWER_SLEEP_STATE_STANDBY	0x00
53bf3e6b54SDavid Rhodus #define POWER_SLEEP_STATE_SUSPEND	0x01
54bf3e6b54SDavid Rhodus #define POWER_SLEEP_STATE_HIBERNATE	0x02
55bf3e6b54SDavid Rhodus 
56bf3e6b54SDavid Rhodus typedef int (*power_pm_fn_t)(u_long, void*, ...);
57*b5516a55SSascha Wildner int	 power_pm_register(u_int, power_pm_fn_t, void *);
58*b5516a55SSascha Wildner u_int	 power_pm_get_type(void);
59*b5516a55SSascha Wildner void	 power_pm_suspend(int);
60bf3e6b54SDavid Rhodus 
61bf3e6b54SDavid Rhodus /*
62bf3e6b54SDavid Rhodus  * System power API.
63bf3e6b54SDavid Rhodus  */
64bf3e6b54SDavid Rhodus #define POWER_PROFILE_PERFORMANCE        0
65bf3e6b54SDavid Rhodus #define POWER_PROFILE_ECONOMY            1
66bf3e6b54SDavid Rhodus 
67*b5516a55SSascha Wildner int	power_profile_get_state(void);
68*b5516a55SSascha Wildner void	power_profile_set_state(int);
69bf3e6b54SDavid Rhodus 
70bf3e6b54SDavid Rhodus typedef void (*power_profile_change_hook)(void *, int);
71bf3e6b54SDavid Rhodus EVENTHANDLER_DECLARE(power_profile_change, power_profile_change_hook);
72bf3e6b54SDavid Rhodus 
73bf3e6b54SDavid Rhodus #endif	/* !_SYS_POWER_H_ */
74bf3e6b54SDavid Rhodus 
75