1b74986e7SEmmanuel Vadot /*-
2b74986e7SEmmanuel Vadot * Copyright (c) 2020 The FreeBSD Foundation
3b74986e7SEmmanuel Vadot *
4b74986e7SEmmanuel Vadot * This software was developed by Emmanuel Vadot under sponsorship
5b74986e7SEmmanuel Vadot * from the FreeBSD Foundation.
6b74986e7SEmmanuel Vadot *
7b74986e7SEmmanuel Vadot * Redistribution and use in source and binary forms, with or without
8b74986e7SEmmanuel Vadot * modification, are permitted provided that the following conditions
9b74986e7SEmmanuel Vadot * are met:
10b74986e7SEmmanuel Vadot * 1. Redistributions of source code must retain the above copyright
11b74986e7SEmmanuel Vadot * notice, this list of conditions and the following disclaimer.
12b74986e7SEmmanuel Vadot * 2. Redistributions in binary form must reproduce the above copyright
13b74986e7SEmmanuel Vadot * notice, this list of conditions and the following disclaimer in the
14b74986e7SEmmanuel Vadot * documentation and/or other materials provided with the distribution.
15b74986e7SEmmanuel Vadot *
16b74986e7SEmmanuel Vadot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17b74986e7SEmmanuel Vadot * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18b74986e7SEmmanuel Vadot * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19b74986e7SEmmanuel Vadot * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20b74986e7SEmmanuel Vadot * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21b74986e7SEmmanuel Vadot * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22b74986e7SEmmanuel Vadot * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23b74986e7SEmmanuel Vadot * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24b74986e7SEmmanuel Vadot * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25b74986e7SEmmanuel Vadot * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26b74986e7SEmmanuel Vadot * SUCH DAMAGE.
27b74986e7SEmmanuel Vadot */
28b74986e7SEmmanuel Vadot
29*307f78f3SVladimir Kondratyev #ifndef _LINUXKPI_LINUX_POWER_SUPPLY_H_
30*307f78f3SVladimir Kondratyev #define _LINUXKPI_LINUX_POWER_SUPPLY_H_
31b74986e7SEmmanuel Vadot
32b74986e7SEmmanuel Vadot #include <sys/types.h>
33b74986e7SEmmanuel Vadot #include <sys/power.h>
34b74986e7SEmmanuel Vadot
35b74986e7SEmmanuel Vadot static inline int
power_supply_is_system_supplied(void)36b74986e7SEmmanuel Vadot power_supply_is_system_supplied(void)
37b74986e7SEmmanuel Vadot {
38b74986e7SEmmanuel Vadot
39b74986e7SEmmanuel Vadot return (power_profile_get_state() == POWER_PROFILE_PERFORMANCE);
40b74986e7SEmmanuel Vadot }
41b74986e7SEmmanuel Vadot
42b74986e7SEmmanuel Vadot #endif
43