From patchwork Mon Oct 9 08:49:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 115187 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2309435qgn; Mon, 9 Oct 2017 01:50:22 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBYnegwFtmamm4ROSiyHQyxOA4G//FIS6/IYP7uE8AlCc462sHrIDDgc9bO6HejELIPrX0n X-Received: by 10.28.50.200 with SMTP id y191mr7097825wmy.74.1507539022549; Mon, 09 Oct 2017 01:50:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507539022; cv=none; d=google.com; s=arc-20160816; b=sd111x89B/A7d1HZjocKErfnmxguWqGn5Wffxuzv1NFF9xxEVSMgeuuo7ACPIWfrwv 5A9zI+iU1AGZ1MmWBB/zKM3VxqjHbCG/R6UVbC47IYy80Vn8ZAp120dD+3EMIeTffOT9 uEGgYBmp87kLLx1qL6mKWyVVcCMxLbycj4QvI7d/FnFg+8AHupYkgk6cWhgFxx3krCbM hE7IR2YUk5GZD4FXEbOWOF7CSW30ieFY3zuEDd9WwnWcLLOoCR6N+kE8WtKus3o9HRUM ZSv2NNmzKTvj0mU7WhMX/v2JPvR92aOun9+Y4tGVn4ZVlScBinYhXA5s5wd9+E2RPBF6 j5DQ== 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:arc-authentication-results; bh=CcbpeMZ6ARTgJode5udJcrlDs20oFn1owryO+ZuNr4U=; b=qNiroS2Z3f7OCoJvpcx+48Tdmk0A6jevRziAqaBAwUxokenYAnmQHwsdSfpIJpP37P 9T4BHcyc+mgAqGtgRKPs11bRVTs0PaDkItMoCMypZwVXbq9jCdYAksBQwaivkDrzBVrH 0jbJMcjGw8ZmNRHAohaTBFrWDISZ1Z8JiewMNpiWaBurKaYqUyGF8rNLLr9KDEnZqGeN kHt8QInBztLaS/aKXWsWh8Zlbmt/0zA4aA6Bra3VtdQ67fHvk+5lZFE+Dc16n+kgUkXt bNA5NMqYdst84bCWNTl8WYuqlWY3iePMws/j+9c9UDvA1keQPOdZi3AfvBcMFV9wLDHg OeOg== 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=rSe38P7N; 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 Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id e4si4354954wrc.555.2017.10.09.01.50.22; Mon, 09 Oct 2017 01:50:22 -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=rSe38P7N; 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 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 78B86267187; Mon, 9 Oct 2017 10:49:51 +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 4BF7626718B; Mon, 9 Oct 2017 10:49:50 +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.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_NEUTRAL 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 D1C7D26717C for ; Mon, 9 Oct 2017 10:49:47 +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=zrBFdYoYOw416eewlbuUqqRG24fKyLtqAKYdbeHPEHg=; b=rSe38P7NBa9G mv9NSIMETXW+9znBjl+5PjQwQS9NU6zzjAMhHkCc0+b+YppwMchC7iqPe38gXMM0nfRcSdjO9sdG/ 8WJVFvIz2UW7ibm73pmjZJRWUitptOJboX+6unlqvBp9dL1V0LonZuMuPEyxrjCTsdH7TS1IBDksG Fga3M=; 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 1e1Tkw-0000dN-7B; Mon, 09 Oct 2017 08:49:46 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1e1Tkv-0006LN-Pi; Mon, 09 Oct 2017 09:49:45 +0100 From: Mark Brown To: Ed Blake In-Reply-To: <20171006145607.13709-2-ed.blake@sondrel.com> Message-Id: Date: Mon, 09 Oct 2017 09:49:45 +0100 Cc: alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com Subject: [alsa-devel] Applied "ASoC: img-spdif-out: Add suspend / resume handling" 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: img-spdif-out: Add suspend / resume handling has been applied to the asoc tree at git://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 634a09d03753844e9fe1af8298266d0126d73549 Mon Sep 17 00:00:00 2001 From: Ed Blake Date: Fri, 6 Oct 2017 15:56:06 +0100 Subject: [PATCH] ASoC: img-spdif-out: Add suspend / resume handling Implement suspend and resume callbacks to save and restore register state, to support platforms where the power is disabled during suspend. In future the driver could be converted to use regmap which would simplify the suspend and resume code. Signed-off-by: Ed Blake Signed-off-by: Mark Brown --- sound/soc/img/img-spdif-out.c | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) -- 2.14.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/img/img-spdif-out.c b/sound/soc/img/img-spdif-out.c index 416aa5786b93..1808a5542fd1 100644 --- a/sound/soc/img/img-spdif-out.c +++ b/sound/soc/img/img-spdif-out.c @@ -47,6 +47,9 @@ struct img_spdif_out { struct snd_dmaengine_dai_dma_data dma_data; struct device *dev; struct reset_control *rst; + u32 suspend_ctl; + u32 suspend_csl; + u32 suspend_csh; }; static int img_spdif_out_runtime_suspend(struct device *dev) @@ -414,6 +417,46 @@ static int img_spdif_out_dev_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int img_spdif_out_suspend(struct device *dev) +{ + struct img_spdif_out *spdif = dev_get_drvdata(dev); + int ret; + + if (pm_runtime_status_suspended(dev)) { + ret = img_spdif_out_runtime_resume(dev); + if (ret) + return ret; + } + + spdif->suspend_ctl = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CTL); + spdif->suspend_csl = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CSL); + spdif->suspend_csh = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CSH_UV); + + img_spdif_out_runtime_suspend(dev); + + return 0; +} + +static int img_spdif_out_resume(struct device *dev) +{ + struct img_spdif_out *spdif = dev_get_drvdata(dev); + int ret; + + ret = img_spdif_out_runtime_resume(dev); + if (ret) + return ret; + + img_spdif_out_writel(spdif, spdif->suspend_ctl, IMG_SPDIF_OUT_CTL); + img_spdif_out_writel(spdif, spdif->suspend_csl, IMG_SPDIF_OUT_CSL); + img_spdif_out_writel(spdif, spdif->suspend_csh, IMG_SPDIF_OUT_CSH_UV); + + if (pm_runtime_status_suspended(dev)) + img_spdif_out_runtime_suspend(dev); + + return 0; +} +#endif static const struct of_device_id img_spdif_out_of_match[] = { { .compatible = "img,spdif-out" }, {} @@ -423,6 +466,7 @@ MODULE_DEVICE_TABLE(of, img_spdif_out_of_match); static const struct dev_pm_ops img_spdif_out_pm_ops = { SET_RUNTIME_PM_OPS(img_spdif_out_runtime_suspend, img_spdif_out_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(img_spdif_out_suspend, img_spdif_out_resume) }; static struct platform_driver img_spdif_out_driver = {