media: mtk-cir: remove superfluous ir_raw_event_reset()
authorSean Young <sean@mess.org>
Thu, 13 Jan 2022 20:53:51 +0000 (21:53 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 24 Jan 2022 00:38:32 +0000 (01:38 +0100)
This IR receiver has two limitations:

1) Any IR pulse or space longer than 12ms will be truncated to 12ms

2) Any pulses/spaces after the first 68 are lost

ir_raw_event_reset() won't help here. If the IR cannot be decoded, any
decoder should reset itself, and if it does not, this is a bug in the
decoder.

Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/rc/mtk-cir.c

index 746d43fdc17a7457812f72d5f760fddd461a1199..1255e3afb032cdb5572ea6e99eb01b80ad985640 100644 (file)
@@ -209,19 +209,18 @@ static irqreturn_t mtk_ir_irq(int irqno, void *dev_id)
        struct ir_raw_event rawir = {};
 
        /*
-        * Reset decoder state machine explicitly is required
-        * because 1) the longest duration for space MTK IR hardware
-        * could record is not safely long. e.g  12ms if rx resolution
-        * is 46us by default. There is still the risk to satisfying
-        * every decoder to reset themselves through long enough
-        * trailing spaces and 2) the IRQ handler guarantees that
-        * start of IR message is always contained in and starting
-        * from register mtk_chkdata_reg(ir, i).
+        * Each pulse and space is encoded as a single byte, each byte
+        * alternating between pulse and space. If a pulse or space is longer
+        * than can be encoded in a single byte, it is encoded as the maximum
+        * value 0xff.
+        *
+        * If a space is longer than ok_count (about 23ms), the value is
+        * encoded as zero, and all following bytes are zero. Any IR that
+        * follows will be presented in the next interrupt.
+        *
+        * If there are more than 68 (=MTK_CHKDATA_SZ * 4) pulses and spaces,
+        * then the only the first 68 will be presented; the rest is lost.
         */
-       ir_raw_event_reset(ir->rc);
-
-       /* First message must be pulse */
-       rawir.pulse = false;
 
        /* Handle all pulse and space IR controller captures */
        for (i = 0 ; i < MTK_CHKDATA_SZ ; i++) {