aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134
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/saa7134
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/saa7134')
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c72
1 files changed, 30 insertions, 42 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 3e37593a328f..fbb2ff171008 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -22,7 +22,6 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/input.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27 26
28#include "saa7134-reg.h" 27#include "saa7134-reg.h"
@@ -45,14 +44,6 @@ MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=g
45static int ir_rc5_remote_gap = 885; 44static int ir_rc5_remote_gap = 885;
46module_param(ir_rc5_remote_gap, int, 0644); 45module_param(ir_rc5_remote_gap, int, 0644);
47 46
48static int repeat_delay = 500;
49module_param(repeat_delay, int, 0644);
50MODULE_PARM_DESC(repeat_delay, "delay before key repeat started");
51static int repeat_period = 33;
52module_param(repeat_period, int, 0644);
53MODULE_PARM_DESC(repeat_period, "repeat period between "
54 "keypresses when key is down");
55
56static unsigned int disable_other_ir; 47static unsigned int disable_other_ir;
57module_param(disable_other_ir, int, 0644); 48module_param(disable_other_ir, int, 0644);
58MODULE_PARM_DESC(disable_other_ir, "disable full codes of " 49MODULE_PARM_DESC(disable_other_ir, "disable full codes of "
@@ -523,17 +514,17 @@ void saa7134_ir_stop(struct saa7134_dev *dev)
523 __saa7134_ir_stop(dev); 514 __saa7134_ir_stop(dev);
524} 515}
525 516
526static int saa7134_ir_open(void *priv) 517static int saa7134_ir_open(struct rc_dev *rc)
527{ 518{
528 struct saa7134_dev *dev = priv; 519 struct saa7134_dev *dev = rc->priv;
529 520
530 dev->remote->users++; 521 dev->remote->users++;
531 return __saa7134_ir_start(dev); 522 return __saa7134_ir_start(dev);
532} 523}
533 524
534static void saa7134_ir_close(void *priv) 525static void saa7134_ir_close(struct rc_dev *rc)
535{ 526{
536 struct saa7134_dev *dev = priv; 527 struct saa7134_dev *dev = rc->priv;
537 528
538 dev->remote->users--; 529 dev->remote->users--;
539 if (!dev->remote->users) 530 if (!dev->remote->users)
@@ -541,9 +532,9 @@ static void saa7134_ir_close(void *priv)
541} 532}
542 533
543 534
544static int saa7134_ir_change_protocol(void *priv, u64 ir_type) 535static int saa7134_ir_change_protocol(struct rc_dev *rc, u64 ir_type)
545{ 536{
546 struct saa7134_dev *dev = priv; 537 struct saa7134_dev *dev = rc->priv;
547 struct card_ir *ir = dev->remote; 538 struct card_ir *ir = dev->remote;
548 u32 nec_gpio, rc5_gpio; 539 u32 nec_gpio, rc5_gpio;
549 540
@@ -577,7 +568,7 @@ static int saa7134_ir_change_protocol(void *priv, u64 ir_type)
577int saa7134_input_init1(struct saa7134_dev *dev) 568int saa7134_input_init1(struct saa7134_dev *dev)
578{ 569{
579 struct card_ir *ir; 570 struct card_ir *ir;
580 struct input_dev *input_dev; 571 struct rc_dev *rc;
581 char *ir_codes = NULL; 572 char *ir_codes = NULL;
582 u32 mask_keycode = 0; 573 u32 mask_keycode = 0;
583 u32 mask_keydown = 0; 574 u32 mask_keydown = 0;
@@ -822,13 +813,13 @@ int saa7134_input_init1(struct saa7134_dev *dev)
822 } 813 }
823 814
824 ir = kzalloc(sizeof(*ir), GFP_KERNEL); 815 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
825 input_dev = input_allocate_device(); 816 rc = rc_allocate_device();
826 if (!ir || !input_dev) { 817 if (!ir || !rc) {
827 err = -ENOMEM; 818 err = -ENOMEM;
828 goto err_out_free; 819 goto err_out_free;
829 } 820 }
830 821
831 ir->dev = input_dev; 822 ir->dev = rc;
832 dev->remote = ir; 823 dev->remote = ir;
833 824
834 ir->running = 0; 825 ir->running = 0;
@@ -848,43 +839,40 @@ int saa7134_input_init1(struct saa7134_dev *dev)
848 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", 839 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
849 pci_name(dev->pci)); 840 pci_name(dev->pci));
850 841
851 842 rc->priv = dev;
852 ir->props.priv = dev; 843 rc->open = saa7134_ir_open;
853 ir->props.open = saa7134_ir_open; 844 rc->close = saa7134_ir_close;
854 ir->props.close = saa7134_ir_close;
855
856 if (raw_decode) 845 if (raw_decode)
857 ir->props.driver_type = RC_DRIVER_IR_RAW; 846 rc->driver_type = RC_DRIVER_IR_RAW;
858 847
859 if (!raw_decode && allow_protocol_change) { 848 if (!raw_decode && allow_protocol_change) {
860 ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; 849 rc->allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC;
861 ir->props.change_protocol = saa7134_ir_change_protocol; 850 rc->change_protocol = saa7134_ir_change_protocol;
862 } 851 }
863 852
864 input_dev->name = ir->name; 853 rc->input_name = ir->name;
865 input_dev->phys = ir->phys; 854 rc->input_phys = ir->phys;
866 input_dev->id.bustype = BUS_PCI; 855 rc->input_id.bustype = BUS_PCI;
867 input_dev->id.version = 1; 856 rc->input_id.version = 1;
868 if (dev->pci->subsystem_vendor) { 857 if (dev->pci->subsystem_vendor) {
869 input_dev->id.vendor = dev->pci->subsystem_vendor; 858 rc->input_id.vendor = dev->pci->subsystem_vendor;
870 input_dev->id.product = dev->pci->subsystem_device; 859 rc->input_id.product = dev->pci->subsystem_device;
871 } else { 860 } else {
872 input_dev->id.vendor = dev->pci->vendor; 861 rc->input_id.vendor = dev->pci->vendor;
873 input_dev->id.product = dev->pci->device; 862 rc->input_id.product = dev->pci->device;
874 } 863 }
875 input_dev->dev.parent = &dev->pci->dev; 864 rc->dev.parent = &dev->pci->dev;
865 rc->map_name = ir_codes;
866 rc->driver_name = MODULE_NAME;
876 867
877 err = ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); 868 err = rc_register_device(rc);
878 if (err) 869 if (err)
879 goto err_out_free; 870 goto err_out_free;
880 871
881 /* the remote isn't as bouncy as a keyboard */
882 ir->dev->rep[REP_DELAY] = repeat_delay;
883 ir->dev->rep[REP_PERIOD] = repeat_period;
884
885 return 0; 872 return 0;
886 873
887err_out_free: 874err_out_free:
875 rc_free_device(rc);
888 dev->remote = NULL; 876 dev->remote = NULL;
889 kfree(ir); 877 kfree(ir);
890 return err; 878 return err;
@@ -896,7 +884,7 @@ void saa7134_input_fini(struct saa7134_dev *dev)
896 return; 884 return;
897 885
898 saa7134_ir_stop(dev); 886 saa7134_ir_stop(dev);
899 ir_input_unregister(dev->remote->dev); 887 rc_unregister_device(dev->remote->dev);
900 kfree(dev->remote); 888 kfree(dev->remote);
901 dev->remote = NULL; 889 dev->remote = NULL;
902} 890}