diff options
author | Ricardo Cerqueira <v4l@cerqueira.org> | 2005-11-09 00:37:51 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:56:21 -0500 |
commit | c2f6f9d866d3ea25eebe32c6c51e47e5141669cf (patch) | |
tree | 1c24ee3bc78c06b625f2eaa87a7ff8bc9c05ee5d /drivers/media/video/ir-kbd-i2c.c | |
parent | 9a741ec9b87ac13f13a1dfcb05979d7c785d0755 (diff) |
[PATCH] v4l: 812: supports the pinnacle pctv 110i board video inputs and remote
- Supports the Pinnacle PCTV 110i board, video inputs, and remote.
Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org>
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
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>
Diffstat (limited to 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 118 |
1 files changed, 117 insertions, 1 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 12f1053137da..0cd1fc89b2d0 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -122,6 +122,64 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { | |||
122 | 122 | ||
123 | }; | 123 | }; |
124 | 124 | ||
125 | static IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = { | ||
126 | [ 0x59 ] = KEY_MUTE, | ||
127 | [ 0x4a ] = KEY_POWER, | ||
128 | |||
129 | [ 0x18 ] = KEY_TEXT, | ||
130 | [ 0x26 ] = KEY_TV, | ||
131 | [ 0x3d ] = KEY_PRINT, | ||
132 | |||
133 | [ 0x48 ] = KEY_RED, | ||
134 | [ 0x04 ] = KEY_GREEN, | ||
135 | [ 0x11 ] = KEY_YELLOW, | ||
136 | [ 0x00 ] = KEY_BLUE, | ||
137 | |||
138 | [ 0x2d ] = KEY_VOLUMEUP, | ||
139 | [ 0x1e ] = KEY_VOLUMEDOWN, | ||
140 | |||
141 | [ 0x49 ] = KEY_MENU, | ||
142 | |||
143 | [ 0x16 ] = KEY_CHANNELUP, | ||
144 | [ 0x17 ] = KEY_CHANNELDOWN, | ||
145 | |||
146 | [ 0x20 ] = KEY_UP, | ||
147 | [ 0x21 ] = KEY_DOWN, | ||
148 | [ 0x22 ] = KEY_LEFT, | ||
149 | [ 0x23 ] = KEY_RIGHT, | ||
150 | [ 0x0d ] = KEY_SELECT, | ||
151 | |||
152 | |||
153 | |||
154 | [ 0x08 ] = KEY_BACK, | ||
155 | [ 0x07 ] = KEY_REFRESH, | ||
156 | |||
157 | [ 0x2f ] = KEY_ZOOM, | ||
158 | [ 0x29 ] = KEY_RECORD, | ||
159 | |||
160 | [ 0x4b ] = KEY_PAUSE, | ||
161 | [ 0x4d ] = KEY_REWIND, | ||
162 | [ 0x2e ] = KEY_PLAY, | ||
163 | [ 0x4e ] = KEY_FORWARD, | ||
164 | [ 0x53 ] = KEY_PREVIOUS, | ||
165 | [ 0x4c ] = KEY_STOP, | ||
166 | [ 0x54 ] = KEY_NEXT, | ||
167 | |||
168 | [ 0x69 ] = KEY_KP0, | ||
169 | [ 0x6a ] = KEY_KP1, | ||
170 | [ 0x6b ] = KEY_KP2, | ||
171 | [ 0x6c ] = KEY_KP3, | ||
172 | [ 0x6d ] = KEY_KP4, | ||
173 | [ 0x6e ] = KEY_KP5, | ||
174 | [ 0x6f ] = KEY_KP6, | ||
175 | [ 0x70 ] = KEY_KP7, | ||
176 | [ 0x71 ] = KEY_KP8, | ||
177 | [ 0x72 ] = KEY_KP9, | ||
178 | |||
179 | [ 0x74 ] = KEY_CHANNEL, | ||
180 | [ 0x0a ] = KEY_BACKSPACE, | ||
181 | }; | ||
182 | |||
125 | /* ----------------------------------------------------------------------- */ | 183 | /* ----------------------------------------------------------------------- */ |
126 | /* insmod parameters */ | 184 | /* insmod parameters */ |
127 | 185 | ||
@@ -245,6 +303,58 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
245 | *ir_raw = b; | 303 | *ir_raw = b; |
246 | return 1; | 304 | return 1; |
247 | } | 305 | } |
306 | |||
307 | /* The new pinnacle PCTV remote (with the colored buttons) | ||
308 | * | ||
309 | * Ricardo Cerqueira <v4l@cerqueira.org> | ||
310 | */ | ||
311 | |||
312 | static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | ||
313 | { | ||
314 | unsigned char b[4]; | ||
315 | unsigned int start = 0,parity = 0,code = 0; | ||
316 | |||
317 | /* poll IR chip */ | ||
318 | if (4 != i2c_master_recv(&ir->c,b,4)) { | ||
319 | dprintk(1,"read error\n"); | ||
320 | return -EIO; | ||
321 | } | ||
322 | |||
323 | for (start = 0; start<4; start++) { | ||
324 | if (b[start] == 0x80) { | ||
325 | code=b[(start+3)%4]; | ||
326 | parity=b[(start+2)%4]; | ||
327 | } | ||
328 | } | ||
329 | |||
330 | /* Empty Request */ | ||
331 | if (parity==0) | ||
332 | return 0; | ||
333 | |||
334 | /* Repeating... */ | ||
335 | if (ir->old == parity) | ||
336 | return 0; | ||
337 | |||
338 | |||
339 | ir->old = parity; | ||
340 | |||
341 | /* Reduce code value to fit inside IR_KEYTAB_SIZE | ||
342 | * | ||
343 | * this is the only value that results in 42 unique | ||
344 | * codes < 128 | ||
345 | */ | ||
346 | |||
347 | code %= 0x88; | ||
348 | |||
349 | *ir_raw = code; | ||
350 | *ir_key = code; | ||
351 | |||
352 | dprintk(1,"Pinnacle PCTV key %02x\n", code); | ||
353 | |||
354 | return 1; | ||
355 | } | ||
356 | |||
357 | |||
248 | /* ----------------------------------------------------------------------- */ | 358 | /* ----------------------------------------------------------------------- */ |
249 | 359 | ||
250 | static void ir_key_poll(struct IR_i2c *ir) | 360 | static void ir_key_poll(struct IR_i2c *ir) |
@@ -350,6 +460,12 @@ static int ir_attach(struct i2c_adapter *adap, int addr, | |||
350 | ir_type = IR_TYPE_OTHER; | 460 | ir_type = IR_TYPE_OTHER; |
351 | ir_codes = ir_codes_empty; | 461 | ir_codes = ir_codes_empty; |
352 | break; | 462 | break; |
463 | case 0x47: | ||
464 | name = "Pinnacle PCTV"; | ||
465 | ir->get_key = get_key_pinnacle; | ||
466 | ir_type = IR_TYPE_OTHER; | ||
467 | ir_codes = ir_codes_pinnacle; | ||
468 | break; | ||
353 | case 0x7a: | 469 | case 0x7a: |
354 | name = "Purple TV"; | 470 | name = "Purple TV"; |
355 | ir->get_key = get_key_purpletv; | 471 | ir->get_key = get_key_purpletv; |
@@ -426,7 +542,7 @@ static int ir_probe(struct i2c_adapter *adap) | |||
426 | */ | 542 | */ |
427 | 543 | ||
428 | static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; | 544 | static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; |
429 | static const int probe_saa7134[] = { 0x7a, -1 }; | 545 | static const int probe_saa7134[] = { 0x7a, 0x47, -1 }; |
430 | static const int probe_em2820[] = { 0x30, 0x47, -1 }; | 546 | static const int probe_em2820[] = { 0x30, 0x47, -1 }; |
431 | const int *probe = NULL; | 547 | const int *probe = NULL; |
432 | struct i2c_client c; | 548 | struct i2c_client c; |