aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-input.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx88/cx88-input.c')
-rw-r--r--drivers/media/video/cx88/cx88-input.c142
1 files changed, 136 insertions, 6 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index 461019dca901..286c85b6bdf9 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (c) 2003 Pavel Machek 6 * Copyright (c) 2003 Pavel Machek
7 * Copyright (c) 2004 Gerd Knorr 7 * Copyright (c) 2004 Gerd Knorr
8 * Copyright (c) 2004 Chris Pascoe 8 * Copyright (c) 2004, 2005 Chris Pascoe
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -29,9 +29,8 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/moduleparam.h> 30#include <linux/moduleparam.h>
31 31
32#include <media/ir-common.h>
33
34#include "cx88.h" 32#include "cx88.h"
33#include <media/ir-common.h>
35 34
36/* ---------------------------------------------------------------------- */ 35/* ---------------------------------------------------------------------- */
37 36
@@ -258,6 +257,114 @@ static IR_KEYTAB_TYPE ir_codes_cinergy_1400[IR_KEYTAB_SIZE] = {
258 257
259/* ---------------------------------------------------------------------- */ 258/* ---------------------------------------------------------------------- */
260 259
260/* AVERTV STUDIO 303 Remote */
261static IR_KEYTAB_TYPE ir_codes_avertv_303[IR_KEYTAB_SIZE] = {
262 [ 0x2a ] = KEY_KP1,
263 [ 0x32 ] = KEY_KP2,
264 [ 0x3a ] = KEY_KP3,
265 [ 0x4a ] = KEY_KP4,
266 [ 0x52 ] = KEY_KP5,
267 [ 0x5a ] = KEY_KP6,
268 [ 0x6a ] = KEY_KP7,
269 [ 0x72 ] = KEY_KP8,
270 [ 0x7a ] = KEY_KP9,
271 [ 0x0e ] = KEY_KP0,
272
273 [ 0x02 ] = KEY_POWER,
274 [ 0x22 ] = KEY_VIDEO,
275 [ 0x42 ] = KEY_AUDIO,
276 [ 0x62 ] = KEY_ZOOM,
277 [ 0x0a ] = KEY_TV,
278 [ 0x12 ] = KEY_CD,
279 [ 0x1a ] = KEY_TEXT,
280
281 [ 0x16 ] = KEY_SUBTITLE,
282 [ 0x1e ] = KEY_REWIND,
283 [ 0x06 ] = KEY_PRINT,
284
285 [ 0x2e ] = KEY_SEARCH,
286 [ 0x36 ] = KEY_SLEEP,
287 [ 0x3e ] = KEY_SHUFFLE,
288 [ 0x26 ] = KEY_MUTE,
289
290 [ 0x4e ] = KEY_RECORD,
291 [ 0x56 ] = KEY_PAUSE,
292 [ 0x5e ] = KEY_STOP,
293 [ 0x46 ] = KEY_PLAY,
294
295 [ 0x6e ] = KEY_RED,
296 [ 0x0b ] = KEY_GREEN,
297 [ 0x66 ] = KEY_YELLOW,
298 [ 0x03 ] = KEY_BLUE,
299
300 [ 0x76 ] = KEY_LEFT,
301 [ 0x7e ] = KEY_RIGHT,
302 [ 0x13 ] = KEY_DOWN,
303 [ 0x1b ] = KEY_UP,
304};
305
306/* ---------------------------------------------------------------------- */
307
308/* DigitalNow DNTV Live! DVB-T Pro Remote */
309static IR_KEYTAB_TYPE ir_codes_dntv_live_dvbt_pro[IR_KEYTAB_SIZE] = {
310 [ 0x16 ] = KEY_POWER,
311 [ 0x5b ] = KEY_HOME,
312
313 [ 0x55 ] = KEY_TV, /* live tv */
314 [ 0x58 ] = KEY_TUNER, /* digital Radio */
315 [ 0x5a ] = KEY_RADIO, /* FM radio */
316 [ 0x59 ] = KEY_DVD, /* dvd menu */
317 [ 0x03 ] = KEY_1,
318 [ 0x01 ] = KEY_2,
319 [ 0x06 ] = KEY_3,
320 [ 0x09 ] = KEY_4,
321 [ 0x1d ] = KEY_5,
322 [ 0x1f ] = KEY_6,
323 [ 0x0d ] = KEY_7,
324 [ 0x19 ] = KEY_8,
325 [ 0x1b ] = KEY_9,
326 [ 0x0c ] = KEY_CANCEL,
327 [ 0x15 ] = KEY_0,
328 [ 0x4a ] = KEY_CLEAR,
329 [ 0x13 ] = KEY_BACK,
330 [ 0x00 ] = KEY_TAB,
331 [ 0x4b ] = KEY_UP,
332 [ 0x4e ] = KEY_LEFT,
333 [ 0x4f ] = KEY_OK,
334 [ 0x52 ] = KEY_RIGHT,
335 [ 0x51 ] = KEY_DOWN,
336 [ 0x1e ] = KEY_VOLUMEUP,
337 [ 0x0a ] = KEY_VOLUMEDOWN,
338 [ 0x02 ] = KEY_CHANNELDOWN,
339 [ 0x05 ] = KEY_CHANNELUP,
340 [ 0x11 ] = KEY_RECORD,
341 [ 0x14 ] = KEY_PLAY,
342 [ 0x4c ] = KEY_PAUSE,
343 [ 0x1a ] = KEY_STOP,
344 [ 0x40 ] = KEY_REWIND,
345 [ 0x12 ] = KEY_FASTFORWARD,
346 [ 0x41 ] = KEY_PREVIOUSSONG, /* replay |< */
347 [ 0x42 ] = KEY_NEXTSONG, /* skip >| */
348 [ 0x54 ] = KEY_CAMERA, /* capture */
349 [ 0x50 ] = KEY_LANGUAGE, /* sap */
350 [ 0x47 ] = KEY_TV2, /* pip */
351 [ 0x4d ] = KEY_SCREEN,
352 [ 0x43 ] = KEY_SUBTITLE,
353 [ 0x10 ] = KEY_MUTE,
354 [ 0x49 ] = KEY_AUDIO, /* l/r */
355 [ 0x07 ] = KEY_SLEEP,
356 [ 0x08 ] = KEY_VIDEO, /* a/v */
357 [ 0x0e ] = KEY_PREVIOUS, /* recall */
358 [ 0x45 ] = KEY_ZOOM, /* zoom + */
359 [ 0x46 ] = KEY_ANGLE, /* zoom - */
360 [ 0x56 ] = KEY_RED,
361 [ 0x57 ] = KEY_GREEN,
362 [ 0x5c ] = KEY_YELLOW,
363 [ 0x5d ] = KEY_BLUE,
364};
365
366/* ---------------------------------------------------------------------- */
367
261struct cx88_IR { 368struct cx88_IR {
262 struct cx88_core *core; 369 struct cx88_core *core;
263 struct input_dev *input; 370 struct input_dev *input;
@@ -266,7 +373,7 @@ struct cx88_IR {
266 char phys[32]; 373 char phys[32];
267 374
268 /* sample from gpio pin 16 */ 375 /* sample from gpio pin 16 */
269 int sampling; 376 u32 sampling;
270 u32 samples[16]; 377 u32 samples[16];
271 int scount; 378 int scount;
272 unsigned long release; 379 unsigned long release;
@@ -384,10 +491,13 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
384 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: 491 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
385 ir_codes = ir_codes_cinergy_1400; 492 ir_codes = ir_codes_cinergy_1400;
386 ir_type = IR_TYPE_PD; 493 ir_type = IR_TYPE_PD;
387 ir->sampling = 1; 494 ir->sampling = 0xeb04; /* address */
388 break; 495 break;
389 case CX88_BOARD_HAUPPAUGE: 496 case CX88_BOARD_HAUPPAUGE:
390 case CX88_BOARD_HAUPPAUGE_DVB_T1: 497 case CX88_BOARD_HAUPPAUGE_DVB_T1:
498 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
499 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
500 case CX88_BOARD_HAUPPAUGE_HVR1100:
391 ir_codes = ir_codes_hauppauge_new; 501 ir_codes = ir_codes_hauppauge_new;
392 ir_type = IR_TYPE_RC5; 502 ir_type = IR_TYPE_RC5;
393 ir->sampling = 1; 503 ir->sampling = 1;
@@ -427,6 +537,19 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
427 ir->mask_keyup = 0x40; 537 ir->mask_keyup = 0x40;
428 ir->polling = 1; /* ms */ 538 ir->polling = 1; /* ms */
429 break; 539 break;
540 case CX88_BOARD_AVERTV_303:
541 case CX88_BOARD_AVERTV_STUDIO_303:
542 ir_codes = ir_codes_avertv_303;
543 ir->gpio_addr = MO_GP2_IO;
544 ir->mask_keycode = 0xfb;
545 ir->mask_keydown = 0x02;
546 ir->polling = 50; /* ms */
547 break;
548 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
549 ir_codes = ir_codes_dntv_live_dvbt_pro;
550 ir_type = IR_TYPE_PD;
551 ir->sampling = 0xff00; /* address */
552 break;
430 } 553 }
431 554
432 if (NULL == ir_codes) { 555 if (NULL == ir_codes) {
@@ -484,6 +607,10 @@ int cx88_ir_fini(struct cx88_core *core)
484 if (NULL == ir) 607 if (NULL == ir)
485 return 0; 608 return 0;
486 609
610 if (ir->sampling) {
611 cx_write(MO_DDSCFG_IO, 0x0);
612 core->pci_irqmask &= ~(1 << 18);
613 }
487 if (ir->polling) { 614 if (ir->polling) {
488 del_timer(&ir->timer); 615 del_timer(&ir->timer);
489 flush_scheduled_work(); 616 flush_scheduled_work();
@@ -535,6 +662,7 @@ void cx88_ir_irq(struct cx88_core *core)
535 /* decode it */ 662 /* decode it */
536 switch (core->board) { 663 switch (core->board) {
537 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: 664 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
665 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
538 ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4); 666 ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4);
539 667
540 if (ircode == 0xffffffff) { /* decoding error */ 668 if (ircode == 0xffffffff) { /* decoding error */
@@ -550,7 +678,7 @@ void cx88_ir_irq(struct cx88_core *core)
550 break; 678 break;
551 } 679 }
552 680
553 if ((ircode & 0xffff) != 0xeb04) { /* wrong address */ 681 if ((ircode & 0xffff) != (ir->sampling & 0xffff)) { /* wrong address */
554 ir_dprintk("pulse distance decoded wrong address\n"); 682 ir_dprintk("pulse distance decoded wrong address\n");
555 break; 683 break;
556 } 684 }
@@ -567,6 +695,8 @@ void cx88_ir_irq(struct cx88_core *core)
567 break; 695 break;
568 case CX88_BOARD_HAUPPAUGE: 696 case CX88_BOARD_HAUPPAUGE:
569 case CX88_BOARD_HAUPPAUGE_DVB_T1: 697 case CX88_BOARD_HAUPPAUGE_DVB_T1:
698 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
699 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
570 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); 700 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
571 ir_dprintk("biphase decoded: %x\n", ircode); 701 ir_dprintk("biphase decoded: %x\n", ircode);
572 if ((ircode & 0xfffff000) != 0x3000) 702 if ((ircode & 0xfffff000) != 0x3000)