Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
1da177e4 LT |
2 | * |
3 | * handle saa7134 IR remotes via linux kernel input layer. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version 2 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program; if not, write to the Free Software | |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | * | |
19 | */ | |
20 | ||
21 | #include <linux/module.h> | |
1da177e4 LT |
22 | #include <linux/init.h> |
23 | #include <linux/delay.h> | |
1da177e4 LT |
24 | #include <linux/interrupt.h> |
25 | #include <linux/input.h> | |
26 | ||
27 | #include "saa7134-reg.h" | |
28 | #include "saa7134.h" | |
29 | ||
ff699e6b | 30 | static unsigned int disable_ir; |
1da177e4 LT |
31 | module_param(disable_ir, int, 0444); |
32 | MODULE_PARM_DESC(disable_ir,"disable infrared remote support"); | |
33 | ||
ff699e6b | 34 | static unsigned int ir_debug; |
1da177e4 LT |
35 | module_param(ir_debug, int, 0644); |
36 | MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); | |
37 | ||
ff699e6b | 38 | static int pinnacle_remote; |
b93eedb6 SP |
39 | module_param(pinnacle_remote, int, 0644); /* Choose Pinnacle PCTV remote */ |
40 | MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=grey (defaults to 0)"); | |
41 | ||
c408a6f6 | 42 | static int ir_rc5_remote_gap = 885; |
9160723e | 43 | module_param(ir_rc5_remote_gap, int, 0644); |
c408a6f6 | 44 | static int ir_rc5_key_timeout = 115; |
9160723e HP |
45 | module_param(ir_rc5_key_timeout, int, 0644); |
46 | ||
0938e319 P |
47 | static int repeat_delay = 500; |
48 | module_param(repeat_delay, int, 0644); | |
49 | MODULE_PARM_DESC(repeat_delay, "delay before key repeat started"); | |
50 | static int repeat_period = 33; | |
51 | module_param(repeat_period, int, 0644); | |
ac9bb7f5 | 52 | MODULE_PARM_DESC(repeat_period, "repeat period between " |
0938e319 P |
53 | "keypresses when key is down"); |
54 | ||
e8018c9e AMT |
55 | static unsigned int disable_other_ir; |
56 | module_param(disable_other_ir, int, 0644); | |
57 | MODULE_PARM_DESC(disable_other_ir, "disable full codes of " | |
58 | "alternative remotes from other manufacturers"); | |
59 | ||
1da177e4 LT |
60 | #define dprintk(fmt, arg...) if (ir_debug) \ |
61 | printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) | |
ac9cd976 | 62 | #define i2cdprintk(fmt, arg...) if (ir_debug) \ |
1df8e986 | 63 | printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg) |
1da177e4 | 64 | |
622ecb30 | 65 | /* Helper functions for RC5 and NEC decoding at GPIO16 or GPIO18 */ |
9160723e | 66 | static int saa7134_rc5_irq(struct saa7134_dev *dev); |
622ecb30 MCC |
67 | static int saa7134_nec_irq(struct saa7134_dev *dev); |
68 | static void nec_task(unsigned long data); | |
69 | static void saa7134_nec_timer(unsigned long data); | |
9160723e | 70 | |
ac9cd976 | 71 | /* -------------------- GPIO generic keycode builder -------------------- */ |
1da177e4 LT |
72 | |
73 | static int build_key(struct saa7134_dev *dev) | |
74 | { | |
9160723e | 75 | struct card_ir *ir = dev->remote; |
1da177e4 LT |
76 | u32 gpio, data; |
77 | ||
0938e319 P |
78 | /* here comes the additional handshake steps for some cards */ |
79 | switch (dev->board) { | |
80 | case SAA7134_BOARD_GOTVIEW_7135: | |
81 | saa_setb(SAA7134_GPIO_GPSTATUS1, 0x80); | |
82 | saa_clearb(SAA7134_GPIO_GPSTATUS1, 0x80); | |
83 | break; | |
84 | } | |
1da177e4 LT |
85 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ |
86 | saa_clearb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN); | |
87 | saa_setb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN); | |
88 | ||
89 | gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); | |
4ac97914 MCC |
90 | if (ir->polling) { |
91 | if (ir->last_gpio == gpio) | |
92 | return 0; | |
93 | ir->last_gpio = gpio; | |
94 | } | |
1da177e4 | 95 | |
4ac97914 | 96 | data = ir_extract_bits(gpio, ir->mask_keycode); |
1da177e4 LT |
97 | dprintk("build_key gpio=0x%x mask=0x%x data=%d\n", |
98 | gpio, ir->mask_keycode, data); | |
99 | ||
26d5f3a3 MCC |
100 | switch (dev->board) { |
101 | case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: | |
102 | if (data == ir->mask_keycode) | |
103 | ir_input_nokey(ir->dev, &ir->ir); | |
104 | else | |
105 | ir_input_keydown(ir->dev, &ir->ir, data, data); | |
106 | return 0; | |
107 | } | |
108 | ||
0602fbb2 PM |
109 | if (ir->polling) { |
110 | if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || | |
111 | (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { | |
112 | ir_input_keydown(ir->dev, &ir->ir, data, data); | |
113 | } else { | |
114 | ir_input_nokey(ir->dev, &ir->ir); | |
115 | } | |
1da177e4 | 116 | } |
0602fbb2 PM |
117 | else { /* IRQ driven mode - handle key press and release in one go */ |
118 | if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || | |
119 | (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { | |
120 | ir_input_keydown(ir->dev, &ir->ir, data, data); | |
121 | ir_input_nokey(ir->dev, &ir->ir); | |
122 | } | |
123 | } | |
124 | ||
1da177e4 LT |
125 | return 0; |
126 | } | |
127 | ||
ac9cd976 RC |
128 | /* --------------------- Chip specific I2C key builders ----------------- */ |
129 | ||
ba340b40 BR |
130 | static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, |
131 | u32 *ir_raw) | |
132 | { | |
133 | unsigned char b; | |
134 | int gpio; | |
135 | ||
136 | /* <dev> is needed to access GPIO. Used by the saa_readl macro. */ | |
c668f32d | 137 | struct saa7134_dev *dev = ir->c->adapter->algo_data; |
ba340b40 BR |
138 | if (dev == NULL) { |
139 | dprintk("get_key_msi_tvanywhere_plus: " | |
c668f32d | 140 | "gir->c->adapter->algo_data is NULL!\n"); |
ba340b40 BR |
141 | return -EIO; |
142 | } | |
143 | ||
144 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ | |
145 | ||
146 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | |
147 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | |
148 | ||
149 | gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); | |
150 | ||
151 | /* GPIO&0x40 is pulsed low when a button is pressed. Don't do | |
152 | I2C receive if gpio&0x40 is not low. */ | |
153 | ||
154 | if (gpio & 0x40) | |
155 | return 0; /* No button press */ | |
156 | ||
157 | /* GPIO says there is a button press. Get it. */ | |
158 | ||
c668f32d | 159 | if (1 != i2c_master_recv(ir->c, &b, 1)) { |
ba340b40 BR |
160 | i2cdprintk("read error\n"); |
161 | return -EIO; | |
162 | } | |
163 | ||
164 | /* No button press */ | |
165 | ||
166 | if (b == 0xff) | |
167 | return 0; | |
168 | ||
169 | /* Button pressed */ | |
170 | ||
171 | dprintk("get_key_msi_tvanywhere_plus: Key = 0x%02X\n", b); | |
172 | *ir_key = b; | |
173 | *ir_raw = b; | |
174 | return 1; | |
175 | } | |
176 | ||
ac9cd976 RC |
177 | static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
178 | { | |
179 | unsigned char b; | |
180 | ||
181 | /* poll IR chip */ | |
c668f32d | 182 | if (1 != i2c_master_recv(ir->c, &b, 1)) { |
ac9cd976 RC |
183 | i2cdprintk("read error\n"); |
184 | return -EIO; | |
185 | } | |
186 | ||
187 | /* no button press */ | |
188 | if (b==0) | |
189 | return 0; | |
190 | ||
191 | /* repeating */ | |
192 | if (b & 0x80) | |
193 | return 1; | |
194 | ||
195 | *ir_key = b; | |
196 | *ir_raw = b; | |
197 | return 1; | |
198 | } | |
199 | ||
177aaaf8 TG |
200 | static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
201 | { | |
202 | unsigned char buf[5], cod4, code3, code4; | |
203 | ||
204 | /* poll IR chip */ | |
c668f32d | 205 | if (5 != i2c_master_recv(ir->c, buf, 5)) |
177aaaf8 TG |
206 | return -EIO; |
207 | ||
208 | cod4 = buf[4]; | |
209 | code4 = (cod4 >> 2); | |
210 | code3 = buf[3]; | |
211 | if (code3 == 0) | |
212 | /* no key pressed */ | |
213 | return 0; | |
214 | ||
215 | /* return key */ | |
216 | *ir_key = code4; | |
217 | *ir_raw = code4; | |
218 | return 1; | |
219 | } | |
220 | ||
e8018c9e AMT |
221 | |
222 | static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |
223 | { | |
224 | unsigned char data[12]; | |
225 | u32 gpio; | |
226 | ||
c668f32d | 227 | struct saa7134_dev *dev = ir->c->adapter->algo_data; |
e8018c9e AMT |
228 | |
229 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ | |
230 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | |
231 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | |
232 | ||
233 | gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); | |
234 | ||
616f8878 | 235 | if (0x400000 & ~gpio) |
e8018c9e AMT |
236 | return 0; /* No button press */ |
237 | ||
c668f32d | 238 | ir->c->addr = 0x5a >> 1; |
e8018c9e | 239 | |
c668f32d | 240 | if (12 != i2c_master_recv(ir->c, data, 12)) { |
e8018c9e AMT |
241 | i2cdprintk("read error\n"); |
242 | return -EIO; | |
243 | } | |
244 | /* IR of this card normally decode signals NEC-standard from | |
245 | * - Sven IHOO MT 5.1R remote. xxyye718 | |
246 | * - Sven DVD HD-10xx remote. xxyyf708 | |
247 | * - BBK ... | |
248 | * - mayby others | |
249 | * So, skip not our, if disable full codes mode. | |
250 | */ | |
251 | if (data[10] != 0x6b && data[11] != 0x86 && disable_other_ir) | |
252 | return 0; | |
253 | ||
254 | *ir_key = data[9]; | |
255 | *ir_raw = data[9]; | |
256 | ||
257 | return 1; | |
258 | } | |
259 | ||
1c22dad8 MCC |
260 | /* Common (grey or coloured) pinnacle PCTV remote handling |
261 | * | |
262 | */ | |
263 | static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, | |
264 | int parity_offset, int marker, int code_modulo) | |
265 | { | |
266 | unsigned char b[4]; | |
267 | unsigned int start = 0,parity = 0,code = 0; | |
268 | ||
269 | /* poll IR chip */ | |
c668f32d | 270 | if (4 != i2c_master_recv(ir->c, b, 4)) { |
1c22dad8 MCC |
271 | i2cdprintk("read error\n"); |
272 | return -EIO; | |
273 | } | |
274 | ||
275 | for (start = 0; start < ARRAY_SIZE(b); start++) { | |
276 | if (b[start] == marker) { | |
277 | code=b[(start+parity_offset + 1) % 4]; | |
278 | parity=b[(start+parity_offset) % 4]; | |
279 | } | |
280 | } | |
281 | ||
282 | /* Empty Request */ | |
283 | if (parity == 0) | |
284 | return 0; | |
285 | ||
286 | /* Repeating... */ | |
287 | if (ir->old == parity) | |
288 | return 0; | |
289 | ||
290 | ir->old = parity; | |
291 | ||
292 | /* drop special codes when a key is held down a long time for the grey controller | |
293 | In this case, the second bit of the code is asserted */ | |
294 | if (marker == 0xfe && (code & 0x40)) | |
295 | return 0; | |
296 | ||
297 | code %= code_modulo; | |
298 | ||
299 | *ir_raw = code; | |
300 | *ir_key = code; | |
301 | ||
302 | i2cdprintk("Pinnacle PCTV key %02x\n", code); | |
303 | ||
304 | return 1; | |
305 | } | |
306 | ||
307 | /* The grey pinnacle PCTV remote | |
308 | * | |
309 | * There are one issue with this remote: | |
310 | * - I2c packet does not change when the same key is pressed quickly. The workaround | |
311 | * is to hold down each key for about half a second, so that another code is generated | |
312 | * in the i2c packet, and the function can distinguish key presses. | |
313 | * | |
314 | * Sylvain Pasche <sylvain.pasche@gmail.com> | |
315 | */ | |
316 | static int get_key_pinnacle_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |
317 | { | |
318 | ||
319 | return get_key_pinnacle(ir, ir_key, ir_raw, 1, 0xfe, 0xff); | |
320 | } | |
321 | ||
322 | ||
323 | /* The new pinnacle PCTV remote (with the colored buttons) | |
324 | * | |
325 | * Ricardo Cerqueira <v4l@cerqueira.org> | |
326 | */ | |
327 | static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |
328 | { | |
329 | /* code_modulo parameter (0x88) is used to reduce code value to fit inside IR_KEYTAB_SIZE | |
330 | * | |
331 | * this is the only value that results in 42 unique | |
332 | * codes < 128 | |
333 | */ | |
334 | ||
335 | return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88); | |
336 | } | |
337 | ||
1da177e4 LT |
338 | void saa7134_input_irq(struct saa7134_dev *dev) |
339 | { | |
9160723e | 340 | struct card_ir *ir = dev->remote; |
1da177e4 | 341 | |
622ecb30 MCC |
342 | if (ir->nec_gpio) { |
343 | saa7134_nec_irq(dev); | |
344 | } else if (!ir->polling && !ir->rc5_gpio) { | |
1da177e4 | 345 | build_key(dev); |
9160723e HP |
346 | } else if (ir->rc5_gpio) { |
347 | saa7134_rc5_irq(dev); | |
348 | } | |
1da177e4 LT |
349 | } |
350 | ||
351 | static void saa7134_input_timer(unsigned long data) | |
352 | { | |
b4ba7884 | 353 | struct saa7134_dev *dev = (struct saa7134_dev *)data; |
9160723e | 354 | struct card_ir *ir = dev->remote; |
1da177e4 LT |
355 | |
356 | build_key(dev); | |
b4ba7884 | 357 | mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); |
1da177e4 LT |
358 | } |
359 | ||
c458473e | 360 | void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) |
b07b4783 DT |
361 | { |
362 | if (ir->polling) { | |
b4ba7884 DT |
363 | setup_timer(&ir->timer, saa7134_input_timer, |
364 | (unsigned long)dev); | |
b07b4783 DT |
365 | ir->timer.expires = jiffies + HZ; |
366 | add_timer(&ir->timer); | |
9160723e HP |
367 | } else if (ir->rc5_gpio) { |
368 | /* set timer_end for code completion */ | |
369 | init_timer(&ir->timer_end); | |
370 | ir->timer_end.function = ir_rc5_timer_end; | |
371 | ir->timer_end.data = (unsigned long)ir; | |
372 | init_timer(&ir->timer_keyup); | |
373 | ir->timer_keyup.function = ir_rc5_timer_keyup; | |
374 | ir->timer_keyup.data = (unsigned long)ir; | |
375 | ir->shift_by = 2; | |
376 | ir->start = 0x2; | |
377 | ir->addr = 0x17; | |
378 | ir->rc5_key_timeout = ir_rc5_key_timeout; | |
379 | ir->rc5_remote_gap = ir_rc5_remote_gap; | |
622ecb30 MCC |
380 | } else if (ir->nec_gpio) { |
381 | setup_timer(&ir->timer_keyup, saa7134_nec_timer, | |
382 | (unsigned long)dev); | |
383 | tasklet_init(&ir->tlet, nec_task, (unsigned long)dev); | |
b07b4783 DT |
384 | } |
385 | } | |
386 | ||
c458473e | 387 | void saa7134_ir_stop(struct saa7134_dev *dev) |
b07b4783 DT |
388 | { |
389 | if (dev->remote->polling) | |
390 | del_timer_sync(&dev->remote->timer); | |
391 | } | |
392 | ||
1da177e4 LT |
393 | int saa7134_input_init1(struct saa7134_dev *dev) |
394 | { | |
9160723e | 395 | struct card_ir *ir; |
b7df3910 | 396 | struct input_dev *input_dev; |
1da177e4 LT |
397 | IR_KEYTAB_TYPE *ir_codes = NULL; |
398 | u32 mask_keycode = 0; | |
399 | u32 mask_keydown = 0; | |
400 | u32 mask_keyup = 0; | |
401 | int polling = 0; | |
9160723e | 402 | int rc5_gpio = 0; |
622ecb30 | 403 | int nec_gpio = 0; |
1da177e4 | 404 | int ir_type = IR_TYPE_OTHER; |
b07b4783 | 405 | int err; |
1da177e4 | 406 | |
cb2444df | 407 | if (dev->has_remote != SAA7134_REMOTE_GPIO) |
1da177e4 LT |
408 | return -ENODEV; |
409 | if (disable_ir) | |
410 | return -ENODEV; | |
411 | ||
412 | /* detect & configure */ | |
413 | switch (dev->board) { | |
414 | case SAA7134_BOARD_FLYVIDEO2000: | |
415 | case SAA7134_BOARD_FLYVIDEO3000: | |
4ac97914 | 416 | case SAA7134_BOARD_FLYTVPLATINUM_FM: |
6af90ab5 | 417 | case SAA7134_BOARD_FLYTVPLATINUM_MINI2: |
4c0f631e | 418 | ir_codes = ir_codes_flyvideo; |
1da177e4 LT |
419 | mask_keycode = 0xEC00000; |
420 | mask_keydown = 0x0040000; | |
421 | break; | |
422 | case SAA7134_BOARD_CINERGY400: | |
423 | case SAA7134_BOARD_CINERGY600: | |
424 | case SAA7134_BOARD_CINERGY600_MK3: | |
4c0f631e | 425 | ir_codes = ir_codes_cinergy; |
1da177e4 LT |
426 | mask_keycode = 0x00003f; |
427 | mask_keyup = 0x040000; | |
428 | break; | |
429 | case SAA7134_BOARD_ECS_TVP3XP: | |
430 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: | |
4c0f631e | 431 | ir_codes = ir_codes_eztv; |
330a115a MCC |
432 | mask_keycode = 0x00017c; |
433 | mask_keyup = 0x000002; | |
1da177e4 | 434 | polling = 50; // ms |
330a115a MCC |
435 | break; |
436 | case SAA7134_BOARD_KWORLD_XPERT: | |
1da177e4 | 437 | case SAA7134_BOARD_AVACSSMARTTV: |
b639f9d2 | 438 | ir_codes = ir_codes_pixelview; |
1da177e4 LT |
439 | mask_keycode = 0x00001F; |
440 | mask_keyup = 0x000020; | |
441 | polling = 50; // ms | |
442 | break; | |
443 | case SAA7134_BOARD_MD2819: | |
ac19ecc6 | 444 | case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: |
1da177e4 LT |
445 | case SAA7134_BOARD_AVERMEDIA_305: |
446 | case SAA7134_BOARD_AVERMEDIA_307: | |
ac19ecc6 | 447 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: |
5a5e1da5 | 448 | case SAA7134_BOARD_AVERMEDIA_STUDIO_505: |
ac19ecc6 | 449 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: |
3ac706d2 | 450 | case SAA7134_BOARD_AVERMEDIA_STUDIO_507: |
df0dbbe2 | 451 | case SAA7134_BOARD_AVERMEDIA_STUDIO_507UA: |
ac19ecc6 | 452 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: |
d2761f22 | 453 | case SAA7134_BOARD_AVERMEDIA_M102: |
6a2d802c | 454 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS: |
b639f9d2 | 455 | ir_codes = ir_codes_avermedia; |
1da177e4 LT |
456 | mask_keycode = 0x0007C8; |
457 | mask_keydown = 0x000010; | |
458 | polling = 50; // ms | |
459 | /* Set GPIO pin2 to high to enable the IR controller */ | |
460 | saa_setb(SAA7134_GPIO_GPMODE0, 0x4); | |
461 | saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); | |
462 | break; | |
36f6bb97 MCC |
463 | case SAA7134_BOARD_AVERMEDIA_M135A: |
464 | ir_codes = ir_codes_avermedia_m135a; | |
465 | mask_keydown = 0x0040000; | |
466 | mask_keycode = 0x00013f; | |
467 | nec_gpio = 1; | |
468 | break; | |
450efcfd | 469 | case SAA7134_BOARD_AVERMEDIA_777: |
29e0f1a1 | 470 | case SAA7134_BOARD_AVERMEDIA_A16AR: |
450efcfd | 471 | ir_codes = ir_codes_avermedia; |
472 | mask_keycode = 0x02F200; | |
473 | mask_keydown = 0x000400; | |
474 | polling = 50; // ms | |
475 | /* Without this we won't receive key up events */ | |
476 | saa_setb(SAA7134_GPIO_GPMODE1, 0x1); | |
477 | saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); | |
4dd7406e | 478 | break; |
6e501a3f TF |
479 | case SAA7134_BOARD_AVERMEDIA_A16D: |
480 | ir_codes = ir_codes_avermedia_a16d; | |
481 | mask_keycode = 0x02F200; | |
482 | mask_keydown = 0x000400; | |
483 | polling = 50; /* ms */ | |
484 | /* Without this we won't receive key up events */ | |
485 | saa_setb(SAA7134_GPIO_GPMODE1, 0x1); | |
486 | saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); | |
487 | break; | |
4ac97914 | 488 | case SAA7134_BOARD_KWORLD_TERMINATOR: |
b639f9d2 | 489 | ir_codes = ir_codes_pixelview; |
dc2286cf JW |
490 | mask_keycode = 0x00001f; |
491 | mask_keyup = 0x000060; | |
492 | polling = 50; // ms | |
493 | break; | |
ac19ecc6 MCC |
494 | case SAA7134_BOARD_MANLI_MTV001: |
495 | case SAA7134_BOARD_MANLI_MTV002: | |
b34dddbe DB |
496 | ir_codes = ir_codes_manli; |
497 | mask_keycode = 0x001f00; | |
498 | mask_keyup = 0x004000; | |
499 | polling = 50; /* ms */ | |
500 | break; | |
a8ff417e | 501 | case SAA7134_BOARD_BEHOLD_409FM: |
e8018c9e AMT |
502 | case SAA7134_BOARD_BEHOLD_401: |
503 | case SAA7134_BOARD_BEHOLD_403: | |
504 | case SAA7134_BOARD_BEHOLD_403FM: | |
505 | case SAA7134_BOARD_BEHOLD_405: | |
506 | case SAA7134_BOARD_BEHOLD_405FM: | |
507 | case SAA7134_BOARD_BEHOLD_407: | |
508 | case SAA7134_BOARD_BEHOLD_407FM: | |
509 | case SAA7134_BOARD_BEHOLD_409: | |
510 | case SAA7134_BOARD_BEHOLD_505FM: | |
84d728c3 | 511 | case SAA7134_BOARD_BEHOLD_505RDS: |
e8018c9e | 512 | case SAA7134_BOARD_BEHOLD_507_9FM: |
84d728c3 DB |
513 | case SAA7134_BOARD_BEHOLD_507RDS_MK3: |
514 | case SAA7134_BOARD_BEHOLD_507RDS_MK5: | |
4c0f631e | 515 | ir_codes = ir_codes_manli; |
b34dddbe DB |
516 | mask_keycode = 0x003f00; |
517 | mask_keyup = 0x004000; | |
518 | polling = 50; /* ms */ | |
519 | break; | |
520 | case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: | |
521 | ir_codes = ir_codes_behold_columbus; | |
522 | mask_keycode = 0x003f00; | |
ac19ecc6 | 523 | mask_keyup = 0x004000; |
ac19ecc6 MCC |
524 | polling = 50; // ms |
525 | break; | |
17ce1ff9 | 526 | case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: |
4c0f631e | 527 | ir_codes = ir_codes_pctv_sedna; |
c3d93192 PM |
528 | mask_keycode = 0x001f00; |
529 | mask_keyup = 0x004000; | |
530 | polling = 50; // ms | |
531 | break; | |
4ac97914 | 532 | case SAA7134_BOARD_GOTVIEW_7135: |
4c0f631e | 533 | ir_codes = ir_codes_gotview7135; |
0938e319 | 534 | mask_keycode = 0x0003CC; |
6b961440 | 535 | mask_keydown = 0x000010; |
0938e319 P |
536 | polling = 5; /* ms */ |
537 | saa_setb(SAA7134_GPIO_GPMODE1, 0x80); | |
6b961440 | 538 | break; |
1da177e4 | 539 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: |
2a9a9a84 | 540 | case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: |
330a115a | 541 | case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: |
4c0f631e | 542 | ir_codes = ir_codes_videomate_tv_pvr; |
1da177e4 LT |
543 | mask_keycode = 0x00003F; |
544 | mask_keyup = 0x400000; | |
545 | polling = 50; // ms | |
546 | break; | |
b04c1baf MM |
547 | case SAA7134_BOARD_PROTEUS_2309: |
548 | ir_codes = ir_codes_proteus_2309; | |
549 | mask_keycode = 0x00007F; | |
550 | mask_keyup = 0x000080; | |
551 | polling = 50; // ms | |
552 | break; | |
4ac97914 MCC |
553 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
554 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: | |
4c0f631e | 555 | ir_codes = ir_codes_videomate_tv_pvr; |
fea095fe NS |
556 | mask_keycode = 0x003F00; |
557 | mask_keyup = 0x040000; | |
558 | break; | |
f5c965ab | 559 | case SAA7134_BOARD_FLYDVBS_LR300: |
3d8466ec | 560 | case SAA7134_BOARD_FLYDVBT_LR301: |
a8029170 | 561 | case SAA7134_BOARD_FLYDVBTDUO: |
3d8466ec GG |
562 | ir_codes = ir_codes_flydvb; |
563 | mask_keycode = 0x0001F00; | |
564 | mask_keydown = 0x0040000; | |
565 | break; | |
9160723e | 566 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: |
904ab884 | 567 | case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: |
dfb4ba1e | 568 | case SAA7134_BOARD_ASUSTeK_P7131_ANALOG: |
9160723e HP |
569 | ir_codes = ir_codes_asus_pc39; |
570 | mask_keydown = 0x0040000; | |
571 | rc5_gpio = 1; | |
572 | break; | |
c36c459a JPS |
573 | case SAA7134_BOARD_ENCORE_ENLTV: |
574 | case SAA7134_BOARD_ENCORE_ENLTV_FM: | |
575 | ir_codes = ir_codes_encore_enltv; | |
576 | mask_keycode = 0x00007f; | |
577 | mask_keyup = 0x040000; | |
578 | polling = 50; // ms | |
579 | break; | |
bf1ece6a MCC |
580 | case SAA7134_BOARD_ENCORE_ENLTV_FM53: |
581 | ir_codes = ir_codes_encore_enltv_fm53; | |
582 | mask_keydown = 0x0040000; | |
583 | mask_keycode = 0x00007f; | |
584 | nec_gpio = 1; | |
585 | break; | |
480f75ac TW |
586 | case SAA7134_BOARD_10MOONSTVMASTER3: |
587 | ir_codes = ir_codes_encore_enltv; | |
588 | mask_keycode = 0x5f80000; | |
589 | mask_keyup = 0x8000000; | |
590 | polling = 50; //ms | |
591 | break; | |
f0ba356c AP |
592 | case SAA7134_BOARD_GENIUS_TVGO_A11MCE: |
593 | ir_codes = ir_codes_genius_tvgo_a11mce; | |
594 | mask_keycode = 0xff; | |
595 | mask_keydown = 0xf00000; | |
596 | polling = 50; /* ms */ | |
597 | break; | |
9b000191 MCC |
598 | case SAA7134_BOARD_REAL_ANGEL_220: |
599 | ir_codes = ir_codes_real_audio_220_32_keys; | |
600 | mask_keycode = 0x3f00; | |
601 | mask_keyup = 0x4000; | |
602 | polling = 50; /* ms */ | |
603 | break; | |
26d5f3a3 MCC |
604 | case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: |
605 | ir_codes = ir_codes_kworld_plus_tv_analog; | |
606 | mask_keycode = 0x7f; | |
607 | polling = 40; /* ms */ | |
608 | break; | |
ecfcfec8 IL |
609 | case SAA7134_BOARD_VIDEOMATE_S350: |
610 | ir_codes = ir_codes_videomate_s350; | |
611 | mask_keycode = 0x003f00; | |
612 | mask_keydown = 0x040000; | |
613 | break; | |
1da177e4 LT |
614 | } |
615 | if (NULL == ir_codes) { | |
616 | printk("%s: Oops: IR config error [card=%d]\n", | |
617 | dev->name, dev->board); | |
618 | return -ENODEV; | |
619 | } | |
620 | ||
b7df3910 DT |
621 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
622 | input_dev = input_allocate_device(); | |
623 | if (!ir || !input_dev) { | |
b07b4783 DT |
624 | err = -ENOMEM; |
625 | goto err_out_free; | |
b7df3910 | 626 | } |
1da177e4 | 627 | |
d271d1c2 DT |
628 | ir->dev = input_dev; |
629 | ||
1da177e4 LT |
630 | /* init hardware-specific stuff */ |
631 | ir->mask_keycode = mask_keycode; | |
632 | ir->mask_keydown = mask_keydown; | |
633 | ir->mask_keyup = mask_keyup; | |
4ac97914 | 634 | ir->polling = polling; |
9160723e | 635 | ir->rc5_gpio = rc5_gpio; |
622ecb30 | 636 | ir->nec_gpio = nec_gpio; |
1da177e4 LT |
637 | |
638 | /* init input device */ | |
639 | snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)", | |
640 | saa7134_boards[dev->board].name); | |
641 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | |
642 | pci_name(dev->pci)); | |
643 | ||
b7df3910 DT |
644 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
645 | input_dev->name = ir->name; | |
646 | input_dev->phys = ir->phys; | |
647 | input_dev->id.bustype = BUS_PCI; | |
648 | input_dev->id.version = 1; | |
1da177e4 | 649 | if (dev->pci->subsystem_vendor) { |
b7df3910 DT |
650 | input_dev->id.vendor = dev->pci->subsystem_vendor; |
651 | input_dev->id.product = dev->pci->subsystem_device; | |
1da177e4 | 652 | } else { |
b7df3910 DT |
653 | input_dev->id.vendor = dev->pci->vendor; |
654 | input_dev->id.product = dev->pci->device; | |
1da177e4 | 655 | } |
2c8a3a33 | 656 | input_dev->dev.parent = &dev->pci->dev; |
1da177e4 | 657 | |
1da177e4 | 658 | dev->remote = ir; |
b07b4783 DT |
659 | saa7134_ir_start(dev, ir); |
660 | ||
661 | err = input_register_device(ir->dev); | |
662 | if (err) | |
663 | goto err_out_stop; | |
1da177e4 | 664 | |
0938e319 P |
665 | /* the remote isn't as bouncy as a keyboard */ |
666 | ir->dev->rep[REP_DELAY] = repeat_delay; | |
667 | ir->dev->rep[REP_PERIOD] = repeat_period; | |
668 | ||
1da177e4 | 669 | return 0; |
b07b4783 DT |
670 | |
671 | err_out_stop: | |
672 | saa7134_ir_stop(dev); | |
673 | dev->remote = NULL; | |
674 | err_out_free: | |
675 | input_free_device(input_dev); | |
676 | kfree(ir); | |
677 | return err; | |
1da177e4 LT |
678 | } |
679 | ||
680 | void saa7134_input_fini(struct saa7134_dev *dev) | |
681 | { | |
682 | if (NULL == dev->remote) | |
683 | return; | |
684 | ||
b07b4783 | 685 | saa7134_ir_stop(dev); |
b7df3910 | 686 | input_unregister_device(dev->remote->dev); |
1da177e4 LT |
687 | kfree(dev->remote); |
688 | dev->remote = NULL; | |
689 | } | |
690 | ||
c668f32d | 691 | void saa7134_probe_i2c_ir(struct saa7134_dev *dev) |
ac9cd976 | 692 | { |
c668f32d | 693 | struct i2c_board_info info; |
4d7a2d67 | 694 | struct IR_i2c_init_data init_data; |
c668f32d JD |
695 | const unsigned short addr_list[] = { |
696 | 0x7a, 0x47, 0x71, 0x2d, | |
697 | I2C_CLIENT_END | |
698 | }; | |
699 | ||
c668f32d JD |
700 | struct i2c_msg msg_msi = { |
701 | .addr = 0x50, | |
702 | .flags = I2C_M_RD, | |
703 | .len = 0, | |
704 | .buf = NULL, | |
705 | }; | |
706 | ||
c668f32d JD |
707 | int rc; |
708 | ||
ac9cd976 | 709 | if (disable_ir) { |
c668f32d | 710 | dprintk("IR has been disabled, not probing for i2c remote\n"); |
ac9cd976 RC |
711 | return; |
712 | } | |
713 | ||
c668f32d | 714 | memset(&info, 0, sizeof(struct i2c_board_info)); |
4d7a2d67 | 715 | memset(&init_data, 0, sizeof(struct IR_i2c_init_data)); |
c668f32d | 716 | strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
c668f32d | 717 | |
ac9cd976 RC |
718 | switch (dev->board) { |
719 | case SAA7134_BOARD_PINNACLE_PCTV_110i: | |
eb591af3 | 720 | case SAA7134_BOARD_PINNACLE_PCTV_310i: |
4d7a2d67 | 721 | init_data.name = "Pinnacle PCTV"; |
b93eedb6 | 722 | if (pinnacle_remote == 0) { |
4d7a2d67 JD |
723 | init_data.get_key = get_key_pinnacle_color; |
724 | init_data.ir_codes = ir_codes_pinnacle_color; | |
a138ebcf | 725 | info.addr = 0x47; |
b93eedb6 | 726 | } else { |
4d7a2d67 JD |
727 | init_data.get_key = get_key_pinnacle_grey; |
728 | init_data.ir_codes = ir_codes_pinnacle_grey; | |
a138ebcf | 729 | info.addr = 0x47; |
b93eedb6 | 730 | } |
ac9cd976 RC |
731 | break; |
732 | case SAA7134_BOARD_UPMOST_PURPLE_TV: | |
4d7a2d67 JD |
733 | init_data.name = "Purple TV"; |
734 | init_data.get_key = get_key_purpletv; | |
735 | init_data.ir_codes = ir_codes_purpletv; | |
ac9cd976 | 736 | break; |
ba340b40 | 737 | case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: |
4d7a2d67 JD |
738 | init_data.name = "MSI TV@nywhere Plus"; |
739 | init_data.get_key = get_key_msi_tvanywhere_plus; | |
740 | init_data.ir_codes = ir_codes_msi_tvanywhere_plus; | |
ec218a41 JD |
741 | info.addr = 0x30; |
742 | /* MSI TV@nywhere Plus controller doesn't seem to | |
743 | respond to probes unless we read something from | |
744 | an existing device. Weird... | |
745 | REVISIT: might no longer be needed */ | |
746 | rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1); | |
747 | dprintk(KERN_DEBUG "probe 0x%02x @ %s: %s\n", | |
748 | msg_msi.addr, dev->i2c_adap.name, | |
749 | (1 == rc) ? "yes" : "no"); | |
ba340b40 | 750 | break; |
177aaaf8 | 751 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
4d7a2d67 JD |
752 | init_data.name = "HVR 1110"; |
753 | init_data.get_key = get_key_hvr1110; | |
754 | init_data.ir_codes = ir_codes_hauppauge_new; | |
177aaaf8 | 755 | break; |
84d728c3 DB |
756 | case SAA7134_BOARD_BEHOLD_607FM_MK3: |
757 | case SAA7134_BOARD_BEHOLD_607FM_MK5: | |
758 | case SAA7134_BOARD_BEHOLD_609FM_MK3: | |
759 | case SAA7134_BOARD_BEHOLD_609FM_MK5: | |
760 | case SAA7134_BOARD_BEHOLD_607RDS_MK3: | |
761 | case SAA7134_BOARD_BEHOLD_607RDS_MK5: | |
762 | case SAA7134_BOARD_BEHOLD_609RDS_MK3: | |
763 | case SAA7134_BOARD_BEHOLD_609RDS_MK5: | |
e8018c9e | 764 | case SAA7134_BOARD_BEHOLD_M6: |
878cf2a5 DB |
765 | case SAA7134_BOARD_BEHOLD_M63: |
766 | case SAA7134_BOARD_BEHOLD_M6_EXTRA: | |
02505271 | 767 | case SAA7134_BOARD_BEHOLD_H6: |
2012c87f | 768 | case SAA7134_BOARD_BEHOLD_X7: |
4d7a2d67 JD |
769 | init_data.name = "BeholdTV"; |
770 | init_data.get_key = get_key_beholdm6xx; | |
771 | init_data.ir_codes = ir_codes_behold; | |
ac9cd976 | 772 | break; |
d9a88e63 JD |
773 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: |
774 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: | |
775 | info.addr = 0x40; | |
776 | break; | |
ac9cd976 RC |
777 | } |
778 | ||
4d7a2d67 JD |
779 | if (init_data.name) |
780 | info.platform_data = &init_data; | |
ec218a41 JD |
781 | /* No need to probe if address is known */ |
782 | if (info.addr) { | |
783 | i2c_new_device(&dev->i2c_adap, &info); | |
4d7a2d67 | 784 | return; |
ec218a41 | 785 | } |
4d7a2d67 | 786 | |
ec218a41 | 787 | /* Address not known, fallback to probing */ |
d9a88e63 | 788 | i2c_new_probed_device(&dev->i2c_adap, &info, addr_list); |
ac9cd976 | 789 | } |
9160723e HP |
790 | |
791 | static int saa7134_rc5_irq(struct saa7134_dev *dev) | |
792 | { | |
793 | struct card_ir *ir = dev->remote; | |
794 | struct timeval tv; | |
795 | u32 gap; | |
796 | unsigned long current_jiffies, timeout; | |
797 | ||
798 | /* get time of bit */ | |
799 | current_jiffies = jiffies; | |
800 | do_gettimeofday(&tv); | |
801 | ||
802 | /* avoid overflow with gap >1s */ | |
803 | if (tv.tv_sec - ir->base_time.tv_sec > 1) { | |
804 | gap = 200000; | |
805 | } else { | |
806 | gap = 1000000 * (tv.tv_sec - ir->base_time.tv_sec) + | |
807 | tv.tv_usec - ir->base_time.tv_usec; | |
808 | } | |
809 | ||
810 | /* active code => add bit */ | |
811 | if (ir->active) { | |
812 | /* only if in the code (otherwise spurious IRQ or timer | |
813 | late) */ | |
814 | if (ir->last_bit < 28) { | |
815 | ir->last_bit = (gap - ir_rc5_remote_gap / 2) / | |
816 | ir_rc5_remote_gap; | |
817 | ir->code |= 1 << ir->last_bit; | |
818 | } | |
819 | /* starting new code */ | |
820 | } else { | |
821 | ir->active = 1; | |
822 | ir->code = 0; | |
823 | ir->base_time = tv; | |
824 | ir->last_bit = 0; | |
825 | ||
826 | timeout = current_jiffies + (500 + 30 * HZ) / 1000; | |
827 | mod_timer(&ir->timer_end, timeout); | |
828 | } | |
829 | ||
830 | return 1; | |
831 | } | |
832 | ||
622ecb30 MCC |
833 | |
834 | /* On NEC protocol, One has 2.25 ms, and zero has 1.125 ms | |
835 | The first pulse (start) has 9 + 4.5 ms | |
1da177e4 | 836 | */ |
622ecb30 MCC |
837 | |
838 | static void saa7134_nec_timer(unsigned long data) | |
839 | { | |
840 | struct saa7134_dev *dev = (struct saa7134_dev *) data; | |
841 | struct card_ir *ir = dev->remote; | |
842 | ||
843 | dprintk("Cancel key repeat\n"); | |
844 | ||
845 | ir_input_nokey(ir->dev, &ir->ir); | |
846 | } | |
847 | ||
848 | static void nec_task(unsigned long data) | |
849 | { | |
850 | struct saa7134_dev *dev = (struct saa7134_dev *) data; | |
851 | struct card_ir *ir; | |
852 | struct timeval tv; | |
853 | int count, pulse, oldpulse, gap; | |
854 | u32 ircode = 0, not_code = 0; | |
855 | int ngap = 0; | |
856 | ||
857 | if (!data) { | |
858 | printk(KERN_ERR "saa713x/ir: Can't recover dev struct\n"); | |
859 | /* GPIO will be kept disabled */ | |
860 | return; | |
861 | } | |
862 | ||
863 | ir = dev->remote; | |
864 | ||
865 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ | |
866 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | |
867 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | |
868 | ||
869 | oldpulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; | |
870 | pulse = oldpulse; | |
871 | ||
872 | do_gettimeofday(&tv); | |
873 | ir->base_time = tv; | |
874 | ||
875 | /* Decode NEC pulsecode. This code can take up to 76.5 ms to run. | |
876 | Unfortunately, using IRQ to decode pulse didn't work, since it uses | |
877 | a pulse train of 38KHz. This means one pulse on each 52 us | |
878 | */ | |
879 | do { | |
880 | /* Wait until the end of pulse/space or 5 ms */ | |
881 | for (count = 0; count < 500; count++) { | |
882 | udelay(10); | |
883 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ | |
884 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | |
885 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | |
886 | pulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) | |
887 | & ir->mask_keydown; | |
888 | if (pulse != oldpulse) | |
889 | break; | |
890 | } | |
891 | ||
892 | do_gettimeofday(&tv); | |
893 | gap = 1000000 * (tv.tv_sec - ir->base_time.tv_sec) + | |
894 | tv.tv_usec - ir->base_time.tv_usec; | |
895 | ||
896 | if (!pulse) { | |
897 | /* Bit 0 has 560 us, while bit 1 has 1120 us. | |
898 | Do something only if bit == 1 | |
899 | */ | |
900 | if (ngap && (gap > 560 + 280)) { | |
901 | unsigned int shift = ngap - 1; | |
902 | ||
903 | /* Address first, then command */ | |
904 | if (shift < 8) { | |
905 | shift += 8; | |
906 | ircode |= 1 << shift; | |
907 | } else if (shift < 16) { | |
908 | not_code |= 1 << shift; | |
909 | } else if (shift < 24) { | |
910 | shift -= 16; | |
911 | ircode |= 1 << shift; | |
912 | } else { | |
913 | shift -= 24; | |
914 | not_code |= 1 << shift; | |
915 | } | |
916 | } | |
917 | ngap++; | |
918 | } | |
919 | ||
920 | ||
921 | ir->base_time = tv; | |
922 | ||
923 | /* TIMEOUT - Long pulse */ | |
924 | if (gap >= 5000) | |
925 | break; | |
926 | oldpulse = pulse; | |
927 | } while (ngap < 32); | |
928 | ||
929 | if (ngap == 32) { | |
930 | /* FIXME: should check if not_code == ~ircode */ | |
931 | ir->code = ir_extract_bits(ircode, ir->mask_keycode); | |
932 | ||
933 | dprintk("scancode = 0x%02x (code = 0x%02x, notcode= 0x%02x)\n", | |
934 | ir->code, ircode, not_code); | |
935 | ||
936 | ir_input_keydown(ir->dev, &ir->ir, ir->code, ir->code); | |
937 | } else | |
938 | dprintk("Repeat last key\n"); | |
939 | ||
940 | /* Keep repeating the last key */ | |
941 | mod_timer(&ir->timer_keyup, jiffies + msecs_to_jiffies(150)); | |
942 | ||
943 | saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); | |
944 | } | |
945 | ||
946 | static int saa7134_nec_irq(struct saa7134_dev *dev) | |
947 | { | |
948 | struct card_ir *ir = dev->remote; | |
949 | ||
950 | saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); | |
951 | tasklet_schedule(&ir->tlet); | |
952 | ||
953 | return 1; | |
954 | } |