aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/bt8xx/bttv-i2c.c38
-rw-r--r--drivers/media/video/bt8xx/bttv-input.c84
-rw-r--r--drivers/media/video/bt8xx/bttv.h1
-rw-r--r--drivers/media/video/bt8xx/bttvp.h13
-rw-r--r--drivers/media/video/ir-kbd-i2c.c29
-rw-r--r--include/media/ir-kbd-i2c.h1
6 files changed, 87 insertions, 79 deletions
diff --git a/drivers/media/video/bt8xx/bttv-i2c.c b/drivers/media/video/bt8xx/bttv-i2c.c
index 685d6597ee79..d502f4106e56 100644
--- a/drivers/media/video/bt8xx/bttv-i2c.c
+++ b/drivers/media/video/bt8xx/bttv-i2c.c
@@ -390,41 +390,3 @@ int __devinit init_bttv_i2c(struct bttv *btv)
390 390
391 return btv->i2c_rc; 391 return btv->i2c_rc;
392} 392}
393
394/* Instantiate the I2C IR receiver device, if present */
395void __devinit init_bttv_i2c_ir(struct bttv *btv)
396{
397 if (0 == btv->i2c_rc) {
398 struct i2c_board_info info;
399 /* The external IR receiver is at i2c address 0x34 (0x35 for
400 reads). Future Hauppauge cards will have an internal
401 receiver at 0x30 (0x31 for reads). In theory, both can be
402 fitted, and Hauppauge suggest an external overrides an
403 internal.
404
405 That's why we probe 0x1a (~0x34) first. CB
406 */
407 const unsigned short addr_list[] = {
408 0x1a, 0x18, 0x4b, 0x64, 0x30, 0x71,
409 I2C_CLIENT_END
410 };
411
412 memset(&info, 0, sizeof(struct i2c_board_info));
413 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
414 i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list, NULL);
415 }
416}
417
418int __devexit fini_bttv_i2c(struct bttv *btv)
419{
420 if (0 != btv->i2c_rc)
421 return 0;
422
423 return i2c_del_adapter(&btv->c.i2c_adap);
424}
425
426/*
427 * Local variables:
428 * c-basic-offset: 8
429 * End:
430 */
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index f68717a4bdec..6bf05a7dc5f9 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -245,6 +245,83 @@ static void bttv_ir_stop(struct bttv *btv)
245 } 245 }
246} 246}
247 247
248/*
249 * Get_key functions used by I2C remotes
250 */
251
252static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
253{
254 unsigned char b;
255
256 /* poll IR chip */
257 if (1 != i2c_master_recv(ir->c, &b, 1)) {
258 dprintk(KERN_INFO DEVNAME ": read error\n");
259 return -EIO;
260 }
261
262 /* ignore 0xaa */
263 if (b==0xaa)
264 return 0;
265 dprintk(KERN_INFO DEVNAME ": key %02x\n", b);
266
267 *ir_key = b;
268 *ir_raw = b;
269 return 1;
270}
271
272/* Instantiate the I2C IR receiver device, if present */
273void __devinit init_bttv_i2c_ir(struct bttv *btv)
274{
275 const unsigned short addr_list[] = {
276 0x1a, 0x18, 0x64, 0x30, 0x71,
277 I2C_CLIENT_END
278 };
279 struct i2c_board_info info;
280
281 if (0 != btv->i2c_rc)
282 return;
283
284 memset(&info, 0, sizeof(struct i2c_board_info));
285 memset(&btv->init_data, 0, sizeof(btv->init_data));
286 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
287
288 switch (btv->c.type) {
289 case BTTV_BOARD_PV951:
290 btv->init_data.name = "PV951";
291 btv->init_data.get_key = get_key_pv951;
292 btv->init_data.ir_codes = RC_MAP_PV951;
293 btv->init_data.type = IR_TYPE_OTHER;
294 info.addr = 0x4b;
295 break;
296 default:
297 /*
298 * The external IR receiver is at i2c address 0x34 (0x35 for
299 * reads). Future Hauppauge cards will have an internal
300 * receiver at 0x30 (0x31 for reads). In theory, both can be
301 * fitted, and Hauppauge suggest an external overrides an
302 * internal.
303 * That's why we probe 0x1a (~0x34) first. CB
304 */
305
306 i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list, NULL);
307 return;
308 }
309
310 if (btv->init_data.name)
311 info.platform_data = &btv->init_data;
312 i2c_new_device(&btv->c.i2c_adap, &info);
313
314 return;
315}
316
317int __devexit fini_bttv_i2c(struct bttv *btv)
318{
319 if (0 != btv->i2c_rc)
320 return 0;
321
322 return i2c_del_adapter(&btv->c.i2c_adap);
323}
324
248int bttv_input_init(struct bttv *btv) 325int bttv_input_init(struct bttv *btv)
249{ 326{
250 struct card_ir *ir; 327 struct card_ir *ir;
@@ -420,10 +497,3 @@ void bttv_input_fini(struct bttv *btv)
420 kfree(btv->remote); 497 kfree(btv->remote);
421 btv->remote = NULL; 498 btv->remote = NULL;
422} 499}
423
424
425/*
426 * Local variables:
427 * c-basic-offset: 8
428 * End:
429 */
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index 3ec2402c6b4a..6fd2a8ebda1e 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -18,7 +18,6 @@
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> 20#include <media/ir-common.h>
21#include <media/ir-kbd-i2c.h>
22#include <media/i2c-addr.h> 21#include <media/i2c-addr.h>
23#include <media/tuner.h> 22#include <media/tuner.h>
24 23
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h
index 6cccc2a17eee..d1e26a448ed2 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -42,7 +42,7 @@
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-common.h>
45 45#include <media/ir-kbd-i2c.h>
46 46
47#include "bt848.h" 47#include "bt848.h"
48#include "bttv.h" 48#include "bttv.h"
@@ -271,6 +271,12 @@ int bttv_sub_del_devices(struct bttv_core *core);
271extern int no_overlay; 271extern int no_overlay;
272 272
273/* ---------------------------------------------------------- */ 273/* ---------------------------------------------------------- */
274/* bttv-input.c */
275
276extern void init_bttv_i2c_ir(struct bttv *btv);
277extern int fini_bttv_i2c(struct bttv *btv);
278
279/* ---------------------------------------------------------- */
274/* bttv-driver.c */ 280/* bttv-driver.c */
275 281
276/* insmod options */ 282/* insmod options */
@@ -279,8 +285,6 @@ extern unsigned int bttv_debug;
279extern unsigned int bttv_gpio; 285extern unsigned int bttv_gpio;
280extern void bttv_gpio_tracking(struct bttv *btv, char *comment); 286extern void bttv_gpio_tracking(struct bttv *btv, char *comment);
281extern int init_bttv_i2c(struct bttv *btv); 287extern int init_bttv_i2c(struct bttv *btv);
282extern void init_bttv_i2c_ir(struct bttv *btv);
283extern int fini_bttv_i2c(struct bttv *btv);
284 288
285#define bttv_printk if (bttv_verbose) printk 289#define bttv_printk if (bttv_verbose) printk
286#define dprintk if (bttv_debug >= 1) printk 290#define dprintk if (bttv_debug >= 1) printk
@@ -366,6 +370,9 @@ struct bttv {
366 int has_remote; 370 int has_remote;
367 struct card_ir *remote; 371 struct card_ir *remote;
368 372
373 /* I2C remote data */
374 struct IR_i2c_init_data init_data;
375
369 /* locking */ 376 /* locking */
370 spinlock_t s_lock; 377 spinlock_t s_lock;
371 struct mutex lock; 378 struct mutex lock;
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index ece6e15e4c07..02fbd08112c9 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -146,26 +146,6 @@ static int get_key_pixelview(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
146 return 1; 146 return 1;
147} 147}
148 148
149static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
150{
151 unsigned char b;
152
153 /* poll IR chip */
154 if (1 != i2c_master_recv(ir->c, &b, 1)) {
155 dprintk(1,"read error\n");
156 return -EIO;
157 }
158
159 /* ignore 0xaa */
160 if (b==0xaa)
161 return 0;
162 dprintk(2,"key %02x\n", b);
163
164 *ir_key = b;
165 *ir_raw = b;
166 return 1;
167}
168
169static int get_key_fusionhdtv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 149static int get_key_fusionhdtv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
170{ 150{
171 unsigned char buf[4]; 151 unsigned char buf[4];
@@ -321,12 +301,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
321 ir_type = IR_TYPE_OTHER; 301 ir_type = IR_TYPE_OTHER;
322 ir_codes = RC_MAP_EMPTY; 302 ir_codes = RC_MAP_EMPTY;
323 break; 303 break;
324 case 0x4b:
325 name = "PV951";
326 ir->get_key = get_key_pv951;
327 ir_type = IR_TYPE_OTHER;
328 ir_codes = RC_MAP_PV951;
329 break;
330 case 0x18: 304 case 0x18:
331 case 0x1f: 305 case 0x1f:
332 case 0x1a: 306 case 0x1a:
@@ -396,9 +370,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
396 case IR_KBD_GET_KEY_PIXELVIEW: 370 case IR_KBD_GET_KEY_PIXELVIEW:
397 ir->get_key = get_key_pixelview; 371 ir->get_key = get_key_pixelview;
398 break; 372 break;
399 case IR_KBD_GET_KEY_PV951:
400 ir->get_key = get_key_pv951;
401 break;
402 case IR_KBD_GET_KEY_HAUP: 373 case IR_KBD_GET_KEY_HAUP:
403 ir->get_key = get_key_haup; 374 ir->get_key = get_key_haup;
404 break; 375 break;
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 5e96d7a430be..4102f0dd5c40 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -24,7 +24,6 @@ struct IR_i2c {
24enum ir_kbd_get_key_fn { 24enum ir_kbd_get_key_fn {
25 IR_KBD_GET_KEY_CUSTOM = 0, 25 IR_KBD_GET_KEY_CUSTOM = 0,
26 IR_KBD_GET_KEY_PIXELVIEW, 26 IR_KBD_GET_KEY_PIXELVIEW,
27 IR_KBD_GET_KEY_PV951,
28 IR_KBD_GET_KEY_HAUP, 27 IR_KBD_GET_KEY_HAUP,
29 IR_KBD_GET_KEY_KNC1, 28 IR_KBD_GET_KEY_KNC1,
30 IR_KBD_GET_KEY_FUSIONHDTV, 29 IR_KBD_GET_KEY_FUSIONHDTV,