aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMarkus Rechberger <mrechberger@gmail.com>2005-11-09 00:37:30 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:18 -0500
commit2f4710b1b1c62da3050c4eac08a5f08227e0e0f0 (patch)
treef69d2faea85b8f337bb075016801ca08b4c6cd7d /drivers/media
parent55b8b2d173adea54a9e8407f26630c19274fa0b6 (diff)
[PATCH] v4l: 782: ir-kbd-i2c.c updates
- fixed probe function - em2820 remote layout - disabled em2820 pinnacle ir support - whitespace cleanups Signed-off-by: Markus Rechberger <mrechberger@gmail.com> 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')
-rw-r--r--drivers/media/video/ir-kbd-i2c.c222
1 files changed, 126 insertions, 96 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 061dda10721b..fbb78b659a8b 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -43,100 +43,100 @@
43#include <media/ir-common.h> 43#include <media/ir-common.h>
44 44
45static IR_KEYTAB_TYPE ir_codes_em2820[IR_KEYTAB_SIZE] = { 45static IR_KEYTAB_TYPE ir_codes_em2820[IR_KEYTAB_SIZE] = {
46 [ 0 ] = KEY_CHANNEL, 46 [ 0x00 ] = KEY_CHANNEL,
47 [ 1 ] = KEY_SELECT, 47 [ 0x01 ] = KEY_SELECT,
48 [ 2 ] = KEY_MUTE, 48 [ 0x02 ] = KEY_MUTE,
49 [ 3 ] = KEY_POWER, 49 [ 0x03 ] = KEY_POWER,
50 [ 4 ] = KEY_KP1, 50 [ 0x04 ] = KEY_KP1,
51 [ 5 ] = KEY_KP2, 51 [ 0x05 ] = KEY_KP2,
52 [ 6 ] = KEY_KP3, 52 [ 0x06 ] = KEY_KP3,
53 [ 7 ] = KEY_CHANNELUP, 53 [ 0x07 ] = KEY_CHANNELUP,
54 [ 8 ] = KEY_KP4, 54 [ 0x08 ] = KEY_KP4,
55 [ 9 ] = KEY_KP5, 55 [ 0x09 ] = KEY_KP5,
56 [ 10 ] = KEY_KP6, 56 [ 0x0a ] = KEY_KP6,
57 57
58 [ 11 ] = KEY_CHANNELDOWN, 58 [ 0x0b ] = KEY_CHANNELDOWN,
59 [ 12 ] = KEY_KP7, 59 [ 0x0c ] = KEY_KP7,
60 [ 13 ] = KEY_KP8, 60 [ 0x0d ] = KEY_KP8,
61 [ 14 ] = KEY_KP9, 61 [ 0x0e ] = KEY_KP9,
62 [ 15 ] = KEY_VOLUMEUP, 62 [ 0x0f ] = KEY_VOLUMEUP,
63 [ 16 ] = KEY_KP0, 63 [ 0x10 ] = KEY_KP0,
64 [ 17 ] = KEY_MENU, 64 [ 0x11 ] = KEY_MENU,
65 [ 18 ] = KEY_PRINT, 65 [ 0x12 ] = KEY_PRINT,
66 66
67 [ 19 ] = KEY_VOLUMEDOWN, 67 [ 0x13 ] = KEY_VOLUMEDOWN,
68 [ 21 ] = KEY_PAUSE, 68 [ 0x15 ] = KEY_PAUSE,
69 [ 23 ] = KEY_RECORD, 69 [ 0x17 ] = KEY_RECORD,
70 [ 24 ] = KEY_REWIND, 70 [ 0x18 ] = KEY_REWIND,
71 [ 25 ] = KEY_PLAY, 71 [ 0x19 ] = KEY_PLAY,
72 [ 27 ] = KEY_BACKSPACE, 72 [ 0x1b ] = KEY_BACKSPACE,
73 [ 29 ] = KEY_STOP, 73 [ 0x1d ] = KEY_STOP,
74 [ 31 ] = KEY_ZOOM, 74 [ 0x40 ] = KEY_ZOOM,
75}; 75};
76 76
77/* Mark Phalan <phalanm@o2.ie> */ 77/* Mark Phalan <phalanm@o2.ie> */
78static IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE] = { 78static IR_KEYTAB_TYPE ir_codes_pv951[IR_KEYTAB_SIZE] = {
79 [ 0 ] = KEY_KP0, 79 [ 0x00 ] = KEY_KP0,
80 [ 1 ] = KEY_KP1, 80 [ 0x01 ] = KEY_KP1,
81 [ 2 ] = KEY_KP2, 81 [ 0x02 ] = KEY_KP2,
82 [ 3 ] = KEY_KP3, 82 [ 0x03 ] = KEY_KP3,
83 [ 4 ] = KEY_KP4, 83 [ 0x04 ] = KEY_KP4,
84 [ 5 ] = KEY_KP5, 84 [ 0x05 ] = KEY_KP5,
85 [ 6 ] = KEY_KP6, 85 [ 0x06 ] = KEY_KP6,
86 [ 7 ] = KEY_KP7, 86 [ 0x07 ] = KEY_KP7,
87 [ 8 ] = KEY_KP8, 87 [ 0x08 ] = KEY_KP8,
88 [ 9 ] = KEY_KP9, 88 [ 0x09 ] = KEY_KP9,
89 89
90 [ 18 ] = KEY_POWER, 90 [ 0x12 ] = KEY_POWER,
91 [ 16 ] = KEY_MUTE, 91 [ 0x10 ] = KEY_MUTE,
92 [ 31 ] = KEY_VOLUMEDOWN, 92 [ 0x1f ] = KEY_VOLUMEDOWN,
93 [ 27 ] = KEY_VOLUMEUP, 93 [ 0x1b ] = KEY_VOLUMEUP,
94 [ 26 ] = KEY_CHANNELUP, 94 [ 0x1a ] = KEY_CHANNELUP,
95 [ 30 ] = KEY_CHANNELDOWN, 95 [ 0x1e ] = KEY_CHANNELDOWN,
96 [ 14 ] = KEY_PAGEUP, 96 [ 0x0e ] = KEY_PAGEUP,
97 [ 29 ] = KEY_PAGEDOWN, 97 [ 0x1d ] = KEY_PAGEDOWN,
98 [ 19 ] = KEY_SOUND, 98 [ 0x13 ] = KEY_SOUND,
99 99
100 [ 24 ] = KEY_KPPLUSMINUS, /* CH +/- */ 100 [ 0x18 ] = KEY_KPPLUSMINUS, /* CH +/- */
101 [ 22 ] = KEY_SUBTITLE, /* CC */ 101 [ 0x16 ] = KEY_SUBTITLE, /* CC */
102 [ 13 ] = KEY_TEXT, /* TTX */ 102 [ 0x0d ] = KEY_TEXT, /* TTX */
103 [ 11 ] = KEY_TV, /* AIR/CBL */ 103 [ 0x0b ] = KEY_TV, /* AIR/CBL */
104 [ 17 ] = KEY_PC, /* PC/TV */ 104 [ 0x11 ] = KEY_PC, /* PC/TV */
105 [ 23 ] = KEY_OK, /* CH RTN */ 105 [ 0x17 ] = KEY_OK, /* CH RTN */
106 [ 25 ] = KEY_MODE, /* FUNC */ 106 [ 0x19 ] = KEY_MODE, /* FUNC */
107 [ 12 ] = KEY_SEARCH, /* AUTOSCAN */ 107 [ 0x0c ] = KEY_SEARCH, /* AUTOSCAN */
108 108
109 /* Not sure what to do with these ones! */ 109 /* Not sure what to do with these ones! */
110 [ 15 ] = KEY_SELECT, /* SOURCE */ 110 [ 0x0f ] = KEY_SELECT, /* SOURCE */
111 [ 10 ] = KEY_KPPLUS, /* +100 */ 111 [ 0x0a ] = KEY_KPPLUS, /* +100 */
112 [ 20 ] = KEY_KPEQUAL, /* SYNC */ 112 [ 0x14 ] = KEY_KPEQUAL, /* SYNC */
113 [ 28 ] = KEY_MEDIA, /* PC/TV */ 113 [ 0x1c ] = KEY_MEDIA, /* PC/TV */
114}; 114};
115 115
116static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = { 116static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = {
117 [ 0x3 ] = KEY_POWER, 117 [ 0x03 ] = KEY_POWER,
118 [ 0x6f ] = KEY_MUTE, 118 [ 0x6f ] = KEY_MUTE,
119 [ 0x10 ] = KEY_BACKSPACE, /* Recall */ 119 [ 0x10 ] = KEY_BACKSPACE, /* Recall */
120 120
121 [ 0x11 ] = KEY_KP0, 121 [ 0x11 ] = KEY_KP0,
122 [ 0x4 ] = KEY_KP1, 122 [ 0x04 ] = KEY_KP1,
123 [ 0x5 ] = KEY_KP2, 123 [ 0x05 ] = KEY_KP2,
124 [ 0x6 ] = KEY_KP3, 124 [ 0x06 ] = KEY_KP3,
125 [ 0x8 ] = KEY_KP4, 125 [ 0x08 ] = KEY_KP4,
126 [ 0x9 ] = KEY_KP5, 126 [ 0x09 ] = KEY_KP5,
127 [ 0xa ] = KEY_KP6, 127 [ 0x0a ] = KEY_KP6,
128 [ 0xc ] = KEY_KP7, 128 [ 0x0c ] = KEY_KP7,
129 [ 0xd ] = KEY_KP8, 129 [ 0x0d ] = KEY_KP8,
130 [ 0xe ] = KEY_KP9, 130 [ 0x0e ] = KEY_KP9,
131 [ 0x12 ] = KEY_KPDOT, /* 100+ */ 131 [ 0x12 ] = KEY_KPDOT, /* 100+ */
132 132
133 [ 0x7 ] = KEY_VOLUMEUP, 133 [ 0x07 ] = KEY_VOLUMEUP,
134 [ 0xb ] = KEY_VOLUMEDOWN, 134 [ 0x0b ] = KEY_VOLUMEDOWN,
135 [ 0x1a ] = KEY_KPPLUS, 135 [ 0x1a ] = KEY_KPPLUS,
136 [ 0x18 ] = KEY_KPMINUS, 136 [ 0x18 ] = KEY_KPMINUS,
137 [ 0x15 ] = KEY_UP, 137 [ 0x15 ] = KEY_UP,
138 [ 0x1d ] = KEY_DOWN, 138 [ 0x1d ] = KEY_DOWN,
139 [ 0xf ] = KEY_CHANNELUP, 139 [ 0x0f ] = KEY_CHANNELUP,
140 [ 0x13 ] = KEY_CHANNELDOWN, 140 [ 0x13 ] = KEY_CHANNELDOWN,
141 [ 0x48 ] = KEY_ZOOM, 141 [ 0x48 ] = KEY_ZOOM,
142 142
@@ -174,6 +174,9 @@ module_param(debug, int, 0644); /* debug level (0,1,2) */
174#define dprintk(level, fmt, arg...) if (debug >= level) \ 174#define dprintk(level, fmt, arg...) if (debug >= level) \
175 printk(KERN_DEBUG DEVNAME ": " fmt , ## arg) 175 printk(KERN_DEBUG DEVNAME ": " fmt , ## arg)
176 176
177#define IR_PINNACLE_REMOTE 0x01
178#define IR_TERRATEC_REMOTE 0x02
179
177/* ----------------------------------------------------------------------- */ 180/* ----------------------------------------------------------------------- */
178 181
179static int get_key_haup(struct IR *ir, u32 *ir_key, u32 *ir_raw) 182static int get_key_haup(struct IR *ir, u32 *ir_key, u32 *ir_raw)
@@ -287,6 +290,7 @@ static int get_key_purpletv(struct IR *ir, u32 *ir_key, u32 *ir_raw)
287 *ir_raw = b; 290 *ir_raw = b;
288 return 1; 291 return 1;
289} 292}
293
290/* ----------------------------------------------------------------------- */ 294/* ----------------------------------------------------------------------- */
291 295
292static void ir_key_poll(struct IR *ir) 296static void ir_key_poll(struct IR *ir)
@@ -386,24 +390,36 @@ static int ir_attach(struct i2c_adapter *adap, int addr,
386 ir_type = IR_TYPE_RC5; 390 ir_type = IR_TYPE_RC5;
387 ir_codes = ir_codes_rc5_tv; 391 ir_codes = ir_codes_rc5_tv;
388 break; 392 break;
389 case 0x60:
390 name = "em2820";
391 ir->get_key = get_key_knc1;
392 ir->c.addr = addr>>1;
393 ir_type = IR_TYPE_OTHER;
394 ir_codes = ir_codes_em2820;
395 break;
396 case 0x30: 393 case 0x30:
397 name = "KNC One"; 394 switch(kind){
398 ir->get_key = get_key_knc1; 395 case IR_TERRATEC_REMOTE:
399 ir_type = IR_TYPE_OTHER; 396 name = "Terratec IR";
400 ir_codes = ir_codes_empty; 397 ir->get_key = get_key_knc1;
398 ir_type = IR_TYPE_OTHER;
399 ir_codes = ir_codes_em2820;
400 break;
401 default:
402 name = "KNC One";
403 ir->get_key = get_key_knc1;
404 ir_type = IR_TYPE_OTHER;
405 ir_codes = ir_codes_em2820;
406 }
401 break; 407 break;
408 case 0x47:
402 case 0x7a: 409 case 0x7a:
403 name = "Purple TV"; 410 switch(kind){
404 ir->get_key = get_key_purpletv; 411 case IR_PINNACLE_REMOTE:
405 ir_type = IR_TYPE_OTHER; 412 name = "Pinnacle IR Remote";
406 ir_codes = ir_codes_purpletv; 413 ir->get_key = get_key_purpletv;
414 ir_type = IR_TYPE_OTHER;
415 ir_codes = ir_codes_em2820;
416 break;
417 default:
418 name = "Purple TV";
419 ir->get_key = get_key_purpletv;
420 ir_type = IR_TYPE_OTHER;
421 ir_codes = ir_codes_empty;
422 }
407 break; 423 break;
408 default: 424 default:
409 /* shouldn't happen */ 425 /* shouldn't happen */
@@ -468,9 +484,11 @@ static int ir_probe(struct i2c_adapter *adap)
468 484
469 static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1}; 485 static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1};
470 static const int probe_saa7134[] = { 0x7a, -1 }; 486 static const int probe_saa7134[] = { 0x7a, -1 };
471 static const int probe_em2820[] = { 0x60, -1 }; 487 static const int probe_em2820[] = { 0x47, 0x30, -1 };
472 const int *probe = NULL; 488 const int *probe = NULL;
473 struct i2c_client c; char buf; int i,rc; 489 int attached = 0;
490
491 struct i2c_client c; unsigned char buf; int i,rc;
474 492
475 switch (adap->id) { 493 switch (adap->id) {
476 case I2C_HW_B_BT848: 494 case I2C_HW_B_BT848:
@@ -488,15 +506,27 @@ static int ir_probe(struct i2c_adapter *adap)
488 506
489 memset(&c,0,sizeof(c)); 507 memset(&c,0,sizeof(c));
490 c.adapter = adap; 508 c.adapter = adap;
491 for (i = 0; -1 != probe[i]; i++) { 509 for (i = 0; -1 != probe[i] && attached != 1; i++) {
492 c.addr = probe[i]; 510 c.addr = probe[i];
493 rc = i2c_master_recv(&c,&buf,1); 511 rc = i2c_master_recv(&c,&buf,1);
494 dprintk(1,"probe 0x%02x @ %s: %s\n", 512 dprintk(1,"probe 0x%02x @ %s: %s\n",
495 probe[i], adap->name, 513 probe[i], adap->name,
496 (1 == rc) ? "yes" : "no"); 514 (1 == rc) ? "yes" : "no");
497 if (1 == rc) { 515 switch(adap->id){
498 ir_attach(adap,probe[i],0,0); 516 case I2C_HW_B_BT848:
499 break; 517 case I2C_HW_SAA7134:
518 if (1 == rc) {
519 ir_attach(adap,probe[i],0,0);
520 attached=1;
521 break;
522 }
523 case I2C_HW_B_EM2820:
524 /* windows logs are needed for fixing the pinnacle device */
525 if (1 == rc && 0xff == buf){
526 ir_attach(adap,probe[i],0,IR_TERRATEC_REMOTE);
527 attached=1;
528 }
529 break;
500 } 530 }
501 } 531 }
502 return 0; 532 return 0;