aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx/bttv-input.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:03:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:03:59 -0400
commitcf2fa66055d718ae13e62451bb546505f63906a2 (patch)
treee206d3f04e74a34e9aa88d21af6c26eea21d4121 /drivers/media/video/bt8xx/bttv-input.c
parent4501a466f28788485604ee42641d7a5fe7258d16 (diff)
parent57f51dbc45f65f7ee1e8c8f77200bb8000e3e271 (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (313 commits) V4L/DVB (9186): Added support for Prof 7300 DVB-S/S2 cards V4L/DVB (9185): S2API: Ensure we have a reasonable ROLLOFF default V4L/DVB (9184): cx24116: Change the default SNR units back to percentage by default. V4L/DVB (9183): S2API: Return error of the caller provides 0 commands. V4L/DVB (9182): S2API: Added support for DTV_HIERARCHY V4L/DVB (9181): S2API: Add support fot DTV_GUARD_INTERVAL and DTV_TRANSMISSION_MODE V4L/DVB (9180): S2API: Added support for DTV_CODE_RATE_HP/LP V4L/DVB (9179): S2API: frontend.h cleanup V4L/DVB (9178): cx24116: Add module parameter to return SNR as ESNO. V4L/DVB (9177): S2API: Change _8PSK / _16APSK to PSK_8 and APSK_16 V4L/DVB (9176): Add support for DvbWorld USB cards with STV0288 demodulator. V4L/DVB (9175): Remove NULL pointer in stb6000 driver. V4L/DVB (9174): Allow custom inittab for ST STV0288 demodulator. V4L/DVB (9173): S2API: Remove the hardcoded command limit during validation V4L/DVB (9172): S2API: Bugfix related to DVB-S / DVB-S2 tuning for the legacy API. V4L/DVB (9171): S2API: Stop an OOPS if illegal commands are dumped in S2API. V4L/DVB (9170): cx24116: Sanity checking to data input via S2API to the cx24116 demod. V4L/DVB (9169): uvcvideo: Support two new Bison Electronics webcams. V4L/DVB (9168): Add support for MSI TV@nywhere Plus remote V4L/DVB: v4l2-dev: remove duplicated #include ...
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);