From patchwork Mon Jun 13 12:29:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 9172817 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 CF6A3604DB for ; Mon, 13 Jun 2016 12:28:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C188C27C0C for ; Mon, 13 Jun 2016 12:28:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B63C227C8F; Mon, 13 Jun 2016 12:28:13 +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 E742927C0C for ; Mon, 13 Jun 2016 12:28:12 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3B77F26651B; Mon, 13 Jun 2016 14:28:07 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7D343265A15; Mon, 13 Jun 2016 14:24:46 +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 64A1E26666E; Mon, 13 Jun 2016 14:24:45 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id F225C2654ED for ; Mon, 13 Jun 2016 14:22:44 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 13 Jun 2016 05:22:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,466,1459839600"; d="scan'208";a="826975861" Received: from vkoul-udesk7.iind.intel.com ([10.223.84.143]) by orsmga003.jf.intel.com with ESMTP; 13 Jun 2016 05:22:42 -0700 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Mon, 13 Jun 2016 17:59:04 +0530 Message-Id: <1465820944-14774-8-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465820944-14774-1-git-send-email-vinod.koul@intel.com> References: <1465820944-14774-1-git-send-email-vinod.koul@intel.com> Cc: patches.audio@intel.com, liam.r.girdwood@linux.intel.com, Vinod Koul , broonie@kernel.org, Jeeja KP , Senthilnathan Veppur Subject: [alsa-devel] [PATCH 7/7] ASoC: Intel: Add support for PM ops in bxt-rt298 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: Jeeja KP We need card to be early suspended and late resumed, so use prepare and complete for card suspend and resume. Signed-off-by: Jeeja KP Signed-off-by: Senthilnathan Veppur Signed-off-by: Vinod Koul --- sound/soc/intel/boards/bxt_rt298.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sound/soc/intel/boards/bxt_rt298.c b/sound/soc/intel/boards/bxt_rt298.c index 8b956500414b..2ef33b113bb5 100644 --- a/sound/soc/intel/boards/bxt_rt298.c +++ b/sound/soc/intel/boards/bxt_rt298.c @@ -454,10 +454,33 @@ static int broxton_audio_probe(struct platform_device *pdev) return devm_snd_soc_register_card(&pdev->dev, &broxton_rt298); } +/* + * we want the card to be suspend first and then platform driver. This + * allows the DAPM to tear down pipelines on suspend and then platform shuts + * down the DSP. For this use .prepare for suspending card + * + * Similarly, use complete to let DSP download firmware first and then sync + * DAPM and restore pipelines to DSP + */ +static void broxton_rt298_complete(struct device *dev) +{ + snd_soc_resume(dev); +} + +static const struct dev_pm_ops broxton_pm_ops = { + .prepare = snd_soc_suspend, + .complete = broxton_rt298_complete, + .freeze = snd_soc_suspend, + .thaw = snd_soc_resume, + .poweroff = snd_soc_poweroff, + .restore = snd_soc_resume, +}; + static struct platform_driver broxton_audio = { .probe = broxton_audio_probe, .driver = { .name = "bxt_alc298s_i2s", + .pm = &broxton_pm_ops, }, }; module_platform_driver(broxton_audio)