From patchwork Fri Dec 2 10:03:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 9458261 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 CA3E260236 for ; Fri, 2 Dec 2016 11:26:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC2EE284E3 for ; Fri, 2 Dec 2016 11:26:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEE4628533; Fri, 2 Dec 2016 11:26:35 +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 F0871284E3 for ; Fri, 2 Dec 2016 11:26:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 87C592677C7; Fri, 2 Dec 2016 12:26:31 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 33652266499; Fri, 2 Dec 2016 12:24:13 +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 CE3CA267795; Fri, 2 Dec 2016 10:54:10 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 2F95B267783 for ; Fri, 2 Dec 2016 10:54:07 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP; 02 Dec 2016 01:54:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,729,1477983600"; d="scan'208";a="36453258" Received: from vkoul-udesk7.iind.intel.com ([10.223.84.143]) by orsmga004.jf.intel.com with ESMTP; 02 Dec 2016 01:54:03 -0800 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Fri, 2 Dec 2016 15:33:44 +0530 Message-Id: <1480673024-28608-1-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.9.1 Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com, broonie@kernel.org, Vinod Koul , Senthilnathan Veppur Subject: [alsa-devel] [PATCH] ASoC: Intel: Add pre & post suspend calls in bxt machine 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 We need to disable jack detection before entering suspend and enable it after resume. This was essential as headphone jack widget will always remain ON if a jack is inserted and this results in no audio after system resumes from a suspend. Signed-off-by: Senthilnathan Veppur Signed-off-by: Vinod Koul --- sound/soc/intel/boards/bxt_rt298.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sound/soc/intel/boards/bxt_rt298.c b/sound/soc/intel/boards/bxt_rt298.c index 1309405b3808..b272b72e6a77 100644 --- a/sound/soc/intel/boards/bxt_rt298.c +++ b/sound/soc/intel/boards/bxt_rt298.c @@ -432,6 +432,33 @@ static int bxt_fe_startup(struct snd_pcm_substream *substream) }, }; +static int bxt_suspend_pre(struct snd_soc_card *card) +{ + struct snd_soc_codec *codec; + + list_for_each_entry(codec, &card->codec_dev_list, card_list) { + if (!strcmp(codec->component.name, "i2c-INT343A:00")) { + rt298_mic_detect(codec, NULL); + break; + } + } + return 0; +} + +static int bxt_resume_post(struct snd_soc_card *card) +{ + struct snd_soc_codec *codec; + + list_for_each_entry(codec, &card->codec_dev_list, card_list) { + if (!strcmp(codec->component.name, "i2c-INT343A:00")) { + rt298_mic_detect(codec, &broxton_headset); + break; + } + } + return 0; +} + + /* broxton audio machine driver for SPT + RT298S */ static struct snd_soc_card broxton_rt298 = { .name = "broxton-rt298", @@ -445,6 +472,9 @@ static int bxt_fe_startup(struct snd_pcm_substream *substream) .dapm_routes = broxton_rt298_map, .num_dapm_routes = ARRAY_SIZE(broxton_rt298_map), .fully_routed = true, + .suspend_pre = bxt_suspend_pre, + .resume_post = bxt_resume_post, + }; static int broxton_audio_probe(struct platform_device *pdev)