Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2116652imm; Sat, 18 Aug 2018 11:17:19 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzf9tYWNGqA1c0WWad+LjyK6Jnw1whXLlWpW6u4MAiVUdMNJxmuZTVEarVA+2H+4N+QJ8Hl X-Received: by 2002:a63:dd09:: with SMTP id t9-v6mr37059645pgg.370.1534616239490; Sat, 18 Aug 2018 11:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534616239; cv=none; d=google.com; s=arc-20160816; b=BCguWViI6JVXavsqJrjJVQ2dFMoXSULuld1Ei/tGKued1TjSckCD8/i/6YUm0CSCsG uom6O1BXF2Fp0N+i9A/PH0MOIfAxtC6d8iZXa46XIAjJS9vjWvIBvGlmZC4i0XwKXQu2 fIOZhSCx7+a4i4cO5h7ph6OnOLG1z9OEdTzDJdcmvXK9j88DNdH6AIAYgIXyjrD0nt6o vEWPv5DQHjKV5yWuYGKdozN7MO1n4DTLyt5DMq/7haROkdR7tVjNhhtjtG1o4qY6BwFx 482UDfGqaFdLiIJEpdwh9tJ2cltUZ+1GSz4zHpE/0HAV4ZnlByx2mk2MuUtGLKU47y+f CRPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=SOH8LTyqN2GaIWRiLDNyw8QGnXnNfaNvH0FxaI+Y60U=; b=bsN6++mTvPB1LR6D7Uh9TIOPQqCNtXoCtinr35k2ckjU3ue17hSOjqmkI01YAJPaVr E4AEe6tZTRgZ4tIO16RwCJPZ/XclwmADg0R7NH+CI+aSkFWnyHBKSqfFz0QNNVmcXxIw ok2U+3Dvcc55B2BvyMltbpbBAA57vw4ESEgjT726tLQRcEBf3NmgaddwYG3ivxt8b4Tj h8ZAYDD78xqURxb2nPjxCut6RBcwJOz75455vjmKPGFQF4AbkBWBhcx5I45KXqR70JbP WmnJDllccmn90Xf8se3BcPFXpD71L8tAGUN4lRUgqbWDYMbJnjDcMjtnmHD7MMrh3Enq VliA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24-v6si4926014pgj.158.2018.08.18.11.17.04; Sat, 18 Aug 2018 11:17:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726473AbeHRVYe (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.7.4