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.
9 #include <linux/config.h>
13 #define PMU_POWER_CTRL 0x11 /* control power of some devices */
14 #define PMU_ADB_CMD 0x20 /* send ADB packet */
15 #define PMU_ADB_POLL_OFF 0x21 /* disable ADB auto-poll */
16 #define PMU_WRITE_NVRAM 0x33 /* write non-volatile RAM */
17 #define PMU_READ_NVRAM 0x3b /* read non-volatile RAM */
18 #define PMU_SET_RTC 0x30 /* set real-time clock */
19 #define PMU_READ_RTC 0x38 /* read real-time clock */
20 #define PMU_SET_VOLBUTTON 0x40 /* set volume up/down position */
21 #define PMU_BACKLIGHT_BRIGHT 0x41 /* set backlight brightness */
22 #define PMU_GET_VOLBUTTON 0x48 /* get volume up/down position */
23 #define PMU_PCEJECT 0x4c /* eject PC-card from slot */
24 #define PMU_BATTERY_STATE 0x6b /* report battery state etc. */
25 #define PMU_SET_INTR_MASK 0x70 /* set PMU interrupt mask */
26 #define PMU_INT_ACK 0x78 /* read interrupt bits */
27 #define PMU_SHUTDOWN 0x7e /* turn power off */
28 #define PMU_SLEEP 0x7f /* put CPU to sleep */
29 #define PMU_RESET 0xd0 /* reset CPU */
30 #define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */
31 #define PMU_GET_COVER 0xdc /* report cover open/closed */
33 /* Bits to use with the PMU_POWER_CTRL command */
34 #define PMU_POW_ON 0x80 /* OR this to power ON the device */
35 #define PMU_POW_OFF 0x00 /* leave bit 7 to 0 to power it OFF */
36 #define PMU_POW_BACKLIGHT 0x01 /* backlight power */
37 #define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) */
39 /* Bits in PMU interrupt and interrupt mask bytes */
40 #define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */
41 #define PMU_INT_PCEJECT 0x04 /* PC-card eject buttons */
42 #define PMU_INT_SNDBRT 0x08 /* sound/brightness up/down buttons */
43 #define PMU_INT_ADB 0x10 /* ADB autopoll or reply data */
44 #define PMU_INT_BATTERY 0x20
45 #define PMU_INT_WAKEUP 0x40
46 #define PMU_INT_TICK 0x80 /* 1-second tick interrupt */
48 /* Kind of PMU (model) */
51 PMU_OHARE_BASED
, /* 2400, 3400, 3500 (old G3 powerbook) */
52 PMU_HEATHROW_BASED
, /* PowerBook G3 series */
53 PMU_PADDINGTON_BASED
, /* 1999 PowerBook G3 */
57 * Ioctl commands for the /dev/pmu device
59 #include <linux/ioctl.h>
62 #define PMU_IOC_SLEEP _IO('B', 0)
63 /* out param: u32* backlight value: 0 to 31 */
64 #define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, sizeof(__u32*))
65 /* in param: u32 backlight value: 0 to 31 */
66 #define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, sizeof(__u32))
67 /* out param: u32* backlight value: 0 to 31 */
68 #define PMU_IOC_GET_MODEL _IOR('B', 3, sizeof(__u32*))
72 int find_via_pmu(void);
73 int via_pmu_init(void);
75 int pmu_request(struct adb_request
*req
,
76 void (*done
)(struct adb_request
*), int nbytes
, ...);
79 void pmu_enable_backlight(int on
);
80 void pmu_set_brightness(int level
);
82 void pmu_enable_irled(int on
);
84 void pmu_restart(void);
85 void pmu_shutdown(void);
87 int pmu_present(void);
88 int pmu_get_model(void);
90 #ifdef CONFIG_PMAC_PBOOK
92 * Stuff for putting the powerbook to sleep and waking it again.
95 #include <linux/list.h>
97 struct pmu_sleep_notifier
99 int (*notifier_call
)(struct pmu_sleep_notifier
*self
, int when
);
101 struct list_head list
;
104 /* Code values for calling sleep/wakeup handlers
106 * Note: If a sleep request got cancelled, all drivers will get
107 * the PBOOK_SLEEP_REJECT, even those who didn't get the PBOOK_SLEEP_REQUEST.
109 #define PBOOK_SLEEP_REQUEST 1
110 #define PBOOK_SLEEP_NOW 2
111 #define PBOOK_SLEEP_REJECT 3
114 /* Result codes returned by the notifiers */
115 #define PBOOK_SLEEP_OK 0
116 #define PBOOK_SLEEP_REFUSE -1
118 /* priority levels in notifiers */
119 #define SLEEP_LEVEL_VIDEO 100 /* Video driver (first wake) */
120 #define SLEEP_LEVEL_SOUND 90 /* Sound driver */
121 #define SLEEP_LEVEL_MEDIABAY 80 /* Media bay driver */
122 #define SLEEP_LEVEL_BLOCK 70 /* IDE, SCSI */
123 #define SLEEP_LEVEL_NET 60 /* bmac */
124 #define SLEEP_LEVEL_ADB 50 /* ADB */
125 #define SLEEP_LEVEL_MISC 30 /* Anything */
126 #define SLEEP_LEVEL_LAST 0 /* Anything */
128 /* special register notifier functions */
129 int pmu_register_sleep_notifier(struct pmu_sleep_notifier
* notifier
);
130 int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier
* notifier
);
132 #endif /* CONFIG_PMAC_PBOOK */
135 #endif /* __KERNEL */