Received: by 10.223.185.116 with SMTP id b49csp179224wrg; Thu, 15 Feb 2018 19:22:13 -0800 (PST) X-Google-Smtp-Source: AH8x224Q94eUN2/aOkz4OAuIXDHJ/yZdQBqV8NOIIchMA9l53r20sPcF+FK5uTMd5muw0QAIq9po X-Received: by 10.99.153.1 with SMTP id d1mr3897718pge.338.1518751333041; Thu, 15 Feb 2018 19:22:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518751332; cv=none; d=google.com; s=arc-20160816; b=EIaPHuUO4H70BXUBV8NdiQ4brbDJvnHXX6wGkoeVMHJUEROMKXDR1miRrnn9TwsqJL 5j4pvk641iTzyt4vGOe5/UBEhwEur51cNn634ocsUoeyIKAjfdwIi3Lf93o2B0KvlVGq ucPdCnvW5pP4H3FrCTB0ZW3mQHzhcWkGSY+q79U4UWJxO7AvRFXtMENvcg7CMzxfkbry o/BDwd2PJsEIILH2qqL+enVub53Uk1JT/o9o4ejcS/ENUruEvUPQFZC2qY3Du5w0QN1m V8u2EXwBDSDtYyi5khGh5t11qnEElihkBNJbAwjolWp6SNbN/u72LyQ0wPNr8lkGceFj cVtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Hu3heJrbyntDxC1KH1b2WpMiu9S0zqJcOp+sU9zdDKk=; b=Gy3pXcXxjMf+uSdxXUbyY/JfwqgRgafAxQdg798fVaSsNJKp+enEqqmBI0Y/B8Q4xj 7MlznLDhHDPFnZwVaugeZI2dAZDNUnJIx/LefeHCcWq3UNv9cmmmL7eykmlX/qesLR8L HkOBuJDhnJfqWDBsOzV6eEyDJnszvfjbPQM0T9EFNZH/bnV1TMgP8b4UBPvhw0wvC0fJ LDJYcxGP6gbfG5dN5XkwBD2dDGBQ+pdACTBa0U40PHwlpv3DpAzBKxMsGe223XDP78js 4KUxNslR/1TTGUuJaNNSlNmd8M1CfZeQkEePDzgd/MylhUWkteiVkPi9Z2oswXBk041G a+yw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az8-v6si4918744plb.723.2018.02.15.19.21.58; Thu, 15 Feb 2018 19:22:12 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424356AbeBOPo5 (ORCPT + 99 others); Thu, 15 Feb 2018 10:44:57 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34726 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033455AbeBOPoy (ORCPT ); Thu, 15 Feb 2018 10:44:54 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6056111AE; Thu, 15 Feb 2018 15:44:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Keeping , Mark Brown Subject: [PATCH 4.15 138/202] ASoC: rockchip: i2s: fix playback after runtime resume Date: Thu, 15 Feb 2018 16:17:18 +0100 Message-Id: <20180215151720.321725404@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: John Keeping commit c66234cfedfc3e6e3b62563a5f2c1562be09a35d upstream. 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 Signed-off-by: Greg Kroah-Hartman --- sound/soc/rockchip/rockchip_i2s.c | 6 ++++++ 1 file changed, 6 insertions(+) --- 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 d 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(st 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(st static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg) { switch (reg) { + case I2S_RXDR: + return true; default: return false; }