aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tc/lk201.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tc/lk201.h')
-rw-r--r--drivers/tc/lk201.h125
1 files changed, 125 insertions, 0 deletions
diff --git a/drivers/tc/lk201.h b/drivers/tc/lk201.h
new file mode 100644
index 000000000000..99f3203c41b8
--- /dev/null
+++ b/drivers/tc/lk201.h
@@ -0,0 +1,125 @@
1/*
2 * Commands to the keyboard processor
3 */
4
5#define LK_PARAM 0x80 /* start/end parameter list */
6
7#define LK_CMD_RESUME 0x8b /* resume transmission to the host */
8#define LK_CMD_INHIBIT 0x89 /* stop transmission to the host */
9#define LK_CMD_LEDS_ON 0x13 /* light LEDs */
10 /* 1st param: led bitmask */
11#define LK_CMD_LEDS_OFF 0x11 /* turn off LEDs */
12 /* 1st param: led bitmask */
13#define LK_CMD_DIS_KEYCLK 0x99 /* disable the keyclick */
14#define LK_CMD_ENB_KEYCLK 0x1b /* enable the keyclick */
15 /* 1st param: volume */
16#define LK_CMD_DIS_CTLCLK 0xb9 /* disable the Ctrl keyclick */
17#define LK_CMD_ENB_CTLCLK 0xbb /* enable the Ctrl keyclick */
18#define LK_CMD_SOUND_CLK 0x9f /* emit a keyclick */
19#define LK_CMD_DIS_BELL 0xa1 /* disable the bell */
20#define LK_CMD_ENB_BELL 0x23 /* enable the bell */
21 /* 1st param: volume */
22#define LK_CMD_BELL 0xa7 /* emit a bell */
23#define LK_CMD_TMP_NORPT 0xd1 /* disable typematic */
24 /* for the currently pressed key */
25#define LK_CMD_ENB_RPT 0xe3 /* enable typematic */
26 /* for RPT_DOWN groups */
27#define LK_CMD_DIS_RPT 0xe1 /* disable typematic */
28 /* for RPT_DOWN groups */
29#define LK_CMD_RPT_TO_DOWN 0xd9 /* set RPT_DOWN groups to DOWN */
30#define LK_CMD_REQ_ID 0xab /* request the keyboard ID */
31#define LK_CMD_POWER_UP 0xfd /* init power-up sequence */
32#define LK_CMD_TEST_MODE 0xcb /* enter the factory test mode */
33#define LK_CMD_TEST_EXIT 0x80 /* exit the factory test mode */
34#define LK_CMD_SET_DEFAULTS 0xd3 /* set power-up defaults */
35
36#define LK_CMD_MODE(m,div) (LK_PARAM|(((div)&0xf)<<3)|(((m)&0x3)<<1))
37 /* select the repeat mode */
38 /* for the selected key group */
39#define LK_CMD_MODE_AR(m,div) ((((div)&0xf)<<3)|(((m)&0x3)<<1))
40 /* select the repeat mode */
41 /* and the repeat register */
42 /* for the selected key group */
43 /* 1st param: register number */
44#define LK_CMD_RPT_RATE(r) (0x78|(((r)&0x3)<<1))
45 /* set the delay and repeat rate */
46 /* for the selected repeat register */
47 /* 1st param: initial delay */
48 /* 2nd param: repeat rate */
49
50/* there are 4 leds, represent them in the low 4 bits of a byte */
51#define LK_PARAM_LED_MASK(ledbmap) (LK_PARAM|((ledbmap)&0xf))
52#define LK_LED_WAIT 0x1 /* Wait LED */
53#define LK_LED_COMP 0x2 /* Compose LED */
54#define LK_LED_LOCK 0x4 /* Lock LED */
55#define LK_LED_HOLD 0x8 /* Hold Screen LED */
56
57/* max volume is 0, lowest is 0x7 */
58#define LK_PARAM_VOLUME(v) (LK_PARAM|((v)&0x7))
59
60/* mode set command details, div is a key group number */
61#define LK_MODE_DOWN 0x0 /* make only */
62#define LK_MODE_RPT_DOWN 0x1 /* make and typematic */
63#define LK_MODE_DOWN_UP 0x3 /* make and release */
64
65/* there are 4 repeat registers */
66#define LK_PARAM_AR(r) (LK_PARAM|((v)&0x3))
67
68/*
69 * Mappings between key groups and keycodes are as follows:
70 *
71 * 1: 0xbf - 0xff -- alphanumeric,
72 * 2: 0x91 - 0xa5 -- numeric keypad,
73 * 3: 0xbc -- Backspace,
74 * 4: 0xbd - 0xbe -- Tab, Return,
75 * 5: 0xb0 - 0xb2 -- Lock, Compose Character,
76 * 6: 0xad - 0xaf -- Ctrl, Shift,
77 * 7: 0xa6 - 0xa8 -- Left Arrow, Right Arrow,
78 * 8: 0xa9 - 0xac -- Up Arrow, Down Arrow, Right Shift,
79 * 9: 0x88 - 0x90 -- editor keypad,
80 * 10: 0x56 - 0x62 -- F1 - F5,
81 * 11: 0x63 - 0x6e -- F6 - F10,
82 * 12: 0x6f - 0x7a -- F11 - F14,
83 * 13: 0x7b - 0x7d -- Help, Do,
84 * 14: 0x7e - 0x87 -- F17 - F20.
85 *
86 * Notes:
87 * 1. Codes in the 0x00 - 0x40 range are reserved.
88 * 2. The assignment of the 0x41 - 0x55 range is undiscovered, probably 10.
89 */
90
91/* delay is 5 - 630 ms; 0x00 and 0x7f are reserved */
92#define LK_PARAM_DELAY(t) ((t)&0x7f)
93
94/* rate is 12 - 127 Hz; 0x00 - 0x0b and 0x7d (power-up!) are reserved */
95#define LK_PARAM_RATE(r) (LK_PARAM|((r)&0x7f))
96
97#define LK_SHIFT 1<<0
98#define LK_CTRL 1<<1
99#define LK_LOCK 1<<2
100#define LK_COMP 1<<3
101
102#define LK_KEY_SHIFT 0xae
103#define LK_KEY_CTRL 0xaf
104#define LK_KEY_LOCK 0xb0
105#define LK_KEY_COMP 0xb1
106
107#define LK_KEY_RELEASE 0xb3 /* all keys released */
108#define LK_KEY_REPEAT 0xb4 /* repeat the last key */
109
110/* status responses */
111#define LK_STAT_RESUME_ERR 0xb5 /* keystrokes lost while inhibited */
112#define LK_STAT_ERROR 0xb6 /* an invalid command received */
113#define LK_STAT_INHIBIT_ACK 0xb7 /* transmission inhibited */
114#define LK_STAT_TEST_ACK 0xb8 /* the factory test mode entered */
115#define LK_STAT_MODE_KEYDOWN 0xb9 /* a key is down on a change */
116 /* to the DOWN_UP mode; */
117 /* the keycode follows */
118#define LK_STAT_MODE_ACK 0xba /* the mode command succeeded */
119
120#define LK_STAT_PWRUP_ID 0x01 /* the power-up response start mark */
121#define LK_STAT_PWRUP_OK 0x00 /* the power-up self test OK */
122#define LK_STAT_PWRUP_KDOWN 0x3d /* a key was down during the test */
123#define LK_STAT_PWRUP_ERROR 0x3e /* keyboard self test failure */
124
125extern unsigned char scancodeRemap[256];