From patchwork Sat Aug 18 18:12:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Anshuman" X-Patchwork-Id: 10569605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0ADCB13B6 for ; Sat, 18 Aug 2018 18:16:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFFF529EA2 for ; Sat, 18 Aug 2018 18:16:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E438B2A524; Sat, 18 Aug 2018 18:16:02 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94F6129EA2 for ; Sat, 18 Aug 2018 18:16:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726429AbeHRVYe (ORCPT ); Sat, 18 Aug 2018 17:24:34 -0400 Received: from mga06.intel.com ([134.134.136.31]:31121 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726219AbeHRVYd (ORCPT ); Sat, 18 Aug 2018 17:24:33 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Aug 2018 11:15:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,257,1531810800"; d="scan'208";a="81415605" Received: from anshuma1-pnp-server.iind.intel.com ([10.223.107.119]) by fmsmga004.fm.intel.com with ESMTP; 18 Aug 2018 11:14:11 -0700 From: Anshuman Gupta To: puneethx.prabhu@intel.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, rafael@kernel.org Cc: alsa-devel@alsa-project.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, anshuman.gupta@intel.com Subject: [PATCH v2 1/1] hdac-codec runtime suspended at PM:Suspend. Date: Sat, 18 Aug 2018 23:42:03 +0530 Message-Id: <1534615923-8541-2-git-send-email-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534615923-8541-1-git-send-email-anshuman.gupta@intel.com> References: <1534615923-8541-1-git-send-email-anshuman.gupta@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Keep hdac hdmi codec to be in runtime suspended while entering to system wide suspend. Currently hdac hdmi codec driver using its suspend and resume operation in prepare and complete PM callbacks, and it resumes the hd audio controller (parent of self) from runtime suspend and blocks the direct complete for hd audio controller. If hdac-codec is already in runtime suspend state skip its power down sequence in prepare, power up sequence in complete phase. It enables direct complete path for hdac-codec and hd audio controller PCI device. Signed-off-by: Anshuman Gupta --- Changes in v2 - Changed the commit message. - Using pm_runtime_suspended instead of pm_runtime_status_suspended in order to handle any race condition. sound/soc/codecs/hdac_hdmi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 84f7a7a..e965338 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -1859,6 +1859,9 @@ static int hdmi_codec_prepare(struct device *dev) struct hdac_ext_device *edev = to_hda_ext_device(dev); struct hdac_device *hdev = &edev->hdev; + if (pm_runtime_suspended(dev)) + return 1; + pm_runtime_get_sync(&edev->hdev.dev); /* @@ -1880,6 +1883,9 @@ static void hdmi_codec_complete(struct device *dev) struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev); struct hdac_device *hdev = &edev->hdev; + if (pm_runtime_suspended(dev)) + return; + /* Power up afg */ snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE, AC_PWRST_D0);