From patchwork Fri Dec 4 23:40:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 7773171 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 948609F350 for ; Fri, 4 Dec 2015 23:43:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C56B520639 for ; Fri, 4 Dec 2015 23:43:03 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 919562061D for ; Fri, 4 Dec 2015 23:43:02 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A7CD82667E0; Sat, 5 Dec 2015 00:43:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 97E322658B1; Sat, 5 Dec 2015 00:41:18 +0100 (CET) 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 3922826589D; Sat, 5 Dec 2015 00:41:17 +0100 (CET) Received: from mail-qg0-f48.google.com (mail-qg0-f48.google.com [209.85.192.48]) by alsa0.perex.cz (Postfix) with ESMTP id 0512726536C for ; Sat, 5 Dec 2015 00:41:03 +0100 (CET) Received: by qgeb1 with SMTP id b1so102433383qge.1 for ; Fri, 04 Dec 2015 15:41:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rbI6i9ogorvOTrCRC/hDCLzwLXfzqOwWKKxkquVpTww=; b=zNo5tmXJrNaF6vQX3+G8OOMNtAH2H7W5Akqi3VZUWnaa1KY3FUtU/2l9UHN/Xu3XoE GOSkiz/cHaVVXx7xnXeUUmxRnZC0PNLMs+V2O+DGIYRsTDyqTaULv3wfuJJmeneB6mI2 dN0iYIakrsMWJXMs2Y0aqYGhhf7d4o3robeUdVH7f08hL/by+IGqH3Hd9bsjgw/nXW6a AZu8A0K/Kgqh65oMI1fD+1wTTk0mTWlqxW1pWXHUuFd2MOoVVq6+y7ntr7MsBUF8DvKS Hl7M4XLCagpal6jQjk1Fw0BxYjJKMiCmxndSNAWewg1jqveFkX/TzP7WdACAXNsSaOQC vz/Q== X-Received: by 10.140.235.212 with SMTP id g203mr23719677qhc.11.1449272462472; Fri, 04 Dec 2015 15:41:02 -0800 (PST) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by smtp.gmail.com with ESMTPSA id e127sm5556698qkb.34.2015.12.04.15.41.01 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Dec 2015 15:41:02 -0800 (PST) From: Alex Deucher X-Google-Original-From: Alex Deucher To: broonie@kernel.org, airlied@gmail.com, dri-devel@lists.freedesktop.org, alsa-devel@alsa-project.org, maruthi.bayyavarapu@amd.com, rajeevkumar.linux@gmail.com Date: Fri, 4 Dec 2015 18:40:31 -0500 Message-Id: <1449272440-8735-4-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1449272440-8735-1-git-send-email-alexander.deucher@amd.com> References: <1449272440-8735-1-git-send-email-alexander.deucher@amd.com> Cc: tiwai@suse.de, Alex Deucher , Maruthi Srinivas Bayyavarapu , lgirdwood@gmail.com Subject: [alsa-devel] [PATCH 03/13] ASoC: dwc: add runtime suspend/resume functionality 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 From: Maruthi Srinivas Bayyavarapu When DW controller is in master mode, it can disable/enable clock during the device runtime suspend/resume sequence. Signed-off-by: Maruthi Bayyavarapu Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- sound/soc/dwc/designware_i2s.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c index 6e6a70c..3d7754c 100644 --- a/sound/soc/dwc/designware_i2s.c +++ b/sound/soc/dwc/designware_i2s.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -394,6 +395,23 @@ static const struct snd_soc_component_driver dw_i2s_component = { }; #ifdef CONFIG_PM +static int dw_i2s_runtime_suspend(struct device *dev) +{ + struct dw_i2s_dev *dw_dev = dev_get_drvdata(dev); + + if (dw_dev->capability & DW_I2S_MASTER) + clk_disable(dw_dev->clk); + return 0; +} + +static int dw_i2s_runtime_resume(struct device *dev) +{ + struct dw_i2s_dev *dw_dev = dev_get_drvdata(dev); + + if (dw_dev->capability & DW_I2S_MASTER) + clk_enable(dw_dev->clk); + return 0; +} static int dw_i2s_suspend(struct snd_soc_dai *dai) { @@ -649,7 +667,7 @@ static int dw_i2s_probe(struct platform_device *pdev) goto err_clk_disable; } } - + pm_runtime_enable(&pdev->dev); return 0; err_clk_disable: @@ -665,6 +683,7 @@ static int dw_i2s_remove(struct platform_device *pdev) if (dev->capability & DW_I2S_MASTER) clk_disable_unprepare(dev->clk); + pm_runtime_disable(&pdev->dev); return 0; } @@ -677,12 +696,17 @@ static const struct of_device_id dw_i2s_of_match[] = { MODULE_DEVICE_TABLE(of, dw_i2s_of_match); #endif +static const struct dev_pm_ops dwc_pm_ops = { + SET_RUNTIME_PM_OPS(dw_i2s_runtime_suspend, dw_i2s_runtime_resume, NULL) +}; + static struct platform_driver dw_i2s_driver = { .probe = dw_i2s_probe, .remove = dw_i2s_remove, .driver = { .name = "designware-i2s", .of_match_table = of_match_ptr(dw_i2s_of_match), + .pm = &dwc_pm_ops, }, };