]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/media/rc/ir-rc5-decoder.c
Merge branch 'master' into tk71
[mv-sheeva.git] / drivers / media / rc / ir-rc5-decoder.c
similarity index 89%
rename from drivers/media/IR/ir-rc5-decoder.c
rename to drivers/media/rc/ir-rc5-decoder.c
index df4770d978ad835201ec31341d122f3011db9427..ebdba55399167a78261e4a45d2d4cb64237d4d7c 100644 (file)
@@ -20,7 +20,7 @@
  * the first two bits are start bits, and a third one is a filing bit
  */
 
-#include "ir-core-priv.h"
+#include "rc-core-priv.h"
 
 #define RC5_NBITS              14
 #define RC5X_NBITS             20
@@ -40,23 +40,23 @@ enum rc5_state {
 
 /**
  * ir_rc5_decode() - Decode one RC-5 pulse or space
- * @input_dev: the struct input_dev descriptor of the device
+ * @dev:       the struct rc_dev descriptor of the device
  * @ev:                the struct ir_raw_event descriptor of the pulse/space
  *
  * This function returns -EINVAL if the pulse violates the state machine
  */
-static int ir_rc5_decode(struct input_dev *input_dev, struct ir_raw_event ev)
+static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)
 {
-       struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
-       struct rc5_dec *data = &ir_dev->raw->rc5;
+       struct rc5_dec *data = &dev->raw->rc5;
        u8 toggle;
        u32 scancode;
 
-        if (!(ir_dev->raw->enabled_protocols & IR_TYPE_RC5))
+        if (!(dev->raw->enabled_protocols & RC_TYPE_RC5))
                 return 0;
 
-       if (IS_RESET(ev)) {
-               data->state = STATE_INACTIVE;
+       if (!is_timing_event(ev)) {
+               if (ev.reset)
+                       data->state = STATE_INACTIVE;
                return 0;
        }
 
@@ -95,7 +95,7 @@ again:
                return 0;
 
        case STATE_BIT_END:
-               if (!is_transition(&ev, &ir_dev->raw->prev_ev))
+               if (!is_transition(&ev, &dev->raw->prev_ev))
                        break;
 
                if (data->count == data->wanted_bits)
@@ -150,7 +150,7 @@ again:
                                   scancode, toggle);
                }
 
-               ir_keydown(input_dev, scancode, toggle);
+               rc_keydown(dev, scancode, toggle);
                data->state = STATE_INACTIVE;
                return 0;
        }
@@ -163,7 +163,7 @@ out:
 }
 
 static struct ir_raw_handler rc5_handler = {
-       .protocols      = IR_TYPE_RC5,
+       .protocols      = RC_TYPE_RC5,
        .decode         = ir_rc5_decode,
 };