From patchwork Fri Jul 12 22:46:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 11042717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 73DA014E5 for ; Fri, 12 Jul 2019 22:47:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 647B026E4F for ; Fri, 12 Jul 2019 22:47:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 586B62855D; Fri, 12 Jul 2019 22:47:04 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 BEA2F26E4F for ; Fri, 12 Jul 2019 22:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728157AbfGLWrC (ORCPT ); Fri, 12 Jul 2019 18:47:02 -0400 Received: from gofer.mess.org ([88.97.38.141]:57605 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727994AbfGLWrC (ORCPT ); Fri, 12 Jul 2019 18:47:02 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id ABB956047B; Fri, 12 Jul 2019 23:47:00 +0100 (BST) From: Sean Young To: linux-media@vger.kernel.org Cc: Frank Wunderlich , Sean Wang , linux-mediatek@lists.infradead.org, Matthias Brugger , Ryder Lee Subject: [PATCH 1/3] media: mtk-cir: only allow protocols that have software decoders Date: Fri, 12 Jul 2019 23:46:58 +0100 Message-Id: <20190712224700.11285-1-sean@mess.org> X-Mailer: git-send-email 2.11.0 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 RC_PROTO_BIT_ALL includes protocols like unknown and other that do not have IR decoders by definition. If these protocols are set in the allowed_protocols, they will show in the protocols sysfs file but cannot be enabled. Signed-off-by: Sean Young Acked-by: Sean Wang --- drivers/media/rc/mtk-cir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c index 46101efe017b..9dc467ebae24 100644 --- a/drivers/media/rc/mtk-cir.c +++ b/drivers/media/rc/mtk-cir.c @@ -342,7 +342,7 @@ static int mtk_ir_probe(struct platform_device *pdev) ir->rc->map_name = map_name ?: RC_MAP_EMPTY; ir->rc->dev.parent = dev; ir->rc->driver_name = MTK_IR_DEV; - ir->rc->allowed_protocols = RC_PROTO_BIT_ALL; + ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; ir->rc->rx_resolution = MTK_IR_SAMPLE; ir->rc->timeout = MTK_MAX_SAMPLES * (MTK_IR_SAMPLE + 1); From patchwork Fri Jul 12 22:46:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 11042719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C180814F6 for ; Fri, 12 Jul 2019 22:47:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B10EF26E4F for ; Fri, 12 Jul 2019 22:47:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5276283AF; Fri, 12 Jul 2019 22:47:04 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UPPERCASE_50_75 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 4CE1C28553 for ; Fri, 12 Jul 2019 22:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728160AbfGLWrD (ORCPT ); Fri, 12 Jul 2019 18:47:03 -0400 Received: from gofer.mess.org ([88.97.38.141]:36655 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728152AbfGLWrD (ORCPT ); Fri, 12 Jul 2019 18:47:03 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id CB0E4600B4; Fri, 12 Jul 2019 23:47:00 +0100 (BST) From: Sean Young To: linux-media@vger.kernel.org Cc: Frank Wunderlich , Sean Wang , linux-mediatek@lists.infradead.org, Matthias Brugger , Ryder Lee Subject: [PATCH 2/3] media: rc: remove unused #define RC_PROTO_BIT_ALL Date: Fri, 12 Jul 2019 23:46:59 +0100 Message-Id: <20190712224700.11285-2-sean@mess.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190712224700.11285-1-sean@mess.org> References: <20190712224700.11285-1-sean@mess.org> 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 This lists all the protocols that the kernel knows about, however there are no users. Signed-off-by: Sean Young --- include/media/rc-map.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/include/media/rc-map.h b/include/media/rc-map.h index bebd3c4c6338..3a7f8728f6ec 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -38,22 +38,6 @@ #define RC_PROTO_BIT_RCMM32 BIT_ULL(RC_PROTO_RCMM32) #define RC_PROTO_BIT_XBOX_DVD BIT_ULL(RC_PROTO_XBOX_DVD) -#define RC_PROTO_BIT_ALL \ - (RC_PROTO_BIT_UNKNOWN | RC_PROTO_BIT_OTHER | \ - RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC5X_20 | \ - RC_PROTO_BIT_RC5_SZ | RC_PROTO_BIT_JVC | \ - RC_PROTO_BIT_SONY12 | RC_PROTO_BIT_SONY15 | \ - RC_PROTO_BIT_SONY20 | RC_PROTO_BIT_NEC | \ - RC_PROTO_BIT_NECX | RC_PROTO_BIT_NEC32 | \ - RC_PROTO_BIT_SANYO | \ - RC_PROTO_BIT_MCIR2_KBD | RC_PROTO_BIT_MCIR2_MSE | \ - RC_PROTO_BIT_RC6_0 | RC_PROTO_BIT_RC6_6A_20 | \ - RC_PROTO_BIT_RC6_6A_24 | RC_PROTO_BIT_RC6_6A_32 | \ - RC_PROTO_BIT_RC6_MCE | RC_PROTO_BIT_SHARP | \ - RC_PROTO_BIT_XMP | RC_PROTO_BIT_CEC | \ - RC_PROTO_BIT_IMON | RC_PROTO_BIT_RCMM12 | \ - RC_PROTO_BIT_RCMM24 | RC_PROTO_BIT_RCMM32 | \ - RC_PROTO_BIT_XBOX_DVD) /* All rc protocols for which we have decoders */ #define RC_PROTO_BIT_ALL_IR_DECODER \ (RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC5X_20 | \ From patchwork Fri Jul 12 22:47:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 11042721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D00A1805 for ; Fri, 12 Jul 2019 22:47:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DCBF26E4F for ; Fri, 12 Jul 2019 22:47:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 525E728553; Fri, 12 Jul 2019 22:47:05 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 072D126E4F for ; Fri, 12 Jul 2019 22:47:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728161AbfGLWrE (ORCPT ); Fri, 12 Jul 2019 18:47:04 -0400 Received: from gofer.mess.org ([88.97.38.141]:45631 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727994AbfGLWrD (ORCPT ); Fri, 12 Jul 2019 18:47:03 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id 1A91060665; Fri, 12 Jul 2019 23:47:01 +0100 (BST) From: Sean Young To: linux-media@vger.kernel.org Cc: Frank Wunderlich , Sean Wang , linux-mediatek@lists.infradead.org, Matthias Brugger , Ryder Lee Subject: [PATCH 3/3] media: mtk-cir: lower de-glitch counter for rc-mm protocol Date: Fri, 12 Jul 2019 23:47:00 +0100 Message-Id: <20190712224700.11285-3-sean@mess.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190712224700.11285-1-sean@mess.org> References: <20190712224700.11285-1-sean@mess.org> 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 The rc-mm protocol can't be decoded by the mtk-cir since the de-glitch filter removes pulses/spaces shorter than 294 microseconds. Tested on a BananaPi R2. Signed-off-by: Sean Young Acked-by: Sean Wang --- drivers/media/rc/mtk-cir.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c index 9dc467ebae24..8027181de985 100644 --- a/drivers/media/rc/mtk-cir.c +++ b/drivers/media/rc/mtk-cir.c @@ -35,6 +35,11 @@ /* Fields containing pulse width data */ #define MTK_WIDTH_MASK (GENMASK(7, 0)) +/* IR threshold */ +#define MTK_IRTHD 0x14 +#define MTK_DG_CNT_MASK (GENMASK(12, 8)) +#define MTK_DG_CNT(x) ((x) << 8) + /* Bit to enable interrupt */ #define MTK_IRINT_EN BIT(0) @@ -400,6 +405,9 @@ static int mtk_ir_probe(struct platform_device *pdev) mtk_w32_mask(ir, val, ir->data->fields[MTK_HW_PERIOD].mask, ir->data->fields[MTK_HW_PERIOD].reg); + /* Set de-glitch counter */ + mtk_w32_mask(ir, MTK_DG_CNT(1), MTK_DG_CNT_MASK, MTK_IRTHD); + /* Enable IR and PWM */ val = mtk_r32(ir, MTK_CONFIG_HIGH_REG); val |= MTK_OK_COUNT(ir->data->ok_count) | MTK_PWM_EN | MTK_IR_EN;