Import 2.3.18pre1
[davej-history.git] / include / asm-ppc / pmu.h
blobf6309d6b228c82c17478b3f603f5278901339562
1 /*
2 * Definitions for talking to the PMU. The PMU is a microcontroller
3 * which controls battery charging and system power on PowerBook 3400
4 * and 2400 models as well as the RTC and various other things.
6 * Copyright (C) 1998 Paul Mackerras.
7 */
9 /*
10 * PMU commands
12 #define PMU_POWER_CTRL 0x11 /* control power of some devices */
13 #define PMU_ADB_CMD 0x20 /* send ADB packet */
14 #define PMU_ADB_POLL_OFF 0x21 /* disable ADB auto-poll */
15 #define PMU_WRITE_NVRAM 0x33 /* write non-volatile RAM */
16 #define PMU_READ_NVRAM 0x3b /* read non-volatile RAM */
17 #define PMU_SET_RTC 0x30 /* set real-time clock */
18 #define PMU_READ_RTC 0x38 /* read real-time clock */
19 #define PMU_SET_VOLBUTTON 0x40 /* set volume up/down position */
20 #define PMU_BACKLIGHT_BRIGHT 0x41 /* set backlight brightness */
21 #define PMU_GET_VOLBUTTON 0x48 /* get volume up/down position */
22 #define PMU_PCEJECT 0x4c /* eject PC-card from slot */
23 #define PMU_BATTERY_STATE 0x6b /* report battery state etc. */
24 #define PMU_SET_INTR_MASK 0x70 /* set PMU interrupt mask */
25 #define PMU_INT_ACK 0x78 /* read interrupt bits */
26 #define PMU_SHUTDOWN 0x7e /* turn power off */
27 #define PMU_SLEEP 0x7f /* put CPU to sleep */
28 #define PMU_RESET 0xd0 /* reset CPU */
29 #define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */
30 #define PMU_GET_COVER 0xdc /* report cover open/closed */
32 /* Bits to use with the PMU_POWER_CTRL command */
33 #define PMU_POW_ON 0x80 /* OR this to power ON the device */
34 #define PMU_POW_OFF 0x00 /* leave bit 7 to 0 to power it OFF */
35 #define PMU_POW_BACKLIGHT 0x01 /* backlight power */
36 #define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) ??? */
38 /* Bits in PMU interrupt and interrupt mask bytes */
39 #define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */
40 #define PMU_INT_PCEJECT 0x04 /* PC-card eject buttons */
41 #define PMU_INT_SNDBRT 0x08 /* sound/brightness up/down buttons */
42 #define PMU_INT_ADB 0x10 /* ADB autopoll or reply data */
43 #define PMU_INT_TICK 0x80 /* 1-second tick interrupt */
45 /* Kind of PMU (model) */
46 enum {
47 PMU_UNKNOWN,
48 PMU_OHARE_BASED,
49 PMU_HEATHROW_BASED
53 * Ioctl commands for the /dev/pmu device
55 #include <linux/ioctl.h>
57 /* no param */
58 #define PMU_IOC_SLEEP _IO('B', 0)
59 /* out param: u32* backlight value: 0 to 31 */
60 #define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, sizeof(__u32*))
61 /* in param: u32 backlight value: 0 to 31 */
62 #define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, sizeof(__u32))
63 /* out param: u32* backlight value: 0 to 31 */
64 #define PMU_IOC_GET_MODEL _IOR('B', 3, sizeof(__u32*))
66 #ifdef __KERNEL__
68 void find_via_pmu(void);
69 void via_pmu_init(void);
71 int pmu_request(struct adb_request *req,
72 void (*done)(struct adb_request *), int nbytes, ...);
73 void pmu_poll(void);
75 void pmu_enable_backlight(int on);
76 void pmu_set_brightness(int level);
78 void pmu_enable_irled(int on);
80 void pmu_restart(void);
81 void pmu_shutdown(void);
83 int pmu_present(void);
84 int pmu_get_model(void);
87 * Stuff for putting the powerbook to sleep and waking it again.
89 #include <linux/notifier.h>
91 extern struct notifier_block *sleep_notifier_list;
93 /* code values for calling sleep/wakeup handlers */
94 #define PBOOK_SLEEP 1
95 #define PBOOK_WAKE 2
97 #endif /* __KERNEL */