2 * winbond-cir.c - Driver for the Consumer IR functionality of Winbond
5 * Currently supports the Winbond WPCD376i chip (PNP id WEC1022), but
6 * could probably support others (Winbond WEC102X, NatSemi, etc)
7 * with minor modifications.
9 * Original Author: David Härdeman <david@hardeman.nu>
10 * Copyright (C) 2009 David Härdeman <david@hardeman.nu>
12 * Dedicated to Matilda, my newborn daughter, without whose loving attention
13 * this driver would have been finished in half the time and with a fraction
17 * o Winbond WPCD376I datasheet helpfully provided by Jesse Barnes at Intel
18 * o NatSemi PC87338/PC97338 datasheet (for the serial port stuff)
23 * o Wake-On-CIR functionality
28 * Left as an exercise for the reader:
29 * o Learning (I have neither the hardware, nor the need)
30 * o IR Transmit (ibid)
32 * This program is free software; you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation; either version 2 of the License, or
35 * (at your option) any later version.
37 * This program is distributed in the hope that it will be useful,
38 * but WITHOUT ANY WARRANTY; without even the implied warranty of
39 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 * GNU General Public License for more details.
42 * You should have received a copy of the GNU General Public License
43 * along with this program; if not, write to the Free Software
44 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
47 #include <linux/module.h>
48 #include <linux/pnp.h>
49 #include <linux/interrupt.h>
50 #include <linux/timer.h>
51 #include <linux/input.h>
52 #include <linux/leds.h>
53 #include <linux/list.h>
54 #include <linux/spinlock.h>
55 #include <linux/pci_ids.h>
57 #include <linux/bitrev.h>
58 #include <linux/bitops.h>
60 #define DRVNAME "winbond-cir"
62 /* CEIR Wake-Up Registers, relative to data->wbase */
63 #define WBCIR_REG_WCEIR_CTL 0x03 /* CEIR Receiver Control */
64 #define WBCIR_REG_WCEIR_STS 0x04 /* CEIR Receiver Status */
65 #define WBCIR_REG_WCEIR_EV_EN 0x05 /* CEIR Receiver Event Enable */
66 #define WBCIR_REG_WCEIR_CNTL 0x06 /* CEIR Receiver Counter Low */
67 #define WBCIR_REG_WCEIR_CNTH 0x07 /* CEIR Receiver Counter High */
68 #define WBCIR_REG_WCEIR_INDEX 0x08 /* CEIR Receiver Index */
69 #define WBCIR_REG_WCEIR_DATA 0x09 /* CEIR Receiver Data */
70 #define WBCIR_REG_WCEIR_CSL 0x0A /* CEIR Re. Compare Strlen */
71 #define WBCIR_REG_WCEIR_CFG1 0x0B /* CEIR Re. Configuration 1 */
72 #define WBCIR_REG_WCEIR_CFG2 0x0C /* CEIR Re. Configuration 2 */
74 /* CEIR Enhanced Functionality Registers, relative to data->ebase */
75 #define WBCIR_REG_ECEIR_CTS 0x00 /* Enhanced IR Control Status */
76 #define WBCIR_REG_ECEIR_CCTL 0x01 /* Infrared Counter Control */
77 #define WBCIR_REG_ECEIR_CNT_LO 0x02 /* Infrared Counter LSB */
78 #define WBCIR_REG_ECEIR_CNT_HI 0x03 /* Infrared Counter MSB */
79 #define WBCIR_REG_ECEIR_IREM 0x04 /* Infrared Emitter Status */
81 /* SP3 Banked Registers, relative to data->sbase */
82 #define WBCIR_REG_SP3_BSR 0x03 /* Bank Select, all banks */
84 #define WBCIR_REG_SP3_RXDATA 0x00 /* FIFO RX data (r) */
85 #define WBCIR_REG_SP3_TXDATA 0x00 /* FIFO TX data (w) */
86 #define WBCIR_REG_SP3_IER 0x01 /* Interrupt Enable */
87 #define WBCIR_REG_SP3_EIR 0x02 /* Event Identification (r) */
88 #define WBCIR_REG_SP3_FCR 0x02 /* FIFO Control (w) */
89 #define WBCIR_REG_SP3_MCR 0x04 /* Mode Control */
90 #define WBCIR_REG_SP3_LSR 0x05 /* Link Status */
91 #define WBCIR_REG_SP3_MSR 0x06 /* Modem Status */
92 #define WBCIR_REG_SP3_ASCR 0x07 /* Aux Status and Control */
94 #define WBCIR_REG_SP3_BGDL 0x00 /* Baud Divisor LSB */
95 #define WBCIR_REG_SP3_BGDH 0x01 /* Baud Divisor MSB */
96 #define WBCIR_REG_SP3_EXCR1 0x02 /* Extended Control 1 */
97 #define WBCIR_REG_SP3_EXCR2 0x04 /* Extended Control 2 */
98 #define WBCIR_REG_SP3_TXFLV 0x06 /* TX FIFO Level */
99 #define WBCIR_REG_SP3_RXFLV 0x07 /* RX FIFO Level */
101 #define WBCIR_REG_SP3_MRID 0x00 /* Module Identification */
102 #define WBCIR_REG_SP3_SH_LCR 0x01 /* LCR Shadow */
103 #define WBCIR_REG_SP3_SH_FCR 0x02 /* FCR Shadow */
105 #define WBCIR_REG_SP3_IRCR1 0x02 /* Infrared Control 1 */
107 #define WBCIR_REG_SP3_IRCR2 0x04 /* Infrared Control 2 */
109 #define WBCIR_REG_SP3_IRCR3 0x00 /* Infrared Control 3 */
110 #define WBCIR_REG_SP3_SIR_PW 0x02 /* SIR Pulse Width */
112 #define WBCIR_REG_SP3_IRRXDC 0x00 /* IR RX Demod Control */
113 #define WBCIR_REG_SP3_IRTXMC 0x01 /* IR TX Mod Control */
114 #define WBCIR_REG_SP3_RCCFG 0x02 /* CEIR Config */
115 #define WBCIR_REG_SP3_IRCFG1 0x04 /* Infrared Config 1 */
116 #define WBCIR_REG_SP3_IRCFG4 0x07 /* Infrared Config 4 */
119 * Magic values follow
122 /* No interrupts for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */
123 #define WBCIR_IRQ_NONE 0x00
124 /* RX data bit for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */
125 #define WBCIR_IRQ_RX 0x01
126 /* Over/Under-flow bit for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */
127 #define WBCIR_IRQ_ERR 0x04
128 /* Led enable/disable bit for WBCIR_REG_ECEIR_CTS */
129 #define WBCIR_LED_ENABLE 0x80
130 /* RX data available bit for WBCIR_REG_SP3_LSR */
131 #define WBCIR_RX_AVAIL 0x01
132 /* RX disable bit for WBCIR_REG_SP3_ASCR */
133 #define WBCIR_RX_DISABLE 0x20
134 /* Extended mode enable bit for WBCIR_REG_SP3_EXCR1 */
135 #define WBCIR_EXT_ENABLE 0x01
136 /* Select compare register in WBCIR_REG_WCEIR_INDEX (bits 5 & 6) */
137 #define WBCIR_REGSEL_COMPARE 0x10
138 /* Select mask register in WBCIR_REG_WCEIR_INDEX (bits 5 & 6) */
139 #define WBCIR_REGSEL_MASK 0x20
140 /* Starting address of selected register in WBCIR_REG_WCEIR_INDEX */
141 #define WBCIR_REG_ADDR0 0x00
143 /* Valid banks for the SP3 UART */
155 /* Supported IR Protocols */
156 enum wbcir_protocol {
157 IR_PROTOCOL_RC5 = 0x0,
158 IR_PROTOCOL_NEC = 0x1,
159 IR_PROTOCOL_RC6 = 0x2,
163 #define WBCIR_NAME "Winbond CIR"
164 #define WBCIR_ID_FAMILY 0xF1 /* Family ID for the WPCD376I */
165 #define WBCIR_ID_CHIP 0x04 /* Chip ID for the WPCD376I */
166 #define IR_KEYPRESS_TIMEOUT 250 /* FIXME: should be per-protocol? */
167 #define INVALID_SCANCODE 0x7FFFFFFF /* Invalid with all protos */
168 #define WAKEUP_IOMEM_LEN 0x10 /* Wake-Up I/O Reg Len */
169 #define EHFUNC_IOMEM_LEN 0x10 /* Enhanced Func I/O Reg Len */
170 #define SP_IOMEM_LEN 0x08 /* Serial Port 3 (IR) Reg Len */
171 #define WBCIR_MAX_IDLE_BYTES 10
173 static DEFINE_SPINLOCK(wbcir_lock);
174 static DEFINE_RWLOCK(keytable_lock);
178 unsigned int keycode;
181 struct wbcir_keyentry {
182 struct wbcir_key key;
183 struct list_head list;
186 static struct wbcir_key rc6_def_keymap[] = {
187 { 0x800F0400, KEY_NUMERIC_0 },
188 { 0x800F0401, KEY_NUMERIC_1 },
189 { 0x800F0402, KEY_NUMERIC_2 },
190 { 0x800F0403, KEY_NUMERIC_3 },
191 { 0x800F0404, KEY_NUMERIC_4 },
192 { 0x800F0405, KEY_NUMERIC_5 },
193 { 0x800F0406, KEY_NUMERIC_6 },
194 { 0x800F0407, KEY_NUMERIC_7 },
195 { 0x800F0408, KEY_NUMERIC_8 },
196 { 0x800F0409, KEY_NUMERIC_9 },
197 { 0x800F041D, KEY_NUMERIC_STAR },
198 { 0x800F041C, KEY_NUMERIC_POUND },
199 { 0x800F0410, KEY_VOLUMEUP },
200 { 0x800F0411, KEY_VOLUMEDOWN },
201 { 0x800F0412, KEY_CHANNELUP },
202 { 0x800F0413, KEY_CHANNELDOWN },
203 { 0x800F040E, KEY_MUTE },
204 { 0x800F040D, KEY_VENDOR }, /* Vista Logo Key */
205 { 0x800F041E, KEY_UP },
206 { 0x800F041F, KEY_DOWN },
207 { 0x800F0420, KEY_LEFT },
208 { 0x800F0421, KEY_RIGHT },
209 { 0x800F0422, KEY_OK },
210 { 0x800F0423, KEY_ESC },
211 { 0x800F040F, KEY_INFO },
212 { 0x800F040A, KEY_CLEAR },
213 { 0x800F040B, KEY_ENTER },
214 { 0x800F045B, KEY_RED },
215 { 0x800F045C, KEY_GREEN },
216 { 0x800F045D, KEY_YELLOW },
217 { 0x800F045E, KEY_BLUE },
218 { 0x800F045A, KEY_TEXT },
219 { 0x800F0427, KEY_SWITCHVIDEOMODE },
220 { 0x800F040C, KEY_POWER },
221 { 0x800F0450, KEY_RADIO },
222 { 0x800F0448, KEY_PVR },
223 { 0x800F0447, KEY_AUDIO },
224 { 0x800F0426, KEY_EPG },
225 { 0x800F0449, KEY_CAMERA },
226 { 0x800F0425, KEY_TV },
227 { 0x800F044A, KEY_VIDEO },
228 { 0x800F0424, KEY_DVD },
229 { 0x800F0416, KEY_PLAY },
230 { 0x800F0418, KEY_PAUSE },
231 { 0x800F0419, KEY_STOP },
232 { 0x800F0414, KEY_FASTFORWARD },
233 { 0x800F041A, KEY_NEXT },
234 { 0x800F041B, KEY_PREVIOUS },
235 { 0x800F0415, KEY_REWIND },
236 { 0x800F0417, KEY_RECORD },
239 /* Registers and other state is protected by wbcir_lock */
241 unsigned long wbase; /* Wake-Up Baseaddr */
242 unsigned long ebase; /* Enhanced Func. Baseaddr */
243 unsigned long sbase; /* Serial Port Baseaddr */
244 unsigned int irq; /* Serial Port IRQ */
246 struct input_dev *input_dev;
247 struct timer_list timer_keyup;
248 struct led_trigger *rxtrigger;
249 struct led_trigger *txtrigger;
250 struct led_classdev led;
253 unsigned int last_keycode;
256 unsigned long keyup_jiffies;
257 unsigned int idle_count;
259 /* RX irdata and parsing state */
260 unsigned long irdata[30];
261 unsigned int irdata_count;
262 unsigned int irdata_idle;
263 unsigned int irdata_off;
264 unsigned int irdata_error;
266 /* Protected by keytable_lock */
267 struct list_head keytable;
270 static enum wbcir_protocol protocol = IR_PROTOCOL_RC6;
271 module_param(protocol, uint, 0444);
272 MODULE_PARM_DESC(protocol, "IR protocol to use "
273 "(0 = RC5, 1 = NEC, 2 = RC6A, default)");
275 static int invert; /* default = 0 */
276 module_param(invert, bool, 0444);
277 MODULE_PARM_DESC(invert, "Invert the signal from the IR receiver");
279 static unsigned int wake_sc = 0x800F040C;
280 module_param(wake_sc, uint, 0644);
281 MODULE_PARM_DESC(wake_sc, "Scancode of the power-on IR command");
283 static unsigned int wake_rc6mode = 6;
284 module_param(wake_rc6mode, uint, 0644);
285 MODULE_PARM_DESC(wake_rc6mode, "RC6 mode for the power-on command "
286 "(0 = 0, 6 = 6A, default)");
290 /*****************************************************************************
294 *****************************************************************************/
296 /* Caller needs to hold wbcir_lock */
298 wbcir_set_bits(unsigned long addr, u8 bits, u8 mask)
303 val = ((val & ~mask) | (bits & mask));
307 /* Selects the register bank for the serial port */
309 wbcir_select_bank(struct wbcir_data *data, enum wbcir_bank bank)
311 outb(bank, data->sbase + WBCIR_REG_SP3_BSR);
314 static enum led_brightness
315 wbcir_led_brightness_get(struct led_classdev *led_cdev)
317 struct wbcir_data *data = container_of(led_cdev,
321 if (inb(data->ebase + WBCIR_REG_ECEIR_CTS) & WBCIR_LED_ENABLE)
328 wbcir_led_brightness_set(struct led_classdev *led_cdev,
329 enum led_brightness brightness)
331 struct wbcir_data *data = container_of(led_cdev,
335 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CTS,
336 brightness == LED_OFF ? 0x00 : WBCIR_LED_ENABLE,
340 /* Manchester encodes bits to RC6 message cells (see wbcir_parse_rc6) */
342 wbcir_to_rc6cells(u8 val)
348 for (i = 0; i < 4; i++) {
350 coded |= 0x02 << (i * 2);
352 coded |= 0x01 << (i * 2);
361 /*****************************************************************************
365 *****************************************************************************/
368 wbcir_do_getkeycode(struct wbcir_data *data, u32 scancode)
370 struct wbcir_keyentry *keyentry;
371 unsigned int keycode = KEY_RESERVED;
374 read_lock_irqsave(&keytable_lock, flags);
376 list_for_each_entry(keyentry, &data->keytable, list) {
377 if (keyentry->key.scancode == scancode) {
378 keycode = keyentry->key.keycode;
383 read_unlock_irqrestore(&keytable_lock, flags);
388 wbcir_getkeycode(struct input_dev *dev, int scancode, int *keycode)
390 struct wbcir_data *data = input_get_drvdata(dev);
392 *keycode = (int)wbcir_do_getkeycode(data, (u32)scancode);
397 wbcir_setkeycode(struct input_dev *dev, int sscancode, int keycode)
399 struct wbcir_data *data = input_get_drvdata(dev);
400 struct wbcir_keyentry *keyentry;
401 struct wbcir_keyentry *new_keyentry;
403 unsigned int old_keycode = KEY_RESERVED;
404 u32 scancode = (u32)sscancode;
406 if (keycode < 0 || keycode > KEY_MAX)
409 new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL);
413 write_lock_irqsave(&keytable_lock, flags);
415 list_for_each_entry(keyentry, &data->keytable, list) {
416 if (keyentry->key.scancode != scancode)
419 old_keycode = keyentry->key.keycode;
420 keyentry->key.keycode = keycode;
422 if (keyentry->key.keycode == KEY_RESERVED) {
423 list_del(&keyentry->list);
430 set_bit(keycode, dev->keybit);
432 if (old_keycode == KEY_RESERVED) {
433 new_keyentry->key.scancode = scancode;
434 new_keyentry->key.keycode = keycode;
435 list_add(&new_keyentry->list, &data->keytable);
438 clear_bit(old_keycode, dev->keybit);
439 list_for_each_entry(keyentry, &data->keytable, list) {
440 if (keyentry->key.keycode == old_keycode) {
441 set_bit(old_keycode, dev->keybit);
447 write_unlock_irqrestore(&keytable_lock, flags);
452 * Timer function to report keyup event some time after keydown is
453 * reported by the ISR.
456 wbcir_keyup(unsigned long cookie)
458 struct wbcir_data *data = (struct wbcir_data *)cookie;
462 * data->keyup_jiffies is used to prevent a race condition if a
463 * hardware interrupt occurs at this point and the keyup timer
464 * event is moved further into the future as a result.
466 * The timer will then be reactivated and this function called
467 * again in the future. We need to exit gracefully in that case
468 * to allow the input subsystem to do its auto-repeat magic or
469 * a keyup event might follow immediately after the keydown.
472 spin_lock_irqsave(&wbcir_lock, flags);
474 if (time_is_after_eq_jiffies(data->keyup_jiffies) && data->keypressed) {
475 data->keypressed = 0;
476 led_trigger_event(data->rxtrigger, LED_OFF);
477 input_report_key(data->input_dev, data->last_keycode, 0);
478 input_sync(data->input_dev);
481 spin_unlock_irqrestore(&wbcir_lock, flags);
485 wbcir_keydown(struct wbcir_data *data, u32 scancode, u8 toggle)
487 unsigned int keycode;
490 if (data->last_scancode == scancode &&
491 data->last_toggle == toggle &&
494 data->last_scancode = scancode;
496 /* Do we need to release an old keypress? */
497 if (data->keypressed) {
498 input_report_key(data->input_dev, data->last_keycode, 0);
499 input_sync(data->input_dev);
500 data->keypressed = 0;
503 /* Report scancode */
504 input_event(data->input_dev, EV_MSC, MSC_SCAN, (int)scancode);
506 /* Do we know this scancode? */
507 keycode = wbcir_do_getkeycode(data, scancode);
508 if (keycode == KEY_RESERVED)
511 /* Register a keypress */
512 input_report_key(data->input_dev, keycode, 1);
513 data->keypressed = 1;
514 data->last_keycode = keycode;
515 data->last_toggle = toggle;
518 input_sync(data->input_dev);
519 led_trigger_event(data->rxtrigger,
520 data->keypressed ? LED_FULL : LED_OFF);
521 data->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT);
522 mod_timer(&data->timer_keyup, data->keyup_jiffies);
527 /*****************************************************************************
529 * IR PARSING FUNCTIONS
531 *****************************************************************************/
533 /* Resets all irdata */
535 wbcir_reset_irdata(struct wbcir_data *data)
537 memset(data->irdata, 0, sizeof(data->irdata));
538 data->irdata_count = 0;
539 data->irdata_off = 0;
540 data->irdata_error = 0;
541 data->idle_count = 0;
544 /* Adds one bit of irdata */
546 add_irdata_bit(struct wbcir_data *data, int set)
548 if (data->irdata_count >= sizeof(data->irdata) * 8) {
549 data->irdata_error = 1;
554 __set_bit(data->irdata_count, data->irdata);
555 data->irdata_count++;
558 /* Gets count bits of irdata */
560 get_bits(struct wbcir_data *data, int count)
564 if (data->irdata_count - data->irdata_off < count) {
565 data->irdata_error = 1;
571 if (test_bit(data->irdata_off, data->irdata))
580 /* Reads 16 cells and converts them to a byte */
582 wbcir_rc6cells_to_byte(struct wbcir_data *data)
584 u16 raw = get_bits(data, 16);
588 for (bit = 0; bit < 8; bit++) {
589 switch (raw & 0x03) {
593 val |= (0x01 << bit);
596 data->irdata_error = 1;
605 /* Decodes a number of bits from raw RC5 data */
607 wbcir_get_rc5bits(struct wbcir_data *data, unsigned int count)
609 u16 raw = get_bits(data, count * 2);
613 for (bit = 0; bit < count; bit++) {
614 switch (raw & 0x03) {
616 val |= (0x01 << bit);
621 data->irdata_error = 1;
631 wbcir_parse_rc6(struct device *dev, struct wbcir_data *data)
634 * Normal bits are manchester coded as follows:
635 * cell0 + cell1 = logic "0"
636 * cell1 + cell0 = logic "1"
638 * The IR pulse has the following components:
640 * Leader - 6 * cell1 - discarded
641 * Gap - 2 * cell0 - discarded
642 * Start bit - Normal Coding - always "1"
643 * Mode Bit 2 - 0 - Normal Coding
644 * Toggle bit - Normal Coding with double bit time,
645 * e.g. cell0 + cell0 + cell1 + cell1
648 * The rest depends on the mode, the following modes are known:
651 * Address Bit 7 - 0 - Normal Coding
652 * Command Bit 7 - 0 - Normal Coding
655 * The above Toggle Bit is used as a submode bit, 0 = A, 1 = B.
656 * Submode B is for pointing devices, only remotes using submode A
659 * Customer range bit - 0 => Customer = 7 bits, 0...127
660 * 1 => Customer = 15 bits, 32768...65535
661 * Customer Bits - Normal Coding
663 * Customer codes are allocated by Philips. The rest of the bits
664 * are customer dependent. The following is commonly used (and the
665 * only supported config):
667 * Toggle Bit - Normal Coding
668 * Address Bit 6 - 0 - Normal Coding
669 * Command Bit 7 - 0 - Normal Coding
671 * All modes are followed by at least 6 * cell0.
674 * 1 * 2 (start bit) + 3 * 2 (mode) + 2 * 2 (toggle) +
675 * 8 * 2 (address) + 8 * 2 (command) =
679 * 1 * 2 (start bit) + 3 * 2 (mode) + 2 * 2 (submode) +
680 * 1 * 2 (customer range bit) + 7/15 * 2 (customer bits) +
681 * 1 * 2 (toggle bit) + 7 * 2 (address) + 8 * 2 (command) =
692 while (get_bits(data, 1) && !data->irdata_error)
696 if (get_bits(data, 1)) {
697 dev_dbg(dev, "RC6 - Invalid leader space\n");
702 if (get_bits(data, 2) != 0x02) {
703 dev_dbg(dev, "RC6 - Invalid start bit\n");
708 mode = get_bits(data, 6);
710 case 0x15: /* 010101 = b000 */
713 case 0x29: /* 101001 = b110 */
717 dev_dbg(dev, "RC6 - Invalid mode\n");
721 /* Toggle bit / Submode bit */
722 toggle = get_bits(data, 4);
731 dev_dbg(dev, "RC6 - Toggle bit error\n");
738 dev_dbg(dev, "RC6B - Not Supported\n");
742 customer = wbcir_rc6cells_to_byte(data);
744 if (customer & 0x80) {
745 /* 15 bit customer value */
747 customer |= wbcir_rc6cells_to_byte(data);
752 address = wbcir_rc6cells_to_byte(data);
754 toggle = address >> 7;
759 command = wbcir_rc6cells_to_byte(data);
761 /* Create scancode */
763 scancode |= address << 8;
764 scancode |= customer << 16;
766 /* Last sanity check */
767 if (data->irdata_error) {
768 dev_dbg(dev, "RC6 - Cell error(s)\n");
772 dev_dbg(dev, "IR-RC6 ad 0x%02X cm 0x%02X cu 0x%04X "
773 "toggle %u mode %u scan 0x%08X\n",
777 (unsigned int)toggle,
781 wbcir_keydown(data, scancode, toggle);
785 wbcir_parse_rc5(struct device *dev, struct wbcir_data *data)
788 * Bits are manchester coded as follows:
789 * cell1 + cell0 = logic "0"
790 * cell0 + cell1 = logic "1"
791 * (i.e. the reverse of RC6)
793 * Start bit 1 - "1" - discarded
794 * Start bit 2 - Must be inverted to get command bit 6
805 if (!get_bits(data, 1)) {
806 dev_dbg(dev, "RC5 - Invalid start bit\n");
811 if (!wbcir_get_rc5bits(data, 1))
816 toggle = wbcir_get_rc5bits(data, 1);
817 address = wbcir_get_rc5bits(data, 5);
818 command |= wbcir_get_rc5bits(data, 6);
819 scancode = address << 7 | command;
821 /* Last sanity check */
822 if (data->irdata_error) {
823 dev_dbg(dev, "RC5 - Invalid message\n");
827 dev_dbg(dev, "IR-RC5 ad %u cm %u t %u s %u\n",
828 (unsigned int)address,
829 (unsigned int)command,
830 (unsigned int)toggle,
831 (unsigned int)scancode);
833 wbcir_keydown(data, scancode, toggle);
837 wbcir_parse_nec(struct device *dev, struct wbcir_data *data)
840 * Each bit represents 560 us.
842 * Leader - 9 ms burst
843 * Gap - 4.5 ms silence
844 * Address1 bit 0 - 7 - Address 1
845 * Address2 bit 0 - 7 - Address 2
846 * Command1 bit 0 - 7 - Command 1
847 * Command2 bit 0 - 7 - Command 2
849 * Note the bit order!
851 * With the old NEC protocol, Address2 was the inverse of Address1
852 * and Command2 was the inverse of Command1 and were used as
855 * With NEC extended, Address1 is the LSB of the Address and
856 * Address2 is the MSB, Command parsing remains unchanged.
858 * A repeat message is coded as:
859 * Leader - 9 ms burst
860 * Gap - 2.25 ms silence
861 * Repeat - 560 us active
871 while (get_bits(data, 1) && !data->irdata_error)
875 if (get_bits(data, 4)) {
876 dev_dbg(dev, "NEC - Invalid leader space\n");
881 if (get_bits(data, 1)) {
882 if (!data->keypressed) {
883 dev_dbg(dev, "NEC - Stray repeat message\n");
887 dev_dbg(dev, "IR-NEC repeat s %u\n",
888 (unsigned int)data->last_scancode);
890 wbcir_keydown(data, data->last_scancode, data->last_toggle);
894 /* Remaining leader space */
895 if (get_bits(data, 3)) {
896 dev_dbg(dev, "NEC - Invalid leader space\n");
900 address1 = bitrev8(get_bits(data, 8));
901 address2 = bitrev8(get_bits(data, 8));
902 command1 = bitrev8(get_bits(data, 8));
903 command2 = bitrev8(get_bits(data, 8));
906 if (data->irdata_error) {
907 dev_dbg(dev, "NEC - Invalid message\n");
911 /* Check command validity */
912 if (command1 != ~command2) {
913 dev_dbg(dev, "NEC - Command bytes mismatch\n");
917 /* Check for extended NEC protocol */
919 if (address1 != ~address2)
920 address |= address2 << 8;
922 scancode = address << 8 | command1;
924 dev_dbg(dev, "IR-NEC ad %u cm %u s %u\n",
925 (unsigned int)address,
926 (unsigned int)command1,
927 (unsigned int)scancode);
929 wbcir_keydown(data, scancode, !data->last_toggle);
934 /*****************************************************************************
936 * INTERRUPT FUNCTIONS
938 *****************************************************************************/
941 wbcir_irq_handler(int irqno, void *cookie)
943 struct pnp_dev *device = cookie;
944 struct wbcir_data *data = pnp_get_drvdata(device);
945 struct device *dev = &device->dev;
952 spin_lock_irqsave(&wbcir_lock, flags);
954 wbcir_select_bank(data, WBCIR_BANK_0);
956 status = inb(data->sbase + WBCIR_REG_SP3_EIR);
958 if (!(status & (WBCIR_IRQ_RX | WBCIR_IRQ_ERR))) {
959 spin_unlock_irqrestore(&wbcir_lock, flags);
963 if (status & WBCIR_IRQ_ERR)
964 data->irdata_error = 1;
966 if (!(status & WBCIR_IRQ_RX))
969 /* Since RXHDLEV is set, at least 8 bytes are in the FIFO */
970 insb(data->sbase + WBCIR_REG_SP3_RXDATA, &irdata[0], 8);
972 for (i = 0; i < sizeof(irdata); i++) {
973 hw = hweight8(irdata[i]);
975 add_irdata_bit(data, 0);
977 add_irdata_bit(data, 1);
982 data->idle_count = 0;
985 if (data->idle_count > WBCIR_MAX_IDLE_BYTES) {
986 /* Set RXINACTIVE... */
987 outb(WBCIR_RX_DISABLE, data->sbase + WBCIR_REG_SP3_ASCR);
989 /* ...and drain the FIFO */
990 while (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_AVAIL)
991 inb(data->sbase + WBCIR_REG_SP3_RXDATA);
993 dev_dbg(dev, "IRDATA:\n");
994 for (i = 0; i < data->irdata_count; i += BITS_PER_LONG)
995 dev_dbg(dev, "0x%08lX\n", data->irdata[i/BITS_PER_LONG]);
998 case IR_PROTOCOL_RC5:
999 wbcir_parse_rc5(dev, data);
1001 case IR_PROTOCOL_RC6:
1002 wbcir_parse_rc6(dev, data);
1004 case IR_PROTOCOL_NEC:
1005 wbcir_parse_nec(dev, data);
1009 wbcir_reset_irdata(data);
1013 spin_unlock_irqrestore(&wbcir_lock, flags);
1019 /*****************************************************************************
1021 * SETUP/INIT/SUSPEND/RESUME FUNCTIONS
1023 *****************************************************************************/
1026 wbcir_shutdown(struct pnp_dev *device)
1028 struct device *dev = &device->dev;
1029 struct wbcir_data *data = pnp_get_drvdata(device);
1036 memset(match, 0, sizeof(match));
1037 memset(mask, 0, sizeof(mask));
1039 if (wake_sc == INVALID_SCANCODE || !device_may_wakeup(dev)) {
1045 case IR_PROTOCOL_RC5:
1046 if (wake_sc > 0xFFF) {
1048 dev_err(dev, "RC5 - Invalid wake scancode\n");
1052 /* Mask = 13 bits, ex toggle */
1056 match[0] = (wake_sc & 0x003F); /* 6 command bits */
1057 match[0] |= (wake_sc & 0x0180) >> 1; /* 2 address bits */
1058 match[1] = (wake_sc & 0x0E00) >> 9; /* 3 address bits */
1059 if (!(wake_sc & 0x0040)) /* 2nd start bit */
1064 case IR_PROTOCOL_NEC:
1065 if (wake_sc > 0xFFFFFF) {
1067 dev_err(dev, "NEC - Invalid wake scancode\n");
1071 mask[0] = mask[1] = mask[2] = mask[3] = 0xFF;
1073 match[1] = bitrev8((wake_sc & 0xFF));
1074 match[0] = ~match[1];
1076 match[3] = bitrev8((wake_sc & 0xFF00) >> 8);
1077 if (wake_sc > 0xFFFF)
1078 match[2] = bitrev8((wake_sc & 0xFF0000) >> 16);
1080 match[2] = ~match[3];
1084 case IR_PROTOCOL_RC6:
1086 if (wake_rc6mode == 0) {
1087 if (wake_sc > 0xFFFF) {
1089 dev_err(dev, "RC6 - Invalid wake scancode\n");
1094 match[0] = wbcir_to_rc6cells(wake_sc >> 0);
1096 match[1] = wbcir_to_rc6cells(wake_sc >> 4);
1100 match[2] = wbcir_to_rc6cells(wake_sc >> 8);
1102 match[3] = wbcir_to_rc6cells(wake_sc >> 12);
1106 match[4] = 0x50; /* mode1 = mode0 = 0, ignore toggle */
1108 match[5] = 0x09; /* start bit = 1, mode2 = 0 */
1113 } else if (wake_rc6mode == 6) {
1117 match[i] = wbcir_to_rc6cells(wake_sc >> 0);
1119 match[i] = wbcir_to_rc6cells(wake_sc >> 4);
1122 /* Address + Toggle */
1123 match[i] = wbcir_to_rc6cells(wake_sc >> 8);
1125 match[i] = wbcir_to_rc6cells(wake_sc >> 12);
1128 /* Customer bits 7 - 0 */
1129 match[i] = wbcir_to_rc6cells(wake_sc >> 16);
1131 match[i] = wbcir_to_rc6cells(wake_sc >> 20);
1134 if (wake_sc & 0x80000000) {
1135 /* Customer range bit and bits 15 - 8 */
1136 match[i] = wbcir_to_rc6cells(wake_sc >> 24);
1138 match[i] = wbcir_to_rc6cells(wake_sc >> 28);
1141 } else if (wake_sc <= 0x007FFFFF) {
1145 dev_err(dev, "RC6 - Invalid wake scancode\n");
1150 match[i] = 0x93; /* mode1 = mode0 = 1, submode = 0 */
1152 match[i] = 0x0A; /* start bit = 1, mode2 = 1 */
1157 dev_err(dev, "RC6 - Invalid wake mode\n");
1169 /* Set compare and compare mask */
1170 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX,
1171 WBCIR_REGSEL_COMPARE | WBCIR_REG_ADDR0,
1173 outsb(data->wbase + WBCIR_REG_WCEIR_DATA, match, 11);
1174 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX,
1175 WBCIR_REGSEL_MASK | WBCIR_REG_ADDR0,
1177 outsb(data->wbase + WBCIR_REG_WCEIR_DATA, mask, 11);
1179 /* RC6 Compare String Len */
1180 outb(rc6_csl, data->wbase + WBCIR_REG_WCEIR_CSL);
1182 /* Clear status bits NEC_REP, BUFF, MSG_END, MATCH */
1183 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17);
1185 /* Clear BUFF_EN, Clear END_EN, Set MATCH_EN */
1186 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x01, 0x07);
1189 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x01, 0x01);
1192 /* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */
1193 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
1196 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01);
1199 /* Disable interrupts */
1200 wbcir_select_bank(data, WBCIR_BANK_0);
1201 outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
1204 * ACPI will set the HW disable bit for SP3 which means that the
1205 * output signals are left in an undefined state which may cause
1206 * spurious interrupts which we need to ignore until the hardware
1209 disable_irq(data->irq);
1213 wbcir_suspend(struct pnp_dev *device, pm_message_t state)
1215 wbcir_shutdown(device);
1220 wbcir_init_hw(struct wbcir_data *data)
1224 /* Disable interrupts */
1225 wbcir_select_bank(data, WBCIR_BANK_0);
1226 outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
1228 /* Set PROT_SEL, RX_INV, Clear CEIR_EN (needed for the led) */
1229 tmp = protocol << 4;
1232 outb(tmp, data->wbase + WBCIR_REG_WCEIR_CTL);
1234 /* Clear status bits NEC_REP, BUFF, MSG_END, MATCH */
1235 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17);
1237 /* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */
1238 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
1240 /* Set RC5 cell time to correspond to 36 kHz */
1241 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CFG1, 0x4A, 0x7F);
1245 outb(0x04, data->ebase + WBCIR_REG_ECEIR_CCTL);
1247 outb(0x00, data->ebase + WBCIR_REG_ECEIR_CCTL);
1250 * Clear IR LED, set SP3 clock to 24Mhz
1251 * set SP3_IRRX_SW to binary 01, helpfully not documented
1253 outb(0x10, data->ebase + WBCIR_REG_ECEIR_CTS);
1255 /* Enable extended mode */
1256 wbcir_select_bank(data, WBCIR_BANK_2);
1257 outb(WBCIR_EXT_ENABLE, data->sbase + WBCIR_REG_SP3_EXCR1);
1260 * Configure baud generator, IR data will be sampled at
1261 * a bitrate of: (24Mhz * prescaler) / (divisor * 16).
1263 * The ECIR registers include a flag to change the
1264 * 24Mhz clock freq to 48Mhz.
1266 * It's not documented in the specs, but fifo levels
1267 * other than 16 seems to be unsupported.
1270 /* prescaler 1.0, tx/rx fifo lvl 16 */
1271 outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2);
1273 /* Set baud divisor to generate one byte per bit/cell */
1275 case IR_PROTOCOL_RC5:
1276 outb(0xA7, data->sbase + WBCIR_REG_SP3_BGDL);
1278 case IR_PROTOCOL_RC6:
1279 outb(0x53, data->sbase + WBCIR_REG_SP3_BGDL);
1281 case IR_PROTOCOL_NEC:
1282 outb(0x69, data->sbase + WBCIR_REG_SP3_BGDL);
1285 outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH);
1288 wbcir_select_bank(data, WBCIR_BANK_0);
1289 outb(0xC0, data->sbase + WBCIR_REG_SP3_MCR);
1290 inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */
1291 inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */
1293 /* Disable RX demod, run-length encoding/decoding, set freq span */
1294 wbcir_select_bank(data, WBCIR_BANK_7);
1295 outb(0x10, data->sbase + WBCIR_REG_SP3_RCCFG);
1298 wbcir_select_bank(data, WBCIR_BANK_4);
1299 outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR1);
1301 /* Enable MSR interrupt, Clear AUX_IRX */
1302 wbcir_select_bank(data, WBCIR_BANK_5);
1303 outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR2);
1306 wbcir_select_bank(data, WBCIR_BANK_6);
1307 outb(0x20, data->sbase + WBCIR_REG_SP3_IRCR3);
1309 /* Set RX/TX (de)modulation freq, not really used */
1310 wbcir_select_bank(data, WBCIR_BANK_7);
1311 outb(0xF2, data->sbase + WBCIR_REG_SP3_IRRXDC);
1312 outb(0x69, data->sbase + WBCIR_REG_SP3_IRTXMC);
1314 /* Set invert and pin direction */
1316 outb(0x10, data->sbase + WBCIR_REG_SP3_IRCFG4);
1318 outb(0x00, data->sbase + WBCIR_REG_SP3_IRCFG4);
1320 /* Set FIFO thresholds (RX = 8, TX = 3), reset RX/TX */
1321 wbcir_select_bank(data, WBCIR_BANK_0);
1322 outb(0x97, data->sbase + WBCIR_REG_SP3_FCR);
1324 /* Clear AUX status bits */
1325 outb(0xE0, data->sbase + WBCIR_REG_SP3_ASCR);
1327 /* Enable interrupts */
1328 wbcir_reset_irdata(data);
1329 outb(WBCIR_IRQ_RX | WBCIR_IRQ_ERR, data->sbase + WBCIR_REG_SP3_IER);
1333 wbcir_resume(struct pnp_dev *device)
1335 struct wbcir_data *data = pnp_get_drvdata(device);
1337 wbcir_init_hw(data);
1338 enable_irq(data->irq);
1343 static int __devinit
1344 wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1346 struct device *dev = &device->dev;
1347 struct wbcir_data *data;
1350 if (!(pnp_port_len(device, 0) == EHFUNC_IOMEM_LEN &&
1351 pnp_port_len(device, 1) == WAKEUP_IOMEM_LEN &&
1352 pnp_port_len(device, 2) == SP_IOMEM_LEN)) {
1353 dev_err(dev, "Invalid resources\n");
1357 data = kzalloc(sizeof(*data), GFP_KERNEL);
1363 pnp_set_drvdata(device, data);
1365 data->ebase = pnp_port_start(device, 0);
1366 data->wbase = pnp_port_start(device, 1);
1367 data->sbase = pnp_port_start(device, 2);
1368 data->irq = pnp_irq(device, 0);
1370 if (data->wbase == 0 || data->ebase == 0 ||
1371 data->sbase == 0 || data->irq == 0) {
1373 dev_err(dev, "Invalid resources\n");
1374 goto exit_free_data;
1377 dev_dbg(&device->dev, "Found device "
1378 "(w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n",
1379 data->wbase, data->ebase, data->sbase, data->irq);
1381 if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
1382 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1383 data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1);
1385 goto exit_free_data;
1388 if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) {
1389 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1390 data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1);
1392 goto exit_release_wbase;
1395 if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) {
1396 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1397 data->sbase, data->sbase + SP_IOMEM_LEN - 1);
1399 goto exit_release_ebase;
1402 err = request_irq(data->irq, wbcir_irq_handler,
1403 IRQF_DISABLED, DRVNAME, device);
1405 dev_err(dev, "Failed to claim IRQ %u\n", data->irq);
1407 goto exit_release_sbase;
1410 led_trigger_register_simple("cir-tx", &data->txtrigger);
1411 if (!data->txtrigger) {
1416 led_trigger_register_simple("cir-rx", &data->rxtrigger);
1417 if (!data->rxtrigger) {
1419 goto exit_unregister_txtrigger;
1422 data->led.name = "cir::activity";
1423 data->led.default_trigger = "cir-rx";
1424 data->led.brightness_set = wbcir_led_brightness_set;
1425 data->led.brightness_get = wbcir_led_brightness_get;
1426 err = led_classdev_register(&device->dev, &data->led);
1428 goto exit_unregister_rxtrigger;
1430 data->input_dev = input_allocate_device();
1431 if (!data->input_dev) {
1433 goto exit_unregister_led;
1436 data->input_dev->evbit[0] = BIT(EV_KEY);
1437 data->input_dev->name = WBCIR_NAME;
1438 data->input_dev->phys = "wbcir/cir0";
1439 data->input_dev->id.bustype = BUS_HOST;
1440 data->input_dev->id.vendor = PCI_VENDOR_ID_WINBOND;
1441 data->input_dev->id.product = WBCIR_ID_FAMILY;
1442 data->input_dev->id.version = WBCIR_ID_CHIP;
1443 data->input_dev->getkeycode = wbcir_getkeycode;
1444 data->input_dev->setkeycode = wbcir_setkeycode;
1445 input_set_capability(data->input_dev, EV_MSC, MSC_SCAN);
1446 input_set_drvdata(data->input_dev, data);
1448 err = input_register_device(data->input_dev);
1450 goto exit_free_input;
1452 data->last_scancode = INVALID_SCANCODE;
1453 INIT_LIST_HEAD(&data->keytable);
1454 setup_timer(&data->timer_keyup, wbcir_keyup, (unsigned long)data);
1456 /* Load default keymaps */
1457 if (protocol == IR_PROTOCOL_RC6) {
1459 for (i = 0; i < ARRAY_SIZE(rc6_def_keymap); i++) {
1460 err = wbcir_setkeycode(data->input_dev,
1461 (int)rc6_def_keymap[i].scancode,
1462 (int)rc6_def_keymap[i].keycode);
1464 goto exit_unregister_keys;
1468 device_init_wakeup(&device->dev, 1);
1470 wbcir_init_hw(data);
1474 exit_unregister_keys:
1475 if (!list_empty(&data->keytable)) {
1476 struct wbcir_keyentry *key;
1477 struct wbcir_keyentry *keytmp;
1479 list_for_each_entry_safe(key, keytmp, &data->keytable, list) {
1480 list_del(&key->list);
1484 input_unregister_device(data->input_dev);
1485 /* Can't call input_free_device on an unregistered device */
1486 data->input_dev = NULL;
1488 input_free_device(data->input_dev);
1489 exit_unregister_led:
1490 led_classdev_unregister(&data->led);
1491 exit_unregister_rxtrigger:
1492 led_trigger_unregister_simple(data->rxtrigger);
1493 exit_unregister_txtrigger:
1494 led_trigger_unregister_simple(data->txtrigger);
1496 free_irq(data->irq, device);
1498 release_region(data->sbase, SP_IOMEM_LEN);
1500 release_region(data->ebase, EHFUNC_IOMEM_LEN);
1502 release_region(data->wbase, WAKEUP_IOMEM_LEN);
1505 pnp_set_drvdata(device, NULL);
1510 static void __devexit
1511 wbcir_remove(struct pnp_dev *device)
1513 struct wbcir_data *data = pnp_get_drvdata(device);
1514 struct wbcir_keyentry *key;
1515 struct wbcir_keyentry *keytmp;
1517 /* Disable interrupts */
1518 wbcir_select_bank(data, WBCIR_BANK_0);
1519 outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
1521 del_timer_sync(&data->timer_keyup);
1523 free_irq(data->irq, device);
1525 /* Clear status bits NEC_REP, BUFF, MSG_END, MATCH */
1526 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17);
1529 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01);
1531 /* Clear BUFF_EN, END_EN, MATCH_EN */
1532 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
1534 /* This will generate a keyup event if necessary */
1535 input_unregister_device(data->input_dev);
1537 led_trigger_unregister_simple(data->rxtrigger);
1538 led_trigger_unregister_simple(data->txtrigger);
1539 led_classdev_unregister(&data->led);
1541 /* This is ok since &data->led isn't actually used */
1542 wbcir_led_brightness_set(&data->led, LED_OFF);
1544 release_region(data->wbase, WAKEUP_IOMEM_LEN);
1545 release_region(data->ebase, EHFUNC_IOMEM_LEN);
1546 release_region(data->sbase, SP_IOMEM_LEN);
1548 list_for_each_entry_safe(key, keytmp, &data->keytable, list) {
1549 list_del(&key->list);
1555 pnp_set_drvdata(device, NULL);
1558 static const struct pnp_device_id wbcir_ids[] = {
1562 MODULE_DEVICE_TABLE(pnp, wbcir_ids);
1564 static struct pnp_driver wbcir_driver = {
1566 .id_table = wbcir_ids,
1567 .probe = wbcir_probe,
1568 .remove = __devexit_p(wbcir_remove),
1569 .suspend = wbcir_suspend,
1570 .resume = wbcir_resume,
1571 .shutdown = wbcir_shutdown
1580 case IR_PROTOCOL_RC5:
1581 case IR_PROTOCOL_NEC:
1582 case IR_PROTOCOL_RC6:
1585 printk(KERN_ERR DRVNAME ": Invalid protocol argument\n");
1589 ret = pnp_register_driver(&wbcir_driver);
1591 printk(KERN_ERR DRVNAME ": Unable to register driver\n");
1599 pnp_unregister_driver(&wbcir_driver);
1602 MODULE_AUTHOR("David Härdeman <david@hardeman.nu>");
1603 MODULE_DESCRIPTION("Winbond SuperI/O Consumer IR Driver");
1604 MODULE_LICENSE("GPL");
1606 module_init(wbcir_init);
1607 module_exit(wbcir_exit);