From patchwork Wed May 8 08:39:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 16779 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f198.google.com (mail-gg0-f198.google.com [209.85.161.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 64BF5238FB for ; Wed, 8 May 2013 08:39:54 +0000 (UTC) Received: by mail-gg0-f198.google.com with SMTP id p4sf1667687ggn.9 for ; Wed, 08 May 2013 01:39:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=5mzG/38TZcXWIHMOzF0+yylU6vzK2tLxXs6s//B/3Y8=; b=Y6RhyDqwCY44RIFcsaOmok262NMvXZbTCJPhXZmrFlmA4sOYhRUSq41KuTzBtKH7Fm MH0NVL1JKABu7U1zDsKTnmQSIsms69X3yfzxkBOqOFmiq4wteHoVdkWDWEgOYDAGcs8x rAuXSAbp7qvs157K5714fe14Sp6MAgDCPuh/tkChVEpk+8C77HUIaeFR/gKoAMaJgn1G fr7AmlnJPyZv/J59oWf+gdN+rL14p0TwcWrND2w7m/gj0OSzIaNm3qgi0MvhsN2thZZE 8vmYplcJKhgnmeF9bpwDPNxR4w5+PKQVb1aAvPLl0C/5cMfJEUvZ9OyTM2Q5T5sZC1D1 Ln4w== X-Received: by 10.224.217.195 with SMTP id hn3mr7024562qab.5.1368002373325; Wed, 08 May 2013 01:39:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.120.33 with SMTP id kz1ls804034qeb.15.gmail; Wed, 08 May 2013 01:39:33 -0700 (PDT) X-Received: by 10.58.65.101 with SMTP id w5mr3817378ves.16.1368002372996; Wed, 08 May 2013 01:39:32 -0700 (PDT) Received: from mail-vb0-x233.google.com (mail-vb0-x233.google.com [2607:f8b0:400c:c02::233]) by mx.google.com with ESMTPS id ha8si14633101vdb.9.2013.05.08.01.39.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 01:39:32 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::233 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::233; Received: by mail-vb0-f51.google.com with SMTP id x16so1336482vbf.38 for ; Wed, 08 May 2013 01:39:32 -0700 (PDT) X-Received: by 10.52.36.115 with SMTP id p19mr3223180vdj.8.1368002372689; Wed, 08 May 2013 01:39:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp144049veb; Wed, 8 May 2013 01:39:29 -0700 (PDT) X-Received: by 10.194.78.137 with SMTP id b9mr8885051wjx.10.1368002368435; Wed, 08 May 2013 01:39:28 -0700 (PDT) Received: from mail-wg0-x229.google.com (mail-wg0-x229.google.com [2a00:1450:400c:c00::229]) by mx.google.com with ESMTPS id gd18si1621761wic.25.2013.05.08.01.39.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 01:39:28 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::229 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=2a00:1450:400c:c00::229; Received: by mail-wg0-f41.google.com with SMTP id y10so4844161wgg.0 for ; Wed, 08 May 2013 01:39:27 -0700 (PDT) X-Received: by 10.180.206.172 with SMTP id lp12mr8539375wic.11.1368002367721; Wed, 08 May 2013 01:39:27 -0700 (PDT) Received: from localhost ([2a01:2003:1:1025:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPSA id eu18sm7716884wid.1.2013.05.08.01.39.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 08 May 2013 01:39:26 -0700 (PDT) From: Fabio Baltieri To: Mark Brown , Liam Girdwood , Lee Jones Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Linus Walleij , Ola Lilja , Fabio Baltieri Subject: [PATCH v2 2/6] ASoC: ux500: Do not clear state if already idle Date: Wed, 8 May 2013 10:39:14 +0200 Message-Id: <1368002354-15471-1-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.8.2 In-Reply-To: <20130508080448.GG3102@gmail.com> References: <20130508080448.GG3102@gmail.com> X-Gm-Message-State: ALoCoQkQSegNOWeeG+edF/U/oTqf92awxAee/a7oif4e2JtSiQMuoYu/Lc9CpkwW4WJUZKEEsi8U X-Original-Sender: fabio.baltieri@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::233 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , As enable_msp gets called only after some audio data has been received, if the userspace closes the device before sending any data it causes ux500_msp_i2s_close to clear device state even if it was not previously initialized. This in turn leads to some non necessary but harmless writel, but also to decrementing the pinctrl usage counter (pinctrl_rxtx_ref) below zero. To prevent this from happening add a condition to skip register and pinctrl clear if current msp state is already MSP_STATE_IDLE. Acked-by: Lee Jones Signed-off-by: Fabio Baltieri --- Changes from v1: - fix grammatical error in commit message Thanks, Fabio sound/soc/ux500/ux500_msp_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index a26c6bf..964cfd6 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -638,7 +638,7 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir) dev_dbg(msp->dev, "%s: Enter (dir = 0x%01x).\n", __func__, dir); status = disable_msp(msp, dir); - if (msp->dir_busy == 0) { + if (msp->dir_busy == 0 && msp->msp_state != MSP_STATE_IDLE) { /* disable sample rate and frame generators */ msp->msp_state = MSP_STATE_IDLE; writel((readl(msp->registers + MSP_GCR) &