From patchwork Wed Oct 28 19:53:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Crome X-Patchwork-Id: 7513811 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2593D9F37F for ; Wed, 28 Oct 2015 19:54:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 32BA02084D for ; Wed, 28 Oct 2015 19:54:19 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D233B205B7 for ; Wed, 28 Oct 2015 19:54:16 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A6226265054; Wed, 28 Oct 2015 20:54:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1F0C6264F10; Wed, 28 Oct 2015 20:54:06 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2367B264F28; Wed, 28 Oct 2015 20:54:03 +0100 (CET) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by alsa0.perex.cz (Postfix) with ESMTP id 89687262607 for ; Wed, 28 Oct 2015 20:53:58 +0100 (CET) Received: by padhk11 with SMTP id hk11so15954914pad.1 for ; Wed, 28 Oct 2015 12:53:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crome_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=KydGzVY2g5l4PZNaPHFPcocNGsCtqZSSBQmTsGyeW/0=; b=MQOcruqdIuww69b3qSJS0ZNbXyM1Qq/FzJZZi/z8pOclv8gY9SH0ZaeB8sS4VCgCrb bT8uYFG5tRBSBh01tIlUS3XFcZCNuuZwC5Oubcc/lv6gnqgYwNzjnv2ZIGBWJ9M3IiT+ hq3RSsGFuWkz5ggqKgydg2HHs5LUTcT4qU+SC3SXbMIrdClTjmSauF4IrqGqv/BWVoSy 5p920cA38PEnvBBuhp0FrNT6bPmnPPppRKaLtM6KnIZyPZbgtYAWU1LgFDUhlGusKz97 z1ZfURsluZWS8BS7g1DSE+3VUi2lQ4YLRvLIIbwu0CjZ6uNpNh4lvW08Xi/pr43Ooccu wwlA== 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; bh=KydGzVY2g5l4PZNaPHFPcocNGsCtqZSSBQmTsGyeW/0=; b=Gj13MQa7uHRFEBSqkVKkSu8XhOKMjinzKWn2XLS+wy0tC0GlpCByvz0qHC3MXZHgVV WuJJMifqJrrwnFceLIwRPcLlBcNZP8dzBUStXBt48deRZ3eDWBJX1aBRryhQFMm+Rcc7 FXXMj39lgcvZd/Yg6R0VPVa3e5IqfW74j5DKypUD1V8TocAcl4JfmoChcMkdZgNnl9w+ jA/i6agZLa1kFhSRvPvGKsBxopFF3PUx3AhlFsbLn7N1vgkfUdGp399HpIhTY+noEAlU TWNzpRR7ooNdawAq7wzH0K3NN/TvxQAzUnEeMTzJ2fGvlKHoxmH7NcA9TEIyjxNtBOql sFPQ== X-Gm-Message-State: ALoCoQnv8zBbjGXfg3KY/u8GR8hWPtP+QE+5HptsdalW/MQjeuLijkOTwFrZeS742xvAlYUimi0D X-Received: by 10.67.8.101 with SMTP id dj5mr35853515pad.127.1446062036774; Wed, 28 Oct 2015 12:53:56 -0700 (PDT) Received: from localhost.localdomain (99-113-34-250.lightspeed.sntcca.sbcglobal.net. [99.113.34.250]) by smtp.gmail.com with ESMTPSA id by6sm42410193pab.25.2015.10.28.12.53.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Oct 2015 12:53:55 -0700 (PDT) From: Caleb Crome To: mpa@pengutronix.de, timur@freescale.com, alsa-devel@alsa-project.org Date: Wed, 28 Oct 2015 12:53:12 -0700 Message-Id: <1446061992-88379-1-git-send-email-caleb@crome.org> X-Mailer: git-send-email 2.1.4 Cc: Caleb Crome Subject: [alsa-devel] [PATCH] FSL_SSI: fix fsl_ssi interrupt reporting so that interrupts are only reported when they have been enabled. X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The current implementation reports all interrupt stats in /sys/kernel/debug/*.ssi/stats, even if the interrupt was not enabled. This is not the intention as per the comments. This fix keeps track of ever bit in the SIER register that has ever been enabled, which allows fsl_ssi_stats_show to actually only report those interrupt counts for interrupts that are enabled. Signed-off-by: Caleb Crome --- sound/soc/fsl/fsl_ssi.c | 15 +++++++++++++++ sound/soc/fsl/fsl_ssi.h | 1 + sound/soc/fsl/fsl_ssi_dbg.c | 8 +++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 73778c2..14d5ade 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -299,6 +299,18 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id) return IRQ_HANDLED; } +// call fsl_ssi_dbg_update_sier_enbled every time sier is +// updated. it tracks which interrupts have ever been enabled. +// so that the print function can keep track. +void fsl_ssi_update_sier_enabled( + struct fsl_ssi_private *ssi_private) +{ + int sier; + struct regmap *regs = ssi_private->regs; + regmap_read(regs, CCSR_SSI_SIER, &sier); + ssi_private->dbg_stats.sier_ever_enabled |= sier; +} + /* * Enable/Disable all rx/tx config flags at once. */ @@ -312,6 +324,7 @@ static void fsl_ssi_rxtx_config(struct fsl_ssi_private *ssi_private, regmap_update_bits(regs, CCSR_SSI_SIER, vals->rx.sier | vals->tx.sier, vals->rx.sier | vals->tx.sier); + fsl_ssi_update_sier_enabled(ssi_private); regmap_update_bits(regs, CCSR_SSI_SRCR, vals->rx.srcr | vals->tx.srcr, vals->rx.srcr | vals->tx.srcr); @@ -404,6 +417,7 @@ static void fsl_ssi_config(struct fsl_ssi_private *ssi_private, bool enable, */ if (enable) { regmap_update_bits(regs, CCSR_SSI_SIER, vals->sier, vals->sier); + fsl_ssi_update_sier_enabled(ssi_private); regmap_update_bits(regs, CCSR_SSI_SRCR, vals->srcr, vals->srcr); regmap_update_bits(regs, CCSR_SSI_STCR, vals->stcr, vals->stcr); } else { @@ -431,6 +445,7 @@ static void fsl_ssi_config(struct fsl_ssi_private *ssi_private, bool enable, regmap_update_bits(regs, CCSR_SSI_SRCR, srcr, 0); regmap_update_bits(regs, CCSR_SSI_STCR, stcr, 0); regmap_update_bits(regs, CCSR_SSI_SIER, sier, 0); + fsl_ssi_update_sier_enabled(ssi_private); } config_done: diff --git a/sound/soc/fsl/fsl_ssi.h b/sound/soc/fsl/fsl_ssi.h index 5065105..a078c69 100644 --- a/sound/soc/fsl/fsl_ssi.h +++ b/sound/soc/fsl/fsl_ssi.h @@ -237,6 +237,7 @@ struct fsl_ssi_dbg { unsigned int tfe1; unsigned int tfe0; } stats; + unsigned int sier_ever_enabled; }; void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *ssi_dbg, u32 sisr); diff --git a/sound/soc/fsl/fsl_ssi_dbg.c b/sound/soc/fsl/fsl_ssi_dbg.c index 5469ffb..1066620 100644 --- a/sound/soc/fsl/fsl_ssi_dbg.c +++ b/sound/soc/fsl/fsl_ssi_dbg.c @@ -82,13 +82,10 @@ void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *dbg, u32 sisr) dbg->stats.tfe0++; } -/* Show the statistics of a flag only if its interrupt is enabled. The - * compiler will optimze this code to a no-op if the interrupt is not - * enabled. - */ +/* Show the statistics of a flag only if its interrupt is enabled. */ #define SIER_SHOW(flag, name) \ do { \ - if (CCSR_SSI_SIER_##flag) \ + if (CCSR_SSI_SIER_##flag & sier) \ seq_printf(s, #name "=%u\n", ssi_dbg->stats.name); \ } while (0) @@ -102,6 +99,7 @@ void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *dbg, u32 sisr) static int fsl_ssi_stats_show(struct seq_file *s, void *unused) { struct fsl_ssi_dbg *ssi_dbg = s->private; + unsigned int sier = ssi_dbg->sier_ever_enabled; SIER_SHOW(RFRC_EN, rfrc); SIER_SHOW(TFRC_EN, tfrc);