aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-input.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-input.c')
-rw-r--r--drivers/media/video/bt8xx/bttv-input.c62
1 files changed, 59 insertions, 3 deletions
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index a38af98f4cae..2f289d981fe6 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -28,8 +28,8 @@
28#include "bttvp.h" 28#include "bttvp.h"
29 29
30 30
31static int debug; 31static int ir_debug;
32module_param(debug, int, 0644); /* debug level (0,1,2) */ 32module_param(ir_debug, int, 0644);
33static int repeat_delay = 500; 33static int repeat_delay = 500;
34module_param(repeat_delay, int, 0644); 34module_param(repeat_delay, int, 0644);
35static int repeat_period = 33; 35static int repeat_period = 33;
@@ -40,6 +40,12 @@ module_param(ir_rc5_remote_gap, int, 0644);
40static int ir_rc5_key_timeout = 200; 40static int ir_rc5_key_timeout = 200;
41module_param(ir_rc5_key_timeout, int, 0644); 41module_param(ir_rc5_key_timeout, int, 0644);
42 42
43#undef dprintk
44#define dprintk(arg...) do { \
45 if (ir_debug >= 1) \
46 printk(arg); \
47} while (0)
48
43#define DEVNAME "bttv-input" 49#define DEVNAME "bttv-input"
44 50
45/* ---------------------------------------------------------------------- */ 51/* ---------------------------------------------------------------------- */
@@ -79,6 +85,45 @@ static void ir_handle_key(struct bttv *btv)
79 85
80} 86}
81 87
88static void ir_enltv_handle_key(struct bttv *btv)
89{
90 struct card_ir *ir = btv->remote;
91 u32 gpio, data, keyup;
92
93 /* read gpio value */
94 gpio = bttv_gpio_read(&btv->c);
95
96 /* extract data */
97 data = ir_extract_bits(gpio, ir->mask_keycode);
98
99 /* Check if it is keyup */
100 keyup = (gpio & ir->mask_keyup) ? 1 << 31 : 0;
101
102 if ((ir->last_gpio & 0x7f) != data) {
103 dprintk(KERN_INFO DEVNAME ": gpio=0x%x code=%d | %s\n",
104 gpio, data,
105 (gpio & ir->mask_keyup) ? " up" : "up/down");
106
107 ir_input_keydown(ir->dev, &ir->ir, data, data);
108 if (keyup)
109 ir_input_nokey(ir->dev, &ir->ir);
110 } else {
111 if ((ir->last_gpio & 1 << 31) == keyup)
112 return;
113
114 dprintk(KERN_INFO DEVNAME ":(cnt) gpio=0x%x code=%d | %s\n",
115 gpio, data,
116 (gpio & ir->mask_keyup) ? " up" : "down");
117
118 if (keyup)
119 ir_input_nokey(ir->dev, &ir->ir);
120 else
121 ir_input_keydown(ir->dev, &ir->ir, data, data);
122 }
123
124 ir->last_gpio = data | keyup;
125}
126
82void bttv_input_irq(struct bttv *btv) 127void bttv_input_irq(struct bttv *btv)
83{ 128{
84 struct card_ir *ir = btv->remote; 129 struct card_ir *ir = btv->remote;
@@ -92,7 +137,10 @@ static void bttv_input_timer(unsigned long data)
92 struct bttv *btv = (struct bttv*)data; 137 struct bttv *btv = (struct bttv*)data;
93 struct card_ir *ir = btv->remote; 138 struct card_ir *ir = btv->remote;
94 139
95 ir_handle_key(btv); 140 if (btv->c.type == BTTV_BOARD_ENLTV_FM_2)
141 ir_enltv_handle_key(btv);
142 else
143 ir_handle_key(btv);
96 mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); 144 mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling));
97} 145}
98 146
@@ -284,6 +332,14 @@ int bttv_input_init(struct bttv *btv)
284 ir->mask_keyup = 0x006000; 332 ir->mask_keyup = 0x006000;
285 ir->polling = 50; /* ms */ 333 ir->polling = 50; /* ms */
286 break; 334 break;
335 case BTTV_BOARD_ENLTV_FM_2:
336 ir_codes = ir_codes_encore_enltv2;
337 ir->mask_keycode = 0x00fd00;
338 ir->mask_keyup = 0x000080;
339 ir->polling = 1; /* ms */
340 ir->last_gpio = ir_extract_bits(bttv_gpio_read(&btv->c),
341 ir->mask_keycode);
342 break;
287 } 343 }
288 if (NULL == ir_codes) { 344 if (NULL == ir_codes) {
289 dprintk(KERN_INFO "Ooops: IR config error [card=%d]\n", btv->c.type); 345 dprintk(KERN_INFO "Ooops: IR config error [card=%d]\n", btv->c.type);