media: rc: increase rc-mm tolerance and add debug message
authorSean Young <sean@mess.org>
Fri, 23 Aug 2019 11:28:02 +0000 (08:28 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 7 Oct 2019 10:32:41 +0000 (07:32 -0300)
Decoding often fails on e.g. redrat3 devices. The dev_dbg() helps
with debugging when decoding does fail.

Cc: Patrick Lerda <patrick9876@free.fr>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/rc/ir-rcmm-decoder.c

index 64fb65a9a19fb89a3730b09e8aace51768af3114..028df5cb18281275ab213ef12ca40e5859f21b18 100644 (file)
@@ -79,7 +79,7 @@ static int ir_rcmm_decode(struct rc_dev *dev, struct ir_raw_event ev)
                if (!ev.pulse)
                        break;
 
-               if (!eq_margin(ev.duration, RCMM_PREFIX_PULSE, RCMM_UNIT / 2))
+               if (!eq_margin(ev.duration, RCMM_PREFIX_PULSE, RCMM_UNIT))
                        break;
 
                data->state = STATE_LOW;
@@ -91,7 +91,7 @@ static int ir_rcmm_decode(struct rc_dev *dev, struct ir_raw_event ev)
                if (ev.pulse)
                        break;
 
-               if (!eq_margin(ev.duration, RCMM_PULSE_0, RCMM_UNIT / 2))
+               if (!eq_margin(ev.duration, RCMM_PULSE_0, RCMM_UNIT))
                        break;
 
                data->state = STATE_BUMP;
@@ -164,6 +164,8 @@ static int ir_rcmm_decode(struct rc_dev *dev, struct ir_raw_event ev)
                break;
        }
 
+       dev_dbg(&dev->dev, "RC-MM decode failed at count %d state %d (%uus %s)\n",
+               data->count, data->state, TO_US(ev.duration), TO_STR(ev.pulse));
        data->state = STATE_INACTIVE;
        return -EINVAL;
 }