From mboxrd@z Thu Jan 1 00:00:00 1970 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 F2748C3DA78 for ; Tue, 17 Jan 2023 12:17:51 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C8C1665E7; Tue, 17 Jan 2023 13:16:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C8C1665E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673957869; bh=GDhYxnt8fQxO9Nc2xcOUlxz8t8IQCPNDuqGwdo8iZko=; h=From:To:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=IYLGzaj7TQpcNxjKQkYWiqkWwXbV3gMCkkuIBe+mtq+e1ic6bBK9fvsL1JAdsgQfS 13UgOEJiFyg5NMo9oD+HbD8mYGqSqowHtvZyvyI+AAWYPyYdFnqsIUrFcUCH7jcoWq wH6s+1yDyq60KCdDzpw8OpbKf/W/By53bONM3lRw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D91E1F804DE; Tue, 17 Jan 2023 13:16:43 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CC4BDF8023A; Tue, 17 Jan 2023 13:16:41 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 82CBDF8023A for ; Tue, 17 Jan 2023 13:16:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 82CBDF8023A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JNTDOiGF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673957800; x=1705493800; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GDhYxnt8fQxO9Nc2xcOUlxz8t8IQCPNDuqGwdo8iZko=; b=JNTDOiGF0pr1+NN3GpBuL+xd9GdUCmJK3/R9nKSpwx1gAW22hVruEztf FzfgZfnPEfyQB922LOCW0VxoLtaIAnlVZjaOH8iNtpmAhwpwE8ZfvomJL rbXvPjU3wWLj6604AnryAoceVy6u9ba93nZJ7riq0yef6rlhI86ODGfvx FaCn9wdaVKnkhmyAMUrflIqCjE9QAPhvB5CawGyNyXSoCYTDljIPiBsOT ClqGr2xytI6K0a+nLD76g59r6r33B5GrEciHDRqw7TVUue2ZktZDwpSKP d7bNelun9pH5WEtn1v8fdkmr7Utn6+0IV9ZJl31+K5SxTgKnBWPE27Ocx A==; X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="389180053" X-IronPort-AV: E=Sophos;i="5.97,222,1669104000"; d="scan'208";a="389180053" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2023 04:16:13 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="988104390" X-IronPort-AV: E=Sophos;i="5.97,222,1669104000"; d="scan'208";a="988104390" Received: from izakharo-mobl1.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.14.16]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2023 04:16:11 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH] ASoC: SOF: ipc4-topology: No need to unbind routes within a pipeline Date: Tue, 17 Jan 2023 14:16:15 +0200 Message-Id: <20230117121615.25690-1-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.intel.com, rander.wang@intel.com, ranjani.sridharan@linux.intel.com, yung-chuan.liao@linux.intel.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Ranjani Sridharan The FW currently ignores unbinding routes if the source and sink widgets belong to the same pipeline. So no need to send the IPC at all in the first place. Signed-off-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Bard Liao Reviewed-by: Rander Wang Signed-off-by: Peter Ujfalusi --- sound/soc/sof/ipc4-topology.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index 59f4d42f9011..89f2dc4f564d 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -1744,12 +1744,19 @@ static int sof_ipc4_route_free(struct snd_sof_dev *sdev, struct snd_sof_route *s struct sof_ipc4_fw_module *sink_fw_module = sink_widget->module_info; struct sof_ipc4_msg msg = {{ 0 }}; u32 header, extension; - int ret; + int ret = 0; dev_dbg(sdev->dev, "unbind modules %s:%d -> %s:%d\n", src_widget->widget->name, sroute->src_queue_id, sink_widget->widget->name, sroute->dst_queue_id); + /* + * routes belonging to the same pipeline will be disconnected by the FW when the pipeline + * is freed. So avoid sending this IPC which will be ignored by the FW anyway. + */ + if (src_widget->pipe_widget == sink_widget->pipe_widget) + goto out; + header = src_fw_module->man4_module_entry.id; header |= SOF_IPC4_MOD_INSTANCE(src_widget->instance_id); header |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_MOD_UNBIND); @@ -1768,7 +1775,7 @@ static int sof_ipc4_route_free(struct snd_sof_dev *sdev, struct snd_sof_route *s if (ret < 0) dev_err(sdev->dev, "failed to unbind modules %s -> %s\n", src_widget->widget->name, sink_widget->widget->name); - +out: sof_ipc4_put_queue_id(sink_widget, sroute->dst_queue_id, SOF_PIN_TYPE_SINK); sof_ipc4_put_queue_id(src_widget, sroute->src_queue_id, SOF_PIN_TYPE_SOURCE); -- 2.39.0