From patchwork Tue Jul 1 05:55:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 365868 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 325FA1400AF for ; Tue, 1 Jul 2014 16:00:22 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1r4P-0004pq-FN; Tue, 01 Jul 2014 05:57:33 +0000 Received: from mail-yk0-x22e.google.com ([2607:f8b0:4002:c07::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1r47-0004Xf-G6 for linux-arm-kernel@lists.infradead.org; Tue, 01 Jul 2014 05:57:15 +0000 Received: by mail-yk0-f174.google.com with SMTP id 19so5372015ykq.19 for ; Mon, 30 Jun 2014 22:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8hBepdrDqQ+Y5VAn8cTwyZPDZrxR08uRLEzpsgbZ1j4=; b=R4QoGVaV8XxwSscmPk4pZek7whdXpOc6XJt/A8TM9miq2Qnjgb2Z2iy5rhS1l8DTu5 LhoQSYhhvQALrncCb89oIqfePtHWvt/tmULU1zK5Vq3FMjO4E+aEe3h8q4JlvLcX9IgY QWF9qgsnkHy037qt4EZOMZcCrD5jxNj3EKUnO8gV0MPk3TCiX+vzKIdqLGn5ilKn/oS6 idVcfJPrSK1bJHLAI3fgrtY54HHKW4KKwIEiHYJLdCjTwIJ8xujMsbAFJqzcnduFfdqi AJ0OYN/qOpjcV3JBq/JquZcPYxpu53eis5CCQYSlYIeuCupr1BaOplsxVY5cTXJGP6Ai IbUw== X-Received: by 10.236.111.2 with SMTP id v2mr66389466yhg.39.1404194214152; Mon, 30 Jun 2014 22:56:54 -0700 (PDT) Received: from localhost.localdomain ([177.194.40.193]) by mx.google.com with ESMTPSA id s22sm24506679yha.8.2014.06.30.22.56.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 22:56:53 -0700 (PDT) From: Fabio Estevam To: shawn.guo@freescale.com Subject: [PATCH 4/5] ARM: imx: clk-gate2: Use post decrement for share_count Date: Tue, 1 Jul 2014 02:55:28 -0300 Message-Id: <1404194129-25543-4-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1404194129-25543-1-git-send-email-festevam@gmail.com> References: <1404194129-25543-1-git-send-email-festevam@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140630_225715_606829_A6C72EE7 X-CRM114-Status: GOOD ( 12.46 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Cc: Fabio Estevam , b42378@freescale.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org From: Fabio Estevam SSI clocks use the share_count mechanism since SSI and SPDIF share the same clock gate bits. When using the share_count for the SSI clock we notice that it gets disabled due to the usage of pre-decrement operation in the clk_gate2_disable() function. Use the post-decrement operation so that the correct share_count is used and the SSI clock does not get disable when an audio file needs to be played. Signed-off-by: Fabio Estevam --- arch/arm/mach-imx/clk-gate2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c index 4ba587d..463083c 100644 --- a/arch/arm/mach-imx/clk-gate2.c +++ b/arch/arm/mach-imx/clk-gate2.c @@ -67,7 +67,7 @@ static void clk_gate2_disable(struct clk_hw *hw) spin_lock_irqsave(gate->lock, flags); - if (gate->share_count && --(*gate->share_count) > 0) + if (gate->share_count && (*gate->share_count)-- > 0) goto out; reg = readl(gate->reg);