* [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders
@ 2019-07-12 22:46 Sean Young
2019-07-12 22:46 ` [PATCH 2/3] media: rc: remove unused #define RC_PROTO_BIT_ALL Sean Young
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Sean Young @ 2019-07-12 22:46 UTC (permalink / raw)
To: linux-media
Cc: Frank Wunderlich, Sean Wang, linux-mediatek, Matthias Brugger, Ryder Lee
RC_PROTO_BIT_ALL includes protocols like unknown and other that do not
have IR decoders by definition. If these protocols are set in the
allowed_protocols, they will show in the protocols sysfs file but cannot
be enabled.
Signed-off-by: Sean Young <sean@mess.org>
---
drivers/media/rc/mtk-cir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c
index 46101efe017b..9dc467ebae24 100644
--- a/drivers/media/rc/mtk-cir.c
+++ b/drivers/media/rc/mtk-cir.c
@@ -342,7 +342,7 @@ static int mtk_ir_probe(struct platform_device *pdev)
ir->rc->map_name = map_name ?: RC_MAP_EMPTY;
ir->rc->dev.parent = dev;
ir->rc->driver_name = MTK_IR_DEV;
- ir->rc->allowed_protocols = RC_PROTO_BIT_ALL;
+ ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
ir->rc->rx_resolution = MTK_IR_SAMPLE;
ir->rc->timeout = MTK_MAX_SAMPLES * (MTK_IR_SAMPLE + 1);
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] media: rc: remove unused #define RC_PROTO_BIT_ALL
2019-07-12 22:46 [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders Sean Young
@ 2019-07-12 22:46 ` Sean Young
2019-07-12 22:47 ` [PATCH 3/3] media: mtk-cir: lower de-glitch counter for rc-mm protocol Sean Young
2019-07-14 6:58 ` [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders Sean Wang
2 siblings, 0 replies; 5+ messages in thread
From: Sean Young @ 2019-07-12 22:46 UTC (permalink / raw)
To: linux-media
Cc: Frank Wunderlich, Sean Wang, linux-mediatek, Matthias Brugger, Ryder Lee
This lists all the protocols that the kernel knows about, however there
are no users.
Signed-off-by: Sean Young <sean@mess.org>
---
include/media/rc-map.h | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index bebd3c4c6338..3a7f8728f6ec 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -38,22 +38,6 @@
#define RC_PROTO_BIT_RCMM32 BIT_ULL(RC_PROTO_RCMM32)
#define RC_PROTO_BIT_XBOX_DVD BIT_ULL(RC_PROTO_XBOX_DVD)
-#define RC_PROTO_BIT_ALL \
- (RC_PROTO_BIT_UNKNOWN | RC_PROTO_BIT_OTHER | \
- RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC5X_20 | \
- RC_PROTO_BIT_RC5_SZ | RC_PROTO_BIT_JVC | \
- RC_PROTO_BIT_SONY12 | RC_PROTO_BIT_SONY15 | \
- RC_PROTO_BIT_SONY20 | RC_PROTO_BIT_NEC | \
- RC_PROTO_BIT_NECX | RC_PROTO_BIT_NEC32 | \
- RC_PROTO_BIT_SANYO | \
- RC_PROTO_BIT_MCIR2_KBD | RC_PROTO_BIT_MCIR2_MSE | \
- RC_PROTO_BIT_RC6_0 | RC_PROTO_BIT_RC6_6A_20 | \
- RC_PROTO_BIT_RC6_6A_24 | RC_PROTO_BIT_RC6_6A_32 | \
- RC_PROTO_BIT_RC6_MCE | RC_PROTO_BIT_SHARP | \
- RC_PROTO_BIT_XMP | RC_PROTO_BIT_CEC | \
- RC_PROTO_BIT_IMON | RC_PROTO_BIT_RCMM12 | \
- RC_PROTO_BIT_RCMM24 | RC_PROTO_BIT_RCMM32 | \
- RC_PROTO_BIT_XBOX_DVD)
/* All rc protocols for which we have decoders */
#define RC_PROTO_BIT_ALL_IR_DECODER \
(RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC5X_20 | \
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] media: mtk-cir: lower de-glitch counter for rc-mm protocol
2019-07-12 22:46 [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders Sean Young
2019-07-12 22:46 ` [PATCH 2/3] media: rc: remove unused #define RC_PROTO_BIT_ALL Sean Young
@ 2019-07-12 22:47 ` Sean Young
2019-07-14 7:00 ` Sean Wang
2019-07-14 6:58 ` [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders Sean Wang
2 siblings, 1 reply; 5+ messages in thread
From: Sean Young @ 2019-07-12 22:47 UTC (permalink / raw)
To: linux-media
Cc: Frank Wunderlich, Sean Wang, linux-mediatek, Matthias Brugger, Ryder Lee
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(+)
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] media: mtk-cir: lower de-glitch counter for rc-mm protocol
2019-07-12 22:47 ` [PATCH 3/3] media: mtk-cir: lower de-glitch counter for rc-mm protocol Sean Young
@ 2019-07-14 7:00 ` Sean Wang
0 siblings, 0 replies; 5+ messages in thread
From: Sean Wang @ 2019-07-14 7:00 UTC (permalink / raw)
To: Sean Young
Cc: linux-media, Matthias Brugger, Sean Wang,
moderated list:ARM/Mediatek SoC support, Ryder Lee,
Frank Wunderlich
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders
2019-07-12 22:46 [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders Sean Young
2019-07-12 22:46 ` [PATCH 2/3] media: rc: remove unused #define RC_PROTO_BIT_ALL Sean Young
2019-07-12 22:47 ` [PATCH 3/3] media: mtk-cir: lower de-glitch counter for rc-mm protocol Sean Young
@ 2019-07-14 6:58 ` Sean Wang
2 siblings, 0 replies; 5+ messages in thread
From: Sean Wang @ 2019-07-14 6:58 UTC (permalink / raw)
To: Sean Young
Cc: linux-media, Matthias Brugger, Sean Wang,
moderated list:ARM/Mediatek SoC support, Ryder Lee,
Frank Wunderlich
On Fri, Jul 12, 2019 at 3:47 PM Sean Young <sean@mess.org> wrote:
>
> RC_PROTO_BIT_ALL includes protocols like unknown and other that do not
> have IR decoders by definition. If these protocols are set in the
> allowed_protocols, they will show in the protocols sysfs file but cannot
> be enabled.
>
> Signed-off-by: Sean Young <sean@mess.org>
Acked-by: Sean Wang <sean.wang@kernel.org>
> ---
> drivers/media/rc/mtk-cir.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c
> index 46101efe017b..9dc467ebae24 100644
> --- a/drivers/media/rc/mtk-cir.c
> +++ b/drivers/media/rc/mtk-cir.c
> @@ -342,7 +342,7 @@ static int mtk_ir_probe(struct platform_device *pdev)
> ir->rc->map_name = map_name ?: RC_MAP_EMPTY;
> ir->rc->dev.parent = dev;
> ir->rc->driver_name = MTK_IR_DEV;
> - ir->rc->allowed_protocols = RC_PROTO_BIT_ALL;
> + ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
> ir->rc->rx_resolution = MTK_IR_SAMPLE;
> ir->rc->timeout = MTK_MAX_SAMPLES * (MTK_IR_SAMPLE + 1);
>
> --
> 2.21.0
>
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-07-14 7:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 22:46 [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders Sean Young
2019-07-12 22:46 ` [PATCH 2/3] media: rc: remove unused #define RC_PROTO_BIT_ALL Sean Young
2019-07-12 22:47 ` [PATCH 3/3] media: mtk-cir: lower de-glitch counter for rc-mm protocol Sean Young
2019-07-14 7:00 ` Sean Wang
2019-07-14 6:58 ` [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders Sean Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).