mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: martin.blumenstingl@googlemail.com (Martin Blumenstingl)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH] media: rc: use the correct register offset and bits to enable raw mode
Date: Sun, 26 Jun 2016 22:29:05 +0200	[thread overview]
Message-ID: <20160626202905.21817-2-martin.blumenstingl@googlemail.com> (raw)
In-Reply-To: <20160626202905.21817-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>
---
 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..662d065 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 << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_RAW	(0x2 << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_THOMSON	(0x4 << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_TOSHIBA	(0x5 << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_SONY	(0x6 << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_RC5	(0x7 << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_RC6	(0x9 << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_RCMM	(0xa << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_DUOKAN	(0xb << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_COMCAST	(0xe << REG2_DEC_MODE_SHIFT)
+#define REG2_DEC_MODE_SANYO	(0xf << REG2_DEC_MODE_SHIFT)
+
 #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

      reply	other threads:[~2016-06-26 20:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-26 20:29 media: rc: fix Meson IR decoder Martin Blumenstingl
2016-06-26 20:29 ` Martin Blumenstingl [this message]

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=20160626202905.21817-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®