summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2022-01-14 15:24:27 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-01-24 01:38:32 +0100
commit1ad09bbf8458298f224eea04e44507bccbe8b229 (patch)
tree4ffbb78d31cdb5b00ed8aa01a8005a9e9cbb3091 /drivers/media/rc
parentd49a14a946db0a8e0713aa43034879f967ab75e2 (diff)
downloadlinux-1ad09bbf8458298f224eea04e44507bccbe8b229.tar.bz2
media: mtk-cir: reduce message end to fix nec repeats
The ir receiver generates an interrupt with the IR data, once a space of at least ok_count is has been seen. Currently this is about 110ms; when holding down a button on a nec remote, no such space is seen until the button is released. This means nothing happens until you release the button. The sample rate is fixed at 46us, so the maximum space that can be encoded is about 12ms. So, the set ok_count above that at 23ms. 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')
-rw-r--r--drivers/media/rc/mtk-cir.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c
index 840e7aec5c21..746d43fdc17a 100644
--- a/drivers/media/rc/mtk-cir.c
+++ b/drivers/media/rc/mtk-cir.c
@@ -24,7 +24,8 @@
* Register to setting ok count whose unit based on hardware sampling period
* indicating IR receiving completion and then making IRQ fires
*/
-#define MTK_OK_COUNT(x) (((x) & GENMASK(23, 16)) << 16)
+#define MTK_OK_COUNT_MASK (GENMASK(22, 16))
+#define MTK_OK_COUNT(x) ((x) << 16)
/* Bit to enable IR hardware function */
#define MTK_IR_EN BIT(0)
@@ -268,7 +269,7 @@ static irqreturn_t mtk_ir_irq(int irqno, void *dev_id)
static const struct mtk_ir_data mt7623_data = {
.regs = mt7623_regs,
.fields = mt7623_fields,
- .ok_count = 0xf,
+ .ok_count = 3,
.hw_period = 0xff,
.div = 4,
};
@@ -276,7 +277,7 @@ static const struct mtk_ir_data mt7623_data = {
static const struct mtk_ir_data mt7622_data = {
.regs = mt7622_regs,
.fields = mt7622_fields,
- .ok_count = 0xf,
+ .ok_count = 3,
.hw_period = 0xffff,
.div = 32,
};
@@ -400,7 +401,7 @@ static int mtk_ir_probe(struct platform_device *pdev)
mtk_w32_mask(ir, MTK_DG_CNT(1), MTK_DG_CNT_MASK, MTK_IRTHD);
/* Enable IR and PWM */
- val = mtk_r32(ir, MTK_CONFIG_HIGH_REG);
+ val = mtk_r32(ir, MTK_CONFIG_HIGH_REG) & ~MTK_OK_COUNT_MASK;
val |= MTK_OK_COUNT(ir->data->ok_count) | MTK_PWM_EN | MTK_IR_EN;
mtk_w32(ir, val, MTK_CONFIG_HIGH_REG);