From patchwork Sun Jun 26 21:06:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 9199605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B319860754 for ; Sun, 26 Jun 2016 21:06:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9644028556 for ; Sun, 26 Jun 2016 21:06:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 899332855B; Sun, 26 Jun 2016 21:06:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A6D228556 for ; Sun, 26 Jun 2016 21:06:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751501AbcFZVGg (ORCPT ); Sun, 26 Jun 2016 17:06:36 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34422 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459AbcFZVGd (ORCPT ); Sun, 26 Jun 2016 17:06:33 -0400 Received: by mail-wm0-f66.google.com with SMTP id 187so19778382wmz.1; Sun, 26 Jun 2016 14:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=F7qfUs7zkGEaWvVE73gIZzOXUN2PPA73+fSaWxXQjo8=; b=hwckuHQnuctWE01b439CiQA/a3stjGGGnn9lyIPHN9xO5neJ+g/6V+dKONuF3uGIWQ ryxc/Sc6+kJcQ7ka0OUdwhiyQBypepIRdFkyykCLR8GBcCaVIGWZHGw88d9EycdSPJ+R KyM/V6MtpVQl9omdbUOlII1uANjASOZHFXBfjHyX4zSAln7r/1xFIp/edJf+eXzmHGud pBtrVK/uJt67GrkUvsP2X2zSVGboNVR8CRBD0bOUzMDl5K5YW2Ow98NCDpM4PWb8yUiB qGlQsIRBlyc3wwmgwWs08TbjyrAouIkXqerWlsVLYyCDQoT74csw1QZzhDZPK/wCS2PK 09MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=F7qfUs7zkGEaWvVE73gIZzOXUN2PPA73+fSaWxXQjo8=; b=H7i7yoMnk1VnGBizRk6ml3dYk2sbkAZ2a0fiG+O0I93sFQkmEjKn4A6yNCjfu9qC70 BCxdtnjJ27/YHJYygAkTbKFk5vqWjoOgZxoP88Q3FWZMRYLkevoqIpCLIEGlwzfGjxmc A6KzndPkA2U8RYava+7AfrlFDOBLSDsz1Xu9JK5nrFrvRKroHbCp1EfJuHaztInTrTCM mlGdmqdU5ytrfUzeEGOZiPlYpjjpkEnnVu9I2qw1Df9VMJxdMlft7YEsNTXe0ERUBihL 3+oa863Df+FeKjnh4jQwxsErGBKGTnqdjnrhSqygOi466nbjDllIlt45ucbBInQkUjqg kEZA== X-Gm-Message-State: ALyK8tKeUwRl1yZSzNG+UB2puQDAF58ksmypwDZ/o9VuIN3dXFDj51UaWWGzXsYu/iXOhQ== X-Received: by 10.194.165.233 with SMTP id zb9mr13939070wjb.172.1466975191876; Sun, 26 Jun 2016 14:06:31 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD3CD1B04BC56BB9C73E3153B.dip0.t-ipconnect.de. [2003:dc:d3cd:1b04:bc56:bb9c:73e3:153b]) by smtp.googlemail.com with ESMTPSA id el4sm3639812wjd.23.2016.06.26.14.06.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Jun 2016 14:06:30 -0700 (PDT) From: Martin Blumenstingl To: b.galvani@gmail.com, linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, khilman@baylibre.com, carlo@caione.org, mchehab@kernel.org, tobetter@gmail.com, devicetree@vger.kernel.org, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, Martin Blumenstingl Subject: [PATCH v2 1/2] media: rc: meson-ir: fix enabling raw/soft-decoding mode Date: Sun, 26 Jun 2016 23:06:21 +0200 Message-Id: <20160626210622.5257-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160626210622.5257-1-martin.blumenstingl@googlemail.com> References: <20160626210622.5257-1-martin.blumenstingl@googlemail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 */