From patchwork Wed May 8 07:14:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 16774 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f199.google.com (mail-ye0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0D348238FB for ; Wed, 8 May 2013 07:15:24 +0000 (UTC) Received: by mail-ye0-f199.google.com with SMTP id l11sf1654584yen.2 for ; Wed, 08 May 2013 00:15:03 -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=mYkA8u8+UAW8mUORkWkLnm84UN5Jh/EQMS+OAKMsKgo=; b=oP13wUd0pkCwAHXzh9Xofz8Frjt5b8f6QXW8kdkaFA7WhOM+i+HR/teIWSRh0+KJdJ /i3/1RRKKi2gzaV51d/p9ilfrkvBNzZX4K2HRGGmdz7e7vV2wJWYmPtwu0e3Df/uzujv n6MjWAiB3lbhgr96oQd8udvetrDJPI710HNxqMc4uTupMxp8FIllSLqvREEezgpdocP0 EcozG+AzBIZzpMZKX1NpSxKnYmZhxzuXrl1EgOW60bS+1PmENzyDym7wtlo8NeSzIX8f 3ydmWf/1MXZqJ3aex68VqkXNITCAZOwspX1naS/dAwsq1aNlv+5G7gq7TRIruww8cKC6 mqog== X-Received: by 10.224.130.195 with SMTP id u3mr6936051qas.1.1367997303478; Wed, 08 May 2013 00:15:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.81.240 with SMTP id d16ls825462qey.70.gmail; Wed, 08 May 2013 00:15:03 -0700 (PDT) X-Received: by 10.52.30.74 with SMTP id q10mr3073099vdh.105.1367997303240; Wed, 08 May 2013 00:15:03 -0700 (PDT) Received: from mail-vb0-x229.google.com (mail-vb0-x229.google.com [2607:f8b0:400c:c02::229]) by mx.google.com with ESMTPS id wl5si14501411vec.25.2013.05.08.00.15.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 00:15:03 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::229 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::229; Received: by mail-vb0-f41.google.com with SMTP id w8so1321796vbf.28 for ; Wed, 08 May 2013 00:15:03 -0700 (PDT) X-Received: by 10.220.189.9 with SMTP id dc9mr3629222vcb.8.1367997303150; Wed, 08 May 2013 00:15:03 -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 nf2csp141010veb; Wed, 8 May 2013 00:15:02 -0700 (PDT) X-Received: by 10.194.248.200 with SMTP id yo8mr8295299wjc.36.1367997302160; Wed, 08 May 2013 00:15:02 -0700 (PDT) Received: from mail-wg0-x233.google.com (mail-wg0-x233.google.com [2a00:1450:400c:c00::233]) by mx.google.com with ESMTPS id u10si2387702wjx.253.2013.05.08.00.15.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 May 2013 00:15:02 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::233 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=2a00:1450:400c:c00::233; Received: by mail-wg0-f51.google.com with SMTP id b13so1469897wgh.18 for ; Wed, 08 May 2013 00:15:01 -0700 (PDT) X-Received: by 10.194.83.33 with SMTP id n1mr8395099wjy.7.1367997301731; Wed, 08 May 2013 00:15:01 -0700 (PDT) Received: from localhost ([2a01:2003:1:1025:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPSA id t1sm6579089wiz.10.2013.05.08.00.14.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 08 May 2013 00:15:01 -0700 (PDT) From: Fabio Baltieri To: Mark Brown , Liam Girdwood Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Linus Walleij , Lee Jones , Ola Lilja , Fabio Baltieri Subject: [PATCH 2/6] ASoC: ux500: Do not clear state if already idle Date: Wed, 8 May 2013 09:14:17 +0200 Message-Id: <1367997261-32048-3-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1367997261-32048-1-git-send-email-fabio.baltieri@linaro.org> References: <1367997261-32048-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQkqnK8shDxDFlljV0Y1rvpcrZxUfPRimwq93anZ9YEoJIf7LEd3uQV4yPTCg/6cXJGfNCj+ X-Original-Sender: fabio.baltieri@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::229 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 turns 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. Signed-off-by: Fabio Baltieri --- 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) &