diff options
-rw-r--r-- | drivers/media/common/ir-keymaps.c | 59 | ||||
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 64 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-cards.c | 5 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-i2c.c | 2 | ||||
-rw-r--r-- | include/media/ir-common.h | 1 |
5 files changed, 130 insertions, 1 deletions
diff --git a/drivers/media/common/ir-keymaps.c b/drivers/media/common/ir-keymaps.c index d7b205472e1c..97e78f71c60d 100644 --- a/drivers/media/common/ir-keymaps.c +++ b/drivers/media/common/ir-keymaps.c | |||
@@ -153,6 +153,65 @@ IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE] = { | |||
153 | }; | 153 | }; |
154 | EXPORT_SYMBOL_GPL(ir_codes_avermedia_m135a); | 154 | EXPORT_SYMBOL_GPL(ir_codes_avermedia_m135a); |
155 | 155 | ||
156 | /* Oldrich Jedlicka <oldium.pro@seznam.cz> */ | ||
157 | IR_KEYTAB_TYPE ir_codes_avermedia_cardbus[IR_KEYTAB_SIZE] = { | ||
158 | [0x00] = KEY_POWER, | ||
159 | [0x01] = KEY_TUNER, /* TV/FM */ | ||
160 | [0x03] = KEY_TEXT, /* Teletext */ | ||
161 | [0x04] = KEY_EPG, | ||
162 | [0x05] = KEY_1, | ||
163 | [0x06] = KEY_2, | ||
164 | [0x07] = KEY_3, | ||
165 | [0x08] = KEY_AUDIO, | ||
166 | [0x09] = KEY_4, | ||
167 | [0x0a] = KEY_5, | ||
168 | [0x0b] = KEY_6, | ||
169 | [0x0c] = KEY_ZOOM, /* Full screen */ | ||
170 | [0x0d] = KEY_7, | ||
171 | [0x0e] = KEY_8, | ||
172 | [0x0f] = KEY_9, | ||
173 | [0x10] = KEY_PAGEUP, /* 16-CH PREV */ | ||
174 | [0x11] = KEY_0, | ||
175 | [0x12] = KEY_INFO, | ||
176 | [0x13] = KEY_AGAIN, /* CH RTN - channel return */ | ||
177 | [0x14] = KEY_MUTE, | ||
178 | [0x15] = KEY_EDIT, /* Autoscan */ | ||
179 | [0x17] = KEY_SAVE, /* Screenshot */ | ||
180 | [0x18] = KEY_PLAYPAUSE, | ||
181 | [0x19] = KEY_RECORD, | ||
182 | [0x1a] = KEY_PLAY, | ||
183 | [0x1b] = KEY_STOP, | ||
184 | [0x1c] = KEY_FASTFORWARD, | ||
185 | [0x1d] = KEY_REWIND, | ||
186 | [0x1e] = KEY_VOLUMEDOWN, | ||
187 | [0x1f] = KEY_VOLUMEUP, | ||
188 | [0x22] = KEY_SLEEP, /* Sleep */ | ||
189 | [0x23] = KEY_ZOOM, /* Aspect */ | ||
190 | [0x26] = KEY_SCREEN, /* Pos */ | ||
191 | [0x27] = KEY_ANGLE, /* Size */ | ||
192 | [0x28] = KEY_SELECT, /* Select */ | ||
193 | [0x29] = KEY_BLUE, /* Blue/Picture */ | ||
194 | [0x2a] = KEY_BACKSPACE, /* Back */ | ||
195 | [0x2b] = KEY_MEDIA, /* PIP (Picture-in-picture) */ | ||
196 | [0x2c] = KEY_DOWN, | ||
197 | [0x2e] = KEY_DOT, | ||
198 | [0x2f] = KEY_TV, /* Live TV */ | ||
199 | [0x32] = KEY_LEFT, | ||
200 | [0x33] = KEY_CLEAR, /* Clear */ | ||
201 | [0x35] = KEY_RED, /* Red/TV */ | ||
202 | [0x36] = KEY_UP, | ||
203 | [0x37] = KEY_HOME, /* Home */ | ||
204 | [0x39] = KEY_GREEN, /* Green/Video */ | ||
205 | [0x3d] = KEY_YELLOW, /* Yellow/Music */ | ||
206 | [0x3e] = KEY_OK, /* Ok */ | ||
207 | [0x3f] = KEY_RIGHT, | ||
208 | [0x40] = KEY_NEXT, /* Next */ | ||
209 | [0x41] = KEY_PREVIOUS, /* Previous */ | ||
210 | [0x42] = KEY_CHANNELDOWN, /* Channel down */ | ||
211 | [0x43] = KEY_CHANNELUP /* Channel up */ | ||
212 | }; | ||
213 | EXPORT_SYMBOL_GPL(ir_codes_avermedia_cardbus); | ||
214 | |||
156 | /* Attila Kondoros <attila.kondoros@chello.hu> */ | 215 | /* Attila Kondoros <attila.kondoros@chello.hu> */ |
157 | IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { | 216 | IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { |
158 | 217 | ||
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index d4658c56eddc..2ee49b7ddcf0 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -16,6 +16,8 @@ | |||
16 | * Henry Wong <henry@stuffedcow.net> | 16 | * Henry Wong <henry@stuffedcow.net> |
17 | * Mark Schultz <n9xmj@yahoo.com> | 17 | * Mark Schultz <n9xmj@yahoo.com> |
18 | * Brian Rogers <brian_rogers@comcast.net> | 18 | * Brian Rogers <brian_rogers@comcast.net> |
19 | * modified for AVerMedia Cardbus by | ||
20 | * Oldrich Jedlicka <oldium.pro@seznam.cz> | ||
19 | * | 21 | * |
20 | * This program is free software; you can redistribute it and/or modify | 22 | * This program is free software; you can redistribute it and/or modify |
21 | * it under the terms of the GNU General Public License as published by | 23 | * it under the terms of the GNU General Public License as published by |
@@ -216,6 +218,46 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |||
216 | return 1; | 218 | return 1; |
217 | } | 219 | } |
218 | 220 | ||
221 | static int get_key_avermedia_cardbus(struct IR_i2c *ir, | ||
222 | u32 *ir_key, u32 *ir_raw) | ||
223 | { | ||
224 | unsigned char subaddr, key, keygroup; | ||
225 | struct i2c_msg msg[] = { { .addr = ir->c.addr, .flags = 0, | ||
226 | .buf = &subaddr, .len = 1}, | ||
227 | { .addr = ir->c.addr, .flags = I2C_M_RD, | ||
228 | .buf = &key, .len = 1} }; | ||
229 | subaddr = 0x0d; | ||
230 | if (2 != i2c_transfer(ir->c.adapter, msg, 2)) { | ||
231 | dprintk(1, "read error\n"); | ||
232 | return -EIO; | ||
233 | } | ||
234 | |||
235 | if (key == 0xff) | ||
236 | return 0; | ||
237 | |||
238 | subaddr = 0x0b; | ||
239 | msg[1].buf = &keygroup; | ||
240 | if (2 != i2c_transfer(ir->c.adapter, msg, 2)) { | ||
241 | dprintk(1, "read error\n"); | ||
242 | return -EIO; | ||
243 | } | ||
244 | |||
245 | if (keygroup == 0xff) | ||
246 | return 0; | ||
247 | |||
248 | dprintk(1, "read key 0x%02x/0x%02x\n", key, keygroup); | ||
249 | if (keygroup < 2 || keygroup > 3) { | ||
250 | /* Only a warning */ | ||
251 | dprintk(1, "warning: invalid key group 0x%02x for key 0x%02x\n", | ||
252 | keygroup, key); | ||
253 | } | ||
254 | key |= (keygroup & 1) << 6; | ||
255 | |||
256 | *ir_key = key; | ||
257 | *ir_raw = key; | ||
258 | return 1; | ||
259 | } | ||
260 | |||
219 | /* ----------------------------------------------------------------------- */ | 261 | /* ----------------------------------------------------------------------- */ |
220 | 262 | ||
221 | static void ir_key_poll(struct IR_i2c *ir) | 263 | static void ir_key_poll(struct IR_i2c *ir) |
@@ -360,6 +402,12 @@ static int ir_attach(struct i2c_adapter *adap, int addr, | |||
360 | ir_type = IR_TYPE_OTHER; | 402 | ir_type = IR_TYPE_OTHER; |
361 | } | 403 | } |
362 | break; | 404 | break; |
405 | case 0x40: | ||
406 | name = "AVerMedia Cardbus remote"; | ||
407 | ir->get_key = get_key_avermedia_cardbus; | ||
408 | ir_type = IR_TYPE_OTHER; | ||
409 | ir_codes = ir_codes_avermedia_cardbus; | ||
410 | break; | ||
363 | default: | 411 | default: |
364 | /* shouldn't happen */ | 412 | /* shouldn't happen */ |
365 | printk(DEVNAME ": Huh? unknown i2c address (0x%02x)?\n", addr); | 413 | printk(DEVNAME ": Huh? unknown i2c address (0x%02x)?\n", addr); |
@@ -524,6 +572,22 @@ static int ir_probe(struct i2c_adapter *adap) | |||
524 | ir_attach(adap, msg.addr, 0, 0); | 572 | ir_attach(adap, msg.addr, 0, 0); |
525 | } | 573 | } |
526 | 574 | ||
575 | /* Special case for AVerMedia Cardbus remote */ | ||
576 | if (adap->id == I2C_HW_SAA7134) { | ||
577 | unsigned char subaddr, data; | ||
578 | struct i2c_msg msg[] = { { .addr = 0x40, .flags = 0, | ||
579 | .buf = &subaddr, .len = 1}, | ||
580 | { .addr = 0x40, .flags = I2C_M_RD, | ||
581 | .buf = &data, .len = 1} }; | ||
582 | subaddr = 0x0d; | ||
583 | rc = i2c_transfer(adap, msg, 2); | ||
584 | dprintk(1, "probe 0x%02x/0x%02x @ %s: %s\n", | ||
585 | msg[0].addr, subaddr, adap->name, | ||
586 | (2 == rc) ? "yes" : "no"); | ||
587 | if (2 == rc) | ||
588 | ir_attach(adap, msg[0].addr, 0, 0); | ||
589 | } | ||
590 | |||
527 | return 0; | 591 | return 0; |
528 | } | 592 | } |
529 | 593 | ||
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 107f6d30d007..67c223cc867f 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -6019,6 +6019,11 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
6019 | msleep(10); | 6019 | msleep(10); |
6020 | break; | 6020 | break; |
6021 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: | 6021 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: |
6022 | saa7134_set_gpio(dev, 23, 0); | ||
6023 | msleep(10); | ||
6024 | saa7134_set_gpio(dev, 23, 1); | ||
6025 | dev->has_remote = SAA7134_REMOTE_I2C; | ||
6026 | break; | ||
6022 | case SAA7134_BOARD_AVERMEDIA_M103: | 6027 | case SAA7134_BOARD_AVERMEDIA_M103: |
6023 | saa7134_set_gpio(dev, 23, 0); | 6028 | saa7134_set_gpio(dev, 23, 0); |
6024 | msleep(10); | 6029 | msleep(10); |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index 2e15f43d26ec..f3e285aa2fb4 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -255,7 +255,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
255 | addr = msgs[i].addr << 1; | 255 | addr = msgs[i].addr << 1; |
256 | if (msgs[i].flags & I2C_M_RD) | 256 | if (msgs[i].flags & I2C_M_RD) |
257 | addr |= 1; | 257 | addr |= 1; |
258 | if (i > 0 && msgs[i].flags & I2C_M_RD) { | 258 | if (i > 0 && msgs[i].flags & I2C_M_RD && msgs[i].addr != 0x40) { |
259 | /* workaround for a saa7134 i2c bug | 259 | /* workaround for a saa7134 i2c bug |
260 | * needed to talk to the mt352 demux | 260 | * needed to talk to the mt352 demux |
261 | * thanks to pinnacle for the hint */ | 261 | * thanks to pinnacle for the hint */ |
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 31e62abb59ad..135e02270c9b 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
@@ -111,6 +111,7 @@ extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; | |||
111 | extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; | 111 | extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; |
112 | extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE]; | 112 | extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE]; |
113 | extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE]; | 113 | extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE]; |
114 | extern IR_KEYTAB_TYPE ir_codes_avermedia_cardbus[IR_KEYTAB_SIZE]; | ||
114 | extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE]; | 115 | extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE]; |
115 | extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; | 116 | extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; |
116 | extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE]; | 117 | extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE]; |