From patchwork Tue Jun 28 19:18:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 9203889 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 AE8846074E for ; Tue, 28 Jun 2016 19:19:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B5B628605 for ; Tue, 28 Jun 2016 19:19:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 901C528616; Tue, 28 Jun 2016 19:19:21 +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=unavailable 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 5348A28605 for ; Tue, 28 Jun 2016 19:19:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752496AbcF1TTR (ORCPT ); Tue, 28 Jun 2016 15:19:17 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35342 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752251AbcF1TTQ (ORCPT ); Tue, 28 Jun 2016 15:19:16 -0400 Received: by mail-wm0-f67.google.com with SMTP id a66so8328753wme.2; Tue, 28 Jun 2016 12:18:45 -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=gSl+ZavfZoqq29uZ/yw6TVnUCUallhgjJ61yxaxmXQY=; b=SbNEfT3J/o+v8oJWgUOsZdyHORE8WG7x8n0e+P/sAjqY+YhCIews7ruuObfbzZMlmC AQraJ2jdbuKUmdS8BKVVX3sOW12qD21zxfg51vXwKOT8EmQ0d5Gx5IOyjUdbxNf26cYR Zu3JueqUGsf3piK4XgCsbpTfYT+2foG7NBlwgRszGtaXicAoKOjq5Lg2/hxSgfeIqR0c jqaIzrtHmuU6sN4wTS3jVMpqi94OApN4pFRlsLsjQn7+GJxICNw63J/SPtiXIyqQe6wV uS59AOXt6UKPs1j+LJeeWgYV9eKgx2561++iRW2Ho/vbDdnFDFJt4+NmctLb350Mzyh/ HEVw== 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=gSl+ZavfZoqq29uZ/yw6TVnUCUallhgjJ61yxaxmXQY=; b=H2aKpLRuL6N+d4NbiGFhBAIWKwRJfoHhb5JgoDErK5OMnUDGtvX94LBEwGXbpcjuwJ W0wURCSeYwZDTgY66CpsKn3iRLOdb5nHJ9gaetunZBHZdjTpWbcLdXbkt1ImwLfTknuY j4hfkAoXq2P+UQf60GzLdzSP2AyDhepcyx/Kr2A6S9szmaMJ7kCotMHPZuiLknUfCT2f DDLeYjVtGQgfN7LdEvnlqI6LcaP3aaRV0zKQPc1vk/jZSBsw7Y164IJ1KKKsSxyIHxIz xwtEMLMOFM4P5O9/yjrshlO71um3IpWoBCP8BvjvV63CJuOfj5eiOgQ5AvuhLD3vcd8K YluA== X-Gm-Message-State: ALyK8tKPQY9H+bPRDMBvHb3oUgV1nIu/u/dyzUNjamxfku6Nm5bIbdV00eFNWuvVkhOEIQ== X-Received: by 10.28.107.23 with SMTP id g23mr18664253wmc.101.1467141524840; Tue, 28 Jun 2016 12:18:44 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD3CD1B0469EC83658463F431.dip0.t-ipconnect.de. [2003:dc:d3cd:1b04:69ec:8365:8463:f431]) by smtp.googlemail.com with ESMTPSA id t190sm1288693wmt.24.2016.06.28.12.18.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2016 12:18:44 -0700 (PDT) From: Martin Blumenstingl To: linux-amlogic@lists.infradead.org, linux-media@vger.kernel.org Cc: robh+dt@kernel.org, mark.rutland@arm.com, carlo@caione.org, khilman@baylibre.com, mchehab@kernel.org, devicetree@vger.kernel.org, narmstrong@baylibre.com, Martin Blumenstingl Subject: [PATCH v3 2/4] media: rc: meson-ir: Add support for newer versions of the IR decoder Date: Tue, 28 Jun 2016 21:18:00 +0200 Message-Id: <20160628191802.21227-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160628191802.21227-1-martin.blumenstingl@googlemail.com> References: <20160626210622.5257-1-martin.blumenstingl@googlemail.com> <20160628191802.21227-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 From: Neil Armstrong Newer SoCs (Meson 8b and GXBB) are using REG2 (offset 0x20) instead of REG1 to configure the decoder mode. This makes it necessary to introduce new bindings so the driver knows which register has to be used. Signed-off-by: Neil Armstrong Signed-off-by: Martin Blumenstingl --- drivers/media/rc/meson-ir.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c index fcc3b82..003fff0 100644 --- a/drivers/media/rc/meson-ir.c +++ b/drivers/media/rc/meson-ir.c @@ -24,6 +24,7 @@ #define DRIVER_NAME "meson-ir" +/* valid on all Meson platforms */ #define IR_DEC_LDR_ACTIVE 0x00 #define IR_DEC_LDR_IDLE 0x04 #define IR_DEC_LDR_REPEAT 0x08 @@ -32,12 +33,21 @@ #define IR_DEC_FRAME 0x14 #define IR_DEC_STATUS 0x18 #define IR_DEC_REG1 0x1c +/* only available on Meson 8b and newer */ +#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 DECODE_MODE_NEC 0x0 +#define DECODE_MODE_RAW 0x2 + +/* Meson 6b uses REG1 to configure the mode */ +#define REG1_MODE_MASK GENMASK(8, 7) +#define REG1_MODE_SHIFT 7 + +/* Meson 8b / GXBB use REG2 to configure the mode */ +#define REG2_MODE_MASK GENMASK(3, 0) +#define REG2_MODE_SHIFT 0 #define REG1_TIME_IV_SHIFT 16 #define REG1_TIME_IV_MASK ((BIT(13) - 1) << REG1_TIME_IV_SHIFT) @@ -158,8 +168,15 @@ 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); + + /* Set general operation mode (= raw/software decoding) */ + if (of_device_is_compatible(node, "amlogic,meson6-ir")) + meson_ir_set_mask(ir, IR_DEC_REG1, REG1_MODE_MASK, + DECODE_MODE_RAW << REG1_MODE_SHIFT); + else + meson_ir_set_mask(ir, IR_DEC_REG2, REG2_MODE_MASK, + DECODE_MODE_RAW << REG2_MODE_SHIFT); + /* Set rate */ meson_ir_set_mask(ir, IR_DEC_REG0, REG0_RATE_MASK, MESON_TRATE - 1); /* IRQ on rising and falling edges */ @@ -197,6 +214,8 @@ static int meson_ir_remove(struct platform_device *pdev) static const struct of_device_id meson_ir_match[] = { { .compatible = "amlogic,meson6-ir" }, + { .compatible = "amlogic,meson8b-ir" }, + { .compatible = "amlogic,meson-gxbb-ir" }, { }, };