]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
media: rc: Add auto-correct for nec decoder
authorDaniel Fu <danifu@nvidia.com>
Wed, 4 Feb 2015 15:53:10 +0000 (15:53 +0000)
committermobile promotions <svcmobile_promotions@nvidia.com>
Thu, 15 Oct 2015 14:31:40 +0000 (07:31 -0700)
- Add auto-correct for the Missing 1 pulse/space caes when IRQ is off.
  Only could handle when IRQ off duration < 1125us.
- Set Key press timout to be 125ms

Bug 1601127

Change-Id: I4488d84f07a46a00bb4489bea9cb795705bc9c99
Signed-off-by: Daniel Fu <danifu@nvidia.com>
(cherry picked from commit 585eb718ca36109c33b7f842a0a3a308c91baeb3)
Reviewed-on: http://git-master/r/816583
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
drivers/media/rc/ir-raw.c
drivers/media/rc/rc-main.c

index 90a0e8b6fb0edd86094b693fa4972d4b515c514f..0a833221106fcc423b067785dadc0c57b39ceb8d 100644 (file)
@@ -1,6 +1,7 @@
 /* ir-raw.c - handle IR pulse/space events
  *
  * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
+ * Copyright (c) 2015, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -108,8 +109,10 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type)
        ktime_t                 now;
        s64                     delta; /* ns */
        DEFINE_IR_RAW_EVENT(ev);
+       DEFINE_IR_RAW_EVENT(drop_ev);
        int                     rc = 0;
        int                     delay;
+       bool flag = false;
 
        if (!dev->raw)
                return -EINVAL;
@@ -124,9 +127,27 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type)
         */
        if (delta > delay || !dev->raw->last_type)
                type |= IR_START_EVENT;
-       else
+       else {
                ev.duration = delta;
 
+               if (dev->allowed_protos & RC_BIT_NEC) {
+                       if (type == dev->raw->last_type) {
+                               drop_ev.duration = 0;
+                               if (type == IR_PULSE) {
+                                       flag = true;
+                                       drop_ev.pulse = false;
+                                       drop_ev.duration = 562500;
+                               } else if (type == IR_SPACE) {
+                                       flag = true;
+                                       drop_ev.pulse = true;
+                                       drop_ev.duration = 562500;
+                               }
+
+                       ev.duration = ev.duration - drop_ev.duration;
+                       }
+               }
+       }
+
        if (type & IR_START_EVENT)
                ir_raw_event_reset(dev);
        else if (dev->raw->last_type & IR_SPACE) {
@@ -138,6 +159,9 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type)
        } else
                return 0;
 
+       if (flag)
+               rc = ir_raw_event_store(dev, &drop_ev);
+
        dev->raw->last_event = now;
        dev->raw->last_type = type;
        return rc;
index 1cf382a0b27761683f6afa4d8c07aed3904ed789..3bc622c437159bfa8b65316b056dd6742aa799e0 100644 (file)
@@ -26,7 +26,7 @@
 #define IR_TAB_MAX_SIZE        8192
 
 /* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */
-#define IR_KEYPRESS_TIMEOUT 250
+#define IR_KEYPRESS_TIMEOUT 125
 
 /* Used to keep track of known keymaps */
 static LIST_HEAD(rc_map_list);