Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / pmu.h
blob9ac8fc60ad492716231b872b01ac7ba3a13f787a
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Definitions for talking to the PMU. The PMU is a microcontroller
4 * which controls battery charging and system power on PowerBook 3400
5 * and 2400 models as well as the RTC and various other things.
7 * Copyright (C) 1998 Paul Mackerras.
8 */
9 #ifndef _LINUX_PMU_H
10 #define _LINUX_PMU_H
12 #include <uapi/linux/pmu.h>
15 extern int find_via_pmu(void);
17 extern int pmu_request(struct adb_request *req,
18 void (*done)(struct adb_request *), int nbytes, ...);
19 extern int pmu_queue_request(struct adb_request *req);
20 extern void pmu_poll(void);
21 extern void pmu_poll_adb(void); /* For use by xmon */
22 extern void pmu_wait_complete(struct adb_request *req);
24 /* For use before switching interrupts off for a long time;
25 * warning: not stackable
27 #if defined(CONFIG_ADB_PMU)
28 extern void pmu_suspend(void);
29 extern void pmu_resume(void);
30 #else
31 static inline void pmu_suspend(void)
33 static inline void pmu_resume(void)
35 #endif
37 extern void pmu_enable_irled(int on);
39 extern void pmu_restart(void);
40 extern void pmu_shutdown(void);
41 extern void pmu_unlock(void);
43 extern int pmu_present(void);
44 extern int pmu_get_model(void);
46 extern void pmu_backlight_set_sleep(int sleep);
48 #define PMU_MAX_BATTERIES 2
50 /* values for pmu_power_flags */
51 #define PMU_PWR_AC_PRESENT 0x00000001
53 /* values for pmu_battery_info.flags */
54 #define PMU_BATT_PRESENT 0x00000001
55 #define PMU_BATT_CHARGING 0x00000002
56 #define PMU_BATT_TYPE_MASK 0x000000f0
57 #define PMU_BATT_TYPE_SMART 0x00000010 /* Smart battery */
58 #define PMU_BATT_TYPE_HOOPER 0x00000020 /* 3400/3500 */
59 #define PMU_BATT_TYPE_COMET 0x00000030 /* 2400 */
61 struct pmu_battery_info
63 unsigned int flags;
64 unsigned int charge; /* current charge */
65 unsigned int max_charge; /* maximum charge */
66 signed int amperage; /* current, positive if charging */
67 unsigned int voltage; /* voltage */
68 unsigned int time_remaining; /* remaining time */
71 extern int pmu_battery_count;
72 extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
73 extern unsigned int pmu_power_flags;
75 /* Backlight */
76 extern void pmu_backlight_init(void);
78 /* some code needs to know if the PMU was suspended for hibernation */
79 #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
80 extern int pmu_sys_suspended;
81 #else
82 /* if power management is not configured it can't be suspended */
83 #define pmu_sys_suspended 0
84 #endif
86 #endif /* _LINUX_PMU_H */