aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/ir-rc6-decoder.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2010-10-29 15:08:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:16:37 -0500
commitd8b4b5822f51e2142b731b42c81e3f03eec475b2 (patch)
treefce9a9b7ca5031adc95fbd6be118352fb2527da5 /drivers/media/rc/ir-rc6-decoder.c
parent4c7b355df6e7f05304e05f6b7a286e59a5f1cc54 (diff)
[media] ir-core: make struct rc_dev the primary interface
This patch merges the ir_input_dev and ir_dev_props structs into a single struct called rc_dev. The drivers and various functions in rc-core used by the drivers are also changed to use rc_dev as the primary interface when dealing with rc-core. This means that the input_dev is abstracted away from the drivers which is necessary if we ever want to support multiple input devs per rc device. The new API is similar to what the input subsystem uses, i.e: rc_device_alloc() rc_device_free() rc_device_register() rc_device_unregister() [mchehab@redhat.com: Fix compilation on mceusb and cx231xx, due to merge conflicts] Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Jarod Wilson <jarod@redhat.com> Tested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/ir-rc6-decoder.c')
-rw-r--r--drivers/media/rc/ir-rc6-decoder.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c
index 48e82be5e01e..2435bbd1dbcc 100644
--- a/drivers/media/rc/ir-rc6-decoder.c
+++ b/drivers/media/rc/ir-rc6-decoder.c
@@ -70,19 +70,18 @@ static enum rc6_mode rc6_mode(struct rc6_dec *data)
70 70
71/** 71/**
72 * ir_rc6_decode() - Decode one RC6 pulse or space 72 * ir_rc6_decode() - Decode one RC6 pulse or space
73 * @input_dev: the struct input_dev descriptor of the device 73 * @dev: the struct rc_dev descriptor of the device
74 * @ev: the struct ir_raw_event descriptor of the pulse/space 74 * @ev: the struct ir_raw_event descriptor of the pulse/space
75 * 75 *
76 * This function returns -EINVAL if the pulse violates the state machine 76 * This function returns -EINVAL if the pulse violates the state machine
77 */ 77 */
78static int ir_rc6_decode(struct input_dev *input_dev, struct ir_raw_event ev) 78static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev)
79{ 79{
80 struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); 80 struct rc6_dec *data = &dev->raw->rc6;
81 struct rc6_dec *data = &ir_dev->raw->rc6;
82 u32 scancode; 81 u32 scancode;
83 u8 toggle; 82 u8 toggle;
84 83
85 if (!(ir_dev->raw->enabled_protocols & IR_TYPE_RC6)) 84 if (!(dev->raw->enabled_protocols & IR_TYPE_RC6))
86 return 0; 85 return 0;
87 86
88 if (!is_timing_event(ev)) { 87 if (!is_timing_event(ev)) {
@@ -139,7 +138,7 @@ again:
139 return 0; 138 return 0;
140 139
141 case STATE_HEADER_BIT_END: 140 case STATE_HEADER_BIT_END:
142 if (!is_transition(&ev, &ir_dev->raw->prev_ev)) 141 if (!is_transition(&ev, &dev->raw->prev_ev))
143 break; 142 break;
144 143
145 if (data->count == RC6_HEADER_NBITS) 144 if (data->count == RC6_HEADER_NBITS)
@@ -159,7 +158,7 @@ again:
159 return 0; 158 return 0;
160 159
161 case STATE_TOGGLE_END: 160 case STATE_TOGGLE_END:
162 if (!is_transition(&ev, &ir_dev->raw->prev_ev) || 161 if (!is_transition(&ev, &dev->raw->prev_ev) ||
163 !geq_margin(ev.duration, RC6_TOGGLE_END, RC6_UNIT / 2)) 162 !geq_margin(ev.duration, RC6_TOGGLE_END, RC6_UNIT / 2))
164 break; 163 break;
165 164
@@ -204,7 +203,7 @@ again:
204 return 0; 203 return 0;
205 204
206 case STATE_BODY_BIT_END: 205 case STATE_BODY_BIT_END:
207 if (!is_transition(&ev, &ir_dev->raw->prev_ev)) 206 if (!is_transition(&ev, &dev->raw->prev_ev))
208 break; 207 break;
209 208
210 if (data->count == data->wanted_bits) 209 if (data->count == data->wanted_bits)
@@ -243,7 +242,7 @@ again:
243 goto out; 242 goto out;
244 } 243 }
245 244
246 ir_keydown(input_dev, scancode, toggle); 245 ir_keydown(dev, scancode, toggle);
247 data->state = STATE_INACTIVE; 246 data->state = STATE_INACTIVE;
248 return 0; 247 return 0;
249 } 248 }