From patchwork Thu Jun 16 12:34:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9180747 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 44D1B60760 for ; Thu, 16 Jun 2016 12:35:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 161BE27DA4 for ; Thu, 16 Jun 2016 12:35:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B29728359; Thu, 16 Jun 2016 12:35:36 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4669227DA4 for ; Thu, 16 Jun 2016 12:35:35 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1109D266D47; Thu, 16 Jun 2016 14:35:32 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 8E9D7265817; Thu, 16 Jun 2016 14:34:55 +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 2A767266C80; Thu, 16 Jun 2016 14:34:53 +0200 (CEST) Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [195.130.137.89]) by alsa0.perex.cz (Postfix) with ESMTP id 5D695265817 for ; Thu, 16 Jun 2016 14:34:40 +0200 (CEST) Received: from ayla.of.borg ([84.195.107.21]) by laurent.telenet-ops.be with bizsmtp id 7Qae1t00l0TjorY01Qae64; Thu, 16 Jun 2016 14:34:40 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1bDWVK-0003zn-RK; Thu, 16 Jun 2016 14:34:38 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1bDWVL-0002Z7-3f; Thu, 16 Jun 2016 14:34:39 +0200 From: Geert Uytterhoeven To: Liam Girdwood , Mark Brown Date: Thu, 16 Jun 2016 14:34:31 +0200 Message-Id: <1466080472-9817-3-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466080472-9817-1-git-send-email-geert+renesas@glider.be> References: <1466080472-9817-1-git-send-email-geert+renesas@glider.be> Cc: linux-renesas-soc@vger.kernel.org, alsa-devel@alsa-project.org, Kuninori Morimoto , Geert Uytterhoeven , patches@opensource.wolfsonmicro.com, Peter Ujfalusi Subject: [alsa-devel] [PATCH 2/3] ASoC: ak4613: Implement suspend callback 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 X-Virus-Scanned: ClamAV using ClamSMTP Add the suspend callback to accompany the existing resume operation. With the suspend/resume callbacks the regmap (regcache) state handling can follow the recommended sequence. Based on commit a2ebd58627e9aa48 ("ASoC: ak4642: Implement suspend callback") by Peter Ujfalusi . Signed-off-by: Geert Uytterhoeven --- sound/soc/codecs/ak4613.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/ak4613.c b/sound/soc/codecs/ak4613.c index 5013d2ba0c10a968..97798d250f08689e 100644 --- a/sound/soc/codecs/ak4613.c +++ b/sound/soc/codecs/ak4613.c @@ -437,15 +437,25 @@ static struct snd_soc_dai_driver ak4613_dai = { .symmetric_rates = 1, }; -static int ak4613_resume(struct snd_soc_codec *codec) +static int ak4613_suspend(struct snd_soc_codec *codec) { struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + regcache_cache_only(regmap, true); regcache_mark_dirty(regmap); + return 0; +} + +static int ak4613_resume(struct snd_soc_codec *codec) +{ + struct regmap *regmap = dev_get_regmap(codec->dev, NULL); + + regcache_cache_only(regmap, false); return regcache_sync(regmap); } static struct snd_soc_codec_driver soc_codec_dev_ak4613 = { + .suspend = ak4613_suspend, .resume = ak4613_resume, .set_bias_level = ak4613_set_bias_level, .controls = ak4613_snd_controls,