From patchwork Mon Oct 17 20:49:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 615694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0F65C4332F for ; Mon, 17 Oct 2022 20:51:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DA8BA8ABA; Mon, 17 Oct 2022 22:50:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DA8BA8ABA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666039900; bh=9fgWs/EI3IVdQXFklmFduZe6R0awE7BsvexEGlGKXhY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JoPlsShn831VQpvjRZYl6ugtgYNUWnp+o4aCuI+8FxOQWHlxDTrfc+AVGx5VqGn8X xuyHDew3S0WNyeKzhOPrKRqwqoDsd74BqCKYYeAzg29HHMT+wb5igrqNYQTBK3o27v 0PHO7cQRNNMEuo0Ss9qjDQDkf7dgSk/GlGNigLGE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5456EF80533; Mon, 17 Oct 2022 22:50:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4A01AF804D9; Mon, 17 Oct 2022 22:50:04 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 23399F800AA for ; Mon, 17 Oct 2022 22:49:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 23399F800AA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NyuG8f9O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666039798; x=1697575798; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9fgWs/EI3IVdQXFklmFduZe6R0awE7BsvexEGlGKXhY=; b=NyuG8f9O5PcvPmSjw59/iUtDEUHA1EQofroZhfuT9v86THWjHGc28vws 3WBjsgl5hKSnJ7XpnEUWFzz0QEMIRz1pGqSkyh2Vrq/pEcFfJ39kPJODo 3A7mQ/RMPgg9H/xlFMIHShGxA7CbHDS4HxE1GDg1NTOE3KloOE7LMiHDi 1G5CtsSk6rRQI2smUBa1bqEvJxSjc3QSn3BMR9FfOAjOYUuyuEWEilZYp odUdhsX0/+UNAR0ogOCoM4VIIo7Gky+nVCivXZEUgynSWUpQ4ruiGgNpI woZXl44dxU3Sndsqiz4FzipgGfVo8O65oARVD5FGt9H4SWdKjaN0oRKvV g==; X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="293286373" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="293286373" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 13:49:53 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="717633050" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="717633050" Received: from cmontgom-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.54.140]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 13:49:52 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 1/3] ASoC: Intel: Skylake: simplify S3 resume flows Date: Mon, 17 Oct 2022 15:49:44 -0500 Message-Id: <20221017204946.207986-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221017204946.207986-1-pierre-louis.bossart@linux.intel.com> References: <20221017204946.207986-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Commit cce6c149eba3a ("ASoC: Intel: Skylake: add link management") added a perfectly logical/symmetrical link handling for 'suspend_active' aka S0ix However that commit also added a less obvious part, where during S3 resume the code will "turn off the links which are off before suspend" as well as stop the cmd_io which is not started. This sequence looks completely unnecessary and possibly wrong, remove it. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi --- sound/soc/intel/skylake/skl.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index bbba2df33aaf0..1cfdb04f589fe 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -387,15 +387,6 @@ static int skl_resume(struct device *dev) snd_hdac_bus_init_cmd_io(bus); } else { ret = _skl_resume(bus); - - /* turn off the links which are off before suspend */ - list_for_each_entry(hlink, &bus->hlink_list, list) { - if (!hlink->ref_count) - snd_hdac_ext_bus_link_power_down(hlink); - } - - if (!bus->cmd_dma_state) - snd_hdac_bus_stop_cmd_io(bus); } return ret; From patchwork Mon Oct 17 20:49:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 616095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A57FC4332F for ; Mon, 17 Oct 2022 20:51:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 467C28AC2; Mon, 17 Oct 2022 22:50:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 467C28AC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666039875; bh=E09SRbz4vBuAa84CL2MW6hIRtPdHq2/QWfpLM1uwHco=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=IU4v6xAjbcZ2pz2vMtKDgQwUVNANW8tr9TxE7umO05wwxDVSWOdNKZYoZ4/RsDr1N KktD/oJe6CTozlmf0vL8dwSwDqBQQvx2zXyqKX0Vhg6UkrxZ5Uws7FRTMJwQvb5gdS VsPpJlrzi/VAGgdHSX8mvTX/SCgdETxgHI+LUHOE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 73D93F80149; Mon, 17 Oct 2022 22:50:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D1128F80533; Mon, 17 Oct 2022 22:50:03 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3AB66F8025E for ; Mon, 17 Oct 2022 22:49:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3AB66F8025E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SRD4Oh4K" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666039798; x=1697575798; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E09SRbz4vBuAa84CL2MW6hIRtPdHq2/QWfpLM1uwHco=; b=SRD4Oh4KGR7LT4NXRAu6I6QHUi4qV3rd923AI5MD/402u15DI1/QyUYT fm/z0V9etj3JRAy6HyxxfINp6Av6sVFUV3GCKdvbdTB1rjOx8cTV6gopc hhnE0KxLYPiFNCssofnKc8d/M/VRPmrOKTUF/Bup61A5y7W80uGe2VHcf qKOOkhwCp9njVz2UQOPi7OOarh+bZS9N45yJOuXjgEsPQURJPF21beKqn fXfSuDeNsbysn5DJMQmgE8XBOBfuAMe416KHywsBm261/KceANUqQAVL1 Jn1w8xntKHxd7AdJQVm5Bt7cts3/H4Sa4kfK14O7jM+HxZN5MdSYl5UcV g==; X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="293286375" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="293286375" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 13:49:54 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="717633055" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="717633055" Received: from cmontgom-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.54.140]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 13:49:53 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 2/3] ASoC: Intel: avs: simplify S3 resume flows Date: Mon, 17 Oct 2022 15:49:45 -0500 Message-Id: <20221017204946.207986-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221017204946.207986-1-pierre-louis.bossart@linux.intel.com> References: <20221017204946.207986-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The same code was directly copied from the skylake driver where it was already questionable. Remove and simplify the flow. Tested-by: Cezary Rojewski Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi --- sound/soc/intel/avs/core.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c index bb0719c58ca49..58a51361c4b11 100644 --- a/sound/soc/intel/avs/core.c +++ b/sound/soc/intel/avs/core.c @@ -580,7 +580,6 @@ static int __maybe_unused avs_suspend_common(struct avs_dev *adev) static int __maybe_unused avs_resume_common(struct avs_dev *adev, bool purge) { struct hdac_bus *bus = &adev->base.core; - struct hdac_ext_link *hlink; int ret; snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true); @@ -595,16 +594,6 @@ static int __maybe_unused avs_resume_common(struct avs_dev *adev, bool purge) return ret; } - /* turn off the links that were off before suspend */ - list_for_each_entry(hlink, &bus->hlink_list, list) { - if (!hlink->ref_count) - snd_hdac_ext_bus_link_power_down(hlink); - } - - /* check dma status and clean up CORB/RIRB buffers */ - if (!bus->cmd_dma_state) - snd_hdac_bus_stop_cmd_io(bus); - return 0; } From patchwork Mon Oct 17 20:49:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 616094 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD483C433FE for ; Mon, 17 Oct 2022 20:51:50 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 953808AD6; Mon, 17 Oct 2022 22:50:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 953808AD6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666039908; bh=mOvIwdn+W7SeD5qeY+W1ifTb6gz0O+wAVKDn2Mvw9ZE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rcyk7uCoYOgKAsN+mA8/kaghmdTWanb/Q+b5oatQw5zaP35ZdHnAc7a94McDpWNBq wlb/UR6kWmbtLcRS7cKNbjGpwXv4w9zJwHunUzh2NZ+pAGDnMPa4G4Qy0Tl76qxUiC HmPYtPmsIOcoDMLN86msL06AHBq9gzzTGNvRflgI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4822BF80552; Mon, 17 Oct 2022 22:50:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E7CA4F804FE; Mon, 17 Oct 2022 22:50:08 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2B1BBF804FE for ; Mon, 17 Oct 2022 22:49:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2B1BBF804FE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MRyjPr10" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666039800; x=1697575800; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mOvIwdn+W7SeD5qeY+W1ifTb6gz0O+wAVKDn2Mvw9ZE=; b=MRyjPr10GQsYzo/PMzbHehzs0TI3Or+ILh9UEV2XpNjWP/1BLbNTAqUV 9H6iRcQOfprWtBz6dNk6PulCq0P57MZB/Wobi8givPpVzvhs4mJueDrzp TMfj5/IPOtCWxlL0O68nR5mgUAYn6WZCVaCGj57jA/KWAgy8KMBDji/dy +kxI1dB2QitZfqygCM+brzGL8Na6xbkfPsnJf+p5qraZuTN3WZpOr4yad o3FCXOXwvLciljMYcc//QtcW59inVJZMasfjoVTF8LZ+qpNvVINBhnmFE D2Imx6YkchMK2Usl0YktJ8k6QzzsLYWXtCKKeOWDWstRnxDYoMeX5fck5 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="293286377" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="293286377" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 13:49:54 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="717633061" X-IronPort-AV: E=Sophos;i="5.95,192,1661842800"; d="scan'208";a="717633061" Received: from cmontgom-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.54.140]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 13:49:54 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 3/3] ASoC: SOF: Intel: hda-dsp: simplify S3 resume flows Date: Mon, 17 Oct 2022 15:49:46 -0500 Message-Id: <20221017204946.207986-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221017204946.207986-1-pierre-louis.bossart@linux.intel.com> References: <20221017204946.207986-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The flow contains surprising parts that seem to have been inspired by the Skylake driver. During a resume from S3, the state of the links prior to suspend should not matter. One would have to assume that the links are powered down anyways prior to suspend, and there is also no specific code that turns links on unconditionally on resume. Likewise, the snd_hdac_init_chip() routine will start the cmd_io handling, and it's not clear why we should care about the state of the DMA prior to suspend. This patch removes these two sequences to simplify the flow. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi --- sound/soc/sof/intel/hda-dsp.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index 3c76f843454b6..799c50fe24dab 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -677,10 +677,6 @@ static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend) static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume) { -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - struct hdac_bus *bus = sof_to_bus(sdev); - struct hdac_ext_link *hlink = NULL; -#endif int ret; /* display codec must be powered before link reset */ @@ -707,16 +703,6 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume) if (sdev->system_suspend_target == SOF_SUSPEND_NONE) hda_codec_jack_check(sdev); } - - /* turn off the links that were off before suspend */ - list_for_each_entry(hlink, &bus->hlink_list, list) { - if (!hlink->ref_count) - snd_hdac_ext_bus_link_power_down(hlink); - } - - /* check dma status and clean up CORB/RIRB buffers */ - if (!bus->cmd_dma_state) - snd_hdac_bus_stop_cmd_io(bus); #endif /* enable ppcap interrupt */