diff options
author | David Härdeman <david@hardeman.nu> | 2010-04-24 17:14:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:58:26 -0400 |
commit | 96c1f99621a73c58f97d7ca615b2fe936abda555 (patch) | |
tree | 7e00f5bcc78cb9e7858a7bddac84efc0ede6e722 /drivers/media/video/cx231xx | |
parent | 5a143b12ebbd37154cb06699a757e9c5845c5e19 (diff) |
V4L/DVB: ir-core: remove ir-functions usage from cx231xx
Convert drivers/media/video/cx231xx/cx231xx-input.c to not
rely on ir-functions.c.
(I do not have the hardware so I can only compile test this)
Signed-off-by: David Härdeman <david@hardeman.nu>
Cc: Srinivasa Deevi <srinivasa.deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-input.c | 47 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx.h | 2 |
2 files changed, 10 insertions, 39 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c index 04ae0839deaa..fd099153b746 100644 --- a/drivers/media/video/cx231xx/cx231xx-input.c +++ b/drivers/media/video/cx231xx/cx231xx-input.c | |||
@@ -61,7 +61,6 @@ struct cx231xx_ir_poll_result { | |||
61 | struct cx231xx_IR { | 61 | struct cx231xx_IR { |
62 | struct cx231xx *dev; | 62 | struct cx231xx *dev; |
63 | struct input_dev *input; | 63 | struct input_dev *input; |
64 | struct ir_input_state ir; | ||
65 | char name[32]; | 64 | char name[32]; |
66 | char phys[32]; | 65 | char phys[32]; |
67 | 66 | ||
@@ -69,9 +68,7 @@ struct cx231xx_IR { | |||
69 | int polling; | 68 | int polling; |
70 | struct work_struct work; | 69 | struct work_struct work; |
71 | struct timer_list timer; | 70 | struct timer_list timer; |
72 | unsigned int last_toggle:1; | ||
73 | unsigned int last_readcount; | 71 | unsigned int last_readcount; |
74 | unsigned int repeat_interval; | ||
75 | 72 | ||
76 | int (*get_key) (struct cx231xx_IR *, struct cx231xx_ir_poll_result *); | 73 | int (*get_key) (struct cx231xx_IR *, struct cx231xx_ir_poll_result *); |
77 | }; | 74 | }; |
@@ -83,7 +80,6 @@ struct cx231xx_IR { | |||
83 | static void cx231xx_ir_handle_key(struct cx231xx_IR *ir) | 80 | static void cx231xx_ir_handle_key(struct cx231xx_IR *ir) |
84 | { | 81 | { |
85 | int result; | 82 | int result; |
86 | int do_sendkey = 0; | ||
87 | struct cx231xx_ir_poll_result poll_result; | 83 | struct cx231xx_ir_poll_result poll_result; |
88 | 84 | ||
89 | /* read the registers containing the IR status */ | 85 | /* read the registers containing the IR status */ |
@@ -97,44 +93,23 @@ static void cx231xx_ir_handle_key(struct cx231xx_IR *ir) | |||
97 | poll_result.toggle_bit, poll_result.read_count, | 93 | poll_result.toggle_bit, poll_result.read_count, |
98 | ir->last_readcount, poll_result.rc_data[0]); | 94 | ir->last_readcount, poll_result.rc_data[0]); |
99 | 95 | ||
100 | if (ir->dev->chip_id == CHIP_ID_EM2874) { | 96 | if (poll_result.read_count > 0 && |
97 | poll_result.read_count != ir->last_readcount) | ||
98 | ir_keydown(ir->input, | ||
99 | poll_result.rc_data[0], | ||
100 | poll_result.toggle_bit); | ||
101 | |||
102 | if (ir->dev->chip_id == CHIP_ID_EM2874) | ||
101 | /* The em2874 clears the readcount field every time the | 103 | /* The em2874 clears the readcount field every time the |
102 | register is read. The em2860/2880 datasheet says that it | 104 | register is read. The em2860/2880 datasheet says that it |
103 | is supposed to clear the readcount, but it doesn't. So with | 105 | is supposed to clear the readcount, but it doesn't. So with |
104 | the em2874, we are looking for a non-zero read count as | 106 | the em2874, we are looking for a non-zero read count as |
105 | opposed to a readcount that is incrementing */ | 107 | opposed to a readcount that is incrementing */ |
106 | ir->last_readcount = 0; | 108 | ir->last_readcount = 0; |
107 | } | 109 | else |
108 | 110 | ir->last_readcount = poll_result.read_count; | |
109 | if (poll_result.read_count == 0) { | ||
110 | /* The button has not been pressed since the last read */ | ||
111 | } else if (ir->last_toggle != poll_result.toggle_bit) { | ||
112 | /* A button has been pressed */ | ||
113 | dprintk("button has been pressed\n"); | ||
114 | ir->last_toggle = poll_result.toggle_bit; | ||
115 | ir->repeat_interval = 0; | ||
116 | do_sendkey = 1; | ||
117 | } else if (poll_result.toggle_bit == ir->last_toggle && | ||
118 | poll_result.read_count > 0 && | ||
119 | poll_result.read_count != ir->last_readcount) { | ||
120 | /* The button is still being held down */ | ||
121 | dprintk("button being held down\n"); | ||
122 | |||
123 | /* Debouncer for first keypress */ | ||
124 | if (ir->repeat_interval++ > 9) { | ||
125 | /* Start repeating after 1 second */ | ||
126 | do_sendkey = 1; | ||
127 | } | ||
128 | } | ||
129 | 111 | ||
130 | if (do_sendkey) { | ||
131 | dprintk("sending keypress\n"); | ||
132 | ir_input_keydown(ir->input, &ir->ir, poll_result.rc_data[0]); | ||
133 | ir_input_nokey(ir->input, &ir->ir); | ||
134 | } | 112 | } |
135 | |||
136 | ir->last_readcount = poll_result.read_count; | ||
137 | return; | ||
138 | } | 113 | } |
139 | 114 | ||
140 | static void ir_timer(unsigned long data) | 115 | static void ir_timer(unsigned long data) |
@@ -200,10 +175,6 @@ int cx231xx_ir_init(struct cx231xx *dev) | |||
200 | usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); | 175 | usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); |
201 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); | 176 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); |
202 | 177 | ||
203 | err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER); | ||
204 | if (err < 0) | ||
205 | goto err_out_free; | ||
206 | |||
207 | input_dev->name = ir->name; | 178 | input_dev->name = ir->name; |
208 | input_dev->phys = ir->phys; | 179 | input_dev->phys = ir->phys; |
209 | input_dev->id.bustype = BUS_USB; | 180 | input_dev->id.bustype = BUS_USB; |
diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index 17d4d1a800ce..38d417191a65 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #include <media/videobuf-vmalloc.h> | 33 | #include <media/videobuf-vmalloc.h> |
34 | #include <media/v4l2-device.h> | 34 | #include <media/v4l2-device.h> |
35 | #include <media/ir-kbd-i2c.h> | 35 | #include <media/ir-core.h> |
36 | #if defined(CONFIG_VIDEO_CX231XX_DVB) || \ | 36 | #if defined(CONFIG_VIDEO_CX231XX_DVB) || \ |
37 | defined(CONFIG_VIDEO_CX231XX_DVB_MODULE) | 37 | defined(CONFIG_VIDEO_CX231XX_DVB_MODULE) |
38 | #include <media/videobuf-dvb.h> | 38 | #include <media/videobuf-dvb.h> |