diff options
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-input.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-input.c | 84 |
1 files changed, 77 insertions, 7 deletions
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 | |||
252 | static 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 */ | ||
273 | void __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 | |||
317 | int __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 | |||
248 | int bttv_input_init(struct bttv *btv) | 325 | int 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 | */ | ||