From patchwork Thu May 8 13:07:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 4136191 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2FE719F23C for ; Thu, 8 May 2014 13:12:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 707D82024F for ; Thu, 8 May 2014 13:12:27 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 42A2120173 for ; Thu, 8 May 2014 13:12:26 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5043B265565; Thu, 8 May 2014 15:12:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id F1DB526556F; Thu, 8 May 2014 15:09:05 +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 89A4926556F; Thu, 8 May 2014 15:09:04 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 8D2222654F6 for ; Thu, 8 May 2014 15:08:34 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 08 May 2014 06:03:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="4.97,1010,1389772800"; d="scan'208"; a="528507872" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.53]) by fmsmga001.fm.intel.com with ESMTP; 08 May 2014 06:08:13 -0700 From: Jarkko Nikula To: alsa-devel@alsa-project.org Date: Thu, 8 May 2014 16:07:27 +0300 Message-Id: <1399554447-16297-8-git-send-email-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.0.0.rc0 In-Reply-To: <1399554447-16297-1-git-send-email-jarkko.nikula@linux.intel.com> References: <1399554447-16297-1-git-send-email-jarkko.nikula@linux.intel.com> Cc: Liam Girdwood , Mark Brown , Jarkko Nikula , Liam Girdwood Subject: [alsa-devel] [PATCH 7/7] ASoC: Intel: Allow byt-5640 machine driver and SST core go to suspend 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 Since there is no support for compressed audio in Baytrail ADSP firmware there is no need to leave it on during suspend since ALSA PCM buffers are too small for leaving ADSP on for playing or recording. Implement PM callbacks to Baytrail byt-rt5640.c machine driver that call snd_soc_suspend and snd_soc_resume functions and unset the ignore_suspend fields in DAI links. This makes soc-core and ALSA core gracefully suspend and resume active stream and call sst_byt_pcm_trigger() during suspend-resume cycle. Signed-off-by: Jarkko Nikula --- sound/soc/intel/byt-rt5640.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/byt-rt5640.c b/sound/soc/intel/byt-rt5640.c index eff97c8e5218..9061616f0f45 100644 --- a/sound/soc/intel/byt-rt5640.c +++ b/sound/soc/intel/byt-rt5640.c @@ -124,7 +124,6 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = { .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .init = byt_rt5640_init, - .ignore_suspend = 1, .ops = &byt_rt5640_ops, }, { @@ -137,7 +136,6 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = { .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .init = NULL, - .ignore_suspend = 1, .ops = &byt_rt5640_ops, }, }; @@ -152,6 +150,17 @@ static struct snd_soc_card byt_rt5640_card = { .num_dapm_routes = ARRAY_SIZE(byt_rt5640_audio_map), }; +#ifdef CONFIG_PM_SLEEP +static const struct dev_pm_ops byt_rt5640_pm_ops = { + .suspend = snd_soc_suspend, + .resume = snd_soc_resume, +}; + +#define BYT_RT5640_PM_OPS (&byt_rt5640_pm_ops) +#else +#define BYT_RT5640_PM_OPS NULL +#endif + static int byt_rt5640_probe(struct platform_device *pdev) { struct snd_soc_card *card = &byt_rt5640_card; @@ -177,6 +186,7 @@ static struct platform_driver byt_rt5640_audio = { .driver = { .name = "byt-rt5640", .owner = THIS_MODULE, + .pm = BYT_RT5640_PM_OPS, }, }; module_platform_driver(byt_rt5640_audio)