diff options
author | Ricardo Cerqueira <v4l@cerqueira.org> | 2005-11-13 19:07:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-13 21:14:18 -0500 |
commit | 8069695c9e7da7ab7cd8ee749e8d5aa9e6e0660b (patch) | |
tree | f5e7208c2b9fd261d12424816388a736d500c987 | |
parent | 800d3c6f90b61cc82b09db635b59c00b1c460728 (diff) |
[PATCH] v4l: (935) Moved common IR stuff to ir-common.c
- The pinnacle handler & remote are common to saa7134 PCI boards and em28xx
USB boards, so the keymap was moved to ir-common and the keyhandler is back
to ir-kbd-i2c
- request_module("ir-kbd-i2c") is no longer necessary at saa7134-core since
saa7134.ko now depends on ir-kbd-i2c.ko to get the keyhandler
Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/media/common/ir-common.c | 60 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 52 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-core.c | 2 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 109 | ||||
-rw-r--r-- | include/media/ir-common.h | 1 | ||||
-rw-r--r-- | include/media/ir-kbd-i2c.h | 2 |
6 files changed, 115 insertions, 111 deletions
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c index 4b71fd6f7aed..7972c73bc14e 100644 --- a/drivers/media/common/ir-common.c +++ b/drivers/media/common/ir-common.c | |||
@@ -126,6 +126,66 @@ IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { | |||
126 | }; | 126 | }; |
127 | EXPORT_SYMBOL_GPL(ir_codes_winfast); | 127 | EXPORT_SYMBOL_GPL(ir_codes_winfast); |
128 | 128 | ||
129 | IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = { | ||
130 | [ 0x59 ] = KEY_MUTE, | ||
131 | [ 0x4a ] = KEY_POWER, | ||
132 | |||
133 | [ 0x18 ] = KEY_TEXT, | ||
134 | [ 0x26 ] = KEY_TV, | ||
135 | [ 0x3d ] = KEY_PRINT, | ||
136 | |||
137 | [ 0x48 ] = KEY_RED, | ||
138 | [ 0x04 ] = KEY_GREEN, | ||
139 | [ 0x11 ] = KEY_YELLOW, | ||
140 | [ 0x00 ] = KEY_BLUE, | ||
141 | |||
142 | [ 0x2d ] = KEY_VOLUMEUP, | ||
143 | [ 0x1e ] = KEY_VOLUMEDOWN, | ||
144 | |||
145 | [ 0x49 ] = KEY_MENU, | ||
146 | |||
147 | [ 0x16 ] = KEY_CHANNELUP, | ||
148 | [ 0x17 ] = KEY_CHANNELDOWN, | ||
149 | |||
150 | [ 0x20 ] = KEY_UP, | ||
151 | [ 0x21 ] = KEY_DOWN, | ||
152 | [ 0x22 ] = KEY_LEFT, | ||
153 | [ 0x23 ] = KEY_RIGHT, | ||
154 | [ 0x0d ] = KEY_SELECT, | ||
155 | |||
156 | |||
157 | |||
158 | [ 0x08 ] = KEY_BACK, | ||
159 | [ 0x07 ] = KEY_REFRESH, | ||
160 | |||
161 | [ 0x2f ] = KEY_ZOOM, | ||
162 | [ 0x29 ] = KEY_RECORD, | ||
163 | |||
164 | [ 0x4b ] = KEY_PAUSE, | ||
165 | [ 0x4d ] = KEY_REWIND, | ||
166 | [ 0x2e ] = KEY_PLAY, | ||
167 | [ 0x4e ] = KEY_FORWARD, | ||
168 | [ 0x53 ] = KEY_PREVIOUS, | ||
169 | [ 0x4c ] = KEY_STOP, | ||
170 | [ 0x54 ] = KEY_NEXT, | ||
171 | |||
172 | [ 0x69 ] = KEY_KP0, | ||
173 | [ 0x6a ] = KEY_KP1, | ||
174 | [ 0x6b ] = KEY_KP2, | ||
175 | [ 0x6c ] = KEY_KP3, | ||
176 | [ 0x6d ] = KEY_KP4, | ||
177 | [ 0x6e ] = KEY_KP5, | ||
178 | [ 0x6f ] = KEY_KP6, | ||
179 | [ 0x70 ] = KEY_KP7, | ||
180 | [ 0x71 ] = KEY_KP8, | ||
181 | [ 0x72 ] = KEY_KP9, | ||
182 | |||
183 | [ 0x74 ] = KEY_CHANNEL, | ||
184 | [ 0x0a ] = KEY_BACKSPACE, | ||
185 | }; | ||
186 | |||
187 | EXPORT_SYMBOL_GPL(ir_codes_pinnacle); | ||
188 | |||
129 | /* empty keytable, can be used as placeholder for not-yet created keytables */ | 189 | /* empty keytable, can be used as placeholder for not-yet created keytables */ |
130 | IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE] = { | 190 | IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE] = { |
131 | [ 42 ] = KEY_COFFEE, | 191 | [ 42 ] = KEY_COFFEE, |
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 0085567a1421..801c736e9328 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -183,6 +183,58 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
183 | return 1; | 183 | return 1; |
184 | } | 184 | } |
185 | 185 | ||
186 | /* The new pinnacle PCTV remote (with the colored buttons) | ||
187 | * | ||
188 | * Ricardo Cerqueira <v4l@cerqueira.org> | ||
189 | */ | ||
190 | |||
191 | int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | ||
192 | { | ||
193 | unsigned char b[4]; | ||
194 | unsigned int start = 0,parity = 0,code = 0; | ||
195 | |||
196 | /* poll IR chip */ | ||
197 | if (4 != i2c_master_recv(&ir->c,b,4)) { | ||
198 | dprintk(2,"read error\n"); | ||
199 | return -EIO; | ||
200 | } | ||
201 | |||
202 | for (start = 0; start<4; start++) { | ||
203 | if (b[start] == 0x80) { | ||
204 | code=b[(start+3)%4]; | ||
205 | parity=b[(start+2)%4]; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | /* Empty Request */ | ||
210 | if (parity==0) | ||
211 | return 0; | ||
212 | |||
213 | /* Repeating... */ | ||
214 | if (ir->old == parity) | ||
215 | return 0; | ||
216 | |||
217 | |||
218 | ir->old = parity; | ||
219 | |||
220 | /* Reduce code value to fit inside IR_KEYTAB_SIZE | ||
221 | * | ||
222 | * this is the only value that results in 42 unique | ||
223 | * codes < 128 | ||
224 | */ | ||
225 | |||
226 | code %= 0x88; | ||
227 | |||
228 | *ir_raw = code; | ||
229 | *ir_key = code; | ||
230 | |||
231 | dprintk(1,"Pinnacle PCTV key %02x\n", code); | ||
232 | |||
233 | return 1; | ||
234 | } | ||
235 | |||
236 | EXPORT_SYMBOL_GPL(get_key_pinnacle); | ||
237 | |||
186 | /* ----------------------------------------------------------------------- */ | 238 | /* ----------------------------------------------------------------------- */ |
187 | 239 | ||
188 | static void ir_key_poll(struct IR_i2c *ir) | 240 | static void ir_key_poll(struct IR_i2c *ir) |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 3d89a33289ed..14347854f98c 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -728,8 +728,6 @@ static int saa7134_hwinit2(struct saa7134_dev *dev) | |||
728 | irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 | | 728 | irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 | |
729 | SAA7134_IRQ2_INTE_GPIO18A | | 729 | SAA7134_IRQ2_INTE_GPIO18A | |
730 | SAA7134_IRQ2_INTE_GPIO16 ); | 730 | SAA7134_IRQ2_INTE_GPIO16 ); |
731 | else if (dev->has_remote == SAA7134_REMOTE_I2C) | ||
732 | request_module("ir-kbd-i2c"); | ||
733 | 731 | ||
734 | saa_writel(SAA7134_IRQ1, 0); | 732 | saa_writel(SAA7134_IRQ1, 0); |
735 | saa_writel(SAA7134_IRQ2, irq2_mask); | 733 | saa_writel(SAA7134_IRQ2, irq2_mask); |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 329accda6d45..e648cc3bc96d 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -485,64 +485,6 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { | |||
485 | 485 | ||
486 | }; | 486 | }; |
487 | 487 | ||
488 | static IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = { | ||
489 | [ 0x59 ] = KEY_MUTE, | ||
490 | [ 0x4a ] = KEY_POWER, | ||
491 | |||
492 | [ 0x18 ] = KEY_TEXT, | ||
493 | [ 0x26 ] = KEY_TV, | ||
494 | [ 0x3d ] = KEY_PRINT, | ||
495 | |||
496 | [ 0x48 ] = KEY_RED, | ||
497 | [ 0x04 ] = KEY_GREEN, | ||
498 | [ 0x11 ] = KEY_YELLOW, | ||
499 | [ 0x00 ] = KEY_BLUE, | ||
500 | |||
501 | [ 0x2d ] = KEY_VOLUMEUP, | ||
502 | [ 0x1e ] = KEY_VOLUMEDOWN, | ||
503 | |||
504 | [ 0x49 ] = KEY_MENU, | ||
505 | |||
506 | [ 0x16 ] = KEY_CHANNELUP, | ||
507 | [ 0x17 ] = KEY_CHANNELDOWN, | ||
508 | |||
509 | [ 0x20 ] = KEY_UP, | ||
510 | [ 0x21 ] = KEY_DOWN, | ||
511 | [ 0x22 ] = KEY_LEFT, | ||
512 | [ 0x23 ] = KEY_RIGHT, | ||
513 | [ 0x0d ] = KEY_SELECT, | ||
514 | |||
515 | |||
516 | |||
517 | [ 0x08 ] = KEY_BACK, | ||
518 | [ 0x07 ] = KEY_REFRESH, | ||
519 | |||
520 | [ 0x2f ] = KEY_ZOOM, | ||
521 | [ 0x29 ] = KEY_RECORD, | ||
522 | |||
523 | [ 0x4b ] = KEY_PAUSE, | ||
524 | [ 0x4d ] = KEY_REWIND, | ||
525 | [ 0x2e ] = KEY_PLAY, | ||
526 | [ 0x4e ] = KEY_FORWARD, | ||
527 | [ 0x53 ] = KEY_PREVIOUS, | ||
528 | [ 0x4c ] = KEY_STOP, | ||
529 | [ 0x54 ] = KEY_NEXT, | ||
530 | |||
531 | [ 0x69 ] = KEY_KP0, | ||
532 | [ 0x6a ] = KEY_KP1, | ||
533 | [ 0x6b ] = KEY_KP2, | ||
534 | [ 0x6c ] = KEY_KP3, | ||
535 | [ 0x6d ] = KEY_KP4, | ||
536 | [ 0x6e ] = KEY_KP5, | ||
537 | [ 0x6f ] = KEY_KP6, | ||
538 | [ 0x70 ] = KEY_KP7, | ||
539 | [ 0x71 ] = KEY_KP8, | ||
540 | [ 0x72 ] = KEY_KP9, | ||
541 | |||
542 | [ 0x74 ] = KEY_CHANNEL, | ||
543 | [ 0x0a ] = KEY_BACKSPACE, | ||
544 | }; | ||
545 | |||
546 | /* Mapping for the 28 key remote control as seen at | 488 | /* Mapping for the 28 key remote control as seen at |
547 | http://www.sednacomputer.com/photo/cardbus-tv.jpg | 489 | http://www.sednacomputer.com/photo/cardbus-tv.jpg |
548 | Pavel Mihaylov <bin@bash.info> */ | 490 | Pavel Mihaylov <bin@bash.info> */ |
@@ -635,57 +577,6 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
635 | return 1; | 577 | return 1; |
636 | } | 578 | } |
637 | 579 | ||
638 | /* The new pinnacle PCTV remote (with the colored buttons) | ||
639 | * | ||
640 | * Ricardo Cerqueira <v4l@cerqueira.org> | ||
641 | */ | ||
642 | |||
643 | static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | ||
644 | { | ||
645 | unsigned char b[4]; | ||
646 | unsigned int start = 0,parity = 0,code = 0; | ||
647 | |||
648 | /* poll IR chip */ | ||
649 | if (4 != i2c_master_recv(&ir->c,b,4)) { | ||
650 | i2cdprintk("read error\n"); | ||
651 | return -EIO; | ||
652 | } | ||
653 | |||
654 | for (start = 0; start<4; start++) { | ||
655 | if (b[start] == 0x80) { | ||
656 | code=b[(start+3)%4]; | ||
657 | parity=b[(start+2)%4]; | ||
658 | } | ||
659 | } | ||
660 | |||
661 | /* Empty Request */ | ||
662 | if (parity==0) | ||
663 | return 0; | ||
664 | |||
665 | /* Repeating... */ | ||
666 | if (ir->old == parity) | ||
667 | return 0; | ||
668 | |||
669 | |||
670 | ir->old = parity; | ||
671 | |||
672 | /* Reduce code value to fit inside IR_KEYTAB_SIZE | ||
673 | * | ||
674 | * this is the only value that results in 42 unique | ||
675 | * codes < 128 | ||
676 | */ | ||
677 | |||
678 | code %= 0x88; | ||
679 | |||
680 | *ir_raw = code; | ||
681 | *ir_key = code; | ||
682 | |||
683 | i2cdprintk("Pinnacle PCTV key %02x\n", code); | ||
684 | |||
685 | return 1; | ||
686 | } | ||
687 | |||
688 | |||
689 | void saa7134_input_irq(struct saa7134_dev *dev) | 580 | void saa7134_input_irq(struct saa7134_dev *dev) |
690 | { | 581 | { |
691 | struct saa7134_ir *ir = dev->remote; | 582 | struct saa7134_ir *ir = dev->remote; |
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 0f1ba95ec8d6..ad3e9bb670c3 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
@@ -49,6 +49,7 @@ struct ir_input_state { | |||
49 | 49 | ||
50 | extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; | 50 | extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; |
51 | extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; | 51 | extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; |
52 | extern IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE]; | ||
52 | extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; | 53 | extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; |
53 | extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; | 54 | extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; |
54 | extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; | 55 | extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; |
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 00fa57eb9fde..730f21ed91db 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h | |||
@@ -19,4 +19,6 @@ struct IR_i2c { | |||
19 | char phys[32]; | 19 | char phys[32]; |
20 | int (*get_key)(struct IR_i2c*, u32*, u32*); | 20 | int (*get_key)(struct IR_i2c*, u32*, u32*); |
21 | }; | 21 | }; |
22 | |||
23 | int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw); | ||
22 | #endif | 24 | #endif |