From patchwork Mon Oct 9 08:49:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 115189 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp2309973qgn; Mon, 9 Oct 2017 01:51:07 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDDzKTjMivjt+CL2GxTCXp+XEaitT9uzI9tdrhqNWNmm0zs/s7nuL2QpMpnlDplBhF/4isW X-Received: by 10.28.129.197 with SMTP id c188mr7147333wmd.58.1507539067690; Mon, 09 Oct 2017 01:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507539067; cv=none; d=google.com; s=arc-20160816; b=gEBJOh5ZFzZSe6Qmk7c1fVQcacnpFcCpNZDFbbX7nCpIJUgIS2PBk0uNvHSBajt9Hx LTn5kT3X2BF/PJPJHTFzmuij6KBDD2NYwum/dvXFRHFKexgurcyXcbkUeWrLE4Fc+oo3 vVdmy3exxIBVw6peNzEFm8M12oHKHwxUMJdH125S8y0HfUXNICbPavBwoxUh+Avq9mhf 89tlGXg4TIKgbqyYBsoCDcFvp7T+eB9eb1y5dGJ8AuvBsWBx2delBKUy0iGwBX+N1+Rn WXcQabfHKIqYeBm0Dzs/Y+rQ4/UpJ6OdYYCnfJnqsNpqH3OuSpfcq9FG8dShQGi/XxkU r8ww== 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=YpHusUeIiA26xZW/xaXMJfW5aLMzITiu5vg1nrO/WwQ=; b=qMfApXx0qx4ngyZ1rC0D0WvPKjcy9H+eLeOTv3iWqBPiV6LO3UoR8ZaPZjf6Zycp+u /jmz34nfieIZeF+PgeOwjrjLOXU2MHVyugDI9aU4uPnf1g2go5TqN9PdtI4sodNhJn6d LLBIsVywa2YZ9I+a32awOkvVdwCsuSvQGf4XJfhTsxeAl1iWHdXcLGrEwk6E8tBL13xn eoaMtUZq3uP7mpjZZzuG1KJ/4HwIZOSIH5GW8yRNbwECZNohsNDoOFpMBk7Tso43xGbX /qV1ZrQJ61MO9nw1HNxLZdi/ELbF/PZiA1DAcId3dI+s7Lt981p+y0p9ASnkikiiJm06 PEhA== 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=tuk2fvBQ; 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 u136si6084505wmf.47.2017.10.09.01.51.07; Mon, 09 Oct 2017 01:51:07 -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=tuk2fvBQ; 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 1E6892671BA; Mon, 9 Oct 2017 10:49:58 +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 E75492671B9; Mon, 9 Oct 2017 10:49:56 +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 242462671AB for ; Mon, 9 Oct 2017 10:49:53 +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=5J5vWX2LOnWlXZK0kBpgaAbZdFVfrE0WFlndOTy03zY=; b=tuk2fvBQiOLq i72+9cEL/0LTh5gmJJeM4KXVuJtDjBcEydP7WlJPKv0yXClpKh8mAbsh7oJD/8UkT1qTaXF/CsUT6 2iS5JxCzlesoaeqwwGPh3DE/kI3MycMISZd7yoEg6VtDCbto+byH5QhnSlz+I9bDrQy4CkYe7PJIX CY2QQ=; 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 1e1Tl2-0000db-6u; Mon, 09 Oct 2017 08:49:52 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1e1Tl1-0006N1-QB; Mon, 09 Oct 2017 09:49:51 +0100 From: Mark Brown To: Ed Blake In-Reply-To: <20171006145355.13616-2-ed.blake@sondrel.com> Message-Id: Date: Mon, 09 Oct 2017 09:49:51 +0100 Cc: alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com Subject: [alsa-devel] Applied "ASoC: img-spdif-in: 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-in: 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 52eb0ed3ec62d1f22f71332aa2e2de84a0a6c756 Mon Sep 17 00:00:00 2001 From: Ed Blake Date: Fri, 6 Oct 2017 15:53:54 +0100 Subject: [PATCH] ASoC: img-spdif-in: 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-in.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) -- 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-in.c b/sound/soc/img/img-spdif-in.c index 8adfd65d4390..be5a64a44252 100644 --- a/sound/soc/img/img-spdif-in.c +++ b/sound/soc/img/img-spdif-in.c @@ -82,6 +82,8 @@ struct img_spdif_in { unsigned int single_freq; unsigned int multi_freqs[IMG_SPDIF_IN_NUM_ACLKGEN]; bool active; + u32 suspend_clkgen; + u32 suspend_ctl; /* Write-only registers */ unsigned int aclkgen_regs[IMG_SPDIF_IN_NUM_ACLKGEN]; @@ -785,16 +787,51 @@ static int img_spdif_in_dev_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int img_spdif_in_suspend(struct device *dev) +{ + struct img_spdif_in *spdif = dev_get_drvdata(dev); + + spdif->suspend_clkgen = img_spdif_in_readl(spdif, IMG_SPDIF_IN_CLKGEN); + spdif->suspend_ctl = img_spdif_in_readl(spdif, IMG_SPDIF_IN_CTL); + + clk_disable_unprepare(spdif->clk_sys); + + return 0; +} + +static int img_spdif_in_resume(struct device *dev) +{ + struct img_spdif_in *spdif = dev_get_drvdata(dev); + int i; + + clk_prepare_enable(spdif->clk_sys); + + for (i = 0; i < IMG_SPDIF_IN_NUM_ACLKGEN; i++) + img_spdif_in_aclkgen_writel(spdif, i); + + img_spdif_in_writel(spdif, spdif->suspend_clkgen, IMG_SPDIF_IN_CLKGEN); + img_spdif_in_writel(spdif, spdif->suspend_ctl, IMG_SPDIF_IN_CTL); + + return 0; +} +#endif + static const struct of_device_id img_spdif_in_of_match[] = { { .compatible = "img,spdif-in" }, {} }; MODULE_DEVICE_TABLE(of, img_spdif_in_of_match); +static const struct dev_pm_ops img_spdif_in_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(img_spdif_in_suspend, img_spdif_in_resume) +}; + static struct platform_driver img_spdif_in_driver = { .driver = { .name = "img-spdif-in", - .of_match_table = img_spdif_in_of_match + .of_match_table = img_spdif_in_of_match, + .pm = &img_spdif_in_pm_ops }, .probe = img_spdif_in_probe, .remove = img_spdif_in_dev_remove