From patchwork Mon Jan 8 16:22:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10150001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 15BBF601A1 for ; Mon, 8 Jan 2018 16:23:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EB522899B for ; Mon, 8 Jan 2018 16:23:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12D48289E6; Mon, 8 Jan 2018 16:23:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CB8A22899B for ; Mon, 8 Jan 2018 16:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id: In-Reply-To:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: References:List-Owner; bh=kF4ZjRhP7SfvyMnstLXsqo2VXTsJLR2autw8AWG6pXE=; b=TT1 1gQfGcsSMTYonEiEvDk8Aqx19WfuaS45d43tU8VJjfJGzmoy5zH8QNKqOtpjfbHsIbEo9JjaePrsi zgN/UasQyFDYMQXLKnjN0qeKekCQQyYXUGvZ0/lZXU+xlr2h78b9ETopP8NDtXmqnNaqG4MMpIvW+ 504afMe1pCJPXiHOq07Fk9L8Rb5KHr99d2jntsn+2ITdc2rT2mGPDGM1BnsNjGAi5F+rvrALfbapI fsJCVpq5Gv159p5QxgABAT53J3qACsYpZdmt1WyUnFfqcBpxi06pxSZvIjOlr9TMPFgbkCUeokASr /EnZmBwmxaBYOs/WNgNfMgM+Aumm32Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eYaDG-0005aF-Iq; Mon, 08 Jan 2018 16:23:50 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eYaDE-0005Xt-QP for linux-rockchip@bombadil.infradead.org; Mon, 08 Jan 2018 16:23:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; 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=QHlbIqZWzhTBiL9YHSBlSB7KsNeDrOGkcrdubgWm3kE=; b=yoef8r5zv4eMUwFEtVXuTjNI/D QClUq2zHJK81+FZ218dpgyMRkF5o/MsyhMCQrohWLmOcCTjQ3YZdDPW8XyyPHt4eULddNGjTyS+Zl X0rx+uDaaDJhX2r2yM3DsT+6HKSkIXeR8wy/gs7OYN4GWCStLFFwMuy7nXmCPEID6gdf7p2ToYq/H eoe9KyJpY+UjiNP4xbP0w1OyAKKnKv/D9a71Z9XJDwbNjLNe3b/fjZzw5B9TziNPDwJDBJNS0UVnX gU33GIOrG9DdS4upg3tudk/wZWHoeVzhiDrRJpxpZLdWkf4LiQOJX+jrjW7Jf8aIOAqvrfToA3aRj vlgc5ogw==; Received: from heliosphere.sirena.org.uk ([2a01:7e01::f03c:91ff:fed4:a3b6]) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eYaD8-0002k1-Pj for linux-rockchip@lists.infradead.org; Mon, 08 Jan 2018 16:23:46 +0000 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=QHlbIqZWzhTBiL9YHSBlSB7KsNeDrOGkcrdubgWm3kE=; b=rmv99GL6TAU/ r5inMlbFJr/E6CSa0G3fIAUI/PP965s/JwHmoHhyxYL6Ds0OLBzzOPWiGGMOBEtUTOsslQPVLvI+2 Grtbz2AR/oDSEgLPzRWCjmdgjdTNeZ5MgNZKaoCznQCpJuIUqU2q4WfkcOJyzc4cR2js0a9Bv6KzD V3yMs=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eYaCL-00024A-SO; Mon, 08 Jan 2018 16:22:53 +0000 Received: from broonie by debutante with local (Exim 4.90) (envelope-from ) id 1eYaCL-0002AW-D7; Mon, 08 Jan 2018 16:22:53 +0000 From: Mark Brown To: John Keeping Subject: Applied "ASoC: rockchip: i2s: fix playback after runtime resume" to the asoc tree In-Reply-To: <20180108160104.6307-1-john@metanate.com> Message-Id: Date: Mon, 08 Jan 2018 16:22:53 +0000 X-Bad-Reply: In-Reply-To but no 'Re:' in Subject. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, Liam Girdwood , stable@vger.kernel.org, Sugar Zhang , linux-rockchip@lists.infradead.org, Mark Brown MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: rockchip: i2s: fix playback after runtime resume 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 c66234cfedfc3e6e3b62563a5f2c1562be09a35d Mon Sep 17 00:00:00 2001 From: John Keeping Date: Mon, 8 Jan 2018 16:01:04 +0000 Subject: [PATCH] ASoC: rockchip: i2s: fix playback after runtime resume When restoring registers during runtime resume, we must not write to I2S_TXDR which is the transmit FIFO as this queues up a sample to be output and pushes all of the output channels down by one. This can be demonstrated with the speaker-test utility: for i in a b c; do speaker-test -c 2 -s 1; done which should play a test through the left speaker three times but if the I2S hardware starts runtime suspended the first sample will be played through the right speaker. Fix this by marking I2S_TXDR as volatile (which also requires marking it as readble, even though it technically isn't). This seems to be the most robust fix, the alternative of giving I2S_TXDR a default value is more fragile since it does not prevent regcache writing to the register in all circumstances. While here, also fix the configuration of I2S_RXDR and I2S_FIFOLR; these are not writable so they do not suffer from the same problem as I2S_TXDR but reading from I2S_RXDR does suffer from a similar problem. Fixes: f0447f6cbb20 ("ASoC: rockchip: i2s: restore register during runtime_suspend/resume cycle", 2016-09-07) Signed-off-by: John Keeping Signed-off-by: Mark Brown Cc: stable@vger.kernel.org --- sound/soc/rockchip/rockchip_i2s.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 908211e1d6fc..eb27f6c24bf7 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -504,6 +504,7 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg) case I2S_INTCR: case I2S_XFER: case I2S_CLR: + case I2S_TXDR: case I2S_RXDR: case I2S_FIFOLR: case I2S_INTSR: @@ -518,6 +519,9 @@ static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) switch (reg) { case I2S_INTSR: case I2S_CLR: + case I2S_FIFOLR: + case I2S_TXDR: + case I2S_RXDR: return true; default: return false; @@ -527,6 +531,8 @@ static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg) { switch (reg) { + case I2S_RXDR: + return true; default: return false; }