aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2010-10-29 15:08:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:16:37 -0500
commitd8b4b5822f51e2142b731b42c81e3f03eec475b2 (patch)
treefce9a9b7ca5031adc95fbd6be118352fb2527da5 /drivers/media/video/bt8xx
parent4c7b355df6e7f05304e05f6b7a286e59a5f1cc54 (diff)
[media] ir-core: make struct rc_dev the primary interface
This patch merges the ir_input_dev and ir_dev_props structs into a single struct called rc_dev. The drivers and various functions in rc-core used by the drivers are also changed to use rc_dev as the primary interface when dealing with rc-core. This means that the input_dev is abstracted away from the drivers which is necessary if we ever want to support multiple input devs per rc device. The new API is similar to what the input subsystem uses, i.e: rc_device_alloc() rc_device_free() rc_device_register() rc_device_unregister() [mchehab@redhat.com: Fix compilation on mceusb and cx231xx, due to merge conflicts] Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Jarod Wilson <jarod@redhat.com> Tested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt8xx')
-rw-r--r--drivers/media/video/bt8xx/bttv-input.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index eb71c3ae36d..4b4f6137c6c 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -31,10 +31,6 @@
31 31
32static int ir_debug; 32static int ir_debug;
33module_param(ir_debug, int, 0644); 33module_param(ir_debug, int, 0644);
34static int repeat_delay = 500;
35module_param(repeat_delay, int, 0644);
36static int repeat_period = 33;
37module_param(repeat_period, int, 0644);
38 34
39static int ir_rc5_remote_gap = 885; 35static int ir_rc5_remote_gap = 885;
40module_param(ir_rc5_remote_gap, int, 0644); 36module_param(ir_rc5_remote_gap, int, 0644);
@@ -317,15 +313,15 @@ int bttv_input_init(struct bttv *btv)
317{ 313{
318 struct card_ir *ir; 314 struct card_ir *ir;
319 char *ir_codes = NULL; 315 char *ir_codes = NULL;
320 struct input_dev *input_dev; 316 struct rc_dev *rc;
321 int err = -ENOMEM; 317 int err = -ENOMEM;
322 318
323 if (!btv->has_remote) 319 if (!btv->has_remote)
324 return -ENODEV; 320 return -ENODEV;
325 321
326 ir = kzalloc(sizeof(*ir),GFP_KERNEL); 322 ir = kzalloc(sizeof(*ir),GFP_KERNEL);
327 input_dev = input_allocate_device(); 323 rc = rc_allocate_device();
328 if (!ir || !input_dev) 324 if (!ir || !rc)
329 goto err_out_free; 325 goto err_out_free;
330 326
331 /* detect & configure */ 327 /* detect & configure */
@@ -431,44 +427,43 @@ int bttv_input_init(struct bttv *btv)
431 } 427 }
432 428
433 /* init input device */ 429 /* init input device */
434 ir->dev = input_dev; 430 ir->dev = rc;
435 431
436 snprintf(ir->name, sizeof(ir->name), "bttv IR (card=%d)", 432 snprintf(ir->name, sizeof(ir->name), "bttv IR (card=%d)",
437 btv->c.type); 433 btv->c.type);
438 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", 434 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
439 pci_name(btv->c.pci)); 435 pci_name(btv->c.pci));
440 436
441 input_dev->name = ir->name; 437 rc->input_name = ir->name;
442 input_dev->phys = ir->phys; 438 rc->input_phys = ir->phys;
443 input_dev->id.bustype = BUS_PCI; 439 rc->input_id.bustype = BUS_PCI;
444 input_dev->id.version = 1; 440 rc->input_id.version = 1;
445 if (btv->c.pci->subsystem_vendor) { 441 if (btv->c.pci->subsystem_vendor) {
446 input_dev->id.vendor = btv->c.pci->subsystem_vendor; 442 rc->input_id.vendor = btv->c.pci->subsystem_vendor;
447 input_dev->id.product = btv->c.pci->subsystem_device; 443 rc->input_id.product = btv->c.pci->subsystem_device;
448 } else { 444 } else {
449 input_dev->id.vendor = btv->c.pci->vendor; 445 rc->input_id.vendor = btv->c.pci->vendor;
450 input_dev->id.product = btv->c.pci->device; 446 rc->input_id.product = btv->c.pci->device;
451 } 447 }
452 input_dev->dev.parent = &btv->c.pci->dev; 448 rc->dev.parent = &btv->c.pci->dev;
449 rc->map_name = ir_codes;
450 rc->driver_name = MODULE_NAME;
453 451
454 btv->remote = ir; 452 btv->remote = ir;
455 bttv_ir_start(btv, ir); 453 bttv_ir_start(btv, ir);
456 454
457 /* all done */ 455 /* all done */
458 err = ir_input_register(btv->remote->dev, ir_codes, NULL, MODULE_NAME); 456 err = rc_register_device(rc);
459 if (err) 457 if (err)
460 goto err_out_stop; 458 goto err_out_stop;
461 459
462 /* the remote isn't as bouncy as a keyboard */
463 ir->dev->rep[REP_DELAY] = repeat_delay;
464 ir->dev->rep[REP_PERIOD] = repeat_period;
465
466 return 0; 460 return 0;
467 461
468 err_out_stop: 462 err_out_stop:
469 bttv_ir_stop(btv); 463 bttv_ir_stop(btv);
470 btv->remote = NULL; 464 btv->remote = NULL;
471 err_out_free: 465 err_out_free:
466 rc_free_device(rc);
472 kfree(ir); 467 kfree(ir);
473 return err; 468 return err;
474} 469}
@@ -479,7 +474,7 @@ void bttv_input_fini(struct bttv *btv)
479 return; 474 return;
480 475
481 bttv_ir_stop(btv); 476 bttv_ir_stop(btv);
482 ir_input_unregister(btv->remote->dev); 477 rc_unregister_device(btv->remote->dev);
483 kfree(btv->remote); 478 kfree(btv->remote);
484 btv->remote = NULL; 479 btv->remote = NULL;
485} 480}