From patchwork Mon Apr 2 18:24:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10320155 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 68D9260375 for ; Mon, 2 Apr 2018 18:24:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A6C828A4C for ; Mon, 2 Apr 2018 18:24:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EEB828A4D; Mon, 2 Apr 2018 18:24:45 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 32AD928A5D for ; Mon, 2 Apr 2018 18:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753459AbeDBSYm (ORCPT ); Mon, 2 Apr 2018 14:24:42 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35073 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753393AbeDBSYl (ORCPT ); Mon, 2 Apr 2018 14:24:41 -0400 Received: by mail-wr0-f196.google.com with SMTP id 80so15044855wrb.2 for ; Mon, 02 Apr 2018 11:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=SUptWmUnzj91zmO/qkhozC0Hrdb9kWA7Ks3ekV2FuHU=; b=rzXEDAzcb5KBZ6DEKkhuTqK8RXjE/vfMKi0Z07N6sz/H1RARgfyedADWGAztimwOFg dCYdev5z8yJwd1dqXwAfOtuFTNPJLL2a7WPfcIoPMWexrOjBSvf0y67liVmSCK4nEMOp Ty+L1z4okXB+0x1w9uHjBT7QfYSQ7OfiM4G8sDu6wSiiyVBhsoHG2PScY8LmlP4Ee/cP F+jRLI4WDMDp/9294XSf9AesIt5+yZK+455dziL8FR1Vl00a/o5KV1/95yiL51AsSiEl 6gx+snF5lB4xlx0KR5s3JPA9m6UPhGMwtWMHbde89yEC/i1mpwFVM1/8Sme2Xb8lNhRS orsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=SUptWmUnzj91zmO/qkhozC0Hrdb9kWA7Ks3ekV2FuHU=; b=uCJpIWO2Ndhp79GQ2Lu+w98aCTk3IVMNj99gIxtorXXs1N4Y1divM//CJoTYXnYSMl aXZMaOKd3pqZF3PkbVq2veSTBiYcCwFzBTFUZreaBmC6ULTzIw89RBbt3jDlX75mobuU ZE0Bfy4EJvn0sYcX5krXORAMBsaKSA6Deq8Qs2OXb6cSNobii6QVQzjoWKPKcK4brPU7 YAD8q5CMYfniMNh/4ex3ncMDUJA1D4IRmOdXiDR4iEaBJYhES+vLphTMUAbYyUSzWbRS fuKNvAaAPC9+tHBNUh5FW+qL8WeBo+Ipms/pv6QjhTD7sZjhjgoLqCzR3kLkem/HZFVj PC+g== X-Gm-Message-State: AElRT7FNIgV8inIzpXTJuiVEuO7nR4zxvjr/ei1hrNFaisPXzHDFqXMZ iOXGhX9+5MuSOFeeJi+snVKiRw== X-Google-Smtp-Source: AIpwx4/vD4H+k3ZXQMbEIorZUErEtLw+F9/Z1kibA4SxHx9efLhInRT/t1M4tt+5NgDL3nlWNxT6Hg== X-Received: by 10.223.182.13 with SMTP id f13mr7130789wre.262.1522693479721; Mon, 02 Apr 2018 11:24:39 -0700 (PDT) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id x9sm2368273wrb.18.2018.04.02.11.24.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 11:24:39 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH 10/20] [media] ddbridge: improve separated MSI IRQ handling Date: Mon, 2 Apr 2018 20:24:17 +0200 Message-Id: <20180402182427.20918-11-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180402182427.20918-1-d.scheller.oss@gmail.com> References: <20180402182427.20918-1-d.scheller.oss@gmail.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: Daniel Scheller Improve IRQ handling in the separated MSG/I2C and IO/TSDATA handlers by applying a mask for recognized bits immediately upon reading the IRQ mask from the hardware, so only the bits/IRQs that actually were set will be acked. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 5fbb0996a12c..9d91221dacc4 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -2443,16 +2443,17 @@ static void irq_handle_io(struct ddb *dev, u32 s) irqreturn_t ddb_irq_handler0(int irq, void *dev_id) { struct ddb *dev = (struct ddb *)dev_id; - u32 s = ddbreadl(dev, INTERRUPT_STATUS); + u32 mask = 0x8fffff00; + u32 s = mask & ddbreadl(dev, INTERRUPT_STATUS); + if (!s) + return IRQ_NONE; do { if (s & 0x80000000) return IRQ_NONE; - if (!(s & 0xfffff00)) - return IRQ_NONE; - ddbwritel(dev, s & 0xfffff00, INTERRUPT_ACK); + ddbwritel(dev, s, INTERRUPT_ACK); irq_handle_io(dev, s); - } while ((s = ddbreadl(dev, INTERRUPT_STATUS))); + } while ((s = mask & ddbreadl(dev, INTERRUPT_STATUS))); return IRQ_HANDLED; } @@ -2460,16 +2461,17 @@ irqreturn_t ddb_irq_handler0(int irq, void *dev_id) irqreturn_t ddb_irq_handler1(int irq, void *dev_id) { struct ddb *dev = (struct ddb *)dev_id; - u32 s = ddbreadl(dev, INTERRUPT_STATUS); + u32 mask = 0x8000000f; + u32 s = mask & ddbreadl(dev, INTERRUPT_STATUS); + if (!s) + return IRQ_NONE; do { if (s & 0x80000000) return IRQ_NONE; - if (!(s & 0x0000f)) - return IRQ_NONE; - ddbwritel(dev, s & 0x0000f, INTERRUPT_ACK); + ddbwritel(dev, s, INTERRUPT_ACK); irq_handle_msg(dev, s); - } while ((s = ddbreadl(dev, INTERRUPT_STATUS))); + } while ((s = mask & ddbreadl(dev, INTERRUPT_STATUS))); return IRQ_HANDLED; }