summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/mtk-cir.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2022-01-13 21:53:51 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-01-24 01:38:32 +0100
commit6a554bb5653f9844c2ee179d91a757b28ec36a99 (patch)
tree0571d0630ec0bc57e49b461a08b9bef82de6b62d /drivers/media/rc/mtk-cir.c
parentmedia: mtk-cir: reduce message end to fix nec repeats (diff)
downloadlinux-6a554bb5653f9844c2ee179d91a757b28ec36a99.tar.xz
linux-6a554bb5653f9844c2ee179d91a757b28ec36a99.zip
media: mtk-cir: remove superfluous ir_raw_event_reset()
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>
Diffstat (limited to 'drivers/media/rc/mtk-cir.c')
-rw-r--r--drivers/media/rc/mtk-cir.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c
index 746d43fdc17a..1255e3afb032 100644
--- a/drivers/media/rc/mtk-cir.c
+++ b/drivers/media/rc/mtk-cir.c
@@ -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++) {