diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-input.c | 5 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttv.h | 1 | ||||
-rw-r--r-- | drivers/media/video/bt8xx/bttvp.h | 43 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 30 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 23 |
5 files changed, 84 insertions, 18 deletions
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index e8f60ab58db6..e4df7f85f9df 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c | |||
@@ -147,6 +147,11 @@ static void bttv_input_timer(unsigned long data) | |||
147 | * testing. | 147 | * testing. |
148 | */ | 148 | */ |
149 | 149 | ||
150 | #define RC5_START(x) (((x) >> 12) & 3) | ||
151 | #define RC5_TOGGLE(x) (((x) >> 11) & 1) | ||
152 | #define RC5_ADDR(x) (((x) >> 6) & 31) | ||
153 | #define RC5_INSTR(x) ((x) & 63) | ||
154 | |||
150 | /* decode raw bit pattern to RC5 code */ | 155 | /* decode raw bit pattern to RC5 code */ |
151 | static u32 bttv_rc5_decode(unsigned int code) | 156 | static u32 bttv_rc5_decode(unsigned int code) |
152 | { | 157 | { |
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h index 6fd2a8ebda1e..fd62bf15d779 100644 --- a/drivers/media/video/bt8xx/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/videodev2.h> | 17 | #include <linux/videodev2.h> |
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <media/v4l2-device.h> | 19 | #include <media/v4l2-device.h> |
20 | #include <media/ir-common.h> | ||
21 | #include <media/i2c-addr.h> | 20 | #include <media/i2c-addr.h> |
22 | #include <media/tuner.h> | 21 | #include <media/tuner.h> |
23 | 22 | ||
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 157285b434c9..0bbdd481e336 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/device.h> | 41 | #include <linux/device.h> |
42 | #include <media/videobuf-dma-sg.h> | 42 | #include <media/videobuf-dma-sg.h> |
43 | #include <media/tveeprom.h> | 43 | #include <media/tveeprom.h> |
44 | #include <media/ir-common.h> | 44 | #include <media/ir-core.h> |
45 | #include <media/ir-kbd-i2c.h> | 45 | #include <media/ir-kbd-i2c.h> |
46 | 46 | ||
47 | #include "bt848.h" | 47 | #include "bt848.h" |
@@ -120,6 +120,47 @@ struct bttv_format { | |||
120 | int hshift,vshift; /* for planar modes */ | 120 | int hshift,vshift; /* for planar modes */ |
121 | }; | 121 | }; |
122 | 122 | ||
123 | struct card_ir { | ||
124 | struct rc_dev *dev; | ||
125 | |||
126 | char name[32]; | ||
127 | char phys[32]; | ||
128 | #if 0 | ||
129 | int users; | ||
130 | u32 running:1; | ||
131 | #endif | ||
132 | /* Usual gpio signalling */ | ||
133 | u32 mask_keycode; | ||
134 | u32 mask_keydown; | ||
135 | u32 mask_keyup; | ||
136 | u32 polling; | ||
137 | u32 last_gpio; | ||
138 | int shift_by; | ||
139 | int start; // What should RC5_START() be | ||
140 | int addr; // What RC5_ADDR() should be. | ||
141 | int rc5_remote_gap; | ||
142 | struct work_struct work; | ||
143 | struct timer_list timer; | ||
144 | |||
145 | /* RC5 gpio */ | ||
146 | u32 rc5_gpio; | ||
147 | struct timer_list timer_end; /* timer_end for code completion */ | ||
148 | u32 last_bit; /* last raw bit seen */ | ||
149 | u32 code; /* raw code under construction */ | ||
150 | struct timeval base_time; /* time of last seen code */ | ||
151 | int active; /* building raw code */ | ||
152 | |||
153 | #if 0 | ||
154 | /* NEC decoding */ | ||
155 | u32 nec_gpio; | ||
156 | struct tasklet_struct tlet; | ||
157 | |||
158 | /* IR core raw decoding */ | ||
159 | u32 raw_decode; | ||
160 | #endif | ||
161 | }; | ||
162 | |||
163 | |||
123 | /* ---------------------------------------------------------- */ | 164 | /* ---------------------------------------------------------- */ |
124 | 165 | ||
125 | struct bttv_geometry { | 166 | struct bttv_geometry { |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 72562b8cf3be..900e7985d9b3 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -61,7 +61,7 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev); | |||
61 | 61 | ||
62 | static int build_key(struct saa7134_dev *dev) | 62 | static int build_key(struct saa7134_dev *dev) |
63 | { | 63 | { |
64 | struct card_ir *ir = dev->remote; | 64 | struct saa7134_card_ir *ir = dev->remote; |
65 | u32 gpio, data; | 65 | u32 gpio, data; |
66 | 66 | ||
67 | /* here comes the additional handshake steps for some cards */ | 67 | /* here comes the additional handshake steps for some cards */ |
@@ -385,7 +385,7 @@ static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
385 | 385 | ||
386 | void saa7134_input_irq(struct saa7134_dev *dev) | 386 | void saa7134_input_irq(struct saa7134_dev *dev) |
387 | { | 387 | { |
388 | struct card_ir *ir; | 388 | struct saa7134_card_ir *ir; |
389 | 389 | ||
390 | if (!dev || !dev->remote) | 390 | if (!dev || !dev->remote) |
391 | return; | 391 | return; |
@@ -404,7 +404,7 @@ void saa7134_input_irq(struct saa7134_dev *dev) | |||
404 | static void saa7134_input_timer(unsigned long data) | 404 | static void saa7134_input_timer(unsigned long data) |
405 | { | 405 | { |
406 | struct saa7134_dev *dev = (struct saa7134_dev *)data; | 406 | struct saa7134_dev *dev = (struct saa7134_dev *)data; |
407 | struct card_ir *ir = dev->remote; | 407 | struct saa7134_card_ir *ir = dev->remote; |
408 | 408 | ||
409 | build_key(dev); | 409 | build_key(dev); |
410 | mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); | 410 | mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); |
@@ -413,17 +413,17 @@ static void saa7134_input_timer(unsigned long data) | |||
413 | static void ir_raw_decode_timer_end(unsigned long data) | 413 | static void ir_raw_decode_timer_end(unsigned long data) |
414 | { | 414 | { |
415 | struct saa7134_dev *dev = (struct saa7134_dev *)data; | 415 | struct saa7134_dev *dev = (struct saa7134_dev *)data; |
416 | struct card_ir *ir = dev->remote; | 416 | struct saa7134_card_ir *ir = dev->remote; |
417 | 417 | ||
418 | ir_raw_event_handle(dev->remote->dev); | 418 | ir_raw_event_handle(dev->remote->dev); |
419 | 419 | ||
420 | ir->active = 0; | 420 | ir->active = false; |
421 | } | 421 | } |
422 | 422 | ||
423 | static int __saa7134_ir_start(void *priv) | 423 | static int __saa7134_ir_start(void *priv) |
424 | { | 424 | { |
425 | struct saa7134_dev *dev = priv; | 425 | struct saa7134_dev *dev = priv; |
426 | struct card_ir *ir; | 426 | struct saa7134_card_ir *ir; |
427 | 427 | ||
428 | if (!dev) | 428 | if (!dev) |
429 | return -EINVAL; | 429 | return -EINVAL; |
@@ -435,7 +435,7 @@ static int __saa7134_ir_start(void *priv) | |||
435 | if (ir->running) | 435 | if (ir->running) |
436 | return 0; | 436 | return 0; |
437 | 437 | ||
438 | ir->running = 1; | 438 | ir->running = true; |
439 | if (ir->polling) { | 439 | if (ir->polling) { |
440 | setup_timer(&ir->timer, saa7134_input_timer, | 440 | setup_timer(&ir->timer, saa7134_input_timer, |
441 | (unsigned long)dev); | 441 | (unsigned long)dev); |
@@ -446,7 +446,7 @@ static int __saa7134_ir_start(void *priv) | |||
446 | init_timer(&ir->timer_end); | 446 | init_timer(&ir->timer_end); |
447 | ir->timer_end.function = ir_raw_decode_timer_end; | 447 | ir->timer_end.function = ir_raw_decode_timer_end; |
448 | ir->timer_end.data = (unsigned long)dev; | 448 | ir->timer_end.data = (unsigned long)dev; |
449 | ir->active = 0; | 449 | ir->active = false; |
450 | } | 450 | } |
451 | 451 | ||
452 | return 0; | 452 | return 0; |
@@ -455,7 +455,7 @@ static int __saa7134_ir_start(void *priv) | |||
455 | static void __saa7134_ir_stop(void *priv) | 455 | static void __saa7134_ir_stop(void *priv) |
456 | { | 456 | { |
457 | struct saa7134_dev *dev = priv; | 457 | struct saa7134_dev *dev = priv; |
458 | struct card_ir *ir; | 458 | struct saa7134_card_ir *ir; |
459 | 459 | ||
460 | if (!dev) | 460 | if (!dev) |
461 | return; | 461 | return; |
@@ -470,10 +470,10 @@ static void __saa7134_ir_stop(void *priv) | |||
470 | del_timer_sync(&dev->remote->timer); | 470 | del_timer_sync(&dev->remote->timer); |
471 | else if (ir->raw_decode) { | 471 | else if (ir->raw_decode) { |
472 | del_timer_sync(&ir->timer_end); | 472 | del_timer_sync(&ir->timer_end); |
473 | ir->active = 0; | 473 | ir->active = false; |
474 | } | 474 | } |
475 | 475 | ||
476 | ir->running = 0; | 476 | ir->running = false; |
477 | 477 | ||
478 | return; | 478 | return; |
479 | } | 479 | } |
@@ -511,7 +511,7 @@ static void saa7134_ir_close(struct rc_dev *rc) | |||
511 | 511 | ||
512 | int saa7134_input_init1(struct saa7134_dev *dev) | 512 | int saa7134_input_init1(struct saa7134_dev *dev) |
513 | { | 513 | { |
514 | struct card_ir *ir; | 514 | struct saa7134_card_ir *ir; |
515 | struct rc_dev *rc; | 515 | struct rc_dev *rc; |
516 | char *ir_codes = NULL; | 516 | char *ir_codes = NULL; |
517 | u32 mask_keycode = 0; | 517 | u32 mask_keycode = 0; |
@@ -764,7 +764,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
764 | ir->dev = rc; | 764 | ir->dev = rc; |
765 | dev->remote = ir; | 765 | dev->remote = ir; |
766 | 766 | ||
767 | ir->running = 0; | 767 | ir->running = false; |
768 | 768 | ||
769 | /* init hardware-specific stuff */ | 769 | /* init hardware-specific stuff */ |
770 | ir->mask_keycode = mask_keycode; | 770 | ir->mask_keycode = mask_keycode; |
@@ -934,7 +934,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) | |||
934 | 934 | ||
935 | static int saa7134_raw_decode_irq(struct saa7134_dev *dev) | 935 | static int saa7134_raw_decode_irq(struct saa7134_dev *dev) |
936 | { | 936 | { |
937 | struct card_ir *ir = dev->remote; | 937 | struct saa7134_card_ir *ir = dev->remote; |
938 | unsigned long timeout; | 938 | unsigned long timeout; |
939 | int space; | 939 | int space; |
940 | 940 | ||
@@ -953,7 +953,7 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) | |||
953 | if (!ir->active) { | 953 | if (!ir->active) { |
954 | timeout = jiffies + jiffies_to_msecs(15); | 954 | timeout = jiffies + jiffies_to_msecs(15); |
955 | mod_timer(&ir->timer_end, timeout); | 955 | mod_timer(&ir->timer_end, timeout); |
956 | ir->active = 1; | 956 | ir->active = true; |
957 | } | 957 | } |
958 | 958 | ||
959 | return 1; | 959 | return 1; |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index a6c726fe4c5d..c6ef95ec68f2 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -119,6 +119,27 @@ struct saa7134_format { | |||
119 | unsigned int uvswap:1; | 119 | unsigned int uvswap:1; |
120 | }; | 120 | }; |
121 | 121 | ||
122 | struct saa7134_card_ir { | ||
123 | struct rc_dev *dev; | ||
124 | |||
125 | char name[32]; | ||
126 | char phys[32]; | ||
127 | int users; | ||
128 | |||
129 | u32 polling; | ||
130 | u32 last_gpio; | ||
131 | u32 mask_keycode, mask_keydown, mask_keyup; | ||
132 | |||
133 | bool running; | ||
134 | bool active; | ||
135 | |||
136 | struct timer_list timer; | ||
137 | struct timer_list timer_end; /* timer_end for code completion */ | ||
138 | |||
139 | /* IR core raw decoding */ | ||
140 | u32 raw_decode; | ||
141 | }; | ||
142 | |||
122 | /* ----------------------------------------------------------- */ | 143 | /* ----------------------------------------------------------- */ |
123 | /* card configuration */ | 144 | /* card configuration */ |
124 | 145 | ||
@@ -530,7 +551,7 @@ struct saa7134_dev { | |||
530 | 551 | ||
531 | /* infrared remote */ | 552 | /* infrared remote */ |
532 | int has_remote; | 553 | int has_remote; |
533 | struct card_ir *remote; | 554 | struct saa7134_card_ir *remote; |
534 | 555 | ||
535 | /* pci i/o */ | 556 | /* pci i/o */ |
536 | char name[32]; | 557 | char name[32]; |