diff options
Diffstat (limited to 'include/asm-powerpc/smu.h')
-rw-r--r-- | include/asm-powerpc/smu.h | 142 |
1 files changed, 133 insertions, 9 deletions
diff --git a/include/asm-powerpc/smu.h b/include/asm-powerpc/smu.h index e49f644ca63a..7ae2753da565 100644 --- a/include/asm-powerpc/smu.h +++ b/include/asm-powerpc/smu.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * Partition info commands | 22 | * Partition info commands |
23 | * | 23 | * |
24 | * These commands are used to retrieve the sdb-partition-XX datas from | 24 | * These commands are used to retrieve the sdb-partition-XX datas from |
25 | * the SMU. The lenght is always 2. First byte is the subcommand code | 25 | * the SMU. The length is always 2. First byte is the subcommand code |
26 | * and second byte is the partition ID. | 26 | * and second byte is the partition ID. |
27 | * | 27 | * |
28 | * The reply is 6 bytes: | 28 | * The reply is 6 bytes: |
@@ -173,12 +173,12 @@ | |||
173 | * Power supply control | 173 | * Power supply control |
174 | * | 174 | * |
175 | * The "sub" command is an ASCII string in the data, the | 175 | * The "sub" command is an ASCII string in the data, the |
176 | * data lenght is that of the string. | 176 | * data length is that of the string. |
177 | * | 177 | * |
178 | * The VSLEW command can be used to get or set the voltage slewing. | 178 | * The VSLEW command can be used to get or set the voltage slewing. |
179 | * - lenght 5 (only "VSLEW") : it returns "DONE" and 3 bytes of | 179 | * - length 5 (only "VSLEW") : it returns "DONE" and 3 bytes of |
180 | * reply at data offset 6, 7 and 8. | 180 | * reply at data offset 6, 7 and 8. |
181 | * - lenght 8 ("VSLEWxyz") has 3 additional bytes appended, and is | 181 | * - length 8 ("VSLEWxyz") has 3 additional bytes appended, and is |
182 | * used to set the voltage slewing point. The SMU replies with "DONE" | 182 | * used to set the voltage slewing point. The SMU replies with "DONE" |
183 | * I yet have to figure out their exact meaning of those 3 bytes in | 183 | * I yet have to figure out their exact meaning of those 3 bytes in |
184 | * both cases. They seem to be: | 184 | * both cases. They seem to be: |
@@ -201,20 +201,90 @@ | |||
201 | */ | 201 | */ |
202 | #define SMU_CMD_READ_ADC 0xd8 | 202 | #define SMU_CMD_READ_ADC 0xd8 |
203 | 203 | ||
204 | |||
204 | /* Misc commands | 205 | /* Misc commands |
205 | * | 206 | * |
206 | * This command seem to be a grab bag of various things | 207 | * This command seem to be a grab bag of various things |
208 | * | ||
209 | * Parameters: | ||
210 | * 1: subcommand | ||
207 | */ | 211 | */ |
208 | #define SMU_CMD_MISC_df_COMMAND 0xdf | 212 | #define SMU_CMD_MISC_df_COMMAND 0xdf |
209 | #define SMU_CMD_MISC_df_SET_DISPLAY_LIT 0x02 /* i: 1 byte */ | 213 | |
214 | /* | ||
215 | * Sets "system ready" status | ||
216 | * | ||
217 | * I did not yet understand how it exactly works or what it does. | ||
218 | * | ||
219 | * Guessing from OF code, 0x02 activates the display backlight. Apple uses/used | ||
220 | * the same codebase for all OF versions. On PowerBooks, this command would | ||
221 | * enable the backlight. For the G5s, it only activates the front LED. However, | ||
222 | * don't take this for granted. | ||
223 | * | ||
224 | * Parameters: | ||
225 | * 2: status [0x00, 0x01 or 0x02] | ||
226 | */ | ||
227 | #define SMU_CMD_MISC_df_SET_DISPLAY_LIT 0x02 | ||
228 | |||
229 | /* | ||
230 | * Sets mode of power switch. | ||
231 | * | ||
232 | * What this actually does is not yet known. Maybe it enables some interrupt. | ||
233 | * | ||
234 | * Parameters: | ||
235 | * 2: enable power switch? [0x00 or 0x01] | ||
236 | * 3 (optional): enable nmi? [0x00 or 0x01] | ||
237 | * | ||
238 | * Returns: | ||
239 | * If parameter 2 is 0x00 and parameter 3 is not specified, returns wether | ||
240 | * NMI is enabled. Otherwise unknown. | ||
241 | */ | ||
210 | #define SMU_CMD_MISC_df_NMI_OPTION 0x04 | 242 | #define SMU_CMD_MISC_df_NMI_OPTION 0x04 |
211 | 243 | ||
244 | /* Sets LED dimm offset. | ||
245 | * | ||
246 | * The front LED dimms itself during sleep. Its brightness (or, well, the PWM | ||
247 | * frequency) depends on current time. Therefore, the SMU needs to know the | ||
248 | * timezone. | ||
249 | * | ||
250 | * Parameters: | ||
251 | * 2-8: unknown (BCD coding) | ||
252 | */ | ||
253 | #define SMU_CMD_MISC_df_DIMM_OFFSET 0x99 | ||
254 | |||
255 | |||
212 | /* | 256 | /* |
213 | * Version info commands | 257 | * Version info commands |
214 | * | 258 | * |
215 | * I haven't quite tried to figure out how these work | 259 | * Parameters: |
260 | * 1 (optional): Specifies version part to retrieve | ||
261 | * | ||
262 | * Returns: | ||
263 | * Version value | ||
216 | */ | 264 | */ |
217 | #define SMU_CMD_VERSION_COMMAND 0xea | 265 | #define SMU_CMD_VERSION_COMMAND 0xea |
266 | #define SMU_VERSION_RUNNING 0x00 | ||
267 | #define SMU_VERSION_BASE 0x01 | ||
268 | #define SMU_VERSION_UPDATE 0x02 | ||
269 | |||
270 | |||
271 | /* | ||
272 | * Switches | ||
273 | * | ||
274 | * These are switches whose status seems to be known to the SMU. | ||
275 | * | ||
276 | * Parameters: | ||
277 | * none | ||
278 | * | ||
279 | * Result: | ||
280 | * Switch bits (ORed, see below) | ||
281 | */ | ||
282 | #define SMU_CMD_SWITCHES 0xdc | ||
283 | |||
284 | /* Switches bits */ | ||
285 | #define SMU_SWITCH_CASE_CLOSED 0x01 | ||
286 | #define SMU_SWITCH_AC_POWER 0x04 | ||
287 | #define SMU_SWITCH_POWER_SWITCH 0x08 | ||
218 | 288 | ||
219 | 289 | ||
220 | /* | 290 | /* |
@@ -243,10 +313,64 @@ | |||
243 | */ | 313 | */ |
244 | #define SMU_CMD_MISC_ee_COMMAND 0xee | 314 | #define SMU_CMD_MISC_ee_COMMAND 0xee |
245 | #define SMU_CMD_MISC_ee_GET_DATABLOCK_REC 0x02 | 315 | #define SMU_CMD_MISC_ee_GET_DATABLOCK_REC 0x02 |
246 | #define SMU_CMD_MISC_ee_LEDS_CTRL 0x04 /* i: 00 (00,01) [00] */ | 316 | |
317 | /* Retrieves currently used watts. | ||
318 | * | ||
319 | * Parameters: | ||
320 | * 1: 0x03 (Meaning unknown) | ||
321 | */ | ||
322 | #define SMU_CMD_MISC_ee_GET_WATTS 0x03 | ||
323 | |||
324 | #define SMU_CMD_MISC_ee_LEDS_CTRL 0x04 /* i: 00 (00,01) [00] */ | ||
247 | #define SMU_CMD_MISC_ee_GET_DATA 0x05 /* i: 00 , o: ?? */ | 325 | #define SMU_CMD_MISC_ee_GET_DATA 0x05 /* i: 00 , o: ?? */ |
248 | 326 | ||
249 | 327 | ||
328 | /* | ||
329 | * Power related commands | ||
330 | * | ||
331 | * Parameters: | ||
332 | * 1: subcommand | ||
333 | */ | ||
334 | #define SMU_CMD_POWER_EVENTS_COMMAND 0x8f | ||
335 | |||
336 | /* SMU_POWER_EVENTS subcommands */ | ||
337 | enum { | ||
338 | SMU_PWR_GET_POWERUP_EVENTS = 0x00, | ||
339 | SMU_PWR_SET_POWERUP_EVENTS = 0x01, | ||
340 | SMU_PWR_CLR_POWERUP_EVENTS = 0x02, | ||
341 | SMU_PWR_GET_WAKEUP_EVENTS = 0x03, | ||
342 | SMU_PWR_SET_WAKEUP_EVENTS = 0x04, | ||
343 | SMU_PWR_CLR_WAKEUP_EVENTS = 0x05, | ||
344 | |||
345 | /* | ||
346 | * Get last shutdown cause | ||
347 | * | ||
348 | * Returns: | ||
349 | * 1 byte (signed char): Last shutdown cause. Exact meaning unknown. | ||
350 | */ | ||
351 | SMU_PWR_LAST_SHUTDOWN_CAUSE = 0x07, | ||
352 | |||
353 | /* | ||
354 | * Sets or gets server ID. Meaning or use is unknown. | ||
355 | * | ||
356 | * Parameters: | ||
357 | * 2 (optional): Set server ID (1 byte) | ||
358 | * | ||
359 | * Returns: | ||
360 | * 1 byte (server ID?) | ||
361 | */ | ||
362 | SMU_PWR_SERVER_ID = 0x08, | ||
363 | }; | ||
364 | |||
365 | /* Power events wakeup bits */ | ||
366 | enum { | ||
367 | SMU_PWR_WAKEUP_KEY = 0x01, /* Wake on key press */ | ||
368 | SMU_PWR_WAKEUP_AC_INSERT = 0x02, /* Wake on AC adapter plug */ | ||
369 | SMU_PWR_WAKEUP_AC_CHANGE = 0x04, | ||
370 | SMU_PWR_WAKEUP_LID_OPEN = 0x08, | ||
371 | SMU_PWR_WAKEUP_RING = 0x10, | ||
372 | }; | ||
373 | |||
250 | 374 | ||
251 | /* | 375 | /* |
252 | * - Kernel side interface - | 376 | * - Kernel side interface - |
@@ -564,13 +688,13 @@ struct smu_user_cmd_hdr | |||
564 | 688 | ||
565 | __u8 cmd; /* SMU command byte */ | 689 | __u8 cmd; /* SMU command byte */ |
566 | __u8 pad[3]; /* padding */ | 690 | __u8 pad[3]; /* padding */ |
567 | __u32 data_len; /* Lenght of data following */ | 691 | __u32 data_len; /* Length of data following */ |
568 | }; | 692 | }; |
569 | 693 | ||
570 | struct smu_user_reply_hdr | 694 | struct smu_user_reply_hdr |
571 | { | 695 | { |
572 | __u32 status; /* Command status */ | 696 | __u32 status; /* Command status */ |
573 | __u32 reply_len; /* Lenght of data follwing */ | 697 | __u32 reply_len; /* Length of data follwing */ |
574 | }; | 698 | }; |
575 | 699 | ||
576 | #endif /* _SMU_H */ | 700 | #endif /* _SMU_H */ |