From patchwork Mon Apr 8 19:41:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 13621540 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1DAC145B3F for ; Mon, 8 Apr 2024 19:41:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712605320; cv=none; b=I2e116CYNRVZjDypzD6TTBFpRAr5MIPBdQ5QfJ9ATwWm4Fw9YO4Bn3rHa+9Uz1NaQD5UdqLeLt8/oK8C7pRumhWZS9hsdp8cm6aPl4+SGB9fm/xZWQhoGWxDFn4dINah9Qose1mkekhtc8kzjDZ467wO7o5D/nQ7uAh7EMnZFkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712605320; c=relaxed/simple; bh=lgpGHDSMO/jymB7XcbSgi2uDFuRy34d9y6Oa8ykJU5I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=o8Q4iSo7OcV9bg+XIqY8P6SlEaUyEiC2akpXpbEioXKkQqJKVNIGHdbDYr7ex1QBUGg26389YcFGpj7RpB7opWlIGwBKmBBE4NhFDRQAKMKEuVy7JAVMdhpZE0BhfC9zFjuX7JPn83p/Z5pz34M5oVMDF1cLHE/UkVPUskDuSJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SyCNmPcK; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SyCNmPcK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712605319; x=1744141319; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lgpGHDSMO/jymB7XcbSgi2uDFuRy34d9y6Oa8ykJU5I=; b=SyCNmPcKnUD2aAXXZlqRsg6FdWPlBj9S9uZpxSnHSRk4/FIOQuwY79Yc lOoXiYAs4iBrjamFpWO6e9WNYvyG5UdMEq6LKIlCKYs7xYtQ9mPWWUmiX ki7WP6p1prQKMavUewnG+jPi/F7HEBvJTIwlxr5UUlNlwXPgDhuXhpDWv aSf5JOrLnPlcuvkJM3WH7c/venmPe0E6HFDyohseEG3/Ax2iDzT1oyEGB +rzYNomLs3We8w/U64EAu0zZjdZuLr10l4U8VweI+i70Uy5DCV4PPYzcj vVZUH7GZulAezS1TMWI5ceNvaRZNQYZb6HK5NYBHE5HyiiBXNv5w/9v/W Q==; X-CSE-ConnectionGUID: CdA1CXHmTKCMKBx4Ha0/3w== X-CSE-MsgGUID: EntLhXbZQXmugYwvqPJmTg== X-IronPort-AV: E=McAfee;i="6600,9927,11038"; a="30390458" X-IronPort-AV: E=Sophos;i="6.07,187,1708416000"; d="scan'208";a="30390458" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 12:41:58 -0700 X-CSE-ConnectionGUID: DhMqwUIdS5aOu8QYFIz38w== X-CSE-MsgGUID: DfkuWC8BRvaSacd7MNWDCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,187,1708416000"; d="scan'208";a="24776969" Received: from aikuseru-mobl1.amr.corp.intel.com (HELO pbossart-mobl6.lan) ([10.212.40.188]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 12:41:58 -0700 From: Pierre-Louis Bossart To: linux-sound@vger.kernel.org Cc: alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, Ranjani Sridharan , Uday M Bhat , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 2/3] ASoC: SOF: pcm: Restrict DSP D0i3 during S0ix to IPC3 Date: Mon, 8 Apr 2024 14:41:46 -0500 Message-Id: <20240408194147.28919-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240408194147.28919-1-pierre-louis.bossart@linux.intel.com> References: <20240408194147.28919-1-pierre-louis.bossart@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Ranjani Sridharan Introduce a new field in struct sof_ipc_pcm_ops that can be used to restrict DSP D0i3 during S0ix suspend to IPC3. With IPC4, all streams must be stopped before S0ix suspend. Reviewed-by: Uday M Bhat Reviewed-by: Bard Liao Signed-off-by: Ranjani Sridharan Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/ipc3-pcm.c | 1 + sound/soc/sof/pcm.c | 13 ++++++------- sound/soc/sof/sof-audio.h | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sound/soc/sof/ipc3-pcm.c b/sound/soc/sof/ipc3-pcm.c index 35769dd7905e..af0bf354cb20 100644 --- a/sound/soc/sof/ipc3-pcm.c +++ b/sound/soc/sof/ipc3-pcm.c @@ -434,4 +434,5 @@ const struct sof_ipc_pcm_ops ipc3_pcm_ops = { .trigger = sof_ipc3_pcm_trigger, .dai_link_fixup = sof_ipc3_pcm_dai_link_fixup, .reset_hw_params_during_stop = true, + .d0i3_supported_in_s0ix = true, }; diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 4e11df6b4823..8fca4b0d63de 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -312,14 +312,13 @@ static int sof_pcm_trigger(struct snd_soc_component *component, ipc_first = true; break; case SNDRV_PCM_TRIGGER_SUSPEND: - if (sdev->system_suspend_target == SOF_SUSPEND_S0IX && + /* + * If DSP D0I3 is allowed during S0iX, set the suspend_ignored flag for + * D0I3-compatible streams to keep the firmware pipeline running + */ + if (pcm_ops && pcm_ops->d0i3_supported_in_s0ix && + sdev->system_suspend_target == SOF_SUSPEND_S0IX && spcm->stream[substream->stream].d0i3_compatible) { - /* - * trap the event, not sending trigger stop to - * prevent the FW pipelines from being stopped, - * and mark the flag to ignore the upcoming DAPM - * PM events. - */ spcm->stream[substream->stream].suspend_ignored = true; return 0; } diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index f4134257789e..2aeb269af752 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -117,6 +117,7 @@ struct snd_sof_dai_config_data { * triggers. The FW keeps the host DMA running in this case and * therefore the host must do the same and should stop the DMA during * hw_free. + * @d0i3_supported_in_s0ix: Allow DSP D0I3 during S0iX */ struct sof_ipc_pcm_ops { int (*hw_params)(struct snd_soc_component *component, struct snd_pcm_substream *substream, @@ -136,6 +137,7 @@ struct sof_ipc_pcm_ops { bool reset_hw_params_during_stop; bool ipc_first_on_start; bool platform_stop_during_hw_free; + bool d0i3_supported_in_s0ix; }; /**