aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/siano
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/dvb/siano
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/dvb/siano')
-rw-r--r--drivers/media/dvb/siano/smscoreapi.c2
-rw-r--r--drivers/media/dvb/siano/smsir.c52
-rw-r--r--drivers/media/dvb/siano/smsir.h3
3 files changed, 29 insertions, 28 deletions
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c
index 135e45bd00c7..78765ed28063 100644
--- a/drivers/media/dvb/siano/smscoreapi.c
+++ b/drivers/media/dvb/siano/smscoreapi.c
@@ -438,7 +438,7 @@ static int smscore_init_ir(struct smscore_device_t *coredev)
438 int rc; 438 int rc;
439 void *buffer; 439 void *buffer;
440 440
441 coredev->ir.input_dev = NULL; 441 coredev->ir.dev = NULL;
442 ir_io = sms_get_board(smscore_get_board_id(coredev))->board_cfg.ir; 442 ir_io = sms_get_board(smscore_get_board_id(coredev))->board_cfg.ir;
443 if (ir_io) {/* only if IR port exist we use IR sub-module */ 443 if (ir_io) {/* only if IR port exist we use IR sub-module */
444 sms_info("IR loading"); 444 sms_info("IR loading");
diff --git a/drivers/media/dvb/siano/smsir.c b/drivers/media/dvb/siano/smsir.c
index a27c44a8af5a..ebd73059b518 100644
--- a/drivers/media/dvb/siano/smsir.c
+++ b/drivers/media/dvb/siano/smsir.c
@@ -45,25 +45,24 @@ void sms_ir_event(struct smscore_device_t *coredev, const char *buf, int len)
45 ev.duration = abs(samples[i]) * 1000; /* Convert to ns */ 45 ev.duration = abs(samples[i]) * 1000; /* Convert to ns */
46 ev.pulse = (samples[i] > 0) ? false : true; 46 ev.pulse = (samples[i] > 0) ? false : true;
47 47
48 ir_raw_event_store(coredev->ir.input_dev, &ev); 48 ir_raw_event_store(coredev->ir.dev, &ev);
49 } 49 }
50 ir_raw_event_handle(coredev->ir.input_dev); 50 ir_raw_event_handle(coredev->ir.dev);
51} 51}
52 52
53int sms_ir_init(struct smscore_device_t *coredev) 53int sms_ir_init(struct smscore_device_t *coredev)
54{ 54{
55 struct input_dev *input_dev; 55 int err;
56 int board_id = smscore_get_board_id(coredev); 56 int board_id = smscore_get_board_id(coredev);
57 struct rc_dev *dev;
57 58
58 sms_log("Allocating input device"); 59 sms_log("Allocating rc device");
59 input_dev = input_allocate_device(); 60 dev = rc_allocate_device();
60 if (!input_dev) { 61 if (!dev) {
61 sms_err("Not enough memory"); 62 sms_err("Not enough memory");
62 return -ENOMEM; 63 return -ENOMEM;
63 } 64 }
64 65
65 coredev->ir.input_dev = input_dev;
66
67 coredev->ir.controller = 0; /* Todo: vega/nova SPI number */ 66 coredev->ir.controller = 0; /* Todo: vega/nova SPI number */
68 coredev->ir.timeout = IR_DEFAULT_TIMEOUT; 67 coredev->ir.timeout = IR_DEFAULT_TIMEOUT;
69 sms_log("IR port %d, timeout %d ms", 68 sms_log("IR port %d, timeout %d ms",
@@ -75,38 +74,41 @@ int sms_ir_init(struct smscore_device_t *coredev)
75 strlcpy(coredev->ir.phys, coredev->devpath, sizeof(coredev->ir.phys)); 74 strlcpy(coredev->ir.phys, coredev->devpath, sizeof(coredev->ir.phys));
76 strlcat(coredev->ir.phys, "/ir0", sizeof(coredev->ir.phys)); 75 strlcat(coredev->ir.phys, "/ir0", sizeof(coredev->ir.phys));
77 76
78 input_dev->name = coredev->ir.name; 77 dev->input_name = coredev->ir.name;
79 input_dev->phys = coredev->ir.phys; 78 dev->input_phys = coredev->ir.phys;
80 input_dev->dev.parent = coredev->device; 79 dev->dev.parent = coredev->device;
81 80
82#if 0 81#if 0
83 /* TODO: properly initialize the parameters bellow */ 82 /* TODO: properly initialize the parameters bellow */
84 input_dev->id.bustype = BUS_USB; 83 dev->input_id.bustype = BUS_USB;
85 input_dev->id.version = 1; 84 dev->input_id.version = 1;
86 input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); 85 dev->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
87 input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct); 86 dev->input_id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
88#endif 87#endif
89 88
90 coredev->ir.props.priv = coredev; 89 dev->priv = coredev;
91 coredev->ir.props.driver_type = RC_DRIVER_IR_RAW; 90 dev->driver_type = RC_DRIVER_IR_RAW;
92 coredev->ir.props.allowed_protos = IR_TYPE_ALL; 91 dev->allowed_protos = IR_TYPE_ALL;
92 dev->map_name = sms_get_board(board_id)->rc_codes;
93 dev->driver_name = MODULE_NAME;
93 94
94 sms_log("Input device (IR) %s is set for key events", input_dev->name); 95 sms_log("Input device (IR) %s is set for key events", dev->input_name);
95 96
96 if (ir_input_register(input_dev, sms_get_board(board_id)->rc_codes, 97 err = rc_register_device(dev);
97 &coredev->ir.props, MODULE_NAME)) { 98 if (err < 0) {
98 sms_err("Failed to register device"); 99 sms_err("Failed to register device");
99 input_free_device(input_dev); 100 rc_free_device(dev);
100 return -EACCES; 101 return err;
101 } 102 }
102 103
104 coredev->ir.dev = dev;
103 return 0; 105 return 0;
104} 106}
105 107
106void sms_ir_exit(struct smscore_device_t *coredev) 108void sms_ir_exit(struct smscore_device_t *coredev)
107{ 109{
108 if (coredev->ir.input_dev) 110 if (coredev->ir.dev)
109 ir_input_unregister(coredev->ir.input_dev); 111 rc_unregister_device(coredev->ir.dev);
110 112
111 sms_log(""); 113 sms_log("");
112} 114}
diff --git a/drivers/media/dvb/siano/smsir.h b/drivers/media/dvb/siano/smsir.h
index 926e247523bd..c2f68a460ee1 100644
--- a/drivers/media/dvb/siano/smsir.h
+++ b/drivers/media/dvb/siano/smsir.h
@@ -35,13 +35,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
35struct smscore_device_t; 35struct smscore_device_t;
36 36
37struct ir_t { 37struct ir_t {
38 struct input_dev *input_dev; 38 struct rc_dev *dev;
39 char name[40]; 39 char name[40];
40 char phys[32]; 40 char phys[32];
41 41
42 char *rc_codes; 42 char *rc_codes;
43 u64 protocol; 43 u64 protocol;
44 struct ir_dev_props props;
45 44
46 u32 timeout; 45 u32 timeout;
47 u32 controller; 46 u32 controller;