tadpmureg.h revision 1.2.6.2 1 1.2.6.2 christos /* $NetBSD: tadpmureg.h,v 1.2.6.2 2019/06/10 22:06:47 christos Exp $ */
2 1.2.6.2 christos
3 1.2.6.2 christos /*-
4 1.2.6.2 christos * Copyright (c) 2018 Michael Lorenz <macallan (at) netbsd.org>
5 1.2.6.2 christos * All rights reserved.
6 1.2.6.2 christos *
7 1.2.6.2 christos * Redistribution and use in source and binary forms, with or without
8 1.2.6.2 christos * modification, are permitted provided that the following conditions
9 1.2.6.2 christos * are met:
10 1.2.6.2 christos * 1. Redistributions of source code must retain the above copyright
11 1.2.6.2 christos * notice, this list of conditions and the following disclaimer.
12 1.2.6.2 christos * 2. Redistributions in binary form must reproduce the above copyright
13 1.2.6.2 christos * notice, this list of conditions and the following disclaimer in the
14 1.2.6.2 christos * documentation and/or other materials provided with the distribution.
15 1.2.6.2 christos *
16 1.2.6.2 christos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 1.2.6.2 christos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.2.6.2 christos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.2.6.2 christos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 1.2.6.2 christos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 1.2.6.2 christos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 1.2.6.2 christos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 1.2.6.2 christos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 1.2.6.2 christos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 1.2.6.2 christos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 1.2.6.2 christos * POSSIBILITY OF SUCH DAMAGE.
27 1.2.6.2 christos */
28 1.2.6.2 christos
29 1.2.6.2 christos /* registers and commands for the PMU found in Tadpole Viper laptops */
30 1.2.6.2 christos
31 1.2.6.2 christos #ifndef TADPMUREG_H
32 1.2.6.2 christos #define TADPMUREG_H
33 1.2.6.2 christos
34 1.2.6.2 christos /* all values were found by looking at OF methods on the tadpmu node */
35 1.2.6.2 christos
36 1.2.6.2 christos /* these registers live in the pckbc's address space */
37 1.2.6.2 christos #define TADPMU_CMD 0x6
38 1.2.6.2 christos #define TADPMU_STATUS 0x6
39 1.2.6.2 christos #define TADPMU_DATA 0x2
40 1.2.6.2 christos
41 1.2.6.2 christos #define STATUS_HAVE_DATA 0x01 /* response from command */
42 1.2.6.2 christos #define STATUS_CMD_IN_PROGRESS 0x02
43 1.2.6.2 christos #define STATUS_INTR 0x04 /* interrupt happened, read data to ack */
44 1.2.6.2 christos #define STATUS_SEND_DATA 0x08 /* cmd waiting for data */
45 1.2.6.2 christos
46 1.2.6.2 christos #define CMD_SET_OPMODE 0x41 /* not sure what exactly this does... */
47 1.2.6.2 christos #define OPMODE_UNIX 0x75 /* other than toggling the UNIX mode */
48 1.2.6.2 christos #define OPMODE_OF 0x67 /* bit in the GENSTAT register */
49 1.2.6.2 christos #define CMD_SET_BACKLIGHT 0x43 /* apparently 0 - 1f */
50 1.2.6.2 christos #define CMD_SET_CPUSPEED 0x44 /* in 10MHz, so 120 == 1.2GHz */
51 1.2.6.2 christos #define CMD_SET_FANSPEED 0x46 /* ??? */
52 1.2.6.2 christos #define CMD_SET_VOLUME 0x48 /* beeper volume */
53 1.2.6.2 christos
54 1.2.6.2 christos #define CMD_READ_GENSTAT 0x10
55 1.2.6.2 christos #define CMD_READ_BACKLIGHT 0x11
56 1.2.6.2 christos #define CMD_READ_SYSTEMP 0x12 /* temperature */
57 1.2.6.2 christos #define CMD_READ_VOLUME 0x13
58 1.2.6.2 christos #define CMD_READ_VBATT 0x14
59 1.2.6.2 christos #define CMD_READ_VERSION 0x15
60 1.2.6.2 christos #define CMD_READ_CPUSPEED 0x16
61 1.2.6.2 christos /* 0x17 returns a byte, always 0 */
62 1.2.6.2 christos /* 0x18 returns a byte, always(?) 0x77 */
63 1.2.6.2 christos #define CMD_READ_GENSTAT2 0x19
64 1.2.6.2 christos #define CMD_READ_FANSPEED 0x50 /* takes a parameter, returns nothing? */
65 1.2.6.2 christos
66 1.2.6.2 christos /* these are according to the ROM methods
67 1.2.6.2 christos #define GENSTAT_DC_PRESENT 0x01
68 1.2.6.2 christos #define GENSTAT_DC_ENABLE 0x02
69 1.2.6.2 christos #define GENSTAT_BATTERY_PRESENT 0x04
70 1.2.6.2 christos #define GENSTAT_BATTERY_CHARGING 0x08
71 1.2.6.2 christos #define GENSTAT_LID_CLOSED 0x10
72 1.2.6.2 christos #define GENSTAT_UNIX_MODE 0x20
73 1.2.6.2 christos #define GENSTAT_SPREADSPECTRUM 0x40
74 1.2.6.2 christos */
75 1.2.6.2 christos
76 1.2.6.2 christos /* these are according to experiment */
77 1.2.6.2 christos #define GENSTAT_UNIX_MODE 0x01
78 1.2.6.2 christos #define GENSTAT_DC_PRESENT 0x08 /* guess */
79 1.2.6.2 christos #define GENSTAT_DC_ENABLE 0x18 /* guess */
80 1.2.6.2 christos #define GENSTAT_LID_CLOSED 0x80
81 1.2.6.2 christos
82 1.2.6.2 christos #define GENSTAT2_MUTE 0x02
83 1.2.6.2 christos
84 1.2.6.2 christos /* messages from interrupts */
85 1.2.6.2 christos #define TADPMU_LID 0x05
86 1.2.6.2 christos #define TADPMU_POWERBUTTON 0x06
87 1.2.6.2 christos
88 1.2.6.2 christos #endif /* TADPMUREG_H */