From patchwork Sun Oct 21 15:58:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 149363 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1675733lji; Sun, 21 Oct 2018 08:59:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV63NoJN7ULd1H/iiKLbf11hWrxaRY1kgLVyq6PptWudKbH0O1wRsSfZhMZL9+y0F/fhTFGBq X-Received: by 2002:adf:c3cd:: with SMTP id d13-v6mr44161337wrg.68.1540137547673; Sun, 21 Oct 2018 08:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540137547; cv=none; d=google.com; s=arc-20160816; b=0UQEIMJzQ2g/C+Wv3BGjKFicqL3PV5YTU+xBDv9xWIfEivQ13SqW+R45IznOgZCd93 vzX6B2ZlILLxV4wwpd2x90cGmIPqUbcMh261+HQCkhH8nt4Jtx3nDGCWLBeZk9rxzSMf M66QkIbziTpNUBlLl+LzYIMuXXm4vITsBikehDP3vpeDSg99/6ooDy6DcIJ81lN+k81F gQ5x798VXjwotCAYfcPqLHmYkf6fAj+3n0ekGcU+hfT/u9XgOpn4zSbafkCeHKhkSVoQ caJrQ943IVx+P5xA8KL2lzoPza7YgiG0tsfui0Epgz4tpLmdxIaI7UshCjD39Z+SgFIb ao+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to; bh=kPbOwmYxN73+/5gmBrV8tRk0NmO4sxe+IzIqMbP8hO4=; b=quxHgqFrHfRVeF0NHXsyrvjCz8vJLsegWQCwLAbjcmZ1ehMLlMTG6Ja/ce9Sz6uRx0 gGnvNy3jpcsYwFWYvy9/CVNzpskcW5GTT3Bow0CFlTySG32OTb20RH8KU8Wm2wVLsDNK oDpRgsunQnwuLn8w1KeCrVFHF0lNkXDauf73+TBcxLJw5p19x7iGLGZP6L+SQCmWBw7+ XjuLWFslpN2ud6saMpkPJVUGLrQMpNud/t7rHTO/MxqyxaiDcTRjI+obGWpxg2yYqGG9 CbSIiUvBjnFK286MHE7sAhLx7E0loIsTunNqdd6VJMY3RO/nj4eC6L9XwTcsBS5g+J7V ra6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Qd+au5oF; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id g26-v6si25329132wrc.195.2018.10.21.08.59.07; Sun, 21 Oct 2018 08:59:07 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Qd+au5oF; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D99852677E4; Sun, 21 Oct 2018 17:59:05 +0200 (CEST) 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 E78E62679F4; Sun, 21 Oct 2018 17:59:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 7E3D02677D1 for ; Sun, 21 Oct 2018 17:58:58 +0200 (CEST) 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=bPZlh+TUdJ+WLnaU76CPVxuPvZKCi3MgRjzz8XxaBjM=; b=Qd+au5oFrlxQ fxtnyEXzbYW6cXkRc4c4nHPZREhuNuzdJ3irlygVeyj48J27n02DD3wrlmaYuIpt5kteWl3HLEejC 4OYXihAhFun/HJOxwANrzzN33JvzE3mm8G+1sNLpW1vG//tQ3v0V70pReUI5VnOodL+eBYgiAY+ej X08+o=; Received: from [87.246.76.36] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gEG81-00049U-Br; Sun, 21 Oct 2018 15:58:57 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id B0FA1440078; Sun, 21 Oct 2018 17:58:56 +0200 (CEST) From: Mark Brown To: Vasily Khoruzhick In-Reply-To: Message-Id: <20181021155856.B0FA1440078@finisterre.ee.mobilebroadband> Date: Sun, 21 Oct 2018 17:58:56 +0200 (CEST) Cc: Maxime Ripard , alsa-devel@alsa-project.org, Mark Brown Subject: [alsa-devel] Applied "ASoC: sun4i-i2s: move code from startup/shutdown hooks into pm_runtime hooks" to the asoc tree 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 The patch ASoC: sun4i-i2s: move code from startup/shutdown hooks into pm_runtime hooks has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 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 7f91e2af1a4a2c34fc2e8fb046c722e1a9c85399 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Sun, 21 Oct 2018 08:39:11 -0700 Subject: [PATCH] ASoC: sun4i-i2s: move code from startup/shutdown hooks into pm_runtime hooks startup() and shutdown() hooks are called for both substreams, so stopping either substream when another is running breaks the latter. E.g. playback breaks if capture is stopped when playback is running. Move code from startup() and shutdown() to resume() and suspend() hooks respectively to fix this issue Signed-off-by: Vasily Khoruzhick Acked-by: Maxime Ripard Signed-off-by: Mark Brown --- sound/soc/sunxi/sun4i-i2s.c | 61 +++++++++++++++---------------------- 1 file changed, 25 insertions(+), 36 deletions(-) -- 2.19.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index c63d226e2436..d5ec1a20499d 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -644,40 +644,6 @@ static int sun4i_i2s_trigger(struct snd_pcm_substream *substream, int cmd, return 0; } -static int sun4i_i2s_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - struct sun4i_i2s *i2s = snd_soc_dai_get_drvdata(dai); - - /* Enable the whole hardware block */ - regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, - SUN4I_I2S_CTRL_GL_EN, SUN4I_I2S_CTRL_GL_EN); - - /* Enable the first output line */ - regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, - SUN4I_I2S_CTRL_SDO_EN_MASK, - SUN4I_I2S_CTRL_SDO_EN(0)); - - - return clk_prepare_enable(i2s->mod_clk); -} - -static void sun4i_i2s_shutdown(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - struct sun4i_i2s *i2s = snd_soc_dai_get_drvdata(dai); - - clk_disable_unprepare(i2s->mod_clk); - - /* Disable our output lines */ - regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, - SUN4I_I2S_CTRL_SDO_EN_MASK, 0); - - /* Disable the whole hardware block */ - regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, - SUN4I_I2S_CTRL_GL_EN, 0); -} - static int sun4i_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { @@ -695,8 +661,6 @@ static const struct snd_soc_dai_ops sun4i_i2s_dai_ops = { .hw_params = sun4i_i2s_hw_params, .set_fmt = sun4i_i2s_set_fmt, .set_sysclk = sun4i_i2s_set_sysclk, - .shutdown = sun4i_i2s_shutdown, - .startup = sun4i_i2s_startup, .trigger = sun4i_i2s_trigger, }; @@ -869,6 +833,21 @@ static int sun4i_i2s_runtime_resume(struct device *dev) goto err_disable_clk; } + /* Enable the whole hardware block */ + regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, + SUN4I_I2S_CTRL_GL_EN, SUN4I_I2S_CTRL_GL_EN); + + /* Enable the first output line */ + regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, + SUN4I_I2S_CTRL_SDO_EN_MASK, + SUN4I_I2S_CTRL_SDO_EN(0)); + + ret = clk_prepare_enable(i2s->mod_clk); + if (ret) { + dev_err(dev, "Failed to enable module clock\n"); + goto err_disable_clk; + } + return 0; err_disable_clk: @@ -880,6 +859,16 @@ static int sun4i_i2s_runtime_suspend(struct device *dev) { struct sun4i_i2s *i2s = dev_get_drvdata(dev); + clk_disable_unprepare(i2s->mod_clk); + + /* Disable our output lines */ + regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, + SUN4I_I2S_CTRL_SDO_EN_MASK, 0); + + /* Disable the whole hardware block */ + regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, + SUN4I_I2S_CTRL_GL_EN, 0); + regcache_cache_only(i2s->regmap, true); clk_disable_unprepare(i2s->bus_clk);