From: martin.blumenstingl@googlemail.com (Martin Blumenstingl)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH v2 1/2] media: rc: meson-ir: fix enabling raw/soft-decoding mode
Date: Sun, 26 Jun 2016 23:06:21 +0200 [thread overview]
Message-ID: <20160626210622.5257-2-martin.blumenstingl@googlemail.com> (raw)
In-Reply-To: <20160626210622.5257-1-martin.blumenstingl@googlemail.com>
According to the datasheet of Meson8b (S805) and GXBB (S905) the
decoding mode is configured in AO_MF_IR_DEC_REG2 (offset 0x20) using
bits 0-3.
The "duration" field may not be set correctly when any of the hardware
decoding modes. This can happen while a "default" decoding mode
(either set by the bootloader or the chip's default, which uses NEC as
it's default) is used.
While here, I also added defines for the protocols which can be decoded
by the hardware (more work is needed to be actually able to use them
though).
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
changes in v1 -> v2:
- fixed subject of the patch to include meson-ir
- fixed double-shifting of the decoder mode values
drivers/media/rc/meson-ir.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c
index fcc3b82..622a4160 100644
--- a/drivers/media/rc/meson-ir.c
+++ b/drivers/media/rc/meson-ir.c
@@ -32,13 +32,10 @@
#define IR_DEC_FRAME 0x14
#define IR_DEC_STATUS 0x18
#define IR_DEC_REG1 0x1c
+#define IR_DEC_REG2 0x20
#define REG0_RATE_MASK (BIT(11) - 1)
-#define REG1_MODE_MASK (BIT(7) | BIT(8))
-#define REG1_MODE_NEC (0 << 7)
-#define REG1_MODE_GENERAL (2 << 7)
-
#define REG1_TIME_IV_SHIFT 16
#define REG1_TIME_IV_MASK ((BIT(13) - 1) << REG1_TIME_IV_SHIFT)
@@ -51,6 +48,20 @@
#define REG1_RESET BIT(0)
#define REG1_ENABLE BIT(15)
+#define REG2_DEC_MODE_SHIFT 0
+#define REG2_DEC_MODE_MASK GENMASK(3, REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_NEC 0x0
+#define REG2_DEC_MODE_RAW 0x2
+#define REG2_DEC_MODE_THOMSON 0x4
+#define REG2_DEC_MODE_TOSHIBA 0x5
+#define REG2_DEC_MODE_SONY 0x6
+#define REG2_DEC_MODE_RC5 0x7
+#define REG2_DEC_MODE_RC6 0x9
+#define REG2_DEC_MODE_RCMM 0xa
+#define REG2_DEC_MODE_DUOKAN 0xb
+#define REG2_DEC_MODE_COMCAST 0xe
+#define REG2_DEC_MODE_SANYO 0xf
+
#define STATUS_IR_DEC_IN BIT(8)
#define MESON_TRATE 10 /* us */
@@ -158,8 +169,9 @@ static int meson_ir_probe(struct platform_device *pdev)
/* Reset the decoder */
meson_ir_set_mask(ir, IR_DEC_REG1, REG1_RESET, REG1_RESET);
meson_ir_set_mask(ir, IR_DEC_REG1, REG1_RESET, 0);
- /* Set general operation mode */
- meson_ir_set_mask(ir, IR_DEC_REG1, REG1_MODE_MASK, REG1_MODE_GENERAL);
+ /* Enable raw/soft-decode mode */
+ meson_ir_set_mask(ir, IR_DEC_REG2, REG2_DEC_MODE_MASK,
+ REG2_DEC_MODE_RAW << REG2_DEC_MODE_SHIFT);
/* Set rate */
meson_ir_set_mask(ir, IR_DEC_REG0, REG0_RATE_MASK, MESON_TRATE - 1);
/* IRQ on rising and falling edges */
--
2.9.0
next prev parent reply other threads:[~2016-06-26 21:06 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-26 21:06 [v2] media: rc: fix Meson IR decoder Martin Blumenstingl
2016-06-26 21:06 ` Martin Blumenstingl [this message]
2016-06-26 21:06 ` [PATCH v2 2/2] ARM: dts: meson: fixed size of the meson-ir registers Martin Blumenstingl
2016-06-27 8:43 ` Carlo Caione
2016-06-27 6:27 ` [v2] media: rc: fix Meson IR decoder Neil Armstrong
2016-06-27 10:53 ` Martin Blumenstingl
2016-06-27 12:57 ` Neil Armstrong
2016-06-28 19:17 ` [PATCH v3 0/4] Add Meson 8b / GXBB support to the IR driver Martin Blumenstingl
2016-06-28 19:17 ` [PATCH v3 1/4] dt-bindings: media: meson-ir: Add Meson8b and GXBB compatible strings Martin Blumenstingl
2016-07-01 1:34 ` Rob Herring
2016-06-28 19:18 ` [PATCH v3 2/4] media: rc: meson-ir: Add support for newer versions of the IR decoder Martin Blumenstingl
2016-06-28 19:18 ` [PATCH v3 3/4] ARM64: meson-gxbb: Add Infrared Remote Controller decoder Martin Blumenstingl
2016-06-28 19:18 ` [PATCH v3 4/4] ARM64: dts: meson-gxbb: Enable the the IR decoder on supported boards Martin Blumenstingl
2016-08-08 5:54 ` [PATCH v3 0/4] Add Meson 8b / GXBB support to the IR driver Kevin Hilman
2016-08-19 21:55 ` [PATCH v4 0/6] " Martin Blumenstingl
2016-08-19 21:55 ` [PATCH v4 1/6] pinctrl: amlogic: gxbb: add the IR remote pin Martin Blumenstingl
2016-08-19 22:23 ` Kevin Hilman
2016-08-19 21:55 ` [PATCH v4 2/6] ARM64: dts: amlogic: add the pin for the IR remote Martin Blumenstingl
2016-08-19 21:55 ` [PATCH v4 3/6] dt-bindings: media: meson-ir: Add Meson8b and GXBB compatible strings Martin Blumenstingl
2016-08-19 21:55 ` [PATCH v4 4/6] media: rc: meson-ir: Add support for newer versions of the IR decoder Martin Blumenstingl
2016-08-19 22:28 ` Kevin Hilman
2016-08-25 12:41 ` Mauro Carvalho Chehab
2016-08-19 21:55 ` [PATCH v4 5/6] ARM64: dts: meson-gxbb: Add Infrared Remote Controller decoder Martin Blumenstingl
2016-08-19 21:55 ` [PATCH v4 6/6] ARM64: dts: meson-gxbb: Enable the the IR decoder on supported boards Martin Blumenstingl
2016-08-20 9:54 ` [PATCH v5 0/6] Add Meson 8b / GXBB support to the IR driver Martin Blumenstingl
2016-08-20 9:54 ` [PATCH v5 1/6] pinctrl: amlogic: gxbb: add the IR remote input pin Martin Blumenstingl
2016-08-22 13:51 ` Linus Walleij
2016-08-20 9:54 ` [PATCH v5 2/6] ARM64: dts: amlogic: add the input pin for the IR remote Martin Blumenstingl
2016-08-22 13:52 ` Linus Walleij
2016-08-20 9:54 ` [PATCH v5 3/6] dt-bindings: media: meson-ir: Add Meson8b and GXBB compatible strings Martin Blumenstingl
2016-08-20 9:54 ` [PATCH v5 4/6] media: rc: meson-ir: Add support for newer versions of the IR decoder Martin Blumenstingl
2016-08-20 9:54 ` [PATCH v5 5/6] ARM64: dts: meson-gxbb: Add Infrared Remote Controller decoder Martin Blumenstingl
2016-08-20 9:54 ` [PATCH v5 6/6] ARM64: dts: meson-gxbb: Enable the the IR decoder on supported boards Martin Blumenstingl
2016-08-29 19:28 ` [PATCH v5 0/6] Add Meson 8b / GXBB support to the IR driver Kevin Hilman
2016-08-20 9:53 ` Martin Blumenstingl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160626210622.5257-2-martin.blumenstingl@googlemail.com \
--to=martin.blumenstingl@googlemail.com \
--cc=linus-amlogic@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®