blob: 9945e5e7f61a6d58d94105c6f5a6a3c9555d93fb [file] [log] [blame]
Jarod Wilson457e2ff2011-01-18 02:33:08 -03001/* ir-lirc-codec.c - rc-core to classic lirc interface bridge
Jarod Wilsonca414692010-07-03 01:07:53 -03002 *
3 * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <linux/sched.h>
16#include <linux/wait.h>
Paul Gortmaker7a707b82011-07-03 14:03:12 -040017#include <linux/module.h>
Jarod Wilsonca414692010-07-03 01:07:53 -030018#include <media/lirc.h>
Jarod Wilson56900852010-07-16 14:25:33 -030019#include <media/lirc_dev.h>
Mauro Carvalho Chehab6bda9642010-11-17 13:28:38 -030020#include <media/rc-core.h>
Mauro Carvalho Chehabf62de672010-11-09 23:09:57 -030021#include "rc-core-priv.h"
Jarod Wilsonca414692010-07-03 01:07:53 -030022
23#define LIRCBUF_SIZE 256
24
25/**
26 * ir_lirc_decode() - Send raw IR data to lirc_dev to be relayed to the
27 * lircd userspace daemon for decoding.
David Härdemand8b4b582010-10-29 16:08:23 -030028 * @input_dev: the struct rc_dev descriptor of the device
Jarod Wilsonca414692010-07-03 01:07:53 -030029 * @duration: the struct ir_raw_event descriptor of the pulse/space
30 *
31 * This function returns -EINVAL if the lirc interfaces aren't wired up.
32 */
David Härdemand8b4b582010-10-29 16:08:23 -030033static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
Jarod Wilsonca414692010-07-03 01:07:53 -030034{
David Härdemand8b4b582010-10-29 16:08:23 -030035 struct lirc_codec *lirc = &dev->raw->lirc;
Maxim Levitsky510fcb72010-07-31 11:59:15 -030036 int sample;
Jarod Wilsonca414692010-07-03 01:07:53 -030037
David Härdemanc003ab12012-10-11 19:11:54 -030038 if (!(dev->raw->enabled_protocols & RC_BIT_LIRC))
Jarod Wilsonca414692010-07-03 01:07:53 -030039 return 0;
40
David Härdemand8b4b582010-10-29 16:08:23 -030041 if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
Jarod Wilsonca414692010-07-03 01:07:53 -030042 return -EINVAL;
43
Maxim Levitsky46519182010-10-16 19:56:28 -030044 /* Packet start */
45 if (ev.reset)
Maxim Levitsky510fcb72010-07-31 11:59:15 -030046 return 0;
47
Maxim Levitsky46519182010-10-16 19:56:28 -030048 /* Carrier reports */
49 if (ev.carrier_report) {
50 sample = LIRC_FREQUENCY(ev.carrier);
Jarod Wilson457e2ff2011-01-18 02:33:08 -030051 IR_dprintk(2, "carrier report (freq: %d)\n", sample);
Jarod Wilsonca414692010-07-03 01:07:53 -030052
Maxim Levitsky46519182010-10-16 19:56:28 -030053 /* Packet end */
54 } else if (ev.timeout) {
55
56 if (lirc->gap)
57 return 0;
58
59 lirc->gap_start = ktime_get();
60 lirc->gap = true;
61 lirc->gap_duration = ev.duration;
62
63 if (!lirc->send_timeout_reports)
64 return 0;
65
66 sample = LIRC_TIMEOUT(ev.duration / 1000);
Jarod Wilson457e2ff2011-01-18 02:33:08 -030067 IR_dprintk(2, "timeout report (duration: %d)\n", sample);
Maxim Levitsky46519182010-10-16 19:56:28 -030068
69 /* Normal sample */
70 } else {
71
72 if (lirc->gap) {
73 int gap_sample;
74
75 lirc->gap_duration += ktime_to_ns(ktime_sub(ktime_get(),
76 lirc->gap_start));
77
78 /* Convert to ms and cap by LIRC_VALUE_MASK */
79 do_div(lirc->gap_duration, 1000);
80 lirc->gap_duration = min(lirc->gap_duration,
81 (u64)LIRC_VALUE_MASK);
82
83 gap_sample = LIRC_SPACE(lirc->gap_duration);
David Härdemand8b4b582010-10-29 16:08:23 -030084 lirc_buffer_write(dev->raw->lirc.drv->rbuf,
Maxim Levitsky46519182010-10-16 19:56:28 -030085 (unsigned char *) &gap_sample);
86 lirc->gap = false;
87 }
88
89 sample = ev.pulse ? LIRC_PULSE(ev.duration / 1000) :
90 LIRC_SPACE(ev.duration / 1000);
Jarod Wilson457e2ff2011-01-18 02:33:08 -030091 IR_dprintk(2, "delivering %uus %s to lirc_dev\n",
92 TO_US(ev.duration), TO_STR(ev.pulse));
Maxim Levitsky46519182010-10-16 19:56:28 -030093 }
Jarod Wilsonca414692010-07-03 01:07:53 -030094
David Härdemand8b4b582010-10-29 16:08:23 -030095 lirc_buffer_write(dev->raw->lirc.drv->rbuf,
Maxim Levitsky510fcb72010-07-31 11:59:15 -030096 (unsigned char *) &sample);
David Härdemand8b4b582010-10-29 16:08:23 -030097 wake_up(&dev->raw->lirc.drv->rbuf->wait_poll);
Jarod Wilsonca414692010-07-03 01:07:53 -030098
Jarod Wilsonca414692010-07-03 01:07:53 -030099 return 0;
100}
101
Dan Carpenter06bd8012011-10-06 02:41:06 -0300102static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
Jarod Wilsonca414692010-07-03 01:07:53 -0300103 size_t n, loff_t *ppos)
104{
105 struct lirc_codec *lirc;
David Härdemand8b4b582010-10-29 16:08:23 -0300106 struct rc_dev *dev;
David Härdeman5588dc22011-04-28 12:13:58 -0300107 unsigned int *txbuf; /* buffer with values to transmit */
Sean Youngd07df2232012-08-13 08:59:49 -0300108 ssize_t ret = -EINVAL;
Vasiliy Kulikov4c8b8692010-11-26 14:06:35 -0300109 size_t count;
David Härdemanf8e00d52011-04-28 11:14:03 -0300110 ktime_t start;
111 s64 towait;
112 unsigned int duration = 0; /* signal duration in us */
113 int i;
114
115 start = ktime_get();
Jarod Wilsonca414692010-07-03 01:07:53 -0300116
117 lirc = lirc_get_pdata(file);
118 if (!lirc)
119 return -EFAULT;
120
David Härdeman5588dc22011-04-28 12:13:58 -0300121 if (n < sizeof(unsigned) || n % sizeof(unsigned))
Jarod Wilsonca414692010-07-03 01:07:53 -0300122 return -EINVAL;
123
David Härdeman5588dc22011-04-28 12:13:58 -0300124 count = n / sizeof(unsigned);
125 if (count > LIRCBUF_SIZE || count % 2 == 0)
Jarod Wilsonca414692010-07-03 01:07:53 -0300126 return -EINVAL;
127
Jarod Wilson6efb8702010-07-16 18:29:54 -0300128 txbuf = memdup_user(buf, n);
129 if (IS_ERR(txbuf))
130 return PTR_ERR(txbuf);
Jarod Wilsonca414692010-07-03 01:07:53 -0300131
David Härdemand8b4b582010-10-29 16:08:23 -0300132 dev = lirc->dev;
133 if (!dev) {
Jarod Wilsonca414692010-07-03 01:07:53 -0300134 ret = -EFAULT;
135 goto out;
136 }
137
David Härdemanf8e00d52011-04-28 11:14:03 -0300138 if (!dev->tx_ir) {
139 ret = -ENOSYS;
140 goto out;
141 }
David Härdeman5588dc22011-04-28 12:13:58 -0300142
Sean Young586c61f2012-08-23 17:18:25 -0300143 ret = dev->tx_ir(dev, txbuf, count);
David Härdemanf8e00d52011-04-28 11:14:03 -0300144 if (ret < 0)
145 goto out;
146
147 for (i = 0; i < ret; i++)
148 duration += txbuf[i];
149
150 ret *= sizeof(unsigned int);
151
152 /*
153 * The lircd gap calculation expects the write function to
154 * wait for the actual IR signal to be transmitted before
155 * returning.
156 */
157 towait = ktime_us_delta(ktime_add_us(start, duration), ktime_get());
158 if (towait > 0) {
159 set_current_state(TASK_INTERRUPTIBLE);
160 schedule_timeout(usecs_to_jiffies(towait));
161 }
Jarod Wilsonca414692010-07-03 01:07:53 -0300162
163out:
164 kfree(txbuf);
165 return ret;
166}
167
Maxim Levitskye5893332010-07-31 11:59:23 -0300168static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
Dan Carpenter06bd8012011-10-06 02:41:06 -0300169 unsigned long arg)
Jarod Wilsonca414692010-07-03 01:07:53 -0300170{
171 struct lirc_codec *lirc;
David Härdemand8b4b582010-10-29 16:08:23 -0300172 struct rc_dev *dev;
Dan Carpenter06bd8012011-10-06 02:41:06 -0300173 u32 __user *argp = (u32 __user *)(arg);
Jarod Wilsonca414692010-07-03 01:07:53 -0300174 int ret = 0;
Maxim Levitsky46519182010-10-16 19:56:28 -0300175 __u32 val = 0, tmp;
Jarod Wilsonca414692010-07-03 01:07:53 -0300176
177 lirc = lirc_get_pdata(filep);
178 if (!lirc)
179 return -EFAULT;
180
David Härdemand8b4b582010-10-29 16:08:23 -0300181 dev = lirc->dev;
182 if (!dev)
Jarod Wilsonca414692010-07-03 01:07:53 -0300183 return -EFAULT;
184
Maxim Levitskye5893332010-07-31 11:59:23 -0300185 if (_IOC_DIR(cmd) & _IOC_WRITE) {
Dan Carpenter06bd8012011-10-06 02:41:06 -0300186 ret = get_user(val, argp);
Jarod Wilsonca414692010-07-03 01:07:53 -0300187 if (ret)
188 return ret;
Maxim Levitskye5893332010-07-31 11:59:23 -0300189 }
Jarod Wilsonca414692010-07-03 01:07:53 -0300190
Maxim Levitskye5893332010-07-31 11:59:23 -0300191 switch (cmd) {
192
193 /* legacy support */
194 case LIRC_GET_SEND_MODE:
195 val = LIRC_CAN_SEND_PULSE & LIRC_CAN_SEND_MASK;
196 break;
197
198 case LIRC_SET_SEND_MODE:
199 if (val != (LIRC_MODE_PULSE & LIRC_CAN_SEND_MASK))
200 return -EINVAL;
Maxim Levitsky46519182010-10-16 19:56:28 -0300201 return 0;
Maxim Levitskye5893332010-07-31 11:59:23 -0300202
203 /* TX settings */
204 case LIRC_SET_TRANSMITTER_MASK:
David Härdemand8b4b582010-10-29 16:08:23 -0300205 if (!dev->s_tx_mask)
Dan Carpenter5f499082012-09-11 07:11:53 -0300206 return -ENOSYS;
Maxim Levitsky46519182010-10-16 19:56:28 -0300207
David Härdemand8b4b582010-10-29 16:08:23 -0300208 return dev->s_tx_mask(dev, val);
Jarod Wilsonca414692010-07-03 01:07:53 -0300209
210 case LIRC_SET_SEND_CARRIER:
David Härdemand8b4b582010-10-29 16:08:23 -0300211 if (!dev->s_tx_carrier)
Dan Carpenter5f499082012-09-11 07:11:53 -0300212 return -ENOSYS;
Maxim Levitsky46519182010-10-16 19:56:28 -0300213
David Härdemand8b4b582010-10-29 16:08:23 -0300214 return dev->s_tx_carrier(dev, val);
Jarod Wilsonca414692010-07-03 01:07:53 -0300215
Maxim Levitskye5893332010-07-31 11:59:23 -0300216 case LIRC_SET_SEND_DUTY_CYCLE:
David Härdemand8b4b582010-10-29 16:08:23 -0300217 if (!dev->s_tx_duty_cycle)
Maxim Levitskye5893332010-07-31 11:59:23 -0300218 return -ENOSYS;
219
220 if (val <= 0 || val >= 100)
221 return -EINVAL;
222
David Härdemand8b4b582010-10-29 16:08:23 -0300223 return dev->s_tx_duty_cycle(dev, val);
Jarod Wilsonca414692010-07-03 01:07:53 -0300224
Maxim Levitskye5893332010-07-31 11:59:23 -0300225 /* RX settings */
226 case LIRC_SET_REC_CARRIER:
David Härdemand8b4b582010-10-29 16:08:23 -0300227 if (!dev->s_rx_carrier_range)
Maxim Levitskye5893332010-07-31 11:59:23 -0300228 return -ENOSYS;
Jarod Wilsonca414692010-07-03 01:07:53 -0300229
Maxim Levitsky46519182010-10-16 19:56:28 -0300230 if (val <= 0)
231 return -EINVAL;
232
David Härdemand8b4b582010-10-29 16:08:23 -0300233 return dev->s_rx_carrier_range(dev,
234 dev->raw->lirc.carrier_low,
235 val);
Maxim Levitskye5893332010-07-31 11:59:23 -0300236
237 case LIRC_SET_REC_CARRIER_RANGE:
Maxim Levitsky46519182010-10-16 19:56:28 -0300238 if (val <= 0)
239 return -EINVAL;
Maxim Levitskye5893332010-07-31 11:59:23 -0300240
David Härdemand8b4b582010-10-29 16:08:23 -0300241 dev->raw->lirc.carrier_low = val;
Maxim Levitsky46519182010-10-16 19:56:28 -0300242 return 0;
Maxim Levitskye5893332010-07-31 11:59:23 -0300243
244 case LIRC_GET_REC_RESOLUTION:
David Härdemand8b4b582010-10-29 16:08:23 -0300245 val = dev->rx_resolution;
Maxim Levitskye5893332010-07-31 11:59:23 -0300246 break;
247
248 case LIRC_SET_WIDEBAND_RECEIVER:
David Härdemand8b4b582010-10-29 16:08:23 -0300249 if (!dev->s_learning_mode)
Maxim Levitskye5893332010-07-31 11:59:23 -0300250 return -ENOSYS;
251
David Härdemand8b4b582010-10-29 16:08:23 -0300252 return dev->s_learning_mode(dev, !!val);
Maxim Levitsky46519182010-10-16 19:56:28 -0300253
254 case LIRC_SET_MEASURE_CARRIER_MODE:
David Härdemand8b4b582010-10-29 16:08:23 -0300255 if (!dev->s_carrier_report)
Maxim Levitsky46519182010-10-16 19:56:28 -0300256 return -ENOSYS;
257
David Härdemand8b4b582010-10-29 16:08:23 -0300258 return dev->s_carrier_report(dev, !!val);
Maxim Levitsky46519182010-10-16 19:56:28 -0300259
Maxim Levitskye5893332010-07-31 11:59:23 -0300260 /* Generic timeout support */
261 case LIRC_GET_MIN_TIMEOUT:
David Härdemand8b4b582010-10-29 16:08:23 -0300262 if (!dev->max_timeout)
Maxim Levitskye5893332010-07-31 11:59:23 -0300263 return -ENOSYS;
David Härdemand8b4b582010-10-29 16:08:23 -0300264 val = dev->min_timeout / 1000;
Maxim Levitskye5893332010-07-31 11:59:23 -0300265 break;
266
267 case LIRC_GET_MAX_TIMEOUT:
David Härdemand8b4b582010-10-29 16:08:23 -0300268 if (!dev->max_timeout)
Maxim Levitskye5893332010-07-31 11:59:23 -0300269 return -ENOSYS;
David Härdemand8b4b582010-10-29 16:08:23 -0300270 val = dev->max_timeout / 1000;
Maxim Levitskye5893332010-07-31 11:59:23 -0300271 break;
272
273 case LIRC_SET_REC_TIMEOUT:
David Härdemand8b4b582010-10-29 16:08:23 -0300274 if (!dev->max_timeout)
Maxim Levitsky46519182010-10-16 19:56:28 -0300275 return -ENOSYS;
276
277 tmp = val * 1000;
278
David Härdemand8b4b582010-10-29 16:08:23 -0300279 if (tmp < dev->min_timeout ||
280 tmp > dev->max_timeout)
Maxim Levitsky46519182010-10-16 19:56:28 -0300281 return -EINVAL;
282
David Härdemand8b4b582010-10-29 16:08:23 -0300283 dev->timeout = tmp;
Maxim Levitsky46519182010-10-16 19:56:28 -0300284 break;
285
286 case LIRC_SET_REC_TIMEOUT_REPORTS:
287 lirc->send_timeout_reports = !!val;
Jarod Wilsonca414692010-07-03 01:07:53 -0300288 break;
289
290 default:
Arnd Bergmann044e5872010-08-02 15:43:35 -0300291 return lirc_dev_fop_ioctl(filep, cmd, arg);
Jarod Wilsonca414692010-07-03 01:07:53 -0300292 }
293
Maxim Levitskye5893332010-07-31 11:59:23 -0300294 if (_IOC_DIR(cmd) & _IOC_READ)
Dan Carpenter06bd8012011-10-06 02:41:06 -0300295 ret = put_user(val, argp);
Maxim Levitskye5893332010-07-31 11:59:23 -0300296
Jarod Wilsonca414692010-07-03 01:07:53 -0300297 return ret;
298}
299
300static int ir_lirc_open(void *data)
301{
302 return 0;
303}
304
305static void ir_lirc_close(void *data)
306{
307 return;
308}
309
310static struct file_operations lirc_fops = {
311 .owner = THIS_MODULE,
312 .write = ir_lirc_transmit_ir,
Arnd Bergmann044e5872010-08-02 15:43:35 -0300313 .unlocked_ioctl = ir_lirc_ioctl,
Jarod Wilson8be292c2010-10-09 15:07:06 -0300314#ifdef CONFIG_COMPAT
315 .compat_ioctl = ir_lirc_ioctl,
316#endif
Jarod Wilsonca414692010-07-03 01:07:53 -0300317 .read = lirc_dev_fop_read,
318 .poll = lirc_dev_fop_poll,
319 .open = lirc_dev_fop_open,
320 .release = lirc_dev_fop_close,
Arnd Bergmannd9d2e9d2010-08-15 18:51:56 +0200321 .llseek = no_llseek,
Jarod Wilsonca414692010-07-03 01:07:53 -0300322};
323
David Härdemand8b4b582010-10-29 16:08:23 -0300324static int ir_lirc_register(struct rc_dev *dev)
Jarod Wilsonca414692010-07-03 01:07:53 -0300325{
Jarod Wilsonca414692010-07-03 01:07:53 -0300326 struct lirc_driver *drv;
327 struct lirc_buffer *rbuf;
328 int rc = -ENOMEM;
329 unsigned long features;
330
331 drv = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
332 if (!drv)
333 return rc;
334
335 rbuf = kzalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
Dan Carpenter49b7a122010-07-23 07:08:26 -0300336 if (!rbuf)
Jarod Wilsonca414692010-07-03 01:07:53 -0300337 goto rbuf_alloc_failed;
338
339 rc = lirc_buffer_init(rbuf, sizeof(int), LIRCBUF_SIZE);
340 if (rc)
341 goto rbuf_init_failed;
342
343 features = LIRC_CAN_REC_MODE2;
David Härdemand8b4b582010-10-29 16:08:23 -0300344 if (dev->tx_ir) {
Jarod Wilsonca414692010-07-03 01:07:53 -0300345 features |= LIRC_CAN_SEND_PULSE;
David Härdemand8b4b582010-10-29 16:08:23 -0300346 if (dev->s_tx_mask)
Jarod Wilsonca414692010-07-03 01:07:53 -0300347 features |= LIRC_CAN_SET_TRANSMITTER_MASK;
David Härdemand8b4b582010-10-29 16:08:23 -0300348 if (dev->s_tx_carrier)
Jarod Wilsonca414692010-07-03 01:07:53 -0300349 features |= LIRC_CAN_SET_SEND_CARRIER;
David Härdemand8b4b582010-10-29 16:08:23 -0300350 if (dev->s_tx_duty_cycle)
Maxim Levitsky67332ba2010-09-06 18:26:08 -0300351 features |= LIRC_CAN_SET_SEND_DUTY_CYCLE;
Jarod Wilsonca414692010-07-03 01:07:53 -0300352 }
353
David Härdemand8b4b582010-10-29 16:08:23 -0300354 if (dev->s_rx_carrier_range)
Maxim Levitskye5893332010-07-31 11:59:23 -0300355 features |= LIRC_CAN_SET_REC_CARRIER |
356 LIRC_CAN_SET_REC_CARRIER_RANGE;
357
David Härdemand8b4b582010-10-29 16:08:23 -0300358 if (dev->s_learning_mode)
Maxim Levitskye5893332010-07-31 11:59:23 -0300359 features |= LIRC_CAN_USE_WIDEBAND_RECEIVER;
360
David Härdemand8b4b582010-10-29 16:08:23 -0300361 if (dev->s_carrier_report)
Maxim Levitsky46519182010-10-16 19:56:28 -0300362 features |= LIRC_CAN_MEASURE_CARRIER;
363
David Härdemand8b4b582010-10-29 16:08:23 -0300364 if (dev->max_timeout)
Maxim Levitskye5893332010-07-31 11:59:23 -0300365 features |= LIRC_CAN_SET_REC_TIMEOUT;
366
Jarod Wilsonca414692010-07-03 01:07:53 -0300367 snprintf(drv->name, sizeof(drv->name), "ir-lirc-codec (%s)",
David Härdemand8b4b582010-10-29 16:08:23 -0300368 dev->driver_name);
Jarod Wilsonca414692010-07-03 01:07:53 -0300369 drv->minor = -1;
370 drv->features = features;
David Härdemand8b4b582010-10-29 16:08:23 -0300371 drv->data = &dev->raw->lirc;
Jarod Wilsonca414692010-07-03 01:07:53 -0300372 drv->rbuf = rbuf;
373 drv->set_use_inc = &ir_lirc_open;
374 drv->set_use_dec = &ir_lirc_close;
375 drv->code_length = sizeof(struct ir_raw_event) * 8;
376 drv->fops = &lirc_fops;
David Härdemand8b4b582010-10-29 16:08:23 -0300377 drv->dev = &dev->dev;
Jarod Wilsonca414692010-07-03 01:07:53 -0300378 drv->owner = THIS_MODULE;
379
380 drv->minor = lirc_register_driver(drv);
381 if (drv->minor < 0) {
382 rc = -ENODEV;
383 goto lirc_register_failed;
384 }
385
David Härdemand8b4b582010-10-29 16:08:23 -0300386 dev->raw->lirc.drv = drv;
387 dev->raw->lirc.dev = dev;
Jarod Wilsonca414692010-07-03 01:07:53 -0300388 return 0;
389
390lirc_register_failed:
391rbuf_init_failed:
392 kfree(rbuf);
393rbuf_alloc_failed:
394 kfree(drv);
395
396 return rc;
397}
398
David Härdemand8b4b582010-10-29 16:08:23 -0300399static int ir_lirc_unregister(struct rc_dev *dev)
Jarod Wilsonca414692010-07-03 01:07:53 -0300400{
David Härdemand8b4b582010-10-29 16:08:23 -0300401 struct lirc_codec *lirc = &dev->raw->lirc;
Jarod Wilsonca414692010-07-03 01:07:53 -0300402
403 lirc_unregister_driver(lirc->drv->minor);
404 lirc_buffer_free(lirc->drv->rbuf);
405 kfree(lirc->drv);
406
407 return 0;
408}
409
410static struct ir_raw_handler lirc_handler = {
David Härdemanc003ab12012-10-11 19:11:54 -0300411 .protocols = RC_BIT_LIRC,
Jarod Wilsonca414692010-07-03 01:07:53 -0300412 .decode = ir_lirc_decode,
413 .raw_register = ir_lirc_register,
414 .raw_unregister = ir_lirc_unregister,
415};
416
417static int __init ir_lirc_codec_init(void)
418{
419 ir_raw_handler_register(&lirc_handler);
420
421 printk(KERN_INFO "IR LIRC bridge handler initialized\n");
422 return 0;
423}
424
425static void __exit ir_lirc_codec_exit(void)
426{
427 ir_raw_handler_unregister(&lirc_handler);
428}
429
430module_init(ir_lirc_codec_init);
431module_exit(ir_lirc_codec_exit);
432
433MODULE_LICENSE("GPL");
434MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>");
435MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)");
436MODULE_DESCRIPTION("LIRC IR handler bridge");