Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1763701ybg; Sat, 19 Oct 2019 02:01:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEcDaU5bWYlp4j6bFySvnTq0pX9NWENBYWisgrOslsR1FgBkAL68sFYw/qoiXb2TnQHXsV X-Received: by 2002:a17:906:615:: with SMTP id s21mr12699887ejb.276.1571475714477; Sat, 19 Oct 2019 02:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571475714; cv=none; d=google.com; s=arc-20160816; b=Cjn360lkTsm20zS/5WbH6INRMO6x/FMxy7VZ+Gh8N7hB1jyOfOOaVyWZbyU8LSFQtK Dp3b4TfWB48Owp8Efr7azEwkpHu+XGjGxggXAAPBKMwUlyGEkLl5C7zlStgCIm3A54qf /jV0yymoUli4jtIkrNGh7CW5kfPLKPKwg2a0bRNTwzSzPqdTZ9TLUNGiWOv4SNhgQCjS 4Mjfr3nexpq6yvyI31nU11jWIALMHaLs3iQbMvi2ZWRByHxNkIyAGKT4SXY6cUFe9Os7 OyTY1VjpBl+nOGmegUYtRhmhDsiFXP9lVOVJHg/Zc8rhcXvPRd+ZYQdIXSZTcJcmi5NG s5ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=kIdn4VulEh9KHSu4X43j6W5Pl8dnzX5CpSEuHNMmqZg=; b=Vf8EitBKJKYJV/Xp7awfK/mf4s9qiotvXSKnSp1/uUinGI9jY7jMF12KcMBgD4Y9ql /TLItMNrR2A/hsnGmi2fWn17nV8Yxuck7Nz+TCEy9vKNYW7hIaN9j39yBOsia4CarVuv bmYd89Q9aw4jvagbC0OOj09ONmBso7FXKhwg79/QWRUW/4mw3a2BpvcCZVpOnnFSmbNj /foXuW/WetJH91DRmHBCVcxGg5gjMlZaXjymeIKDrGZ6bERi52YRsLqU5tuJVuONadjw U4uOlzqMmaUsmy3tJ/6MTO184JMjDbhQdUvbw5uSd12b7uLGMt+Lab5ghq8STNxGD/kc CYFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=WjwNhdAg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b34si6325689edb.439.2019.10.19.02.01.31; Sat, 19 Oct 2019 02:01:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=WjwNhdAg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505738AbfJRSHM (ORCPT + 99 others); Fri, 18 Oct 2019 14:07:12 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:45002 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505694AbfJRSHL (ORCPT ); Fri, 18 Oct 2019 14:07:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=kIdn4VulEh9KHSu4X43j6W5Pl8dnzX5CpSEuHNMmqZg=; b=WjwNhdAgMXyf f/FpHLUkv9G0+RYaluq+UfZ74TKDku8p3GcVgmeDSuHf+HaJTuXfnFgJHPx9fLV5vwYYdOA0mDbXC An0OrN8jGzCDLrpDYYQiHfZgoMOeRPov+MKLyAN4SwFfRe2vbPKQOhxCXCIzXgyv8NSADueQtIhib PbwmU=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=ypsilon.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iLWeS-0004FY-Lf; Fri, 18 Oct 2019 18:07:00 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id 1F8F92743259; Fri, 18 Oct 2019 19:07:00 +0100 (BST) From: Mark Brown To: Olivier Moysan Cc: alexandre.torgue@st.com, alsa-devel@alsa-project.org, arnaud.pouliquen@st.com, benjamin.gaignard@st.com, broonie@kernel.org, lgirdwood@gmail.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Mark Brown , mcoquelin.stm32@gmail.com, olivier.moysan@st.com, perex@perex.cz, tiwai@suse.com Subject: Applied "ASoC: stm32: sai: fix sysclk management on shutdown" to the asoc tree In-Reply-To: <20191018082040.31022-1-olivier.moysan@st.com> X-Patchwork-Hint: ignore Message-Id: <20191018180700.1F8F92743259@ypsilon.sirena.org.uk> Date: Fri, 18 Oct 2019 19:07:00 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: stm32: sai: fix sysclk management on shutdown has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 9b7a7f921689d6c254e5acd670be631ebd82d54d Mon Sep 17 00:00:00 2001 From: Olivier Moysan Date: Fri, 18 Oct 2019 10:20:40 +0200 Subject: [PATCH] ASoC: stm32: sai: fix sysclk management on shutdown The commit below, adds a call to sysclk callback on shutdown. This introduces a regression in stm32 SAI driver, as some clock services are called twice, leading to unbalanced calls. Move processing related to mclk from shutdown to sysclk callback. When requested frequency is 0, assume shutdown and release mclk. Fixes: 2458adb8f92a ("SoC: simple-card-utils: set 0Hz to sysclk when shutdown") Signed-off-by: Olivier Moysan Link: https://lore.kernel.org/r/20191018082040.31022-1-olivier.moysan@st.com Signed-off-by: Mark Brown --- sound/soc/stm/stm32_sai_sub.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index d7501f88aaa6..a4060813bc74 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -505,10 +505,20 @@ static int stm32_sai_set_sysclk(struct snd_soc_dai *cpu_dai, if (dir == SND_SOC_CLOCK_OUT && sai->sai_mclk) { ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, SAI_XCR1_NODIV, - (unsigned int)~SAI_XCR1_NODIV); + freq ? 0 : SAI_XCR1_NODIV); if (ret < 0) return ret; + /* Assume shutdown if requested frequency is 0Hz */ + if (!freq) { + /* Release mclk rate only if rate was actually set */ + if (sai->mclk_rate) { + clk_rate_exclusive_put(sai->sai_mclk); + sai->mclk_rate = 0; + } + return 0; + } + /* If master clock is used, set parent clock now */ ret = stm32_sai_set_parent_clock(sai, freq); if (ret) @@ -1093,15 +1103,6 @@ static void stm32_sai_shutdown(struct snd_pcm_substream *substream, regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0); - regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, SAI_XCR1_NODIV, - SAI_XCR1_NODIV); - - /* Release mclk rate only if rate was actually set */ - if (sai->mclk_rate) { - clk_rate_exclusive_put(sai->sai_mclk); - sai->mclk_rate = 0; - } - clk_disable_unprepare(sai->sai_ck); spin_lock_irqsave(&sai->irq_lock, flags); -- 2.20.1