From patchwork Tue Jun 19 12:57:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 10474371 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 3100960383 for ; Tue, 19 Jun 2018 13:31:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22EA028A06 for ; Tue, 19 Jun 2018 13:31:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17BDB28A22; Tue, 19 Jun 2018 13:31: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 05A9D28A06 for ; Tue, 19 Jun 2018 13:31:03 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hrtSS2fywaBdAsX/V8dmhb/5uFsBV+mJVLN01JZWtEM=; b=ocHBm2szam3w43 xCi8QRJSsoX7VT+PHmPMTW/alP9Y9EBB7PgOHGdbW0UXcP9QJI9T4ifFjFI38NKO5GPMxCUa6H0yt xrH2hNNR9AjaUFpi1r3ju+qXDfHUdTkR9MT98egPTxowkHbqRV1GJtUmOrTAH4JROLVs9Yk6djpZ0 B8Z2HyvjXIoei2vLccT5/K4Wy4M2G6siJLW9yuLXGsrD1OP2EfgunsIIfKs67616UfrI4MXN4ZuaW d3AdDzo9PDczby6Aw24SQkkMU4zR0+t3W59ghRbh/TWCNP8dEQztaJNuQ5A7r+BX7CaQre9atDaMs h4BwY6qEFLw1KBY0PsBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVGiq-0008VG-CM; Tue, 19 Jun 2018 13:31:00 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVGiN-0007Jq-2R for linux-amlogic@bombadil.infradead.org; Tue, 19 Jun 2018 13:30:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zZ7dc3bbeIF2Rl1/FKhQc+2Yk7O8CdPwmfi/HiH1kcs=; b=D2g0riUEMbj10TAm8QdRwQc+c //pX8FOumoMEsclnuQx0W3r4nKyueVAtnXkNB7CC695RUBn22fhnRIkW0Wmj7BV4mUnPUTMhRsAmp YyYZL7Ll6jAsMYhugbr3hlNSwTRBESzNH2It32EA5mEax5KRJ26+2qty5x//6ZVvuK+QhnKqIImyL tYu03kLd4p/zYwupCydN9GCe5RQFd4+IFMnrI0IzCk1bfGT0wgcevgCJJAnbxeGh+eMqyE9YcjpIe cHtnB5DEPMWX8Cve+vkx5f8SkumtfMtbmai62DixNMTkTfx2oR4kBVL7pSQ9U8gERWRj24VyGYtEc CqBkJTiEw==; Received: from gofer.mess.org ([2a02:8011:d000:212::1]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVGD5-0001VD-Bl for linux-amlogic@lists.infradead.org; Tue, 19 Jun 2018 12:58:12 +0000 Received: by gofer.mess.org (Postfix, from userid 1000) id CAE2960097; Tue, 19 Jun 2018 13:57:55 +0100 (BST) Date: Tue, 19 Jun 2018 13:57:55 +0100 From: Sean Young To: Jerome Brunet Subject: Re: [1/3] media: rc: drivers should produce alternate pulse and space timing events Message-ID: <20180619125755.cd3tyfgsx5yqjohw@gofer.mess.org> References: <20180512105531.30482-1-sean@mess.org> <1529410092.28510.20.camel@baylibre.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1529410092.28510.20.camel@baylibre.com> User-Agent: NeoMutt/20170113 (1.7.2) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180619_085811_608653_232053A9 X-CRM114-Status: GOOD ( 25.93 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mauro Carvalho Chehab , "open list:ARM/Amlogic Meson..." , linux-media@vger.kernel.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Jun 19, 2018 at 02:08:12PM +0200, Jerome Brunet wrote: > On Sat, 2018-05-12 at 11:55 +0100, Sean Young wrote: > > Report an error if this is not the case or any problem with the generated > > raw events. > > Hi, > > Since the inclusion of this patch, every 3 to 15 seconds, I get the following > message: > > "rc rc0: two consecutive events of type space" > > on the console of amlogic s400 platform (arch/arm64/boot/dts/amlogic/meson-axg- > s400.dts). I don't know much about ir protocol and surely there is something > worth investigating in the related driver, but ... > > > > > Signed-off-by: Sean Young > > --- > > drivers/media/rc/rc-ir-raw.c | 19 +++++++++++++++---- > > 1 file changed, 15 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c > > index 2e50104ae138..49c56da9bc67 100644 > > --- a/drivers/media/rc/rc-ir-raw.c > > +++ b/drivers/media/rc/rc-ir-raw.c > > @@ -22,16 +22,27 @@ static int ir_raw_event_thread(void *data) > > { > > struct ir_raw_event ev; > > struct ir_raw_handler *handler; > > - struct ir_raw_event_ctrl *raw = (struct ir_raw_event_ctrl *)data; > > + struct ir_raw_event_ctrl *raw = data; > > + struct rc_dev *dev = raw->dev; > > > > while (1) { > > mutex_lock(&ir_raw_handler_lock); > > while (kfifo_out(&raw->kfifo, &ev, 1)) { > > + if (is_timing_event(ev)) { > > + if (ev.duration == 0) > > + dev_err(&dev->dev, "nonsensical timing event of duration 0"); > > + if (is_timing_event(raw->prev_ev) && > > + !is_transition(&ev, &raw->prev_ev)) > > + dev_err(&dev->dev, "two consecutive events of type %s", > > + TO_STR(ev.pulse)); > > + if (raw->prev_ev.reset && ev.pulse == 0) > > + dev_err(&dev->dev, "timing event after reset should be pulse"); > > + } > > ... considering that we continue the processing as if nothing happened, is it > really an error ? > > Could we consider something less invasive ? like dev_dbg() or dev_warn_once() ? Maybe it should be dev_warn(). The fact that it is not dev_warn_once() means that we now know this occurs regularly. Would you mind testing the following patch please? Thanks Sean From 6a44fbe4738d230b9cf378777e7e9a93e5fda726 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Tue, 19 Jun 2018 13:50:36 +0100 Subject: [PATCH] media: rc: meson: rc rc0: two consecutive events of type space The meson generates one edge per interrupt. The duration is encoded in 12 bits of 10 microseconds, so it can only encoding a maximum of 40 milliseconds. As a result, it can produce multiple space events. Signed-off-by: Sean Young Tested-by: Jerome Brunet --- drivers/media/rc/meson-ir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c index f449b35d25e7..9747426719b2 100644 --- a/drivers/media/rc/meson-ir.c +++ b/drivers/media/rc/meson-ir.c @@ -97,7 +97,8 @@ static irqreturn_t meson_ir_irq(int irqno, void *dev_id) status = readl_relaxed(ir->reg + IR_DEC_STATUS); rawir.pulse = !!(status & STATUS_IR_DEC_IN); - ir_raw_event_store_with_timeout(ir->rc, &rawir); + if (ir_raw_event_store_with_filter(ir->rc, &rawir)) + ir_raw_event_handle(ir->rc); spin_unlock(&ir->lock);