diff options
author | David Härdeman <david@hardeman.nu> | 2010-06-07 15:32:28 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 13:53:45 -0400 |
commit | 3bbd3f2d09de39fe6c43b118a32ba5155bb3d25e (patch) | |
tree | 0144f81ff3e0dfe8dbb686b7ec3d357d940dcb06 /drivers/media/video/cx88 | |
parent | 603044d883d610acdb44daecf94b0fca48880b5c (diff) |
V4L/DVB: ir-core: partially convert cx88 to not use ir-functions.c
Partially convert drivers/media/video/cx88/cx88-input.c to not use
ir-functions.c
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r-- | drivers/media/video/cx88/cx88-input.c | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index e185289e446c..eccc5e49a350 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | 31 | ||
32 | #include "cx88.h" | 32 | #include "cx88.h" |
33 | #include <media/ir-core.h> | ||
33 | #include <media/ir-common.h> | 34 | #include <media/ir-common.h> |
34 | 35 | ||
35 | #define MODULE_NAME "cx88xx" | 36 | #define MODULE_NAME "cx88xx" |
@@ -39,8 +40,8 @@ | |||
39 | struct cx88_IR { | 40 | struct cx88_IR { |
40 | struct cx88_core *core; | 41 | struct cx88_core *core; |
41 | struct input_dev *input; | 42 | struct input_dev *input; |
42 | struct ir_input_state ir; | ||
43 | struct ir_dev_props props; | 43 | struct ir_dev_props props; |
44 | u64 ir_type; | ||
44 | 45 | ||
45 | int users; | 46 | int users; |
46 | 47 | ||
@@ -51,7 +52,6 @@ struct cx88_IR { | |||
51 | u32 sampling; | 52 | u32 sampling; |
52 | u32 samples[16]; | 53 | u32 samples[16]; |
53 | int scount; | 54 | int scount; |
54 | unsigned long release; | ||
55 | 55 | ||
56 | /* poll external decoder */ | 56 | /* poll external decoder */ |
57 | int polling; | 57 | int polling; |
@@ -125,29 +125,21 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) | |||
125 | 125 | ||
126 | data = (data << 4) | ((gpio_key & 0xf0) >> 4); | 126 | data = (data << 4) | ((gpio_key & 0xf0) >> 4); |
127 | 127 | ||
128 | ir_input_keydown(ir->input, &ir->ir, data); | 128 | ir_keydown(ir->input, data, 0); |
129 | ir_input_nokey(ir->input, &ir->ir); | ||
130 | 129 | ||
131 | } else if (ir->mask_keydown) { | 130 | } else if (ir->mask_keydown) { |
132 | /* bit set on keydown */ | 131 | /* bit set on keydown */ |
133 | if (gpio & ir->mask_keydown) { | 132 | if (gpio & ir->mask_keydown) |
134 | ir_input_keydown(ir->input, &ir->ir, data); | 133 | ir_keydown(ir->input, data, 0); |
135 | } else { | ||
136 | ir_input_nokey(ir->input, &ir->ir); | ||
137 | } | ||
138 | 134 | ||
139 | } else if (ir->mask_keyup) { | 135 | } else if (ir->mask_keyup) { |
140 | /* bit cleared on keydown */ | 136 | /* bit cleared on keydown */ |
141 | if (0 == (gpio & ir->mask_keyup)) { | 137 | if (0 == (gpio & ir->mask_keyup)) |
142 | ir_input_keydown(ir->input, &ir->ir, data); | 138 | ir_keydown(ir->input, data, 0); |
143 | } else { | ||
144 | ir_input_nokey(ir->input, &ir->ir); | ||
145 | } | ||
146 | 139 | ||
147 | } else { | 140 | } else { |
148 | /* can't distinguish keydown/up :-/ */ | 141 | /* can't distinguish keydown/up :-/ */ |
149 | ir_input_keydown(ir->input, &ir->ir, data); | 142 | ir_keydown(ir->input, data, 0); |
150 | ir_input_nokey(ir->input, &ir->ir); | ||
151 | } | 143 | } |
152 | } | 144 | } |
153 | 145 | ||
@@ -439,9 +431,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
439 | snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); | 431 | snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); |
440 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); | 432 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); |
441 | 433 | ||
442 | err = ir_input_init(input_dev, &ir->ir, ir_type); | 434 | ir->ir_type = ir_type; |
443 | if (err < 0) | ||
444 | goto err_out_free; | ||
445 | 435 | ||
446 | input_dev->name = ir->name; | 436 | input_dev->name = ir->name; |
447 | input_dev->phys = ir->phys; | 437 | input_dev->phys = ir->phys; |
@@ -516,8 +506,6 @@ void cx88_ir_irq(struct cx88_core *core) | |||
516 | } | 506 | } |
517 | if (!ir->scount) { | 507 | if (!ir->scount) { |
518 | /* nothing to sample */ | 508 | /* nothing to sample */ |
519 | if (ir->ir.keypressed && time_after(jiffies, ir->release)) | ||
520 | ir_input_nokey(ir->input, &ir->ir); | ||
521 | return; | 509 | return; |
522 | } | 510 | } |
523 | 511 | ||
@@ -553,7 +541,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
553 | 541 | ||
554 | if (ircode == 0) { /* key still pressed */ | 542 | if (ircode == 0) { /* key still pressed */ |
555 | ir_dprintk("pulse distance decoded repeat code\n"); | 543 | ir_dprintk("pulse distance decoded repeat code\n"); |
556 | ir->release = jiffies + msecs_to_jiffies(120); | 544 | ir_repeat(ir->input); |
557 | break; | 545 | break; |
558 | } | 546 | } |
559 | 547 | ||
@@ -567,10 +555,8 @@ void cx88_ir_irq(struct cx88_core *core) | |||
567 | break; | 555 | break; |
568 | } | 556 | } |
569 | 557 | ||
570 | ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f); | 558 | ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0xff); |
571 | 559 | ir_keydown(ir->input, (ircode >> 16) & 0xff, 0); | |
572 | ir_input_keydown(ir->input, &ir->ir, (ircode >> 16) & 0x7f); | ||
573 | ir->release = jiffies + msecs_to_jiffies(120); | ||
574 | break; | 560 | break; |
575 | case CX88_BOARD_HAUPPAUGE: | 561 | case CX88_BOARD_HAUPPAUGE: |
576 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 562 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
@@ -606,16 +592,16 @@ void cx88_ir_irq(struct cx88_core *core) | |||
606 | if ( dev != 0x1e && dev != 0x1f ) | 592 | if ( dev != 0x1e && dev != 0x1f ) |
607 | /* not a hauppauge remote */ | 593 | /* not a hauppauge remote */ |
608 | break; | 594 | break; |
609 | ir_input_keydown(ir->input, &ir->ir, code); | 595 | ir_keydown(ir->input, code, toggle); |
610 | ir->release = jiffies + msecs_to_jiffies(120); | ||
611 | break; | 596 | break; |
612 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: | 597 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: |
613 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); | 598 | ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); |
614 | ir_dprintk("biphase decoded: %x\n", ircode); | 599 | ir_dprintk("biphase decoded: %x\n", ircode); |
615 | if ((ircode & 0xfffff000) != 0x3000) | 600 | if ((ircode & 0xfffff000) != 0x3000) |
616 | break; | 601 | break; |
617 | ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f); | 602 | /* Note: bit 0x800 being the toggle is assumed, not checked |
618 | ir->release = jiffies + msecs_to_jiffies(120); | 603 | with real hardware */ |
604 | ir_keydown(ir->input, ircode & 0x3f, ircode & 0x0800 ? 1 : 0); | ||
619 | break; | 605 | break; |
620 | } | 606 | } |
621 | 607 | ||