Message ID | 20190712224700.11285-3-sean@mess.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] media: mtk-cir: only allow protocols that have software decoders | expand |
On Fri, Jul 12, 2019 at 3:47 PM Sean Young <sean@mess.org> wrote: > > The rc-mm protocol can't be decoded by the mtk-cir since the de-glitch > filter removes pulses/spaces shorter than 294 microseconds. > > Tested on a BananaPi R2. Thanks for grabbing the board and do the test voluntarily. > > Signed-off-by: Sean Young <sean@mess.org> Acked-by: Sean Wang <sean.wang@kernel.org> > --- > drivers/media/rc/mtk-cir.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c > index 9dc467ebae24..8027181de985 100644 > --- a/drivers/media/rc/mtk-cir.c > +++ b/drivers/media/rc/mtk-cir.c > @@ -35,6 +35,11 @@ > /* Fields containing pulse width data */ > #define MTK_WIDTH_MASK (GENMASK(7, 0)) > > +/* IR threshold */ > +#define MTK_IRTHD 0x14 > +#define MTK_DG_CNT_MASK (GENMASK(12, 8)) > +#define MTK_DG_CNT(x) ((x) << 8) > + > /* Bit to enable interrupt */ > #define MTK_IRINT_EN BIT(0) > > @@ -400,6 +405,9 @@ static int mtk_ir_probe(struct platform_device *pdev) > mtk_w32_mask(ir, val, ir->data->fields[MTK_HW_PERIOD].mask, > ir->data->fields[MTK_HW_PERIOD].reg); > > + /* Set de-glitch counter */ > + 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_OK_COUNT(ir->data->ok_count) | MTK_PWM_EN | MTK_IR_EN; > -- > 2.21.0 > > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek
diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c index 9dc467ebae24..8027181de985 100644 --- a/drivers/media/rc/mtk-cir.c +++ b/drivers/media/rc/mtk-cir.c @@ -35,6 +35,11 @@ /* Fields containing pulse width data */ #define MTK_WIDTH_MASK (GENMASK(7, 0)) +/* IR threshold */ +#define MTK_IRTHD 0x14 +#define MTK_DG_CNT_MASK (GENMASK(12, 8)) +#define MTK_DG_CNT(x) ((x) << 8) + /* Bit to enable interrupt */ #define MTK_IRINT_EN BIT(0) @@ -400,6 +405,9 @@ static int mtk_ir_probe(struct platform_device *pdev) mtk_w32_mask(ir, val, ir->data->fields[MTK_HW_PERIOD].mask, ir->data->fields[MTK_HW_PERIOD].reg); + /* Set de-glitch counter */ + 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_OK_COUNT(ir->data->ok_count) | MTK_PWM_EN | MTK_IR_EN;
The rc-mm protocol can't be decoded by the mtk-cir since the de-glitch filter removes pulses/spaces shorter than 294 microseconds. Tested on a BananaPi R2. Signed-off-by: Sean Young <sean@mess.org> --- drivers/media/rc/mtk-cir.c | 8 ++++++++ 1 file changed, 8 insertions(+)