Go to the documentation of this file.
32 #define NVT_DRIVER_NAME "nuvoton-cir"
38 #define nvt_pr(level, text, ...) \
39 printk(level KBUILD_MODNAME ": " text, ## __VA_ARGS__)
41 #define nvt_dbg(text, ...) \
44 KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__)
46 #define nvt_dbg_verbose(text, ...) \
49 KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__)
51 #define nvt_dbg_wake(text, ...) \
54 KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__)
64 #define TX_BUF_LEN 256
117 #define ST_STUDY_NONE 0x0
118 #define ST_STUDY_START 0x1
119 #define ST_STUDY_CARRIER 0x2
120 #define ST_STUDY_ALL_RECV 0x4
123 #define ST_WAKE_NONE 0x0
124 #define ST_WAKE_START 0x1
125 #define ST_WAKE_FINISH 0x2
128 #define ST_RX_WAIT_7F 0x1
129 #define ST_RX_WAIT_HEAD 0x2
130 #define ST_RX_WAIT_SILENT_END 0x4
133 #define ST_TX_NONE 0x0
134 #define ST_TX_REQUEST 0x2
135 #define ST_TX_REPLY 0x4
138 #define BUF_PULSE_BIT 0x80
139 #define BUF_LEN_MASK 0x7f
140 #define BUF_REPEAT_BYTE 0x70
141 #define BUF_REPEAT_MASK 0xf0
146 #define CIR_IOREG_LENGTH 0x0f
149 #define CIR_RX_LIMIT_COUNT 0x7d0
152 #define CIR_IRCON 0x00
153 #define CIR_IRSTS 0x01
154 #define CIR_IREN 0x02
155 #define CIR_RXFCONT 0x03
158 #define CIR_SLCH 0x06
159 #define CIR_SLCL 0x07
160 #define CIR_FIFOCON 0x08
161 #define CIR_IRFIFOSTS 0x09
162 #define CIR_SRXFIFO 0x0a
163 #define CIR_TXFCONT 0x0b
164 #define CIR_STXFIFO 0x0c
165 #define CIR_FCCH 0x0d
166 #define CIR_FCCL 0x0e
167 #define CIR_IRFSM 0x0f
170 #define CIR_IRCON_RECV 0x80
171 #define CIR_IRCON_WIREN 0x40
172 #define CIR_IRCON_TXEN 0x20
173 #define CIR_IRCON_RXEN 0x10
174 #define CIR_IRCON_WRXINV 0x08
175 #define CIR_IRCON_RXINV 0x04
177 #define CIR_IRCON_SAMPLE_PERIOD_SEL_1 0x00
178 #define CIR_IRCON_SAMPLE_PERIOD_SEL_25 0x01
179 #define CIR_IRCON_SAMPLE_PERIOD_SEL_50 0x02
180 #define CIR_IRCON_SAMPLE_PERIOD_SEL_100 0x03
184 #define CIR_IRCON_SAMPLE_PERIOD_SEL CIR_IRCON_SAMPLE_PERIOD_SEL_50
187 #define CIR_IRSTS_RDR 0x80
188 #define CIR_IRSTS_RTR 0x40
189 #define CIR_IRSTS_PE 0x20
190 #define CIR_IRSTS_RFO 0x10
191 #define CIR_IRSTS_TE 0x08
192 #define CIR_IRSTS_TTR 0x04
193 #define CIR_IRSTS_TFU 0x02
194 #define CIR_IRSTS_GH 0x01
197 #define CIR_IREN_RDR 0x80
198 #define CIR_IREN_RTR 0x40
199 #define CIR_IREN_PE 0x20
200 #define CIR_IREN_RFO 0x10
201 #define CIR_IREN_TE 0x08
202 #define CIR_IREN_TTR 0x04
203 #define CIR_IREN_TFU 0x02
204 #define CIR_IREN_GH 0x01
207 #define CIR_FIFOCON_TXFIFOCLR 0x80
209 #define CIR_FIFOCON_TX_TRIGGER_LEV_31 0x00
210 #define CIR_FIFOCON_TX_TRIGGER_LEV_24 0x10
211 #define CIR_FIFOCON_TX_TRIGGER_LEV_16 0x20
212 #define CIR_FIFOCON_TX_TRIGGER_LEV_8 0x30
216 #define CIR_FIFOCON_TX_TRIGGER_LEV CIR_FIFOCON_TX_TRIGGER_LEV_16
218 #define CIR_FIFOCON_RXFIFOCLR 0x08
220 #define CIR_FIFOCON_RX_TRIGGER_LEV_1 0x00
221 #define CIR_FIFOCON_RX_TRIGGER_LEV_8 0x01
222 #define CIR_FIFOCON_RX_TRIGGER_LEV_16 0x02
223 #define CIR_FIFOCON_RX_TRIGGER_LEV_24 0x03
227 #define CIR_FIFOCON_RX_TRIGGER_LEV CIR_FIFOCON_RX_TRIGGER_LEV_24
230 #define CIR_IRFIFOSTS_IR_PENDING 0x80
231 #define CIR_IRFIFOSTS_RX_GS 0x40
232 #define CIR_IRFIFOSTS_RX_FTA 0x20
233 #define CIR_IRFIFOSTS_RX_EMPTY 0x10
234 #define CIR_IRFIFOSTS_RX_FULL 0x08
235 #define CIR_IRFIFOSTS_TX_FTA 0x04
236 #define CIR_IRFIFOSTS_TX_EMPTY 0x02
237 #define CIR_IRFIFOSTS_TX_FULL 0x01
241 #define CIR_WAKE_IRCON 0x00
242 #define CIR_WAKE_IRSTS 0x01
243 #define CIR_WAKE_IREN 0x02
244 #define CIR_WAKE_FIFO_CMP_DEEP 0x03
245 #define CIR_WAKE_FIFO_CMP_TOL 0x04
246 #define CIR_WAKE_FIFO_COUNT 0x05
247 #define CIR_WAKE_SLCH 0x06
248 #define CIR_WAKE_SLCL 0x07
249 #define CIR_WAKE_FIFOCON 0x08
250 #define CIR_WAKE_SRXFSTS 0x09
251 #define CIR_WAKE_SAMPLE_RX_FIFO 0x0a
252 #define CIR_WAKE_WR_FIFO_DATA 0x0b
253 #define CIR_WAKE_RD_FIFO_ONLY 0x0c
254 #define CIR_WAKE_RD_FIFO_ONLY_IDX 0x0d
255 #define CIR_WAKE_FIFO_IGNORE 0x0e
256 #define CIR_WAKE_IRFSM 0x0f
259 #define CIR_WAKE_IRCON_DEC_RST 0x80
260 #define CIR_WAKE_IRCON_MODE1 0x40
261 #define CIR_WAKE_IRCON_MODE0 0x20
262 #define CIR_WAKE_IRCON_RXEN 0x10
263 #define CIR_WAKE_IRCON_R 0x08
264 #define CIR_WAKE_IRCON_RXINV 0x04
268 #define CIR_WAKE_IRCON_SAMPLE_PERIOD_SEL CIR_IRCON_SAMPLE_PERIOD_SEL_50
271 #define CIR_WAKE_IRSTS_RDR 0x80
272 #define CIR_WAKE_IRSTS_RTR 0x40
273 #define CIR_WAKE_IRSTS_PE 0x20
274 #define CIR_WAKE_IRSTS_RFO 0x10
275 #define CIR_WAKE_IRSTS_GH 0x08
276 #define CIR_WAKE_IRSTS_IR_PENDING 0x01
279 #define CIR_WAKE_IREN_RDR 0x80
280 #define CIR_WAKE_IREN_RTR 0x40
281 #define CIR_WAKE_IREN_PE 0x20
282 #define CIR_WAKE_IREN_RFO 0x10
283 #define CIR_WAKE_IREN_TE 0x08
284 #define CIR_WAKE_IREN_TTR 0x04
285 #define CIR_WAKE_IREN_TFU 0x02
286 #define CIR_WAKE_IREN_GH 0x01
289 #define CIR_WAKE_FIFOCON_RXFIFOCLR 0x08
291 #define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_67 0x00
292 #define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_66 0x01
293 #define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_65 0x02
294 #define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_64 0x03
298 #define CIR_WAKE_FIFOCON_RX_TRIGGER_LEV CIR_WAKE_FIFOCON_RX_TRIGGER_LEV_67
301 #define CIR_WAKE_IRFIFOSTS_RX_GS 0x80
302 #define CIR_WAKE_IRFIFOSTS_RX_FTA 0x40
303 #define CIR_WAKE_IRFIFOSTS_RX_EMPTY 0x20
304 #define CIR_WAKE_IRFIFOSTS_RX_FULL 0x10
310 #define CIR_WAKE_FIFO_CMP_BYTES 65
312 #define CIR_WAKE_CMP_TOLERANCE 5
323 #define CR_EFIR2 0x4e
324 #define CR_EFDR2 0x4f
327 #define EFER_EFM_ENABLE 0x87
328 #define EFER_EFM_DISABLE 0xaa
331 #define CHIP_ID_HIGH_667 0xa5
332 #define CHIP_ID_HIGH_677B 0xb4
333 #define CHIP_ID_HIGH_677C 0xc3
334 #define CHIP_ID_LOW_667 0x13
335 #define CHIP_ID_LOW_677B2 0x72
336 #define CHIP_ID_LOW_677B3 0x73
337 #define CHIP_ID_LOW_677C 0x33
340 #define CR_SOFTWARE_RESET 0x02
341 #define CR_LOGICAL_DEV_SEL 0x07
342 #define CR_CHIP_ID_HI 0x20
343 #define CR_CHIP_ID_LO 0x21
344 #define CR_DEV_POWER_DOWN 0x22
345 #define CR_OUTPUT_PIN_SEL 0x27
346 #define CR_MULTIFUNC_PIN_SEL 0x2c
347 #define CR_LOGICAL_DEV_EN 0x30
349 #define CR_CIR_BASE_ADDR_HI 0x60
350 #define CR_CIR_BASE_ADDR_LO 0x61
351 #define CR_CIR_IRQ_RSRC 0x70
353 #define CR_ACPI_CIR_WAKE 0xe0
354 #define CR_ACPI_IRQ_EVENTS 0xf6
355 #define CR_ACPI_IRQ_EVENTS2 0xf7
358 #define LOGICAL_DEV_LPT 0x01
359 #define LOGICAL_DEV_CIR 0x06
360 #define LOGICAL_DEV_ACPI 0x0a
361 #define LOGICAL_DEV_CIR_WAKE 0x0e
363 #define LOGICAL_DEV_DISABLE 0x00
364 #define LOGICAL_DEV_ENABLE 0x01
366 #define CIR_WAKE_ENABLE_BIT 0x08
367 #define CIR_INTR_MOUSE_IRQ_BIT 0x80
368 #define PME_INTR_CIR_PASS_BIT 0x08
371 #define OUTPUT_PIN_SEL_MASK 0xbc
372 #define OUTPUT_ENABLE_CIR 0x01
373 #define OUTPUT_ENABLE_CIRWB 0x40
376 #define MULTIFUNC_PIN_SEL_MASK 0x1f
377 #define MULTIFUNC_ENABLE_CIR 0x80
378 #define MULTIFUNC_ENABLE_CIRWB 0x20
385 #define CONTROLLER_BUF_LEN_MIN 830
390 #define KEYBOARD_BUF_LEN_MAX 650
391 #define KEYBOARD_BUF_LEN_MIN 610
396 #define MOUSE_BUF_LEN_MIN 565
398 #define CIR_SAMPLE_PERIOD 50
399 #define CIR_SAMPLE_LOW_INACCURACY 0.85
402 #define MAX_SILENCE_TIME 60000
404 #if CIR_IRCON_SAMPLE_PERIOD_SEL == CIR_IRCON_SAMPLE_PERIOD_SEL_100
405 #define SAMPLE_PERIOD 100
407 #elif CIR_IRCON_SAMPLE_PERIOD_SEL == CIR_IRCON_SAMPLE_PERIOD_SEL_50
408 #define SAMPLE_PERIOD 50
410 #elif CIR_IRCON_SAMPLE_PERIOD_SEL == CIR_IRCON_SAMPLE_PERIOD_SEL_25
411 #define SAMPLE_PERIOD 25
414 #define SAMPLE_PERIOD 1
418 #define MAX_CARRIER 60000
419 #define MIN_CARRIER 30000