Commit 3bbd3f2d authored by David Härdeman's avatar David Härdeman Committed by Mauro Carvalho Chehab

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: default avatarDavid Härdeman <david@hardeman.nu>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 603044d8
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/module.h> #include <linux/module.h>
#include "cx88.h" #include "cx88.h"
#include <media/ir-core.h>
#include <media/ir-common.h> #include <media/ir-common.h>
#define MODULE_NAME "cx88xx" #define MODULE_NAME "cx88xx"
...@@ -39,8 +40,8 @@ ...@@ -39,8 +40,8 @@
struct cx88_IR { struct cx88_IR {
struct cx88_core *core; struct cx88_core *core;
struct input_dev *input; struct input_dev *input;
struct ir_input_state ir;
struct ir_dev_props props; struct ir_dev_props props;
u64 ir_type;
int users; int users;
...@@ -51,7 +52,6 @@ struct cx88_IR { ...@@ -51,7 +52,6 @@ struct cx88_IR {
u32 sampling; u32 sampling;
u32 samples[16]; u32 samples[16];
int scount; int scount;
unsigned long release;
/* poll external decoder */ /* poll external decoder */
int polling; int polling;
...@@ -125,29 +125,21 @@ static void cx88_ir_handle_key(struct cx88_IR *ir) ...@@ -125,29 +125,21 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
data = (data << 4) | ((gpio_key & 0xf0) >> 4); data = (data << 4) | ((gpio_key & 0xf0) >> 4);
ir_input_keydown(ir->input, &ir->ir, data); ir_keydown(ir->input, data, 0);
ir_input_nokey(ir->input, &ir->ir);
} else if (ir->mask_keydown) { } else if (ir->mask_keydown) {
/* bit set on keydown */ /* bit set on keydown */
if (gpio & ir->mask_keydown) { if (gpio & ir->mask_keydown)
ir_input_keydown(ir->input, &ir->ir, data); ir_keydown(ir->input, data, 0);
} else {
ir_input_nokey(ir->input, &ir->ir);
}
} else if (ir->mask_keyup) { } else if (ir->mask_keyup) {
/* bit cleared on keydown */ /* bit cleared on keydown */
if (0 == (gpio & ir->mask_keyup)) { if (0 == (gpio & ir->mask_keyup))
ir_input_keydown(ir->input, &ir->ir, data); ir_keydown(ir->input, data, 0);
} else {
ir_input_nokey(ir->input, &ir->ir);
}
} else { } else {
/* can't distinguish keydown/up :-/ */ /* can't distinguish keydown/up :-/ */
ir_input_keydown(ir->input, &ir->ir, data); ir_keydown(ir->input, data, 0);
ir_input_nokey(ir->input, &ir->ir);
} }
} }
...@@ -439,9 +431,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ...@@ -439,9 +431,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name);
snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
err = ir_input_init(input_dev, &ir->ir, ir_type); ir->ir_type = ir_type;
if (err < 0)
goto err_out_free;
input_dev->name = ir->name; input_dev->name = ir->name;
input_dev->phys = ir->phys; input_dev->phys = ir->phys;
...@@ -516,8 +506,6 @@ void cx88_ir_irq(struct cx88_core *core) ...@@ -516,8 +506,6 @@ void cx88_ir_irq(struct cx88_core *core)
} }
if (!ir->scount) { if (!ir->scount) {
/* nothing to sample */ /* nothing to sample */
if (ir->ir.keypressed && time_after(jiffies, ir->release))
ir_input_nokey(ir->input, &ir->ir);
return; return;
} }
...@@ -553,7 +541,7 @@ void cx88_ir_irq(struct cx88_core *core) ...@@ -553,7 +541,7 @@ void cx88_ir_irq(struct cx88_core *core)
if (ircode == 0) { /* key still pressed */ if (ircode == 0) { /* key still pressed */
ir_dprintk("pulse distance decoded repeat code\n"); ir_dprintk("pulse distance decoded repeat code\n");
ir->release = jiffies + msecs_to_jiffies(120); ir_repeat(ir->input);
break; break;
} }
...@@ -567,10 +555,8 @@ void cx88_ir_irq(struct cx88_core *core) ...@@ -567,10 +555,8 @@ void cx88_ir_irq(struct cx88_core *core)
break; break;
} }
ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0x7f); ir_dprintk("Key Code: %x\n", (ircode >> 16) & 0xff);
ir_keydown(ir->input, (ircode >> 16) & 0xff, 0);
ir_input_keydown(ir->input, &ir->ir, (ircode >> 16) & 0x7f);
ir->release = jiffies + msecs_to_jiffies(120);
break; break;
case CX88_BOARD_HAUPPAUGE: case CX88_BOARD_HAUPPAUGE:
case CX88_BOARD_HAUPPAUGE_DVB_T1: case CX88_BOARD_HAUPPAUGE_DVB_T1:
...@@ -606,16 +592,16 @@ void cx88_ir_irq(struct cx88_core *core) ...@@ -606,16 +592,16 @@ void cx88_ir_irq(struct cx88_core *core)
if ( dev != 0x1e && dev != 0x1f ) if ( dev != 0x1e && dev != 0x1f )
/* not a hauppauge remote */ /* not a hauppauge remote */
break; break;
ir_input_keydown(ir->input, &ir->ir, code); ir_keydown(ir->input, code, toggle);
ir->release = jiffies + msecs_to_jiffies(120);
break; break;
case CX88_BOARD_PINNACLE_PCTV_HD_800i: case CX88_BOARD_PINNACLE_PCTV_HD_800i:
ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
ir_dprintk("biphase decoded: %x\n", ircode); ir_dprintk("biphase decoded: %x\n", ircode);
if ((ircode & 0xfffff000) != 0x3000) if ((ircode & 0xfffff000) != 0x3000)
break; break;
ir_input_keydown(ir->input, &ir->ir, ircode & 0x3f); /* Note: bit 0x800 being the toggle is assumed, not checked
ir->release = jiffies + msecs_to_jiffies(120); with real hardware */
ir_keydown(ir->input, ircode & 0x3f, ircode & 0x0800 ? 1 : 0);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment