From patchwork Tue Sep 6 01:19:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sugar Zhang X-Patchwork-Id: 9315389 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 14214607D3 for ; Tue, 6 Sep 2016 01:26:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 040B32898B for ; Tue, 6 Sep 2016 01:26:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EABDA28993; Tue, 6 Sep 2016 01:26:47 +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, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 806E32898B for ; Tue, 6 Sep 2016 01:26:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bh59w-00060N-U7; Tue, 06 Sep 2016 01:26:44 +0000 Received: from regular1.263xmail.com ([211.150.99.140]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bh59h-0005xw-6D; Tue, 06 Sep 2016 01:26:30 +0000 Received: from sugar.zhang?rock-chips.com (unknown [192.168.167.156]) by regular1.263xmail.com (Postfix) with ESMTP id 894654B34; Tue, 6 Sep 2016 09:26:04 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 0C0DA40D; Tue, 6 Sep 2016 09:26:02 +0800 (CST) X-RL-SENDER: sugar.zhang@rock-chips.com X-FST-TO: dianders@chromium.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: sugar.zhang@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: zxg@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 21232QZTBGW; Tue, 06 Sep 2016 09:26:04 +0800 (CST) From: Sugar Zhang To: dianders@chromium.org, broonie@kernel.org Subject: [PATCH v2] ASoC: rockchip: i2s: restore register during runtime_suspend/resume cycle Date: Tue, 6 Sep 2016 09:19:53 +0800 Message-Id: <1473124793-74625-1-git-send-email-sugar.zhang@rock-chips.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160905_182629_753433_F180A18A X-CRM114-Status: UNSURE ( 7.88 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 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, Heiko Stuebner , linux-kernel@vger.kernel.org, Takashi Iwai , Liam Girdwood , Sugar Zhang , linux-rockchip@lists.infradead.org, Jaroslav Kysela , linux-arm-kernel@lists.infradead.org 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 when step into runtime_suspend, i2s pd will be disabled and loss state. so need to restore register when runtime_resume. Signed-off-by: Sugar Zhang --- Changes in v2: - remove system suspend/resume and restore register in runtime_suspend/resume per Doug Anderson's suggestion sound/soc/rockchip/rockchip_i2s.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 652e8c5..98b6822 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -57,6 +57,7 @@ static int i2s_runtime_suspend(struct device *dev) { struct rk_i2s_dev *i2s = dev_get_drvdata(dev); + regcache_cache_only(i2s->regmap, true); clk_disable_unprepare(i2s->mclk); return 0; @@ -65,7 +66,7 @@ static int i2s_runtime_suspend(struct device *dev) static int i2s_runtime_resume(struct device *dev) { struct rk_i2s_dev *i2s = dev_get_drvdata(dev); - int ret; + int ret = 0; ret = clk_prepare_enable(i2s->mclk); if (ret) { @@ -73,7 +74,14 @@ static int i2s_runtime_resume(struct device *dev) return ret; } - return 0; + regcache_cache_only(i2s->regmap, false); + regcache_mark_dirty(i2s->regmap); + + ret = regcache_sync(i2s->regmap); + if (ret) + clk_disable_unprepare(i2s->mclk); + + return ret; } static inline struct rk_i2s_dev *to_info(struct snd_soc_dai *dai)