From patchwork Fri Jun 30 06:03:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 9818505 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 47BF76035F for ; Fri, 30 Jun 2017 06:10:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACC2128504 for ; Fri, 30 Jun 2017 06:10:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0DEE285A8; Fri, 30 Jun 2017 06:10:29 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B7FC628504 for ; Fri, 30 Jun 2017 06:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0pTdpARlph+H8lUTWd84PzU24r5IfGL0PViAHZwZJDQ=; b=DPRRKgha/MnTdB OOfqoeFPnuIVAXUJGEAYHd4i0cNGmzExbGRnJL/OMW2r+nFOrMXXj5V8InTl+UgXXC1rGwWS6nb/U rx/owfE9VlTg0rEGRkVbcimlGSdP3CwOp4lrfscp2Q4rw2vZjf6nyJuKg+jAYp88Z5+Dz+Qj0cV0C S8qJVMc9QyCo5DyR06658pfUf7XVj/AneYohZfxtkXDzVS0Us2ysIkIRTG/rch7+uD1sefNyVfpQQ pF+iZbfoLr3vcSbkFrE9O2ilM4njmqZ/S57hRK6a3paVlXp4hWTTz9A4A1QJzcC6x2lc0XpECL0P5 Py1mtsb2nXV2I3qVVuFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dQp8K-0008L3-4U; Fri, 30 Jun 2017 06:10:24 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dQp1m-0003AN-At; Fri, 30 Jun 2017 06:03:39 +0000 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 825970402; Fri, 30 Jun 2017 14:03:18 +0800 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 30 Jun 2017 14:03:16 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkexhb02.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Fri, 30 Jun 2017 14:03:16 +0800 From: To: , , , , , , Subject: [PATCH v1 3/4] media: rc: mtk-cir: add support for MediaTek MT7622 SoC Date: Fri, 30 Jun 2017 14:03:06 +0800 Message-ID: <37ff7a2deabfddfd899613caf13209754e9ac68a.1498794408.git.sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170629_230338_553047_74F31B64 X-CRM114-Status: GOOD ( 11.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, ivo.g.dimitrov.75@gmail.com, Sean Wang , linux-kernel@vger.kernel.org, andi.shyti@samsung.com, hverkuil@xs4all.nl, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Wang This patch adds driver for CIR controller on MT7622 SoC. It has similar handling logic as the previously MT7623 does, but there are some differences in the register and field definition. So for ease portability and maintenance, those differences all are being kept inside the platform data as other drivers usually do. Currently testing successfully on NEC and SONY remote controller. Signed-off-by: Sean Wang --- drivers/media/rc/mtk-cir.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c index 32b1031..6672772 100644 --- a/drivers/media/rc/mtk-cir.c +++ b/drivers/media/rc/mtk-cir.c @@ -84,6 +84,13 @@ static const u32 mt7623_regs[] = { [MTK_IRINT_CLR_REG] = 0xd0, }; +static const u32 mt7622_regs[] = { + [MTK_IRCLR_REG] = 0x18, + [MTK_CHKDATA_REG] = 0x30, + [MTK_IRINT_EN_REG] = 0x1c, + [MTK_IRINT_CLR_REG] = 0x20, +}; + struct mtk_field_type { u32 reg; u8 offset; @@ -113,6 +120,11 @@ static const struct mtk_field_type mt7623_fields[] = { [MTK_HW_PERIOD] = {0x10, 0, GENMASK(7, 0)}, }; +static const struct mtk_field_type mt7622_fields[] = { + [MTK_CHK_PERIOD] = {0x24, 0, GENMASK(24, 0)}, + [MTK_HW_PERIOD] = {0x10, 0, GENMASK(24, 0)}, +}; + /* * struct mtk_ir - This is the main datasructure for holding the state * of the driver @@ -268,8 +280,17 @@ static const struct mtk_ir_data mt7623_data = { .div = 4, }; +static const struct mtk_ir_data mt7622_data = { + .regs = mt7622_regs, + .fields = mt7622_fields, + .ok_count = 0xf, + .hw_period = 0xffff, + .div = 32, +}; + static const struct of_device_id mtk_ir_match[] = { { .compatible = "mediatek,mt7623-cir", .data = &mt7623_data}, + { .compatible = "mediatek,mt7622-cir", .data = &mt7622_data}, {}, }; MODULE_DEVICE_TABLE(of, mtk_ir_match);