]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
1da177e4 LT |
2 | * |
3 | * handle saa7134 IR remotes via linux kernel input layer. | |
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; either version 2 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program; if not, write to the Free Software | |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | * | |
19 | */ | |
20 | ||
21 | #include <linux/module.h> | |
22 | #include <linux/moduleparam.h> | |
23 | #include <linux/init.h> | |
24 | #include <linux/delay.h> | |
1da177e4 LT |
25 | #include <linux/interrupt.h> |
26 | #include <linux/input.h> | |
27 | ||
28 | #include "saa7134-reg.h" | |
29 | #include "saa7134.h" | |
30 | ||
31 | static unsigned int disable_ir = 0; | |
32 | module_param(disable_ir, int, 0444); | |
33 | MODULE_PARM_DESC(disable_ir,"disable infrared remote support"); | |
34 | ||
35 | static unsigned int ir_debug = 0; | |
36 | module_param(ir_debug, int, 0644); | |
37 | MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); | |
38 | ||
b93eedb6 SP |
39 | static int pinnacle_remote = 0; |
40 | module_param(pinnacle_remote, int, 0644); /* Choose Pinnacle PCTV remote */ | |
41 | MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=grey (defaults to 0)"); | |
42 | ||
c408a6f6 | 43 | static int ir_rc5_remote_gap = 885; |
9160723e | 44 | module_param(ir_rc5_remote_gap, int, 0644); |
c408a6f6 | 45 | static int ir_rc5_key_timeout = 115; |
9160723e HP |
46 | module_param(ir_rc5_key_timeout, int, 0644); |
47 | ||
1da177e4 LT |
48 | #define dprintk(fmt, arg...) if (ir_debug) \ |
49 | printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) | |
ac9cd976 RC |
50 | #define i2cdprintk(fmt, arg...) if (ir_debug) \ |
51 | printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg) | |
1da177e4 | 52 | |
9160723e HP |
53 | /** rc5 functions */ |
54 | static int saa7134_rc5_irq(struct saa7134_dev *dev); | |
55 | ||
ac9cd976 | 56 | /* -------------------- GPIO generic keycode builder -------------------- */ |
1da177e4 LT |
57 | |
58 | static int build_key(struct saa7134_dev *dev) | |
59 | { | |
9160723e | 60 | struct card_ir *ir = dev->remote; |
1da177e4 LT |
61 | u32 gpio, data; |
62 | ||
63 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ | |
64 | saa_clearb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN); | |
65 | saa_setb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN); | |
66 | ||
67 | gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); | |
4ac97914 MCC |
68 | if (ir->polling) { |
69 | if (ir->last_gpio == gpio) | |
70 | return 0; | |
71 | ir->last_gpio = gpio; | |
72 | } | |
1da177e4 | 73 | |
4ac97914 | 74 | data = ir_extract_bits(gpio, ir->mask_keycode); |
1da177e4 LT |
75 | dprintk("build_key gpio=0x%x mask=0x%x data=%d\n", |
76 | gpio, ir->mask_keycode, data); | |
77 | ||
0602fbb2 PM |
78 | if (ir->polling) { |
79 | if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || | |
80 | (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { | |
81 | ir_input_keydown(ir->dev, &ir->ir, data, data); | |
82 | } else { | |
83 | ir_input_nokey(ir->dev, &ir->ir); | |
84 | } | |
1da177e4 | 85 | } |
0602fbb2 PM |
86 | else { /* IRQ driven mode - handle key press and release in one go */ |
87 | if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) || | |
88 | (ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) { | |
89 | ir_input_keydown(ir->dev, &ir->ir, data, data); | |
90 | ir_input_nokey(ir->dev, &ir->ir); | |
91 | } | |
92 | } | |
93 | ||
1da177e4 LT |
94 | return 0; |
95 | } | |
96 | ||
ac9cd976 RC |
97 | /* --------------------- Chip specific I2C key builders ----------------- */ |
98 | ||
99 | static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | |
100 | { | |
101 | unsigned char b; | |
102 | ||
103 | /* poll IR chip */ | |
104 | if (1 != i2c_master_recv(&ir->c,&b,1)) { | |
105 | i2cdprintk("read error\n"); | |
106 | return -EIO; | |
107 | } | |
108 | ||
109 | /* no button press */ | |
110 | if (b==0) | |
111 | return 0; | |
112 | ||
113 | /* repeating */ | |
114 | if (b & 0x80) | |
115 | return 1; | |
116 | ||
117 | *ir_key = b; | |
118 | *ir_raw = b; | |
119 | return 1; | |
120 | } | |
121 | ||
177aaaf8 TG |
122 | static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
123 | { | |
124 | unsigned char buf[5], cod4, code3, code4; | |
125 | ||
126 | /* poll IR chip */ | |
127 | if (5 != i2c_master_recv(&ir->c,buf,5)) | |
128 | return -EIO; | |
129 | ||
130 | cod4 = buf[4]; | |
131 | code4 = (cod4 >> 2); | |
132 | code3 = buf[3]; | |
133 | if (code3 == 0) | |
134 | /* no key pressed */ | |
135 | return 0; | |
136 | ||
137 | /* return key */ | |
138 | *ir_key = code4; | |
139 | *ir_raw = code4; | |
140 | return 1; | |
141 | } | |
142 | ||
1da177e4 LT |
143 | void saa7134_input_irq(struct saa7134_dev *dev) |
144 | { | |
9160723e | 145 | struct card_ir *ir = dev->remote; |
1da177e4 | 146 | |
9160723e | 147 | if (!ir->polling && !ir->rc5_gpio) { |
1da177e4 | 148 | build_key(dev); |
9160723e HP |
149 | } else if (ir->rc5_gpio) { |
150 | saa7134_rc5_irq(dev); | |
151 | } | |
1da177e4 LT |
152 | } |
153 | ||
154 | static void saa7134_input_timer(unsigned long data) | |
155 | { | |
156 | struct saa7134_dev *dev = (struct saa7134_dev*)data; | |
9160723e | 157 | struct card_ir *ir = dev->remote; |
1da177e4 LT |
158 | unsigned long timeout; |
159 | ||
160 | build_key(dev); | |
161 | timeout = jiffies + (ir->polling * HZ / 1000); | |
162 | mod_timer(&ir->timer, timeout); | |
163 | } | |
164 | ||
9160723e | 165 | static void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) |
b07b4783 DT |
166 | { |
167 | if (ir->polling) { | |
168 | init_timer(&ir->timer); | |
169 | ir->timer.function = saa7134_input_timer; | |
170 | ir->timer.data = (unsigned long)dev; | |
171 | ir->timer.expires = jiffies + HZ; | |
172 | add_timer(&ir->timer); | |
9160723e HP |
173 | } else if (ir->rc5_gpio) { |
174 | /* set timer_end for code completion */ | |
175 | init_timer(&ir->timer_end); | |
176 | ir->timer_end.function = ir_rc5_timer_end; | |
177 | ir->timer_end.data = (unsigned long)ir; | |
178 | init_timer(&ir->timer_keyup); | |
179 | ir->timer_keyup.function = ir_rc5_timer_keyup; | |
180 | ir->timer_keyup.data = (unsigned long)ir; | |
181 | ir->shift_by = 2; | |
182 | ir->start = 0x2; | |
183 | ir->addr = 0x17; | |
184 | ir->rc5_key_timeout = ir_rc5_key_timeout; | |
185 | ir->rc5_remote_gap = ir_rc5_remote_gap; | |
b07b4783 DT |
186 | } |
187 | } | |
188 | ||
189 | static void saa7134_ir_stop(struct saa7134_dev *dev) | |
190 | { | |
191 | if (dev->remote->polling) | |
192 | del_timer_sync(&dev->remote->timer); | |
193 | } | |
194 | ||
1da177e4 LT |
195 | int saa7134_input_init1(struct saa7134_dev *dev) |
196 | { | |
9160723e | 197 | struct card_ir *ir; |
b7df3910 | 198 | struct input_dev *input_dev; |
1da177e4 LT |
199 | IR_KEYTAB_TYPE *ir_codes = NULL; |
200 | u32 mask_keycode = 0; | |
201 | u32 mask_keydown = 0; | |
202 | u32 mask_keyup = 0; | |
203 | int polling = 0; | |
9160723e | 204 | int rc5_gpio = 0; |
1da177e4 | 205 | int ir_type = IR_TYPE_OTHER; |
b07b4783 | 206 | int err; |
1da177e4 | 207 | |
cb2444df | 208 | if (dev->has_remote != SAA7134_REMOTE_GPIO) |
1da177e4 LT |
209 | return -ENODEV; |
210 | if (disable_ir) | |
211 | return -ENODEV; | |
212 | ||
213 | /* detect & configure */ | |
214 | switch (dev->board) { | |
215 | case SAA7134_BOARD_FLYVIDEO2000: | |
216 | case SAA7134_BOARD_FLYVIDEO3000: | |
4ac97914 | 217 | case SAA7134_BOARD_FLYTVPLATINUM_FM: |
6af90ab5 | 218 | case SAA7134_BOARD_FLYTVPLATINUM_MINI2: |
4c0f631e | 219 | ir_codes = ir_codes_flyvideo; |
1da177e4 LT |
220 | mask_keycode = 0xEC00000; |
221 | mask_keydown = 0x0040000; | |
222 | break; | |
223 | case SAA7134_BOARD_CINERGY400: | |
224 | case SAA7134_BOARD_CINERGY600: | |
225 | case SAA7134_BOARD_CINERGY600_MK3: | |
4c0f631e | 226 | ir_codes = ir_codes_cinergy; |
1da177e4 LT |
227 | mask_keycode = 0x00003f; |
228 | mask_keyup = 0x040000; | |
229 | break; | |
230 | case SAA7134_BOARD_ECS_TVP3XP: | |
231 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: | |
4c0f631e | 232 | ir_codes = ir_codes_eztv; |
330a115a MCC |
233 | mask_keycode = 0x00017c; |
234 | mask_keyup = 0x000002; | |
1da177e4 | 235 | polling = 50; // ms |
330a115a MCC |
236 | break; |
237 | case SAA7134_BOARD_KWORLD_XPERT: | |
1da177e4 | 238 | case SAA7134_BOARD_AVACSSMARTTV: |
b639f9d2 | 239 | ir_codes = ir_codes_pixelview; |
1da177e4 LT |
240 | mask_keycode = 0x00001F; |
241 | mask_keyup = 0x000020; | |
242 | polling = 50; // ms | |
243 | break; | |
244 | case SAA7134_BOARD_MD2819: | |
ac19ecc6 | 245 | case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: |
1da177e4 LT |
246 | case SAA7134_BOARD_AVERMEDIA_305: |
247 | case SAA7134_BOARD_AVERMEDIA_307: | |
ac19ecc6 MCC |
248 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: |
249 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: | |
3ac706d2 | 250 | case SAA7134_BOARD_AVERMEDIA_STUDIO_507: |
ac19ecc6 | 251 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: |
b639f9d2 | 252 | ir_codes = ir_codes_avermedia; |
1da177e4 LT |
253 | mask_keycode = 0x0007C8; |
254 | mask_keydown = 0x000010; | |
255 | polling = 50; // ms | |
256 | /* Set GPIO pin2 to high to enable the IR controller */ | |
257 | saa_setb(SAA7134_GPIO_GPMODE0, 0x4); | |
258 | saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); | |
259 | break; | |
450efcfd | 260 | case SAA7134_BOARD_AVERMEDIA_777: |
29e0f1a1 | 261 | case SAA7134_BOARD_AVERMEDIA_A16AR: |
450efcfd | 262 | ir_codes = ir_codes_avermedia; |
263 | mask_keycode = 0x02F200; | |
264 | mask_keydown = 0x000400; | |
265 | polling = 50; // ms | |
266 | /* Without this we won't receive key up events */ | |
267 | saa_setb(SAA7134_GPIO_GPMODE1, 0x1); | |
268 | saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); | |
4dd7406e | 269 | break; |
4ac97914 | 270 | case SAA7134_BOARD_KWORLD_TERMINATOR: |
b639f9d2 | 271 | ir_codes = ir_codes_pixelview; |
dc2286cf JW |
272 | mask_keycode = 0x00001f; |
273 | mask_keyup = 0x000060; | |
274 | polling = 50; // ms | |
275 | break; | |
ac19ecc6 MCC |
276 | case SAA7134_BOARD_MANLI_MTV001: |
277 | case SAA7134_BOARD_MANLI_MTV002: | |
a8ff417e | 278 | case SAA7134_BOARD_BEHOLD_409FM: |
4c0f631e | 279 | ir_codes = ir_codes_manli; |
ac19ecc6 MCC |
280 | mask_keycode = 0x001f00; |
281 | mask_keyup = 0x004000; | |
ac19ecc6 MCC |
282 | polling = 50; // ms |
283 | break; | |
17ce1ff9 | 284 | case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: |
4c0f631e | 285 | ir_codes = ir_codes_pctv_sedna; |
c3d93192 PM |
286 | mask_keycode = 0x001f00; |
287 | mask_keyup = 0x004000; | |
288 | polling = 50; // ms | |
289 | break; | |
4ac97914 | 290 | case SAA7134_BOARD_GOTVIEW_7135: |
4c0f631e | 291 | ir_codes = ir_codes_gotview7135; |
6b961440 NS |
292 | mask_keycode = 0x0003EC; |
293 | mask_keyup = 0x008000; | |
294 | mask_keydown = 0x000010; | |
295 | polling = 50; // ms | |
296 | break; | |
1da177e4 | 297 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: |
2a9a9a84 | 298 | case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: |
330a115a | 299 | case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: |
4c0f631e | 300 | ir_codes = ir_codes_videomate_tv_pvr; |
1da177e4 LT |
301 | mask_keycode = 0x00003F; |
302 | mask_keyup = 0x400000; | |
303 | polling = 50; // ms | |
304 | break; | |
b04c1baf MM |
305 | case SAA7134_BOARD_PROTEUS_2309: |
306 | ir_codes = ir_codes_proteus_2309; | |
307 | mask_keycode = 0x00007F; | |
308 | mask_keyup = 0x000080; | |
309 | polling = 50; // ms | |
310 | break; | |
4ac97914 MCC |
311 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
312 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: | |
4c0f631e | 313 | ir_codes = ir_codes_videomate_tv_pvr; |
fea095fe NS |
314 | mask_keycode = 0x003F00; |
315 | mask_keyup = 0x040000; | |
316 | break; | |
3d8466ec | 317 | case SAA7134_BOARD_FLYDVBT_LR301: |
a8029170 | 318 | case SAA7134_BOARD_FLYDVBTDUO: |
3d8466ec GG |
319 | ir_codes = ir_codes_flydvb; |
320 | mask_keycode = 0x0001F00; | |
321 | mask_keydown = 0x0040000; | |
322 | break; | |
9160723e | 323 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: |
904ab884 | 324 | case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: |
9160723e HP |
325 | ir_codes = ir_codes_asus_pc39; |
326 | mask_keydown = 0x0040000; | |
327 | rc5_gpio = 1; | |
328 | break; | |
c36c459a JPS |
329 | case SAA7134_BOARD_ENCORE_ENLTV: |
330 | case SAA7134_BOARD_ENCORE_ENLTV_FM: | |
331 | ir_codes = ir_codes_encore_enltv; | |
332 | mask_keycode = 0x00007f; | |
333 | mask_keyup = 0x040000; | |
334 | polling = 50; // ms | |
335 | break; | |
1da177e4 LT |
336 | } |
337 | if (NULL == ir_codes) { | |
338 | printk("%s: Oops: IR config error [card=%d]\n", | |
339 | dev->name, dev->board); | |
340 | return -ENODEV; | |
341 | } | |
342 | ||
b7df3910 DT |
343 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
344 | input_dev = input_allocate_device(); | |
345 | if (!ir || !input_dev) { | |
b07b4783 DT |
346 | err = -ENOMEM; |
347 | goto err_out_free; | |
b7df3910 | 348 | } |
1da177e4 | 349 | |
d271d1c2 DT |
350 | ir->dev = input_dev; |
351 | ||
1da177e4 LT |
352 | /* init hardware-specific stuff */ |
353 | ir->mask_keycode = mask_keycode; | |
354 | ir->mask_keydown = mask_keydown; | |
355 | ir->mask_keyup = mask_keyup; | |
4ac97914 | 356 | ir->polling = polling; |
9160723e | 357 | ir->rc5_gpio = rc5_gpio; |
1da177e4 LT |
358 | |
359 | /* init input device */ | |
360 | snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)", | |
361 | saa7134_boards[dev->board].name); | |
362 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | |
363 | pci_name(dev->pci)); | |
364 | ||
b7df3910 DT |
365 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
366 | input_dev->name = ir->name; | |
367 | input_dev->phys = ir->phys; | |
368 | input_dev->id.bustype = BUS_PCI; | |
369 | input_dev->id.version = 1; | |
1da177e4 | 370 | if (dev->pci->subsystem_vendor) { |
b7df3910 DT |
371 | input_dev->id.vendor = dev->pci->subsystem_vendor; |
372 | input_dev->id.product = dev->pci->subsystem_device; | |
1da177e4 | 373 | } else { |
b7df3910 DT |
374 | input_dev->id.vendor = dev->pci->vendor; |
375 | input_dev->id.product = dev->pci->device; | |
1da177e4 | 376 | } |
b7df3910 | 377 | input_dev->cdev.dev = &dev->pci->dev; |
1da177e4 | 378 | |
1da177e4 | 379 | dev->remote = ir; |
b07b4783 DT |
380 | saa7134_ir_start(dev, ir); |
381 | ||
382 | err = input_register_device(ir->dev); | |
383 | if (err) | |
384 | goto err_out_stop; | |
1da177e4 | 385 | |
1da177e4 | 386 | return 0; |
b07b4783 DT |
387 | |
388 | err_out_stop: | |
389 | saa7134_ir_stop(dev); | |
390 | dev->remote = NULL; | |
391 | err_out_free: | |
392 | input_free_device(input_dev); | |
393 | kfree(ir); | |
394 | return err; | |
1da177e4 LT |
395 | } |
396 | ||
397 | void saa7134_input_fini(struct saa7134_dev *dev) | |
398 | { | |
399 | if (NULL == dev->remote) | |
400 | return; | |
401 | ||
b07b4783 | 402 | saa7134_ir_stop(dev); |
b7df3910 | 403 | input_unregister_device(dev->remote->dev); |
1da177e4 LT |
404 | kfree(dev->remote); |
405 | dev->remote = NULL; | |
406 | } | |
407 | ||
ac9cd976 RC |
408 | void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) |
409 | { | |
410 | if (disable_ir) { | |
cb2444df | 411 | dprintk("Found supported i2c remote, but IR has been disabled\n"); |
ac9cd976 RC |
412 | ir->get_key=NULL; |
413 | return; | |
414 | } | |
415 | ||
416 | switch (dev->board) { | |
417 | case SAA7134_BOARD_PINNACLE_PCTV_110i: | |
eb591af3 | 418 | case SAA7134_BOARD_PINNACLE_PCTV_310i: |
ac9cd976 | 419 | snprintf(ir->c.name, sizeof(ir->c.name), "Pinnacle PCTV"); |
b93eedb6 SP |
420 | if (pinnacle_remote == 0) { |
421 | ir->get_key = get_key_pinnacle_color; | |
422 | ir->ir_codes = ir_codes_pinnacle_color; | |
423 | } else { | |
424 | ir->get_key = get_key_pinnacle_grey; | |
425 | ir->ir_codes = ir_codes_pinnacle_grey; | |
426 | } | |
ac9cd976 RC |
427 | break; |
428 | case SAA7134_BOARD_UPMOST_PURPLE_TV: | |
429 | snprintf(ir->c.name, sizeof(ir->c.name), "Purple TV"); | |
430 | ir->get_key = get_key_purpletv; | |
431 | ir->ir_codes = ir_codes_purpletv; | |
432 | break; | |
177aaaf8 TG |
433 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
434 | snprintf(ir->c.name, sizeof(ir->c.name), "HVR 1110"); | |
435 | ir->get_key = get_key_hvr1110; | |
436 | ir->ir_codes = ir_codes_hauppauge_new; | |
437 | break; | |
ac9cd976 RC |
438 | default: |
439 | dprintk("Shouldn't get here: Unknown board %x for I2C IR?\n",dev->board); | |
440 | break; | |
441 | } | |
442 | ||
443 | } | |
9160723e HP |
444 | |
445 | static int saa7134_rc5_irq(struct saa7134_dev *dev) | |
446 | { | |
447 | struct card_ir *ir = dev->remote; | |
448 | struct timeval tv; | |
449 | u32 gap; | |
450 | unsigned long current_jiffies, timeout; | |
451 | ||
452 | /* get time of bit */ | |
453 | current_jiffies = jiffies; | |
454 | do_gettimeofday(&tv); | |
455 | ||
456 | /* avoid overflow with gap >1s */ | |
457 | if (tv.tv_sec - ir->base_time.tv_sec > 1) { | |
458 | gap = 200000; | |
459 | } else { | |
460 | gap = 1000000 * (tv.tv_sec - ir->base_time.tv_sec) + | |
461 | tv.tv_usec - ir->base_time.tv_usec; | |
462 | } | |
463 | ||
464 | /* active code => add bit */ | |
465 | if (ir->active) { | |
466 | /* only if in the code (otherwise spurious IRQ or timer | |
467 | late) */ | |
468 | if (ir->last_bit < 28) { | |
469 | ir->last_bit = (gap - ir_rc5_remote_gap / 2) / | |
470 | ir_rc5_remote_gap; | |
471 | ir->code |= 1 << ir->last_bit; | |
472 | } | |
473 | /* starting new code */ | |
474 | } else { | |
475 | ir->active = 1; | |
476 | ir->code = 0; | |
477 | ir->base_time = tv; | |
478 | ir->last_bit = 0; | |
479 | ||
480 | timeout = current_jiffies + (500 + 30 * HZ) / 1000; | |
481 | mod_timer(&ir->timer_end, timeout); | |
482 | } | |
483 | ||
484 | return 1; | |
485 | } | |
486 | ||
1da177e4 LT |
487 | /* ---------------------------------------------------------------------- |
488 | * Local variables: | |
489 | * c-basic-offset: 8 | |
490 | * End: | |
491 | */ |