~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/linux/pmu.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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.
  5  *
  6  * Copyright (C) 1998 Paul Mackerras.
  7  */
  8 
  9 #include <linux/config.h>
 10 /*
 11  * PMU commands
 12  */
 13 #define PMU_POWER_CTRL0         0x10    /* control power of some devices */
 14 #define PMU_POWER_CTRL          0x11    /* control power of some devices */
 15 #define PMU_ADB_CMD             0x20    /* send ADB packet */
 16 #define PMU_ADB_POLL_OFF        0x21    /* disable ADB auto-poll */
 17 #define PMU_WRITE_NVRAM         0x33    /* write non-volatile RAM */
 18 #define PMU_READ_NVRAM          0x3b    /* read non-volatile RAM */
 19 #define PMU_SET_RTC             0x30    /* set real-time clock */
 20 #define PMU_READ_RTC            0x38    /* read real-time clock */
 21 #define PMU_SET_VOLBUTTON       0x40    /* set volume up/down position */
 22 #define PMU_BACKLIGHT_BRIGHT    0x41    /* set backlight brightness */
 23 #define PMU_GET_VOLBUTTON       0x48    /* get volume up/down position */
 24 #define PMU_PCEJECT             0x4c    /* eject PC-card from slot */
 25 #define PMU_BATTERY_STATE       0x6b    /* report battery state etc. */
 26 #define PMU_SET_INTR_MASK       0x70    /* set PMU interrupt mask */
 27 #define PMU_INT_ACK             0x78    /* read interrupt bits */
 28 #define PMU_SHUTDOWN            0x7e    /* turn power off */
 29 #define PMU_SLEEP               0x7f    /* put CPU to sleep */
 30 #define PMU_POWER_EVENTS        0x8f    /* Send power-event commands to PMU */
 31 #define PMU_RESET               0xd0    /* reset CPU */
 32 #define PMU_GET_BRIGHTBUTTON    0xd9    /* report brightness up/down pos */
 33 #define PMU_GET_COVER           0xdc    /* report cover open/closed */
 34 #define PMU_SYSTEM_READY        0xdf    /* tell PMU we are awake */
 35 
 36 /* Bits to use with the PMU_POWER_CTRL0 command */
 37 #define PMU_POW0_ON             0x80    /* OR this to power ON the device */
 38 #define PMU_POW0_OFF            0x00    /* leave bit 7 to 0 to power it OFF */
 39 #define PMU_POW0_HARD_DRIVE     0x04    /* Hard drive power (on wallstreet/lombard ?) */
 40 
 41 /* Bits to use with the PMU_POWER_CTRL command */
 42 #define PMU_POW_ON              0x80    /* OR this to power ON the device */
 43 #define PMU_POW_OFF             0x00    /* leave bit 7 to 0 to power it OFF */
 44 #define PMU_POW_BACKLIGHT       0x01    /* backlight power */
 45 #define PMU_POW_CHARGER         0x02    /* battery charger power */
 46 #define PMU_POW_IRLED           0x04    /* IR led power (on wallstreet) */
 47 #define PMU_POW_MEDIABAY        0x08    /* media bay power (wallstreet/lombard ?) */
 48 
 49 
 50 /* Bits in PMU interrupt and interrupt mask bytes */
 51 #define PMU_INT_ADB_AUTO        0x04    /* ADB autopoll, when PMU_INT_ADB */
 52 #define PMU_INT_PCEJECT         0x04    /* PC-card eject buttons */
 53 #define PMU_INT_SNDBRT          0x08    /* sound/brightness up/down buttons */
 54 #define PMU_INT_ADB             0x10    /* ADB autopoll or reply data */
 55 #define PMU_INT_BATTERY         0x20
 56 #define PMU_INT_WAKEUP          0x40
 57 #define PMU_INT_TICK            0x80    /* 1-second tick interrupt */
 58 
 59 /* Kind of PMU (model) */
 60 enum {
 61         PMU_UNKNOWN,
 62         PMU_OHARE_BASED,        /* 2400, 3400, 3500 (old G3 powerbook) */
 63         PMU_HEATHROW_BASED,     /* PowerBook G3 series */
 64         PMU_PADDINGTON_BASED,   /* 1999 PowerBook G3 */
 65         PMU_KEYLARGO_BASED,     /* Core99 motherboard (PMU99) */
 66 };
 67 
 68 /* PMU PMU_POWER_EVENTS commands */
 69 enum {
 70         PMU_PWR_GET_POWERUP_EVENTS      = 0x00,
 71         PMU_PWR_SET_POWERUP_EVENTS      = 0x01,
 72         PMU_PWR_CLR_POWERUP_EVENTS      = 0x02,
 73         PMU_PWR_GET_WAKEUP_EVENTS       = 0x03,
 74         PMU_PWR_SET_WAKEUP_EVENTS       = 0x04,
 75         PMU_PWR_CLR_WAKEUP_EVENTS       = 0x05,
 76 };
 77 
 78 /* Power events wakeup bits */
 79 enum {
 80         PMU_PWR_WAKEUP_KEY              = 0x01, /* Wake on key press */
 81         PMU_PWR_WAKEUP_AC_INSERT        = 0x02, /* Wake on AC adapter plug */
 82         PMU_PWR_WAKEUP_AC_CHANGE        = 0x04,
 83         PMU_PWR_WAKEUP_LID_OPEN         = 0x08,
 84         PMU_PWR_WAKEUP_RING             = 0x10,
 85 };
 86         
 87 /*
 88  * Ioctl commands for the /dev/pmu device
 89  */
 90 #include <linux/ioctl.h>
 91 
 92 /* no param */
 93 #define PMU_IOC_SLEEP           _IO('B', 0)
 94 /* out param: u32*      backlight value: 0 to 15 */
 95 #define PMU_IOC_GET_BACKLIGHT   _IOR('B', 1, sizeof(__u32*))
 96 /* in param: u32        backlight value: 0 to 15 */
 97 #define PMU_IOC_SET_BACKLIGHT   _IOW('B', 2, sizeof(__u32))
 98 /* out param: u32*      PMU model */
 99 #define PMU_IOC_GET_MODEL       _IOR('B', 3, sizeof(__u32*))
100 /* out param: u32*      has_adb: 0 or 1 */
101 #define PMU_IOC_HAS_ADB         _IOR('B', 4, sizeof(__u32*)) 
102 
103 #ifdef __KERNEL__
104 
105 extern int find_via_pmu(void);
106 extern int via_pmu_start(void);
107 
108 extern int pmu_request(struct adb_request *req,
109                 void (*done)(struct adb_request *), int nbytes, ...);
110 
111 extern void pmu_poll(void);
112 
113 /* For use before switching interrupts off for a long time;
114  * warning: not stackable
115  */
116 extern void pmu_suspend(void);
117 extern void pmu_resume(void);
118 
119 extern void pmu_enable_irled(int on);
120 
121 extern void pmu_restart(void);
122 extern void pmu_shutdown(void);
123 
124 extern int pmu_present(void);
125 extern int pmu_get_model(void);
126 
127 #ifdef CONFIG_PMAC_PBOOK
128 /*
129  * Stuff for putting the powerbook to sleep and waking it again.
130  *
131  */
132 #include <linux/list.h>
133 
134 struct pmu_sleep_notifier
135 {
136         int (*notifier_call)(struct pmu_sleep_notifier *self, int when);
137         int priority;
138         struct list_head list;
139 };
140 
141 /* Code values for calling sleep/wakeup handlers
142  *
143  * Note: If a sleep request got cancelled, all drivers will get
144  * the PBOOK_SLEEP_REJECT, even those who didn't get the PBOOK_SLEEP_REQUEST.
145  */
146 #define PBOOK_SLEEP_REQUEST     1
147 #define PBOOK_SLEEP_NOW         2
148 #define PBOOK_SLEEP_REJECT      3
149 #define PBOOK_WAKE              4
150 
151 /* Result codes returned by the notifiers */
152 #define PBOOK_SLEEP_OK          0
153 #define PBOOK_SLEEP_REFUSE      -1
154 
155 /* priority levels in notifiers */
156 #define SLEEP_LEVEL_VIDEO       100     /* Video driver (first wake) */
157 #define SLEEP_LEVEL_SOUND       90      /* Sound driver */
158 #define SLEEP_LEVEL_MEDIABAY    80      /* Media bay driver */
159 #define SLEEP_LEVEL_BLOCK       70      /* IDE, SCSI */
160 #define SLEEP_LEVEL_NET         60      /* bmac */
161 #define SLEEP_LEVEL_ADB         50      /* ADB */
162 #define SLEEP_LEVEL_MISC        30      /* Anything */
163 #define SLEEP_LEVEL_LAST        0       /* Anything */
164 
165 /* special register notifier functions */
166 int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier);
167 int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier);
168 
169 #endif /* CONFIG_PMAC_PBOOK */
170 
171 
172 #endif  /* __KERNEL__ */
173 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.