From patchwork Fri Jan 13 16:18:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?P=C3=A9ter_Ujfalusi?= X-Patchwork-Id: 642057 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 A0DA3C54EBE for ; Fri, 13 Jan 2023 16:19:47 +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 4F8F065F9; Fri, 13 Jan 2023 17:18:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4F8F065F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673626785; bh=riUTuc7sHJ+/+4lkWQSnkn1MW6HWbm771+vzimqcx1c=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=E/wrggIzgBhP4X0vd08OGSSCXYK1RXZLwYXuih6enwJARUun4VsO0jgFqzCT4j4Nr KjaIJIgFSwABrURJG9TCecF6g7f4dhCRAcCnVWeXqUSoWPp4nrrbU5U4ya1mfDd4x8 kkLMi1YeNWyHWhX/oc3f8V2WKSe1THt0/n8rncUU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E81C4F803DC; Fri, 13 Jan 2023 17:18:54 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 20EF9F803DC; Fri, 13 Jan 2023 17:18:53 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 C3CEAF803DC for ; Fri, 13 Jan 2023 17:18:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C3CEAF803DC 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=FTArcZEt DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673626731; x=1705162731; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=riUTuc7sHJ+/+4lkWQSnkn1MW6HWbm771+vzimqcx1c=; b=FTArcZEtZZmsrh/HlMw2aodT94z6huX/A3JI/rMEY8G5193hlWD2sljC duhrV1rELdaTywc0J0fq2uhH2lebxyaTgbOa5fhFFrTVYJGKTahus2vOY P9Dx0mywOubwURPO9e8oy5VdVNCpfn6iHogJGVQpNj/1mJjAuzjogF+sO PIAUVA4uS0mnqxDql35YSH6beQ5Z29p3i5szCgjx28MMKchs1dGlEUX3B kGJyufZAuUNrJQvHyXn+i9CMvmO/v6fLMbExi9DgdnEjKgm35C5SCg6ys xL0V/x2XnozXIfAynsguQEKBRFsc31gxcrfHqCj8wrWwF0RdDPidE/A/I Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="324087569" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="324087569" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 08:18:45 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="690547420" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="690547420" Received: from rjmaskel-mobl1.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.27.128]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 08:18:42 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH 1/3] ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 Date: Fri, 13 Jan 2023 18:18:40 +0200 Message-Id: <20230113161842.22059-2-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113161842.22059-1-peter.ujfalusi@linux.intel.com> References: <20230113161842.22059-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 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, angelogioacchino.delregno@collabora.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Bard Liao We should unprepare the widget if its use_count = 1. Fixes: 9862dcf70245 ("ASoC: SOF: don't unprepare widget used other pipelines") Signed-off-by: Bard Liao Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Peter Ujfalusi --- sound/soc/sof/sof-audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index e1ab8380e7d8..068501ed7951 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -274,7 +274,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg struct snd_soc_dapm_path *p; /* return if the widget is in use or if it is already unprepared */ - if (!swidget->prepared || swidget->use_count > 1) + if (!swidget->prepared || swidget->use_count > 0) return; widget_ops = tplg_ops ? tplg_ops->widget : NULL; From patchwork Fri Jan 13 16:18:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?P=C3=A9ter_Ujfalusi?= X-Patchwork-Id: 642613 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 0436EC54EBD for ; Fri, 13 Jan 2023 16:19:55 +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 02FCC65EF; Fri, 13 Jan 2023 17:19:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 02FCC65EF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673626794; bh=RO2DxJpWKcs/biap7pUL0Svq85+wGUUs0mLIBKz6Tig=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=fmEB9r+6U8MAng9tqDiZWny2DHNujtmQ7HHcskXmIaMgz8HzWxvkeWh+6KWY6s19U RtP9YH+XHGIZ8/daYPSs911xf3/edveAszasdqq1oB8btAHMz7ntVnLY9pyY0XKBVW 5w4gG0xAXNN+cjk5NIU2z/t8feiFT8ZFp6ts75uU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 97298F804A9; Fri, 13 Jan 2023 17:18:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E5FA4F80539; Fri, 13 Jan 2023 17:18:54 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 B9860F803DC for ; Fri, 13 Jan 2023 17:18:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B9860F803DC 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=hjF720O8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673626733; x=1705162733; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RO2DxJpWKcs/biap7pUL0Svq85+wGUUs0mLIBKz6Tig=; b=hjF720O8bh4Sl/65g/j5xnwu4nfrjEDQBdXJ/UG7LqvECYzBSAeI85jx /xdASOIGDMV4x+tnILcnJlMG6IFPNWOdyVAFAC7TTkaPT8uaScJvMpIdZ iyaNhiir6jnWbesIVA8sRdQN3OW+H9GDce4RmPN6lJZWH7WdDJILg9tK8 cY1Krp4Vc6XV/rD+Lx4JiPhPw9CmgQjRPwXqayJakjL0fWqWWyRBM/4Xt qcg8U2ik6AvmbL/3g72NKz/HCLUxFIltV/TKOO13cZi/4QmjPwUEO8QKU HbYUYKd3VnqcLYA9eV9UAh8tcCSn1PwayVYZ4N97/0eb1ZFVwWJf9QcSj g==; X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="324087588" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="324087588" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 08:18:48 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="690547430" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="690547430" Received: from rjmaskel-mobl1.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.27.128]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 08:18:45 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH 2/3] ASoC: SOF: sof-audio: keep prepare/unprepare widgets in sink path Date: Fri, 13 Jan 2023 18:18:41 +0200 Message-Id: <20230113161842.22059-3-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113161842.22059-1-peter.ujfalusi@linux.intel.com> References: <20230113161842.22059-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 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, angelogioacchino.delregno@collabora.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Bard Liao The existing code return when a widget doesn't need to prepare/unprepare. This will prevent widgets in the sink path from being prepared/unprepared. Link: https://github.com/thesofproject/linux/issues/4021 Signed-off-by: Bard Liao Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Peter Ujfalusi --- sound/soc/sof/sof-audio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 068501ed7951..721de96fdb83 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -273,9 +273,9 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg const struct sof_ipc_tplg_widget_ops *widget_ops; struct snd_soc_dapm_path *p; - /* return if the widget is in use or if it is already unprepared */ + /* skip if the widget is in use or if it is already unprepared */ if (!swidget->prepared || swidget->use_count > 0) - return; + goto sink_unprepare; widget_ops = tplg_ops ? tplg_ops->widget : NULL; if (widget_ops && widget_ops[widget->id].ipc_unprepare) @@ -284,6 +284,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg swidget->prepared = false; +sink_unprepare: /* unprepare all widgets in the sink paths */ snd_soc_dapm_widget_for_each_sink_path(widget, p) { if (!p->walking && p->sink->dobj.private) { From patchwork Fri Jan 13 16:18:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?P=C3=A9ter_Ujfalusi?= X-Patchwork-Id: 642056 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 4E64FC54EBE for ; Fri, 13 Jan 2023 16:20:01 +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 551386A71; Fri, 13 Jan 2023 17:19:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 551386A71 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673626799; bh=gR3lFRuixolSVgSLsxswUCJzS4/2DJJ0wiJyBOY5QgU=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=t7fUdDuk5mxw3ldL1vQA5sK6dXrj/rAnpdlsThksanymYIrY83rFzQZTCSARf+tah fzd+jWlFN6SInHCVcK5/ykgFVDInkF/ATVmvcGN1AdkKE74K6N612uiz3bx0yX8EOa JunxcGdaKzsaEMe4M1pdszmGKcj7xoLNLEPRLp8k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3F8B5F8053A; Fri, 13 Jan 2023 17:18:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 706D8F8053D; Fri, 13 Jan 2023 17:18:55 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 555C0F8019B for ; Fri, 13 Jan 2023 17:18:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 555C0F8019B 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=FTSNl92I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673626734; x=1705162734; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gR3lFRuixolSVgSLsxswUCJzS4/2DJJ0wiJyBOY5QgU=; b=FTSNl92Iw414m+rQxG1bJPshJ5P9dK7caM1X6PchCP8MvOMUlMSOXW54 nJ5q5R1EI/EsWRNOvBftkJ8CPn7qHWrkHUY9OeWYZ1pnCmU41ulFo/yPk AyCXhgrRS7dQExLUE/Uk92YEmXKl69a3kIea6PQdWXv2IS6X4ziI2kGDX uRGLqd7fZMQQrcVYMyVP56p3qveXJ3Y5LqbvsFVjvOuhoEKT2GP+j1ik/ sK/mUA1djPkM5N+YDsyw46Y+GdYEsHkU5E2y8GRshAxu2TkcTxTsN/LWi CfLMCDZwr8EN6fQ3I2C47GTcXMpWho5/ektgQs2V/MMErRvDdHyzJeQUF g==; X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="324087603" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="324087603" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 08:18:51 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10589"; a="690547439" X-IronPort-AV: E=Sophos;i="5.97,214,1669104000"; d="scan'208";a="690547439" Received: from rjmaskel-mobl1.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.27.128]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2023 08:18:48 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Subject: [PATCH 3/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Date: Fri, 13 Jan 2023 18:18:42 +0200 Message-Id: <20230113161842.22059-4-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113161842.22059-1-peter.ujfalusi@linux.intel.com> References: <20230113161842.22059-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 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, angelogioacchino.delregno@collabora.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Ranjani Sridharan Skip preparing/unpreparing widgets if the swidget pointer is NULL. This will be true in the case of virtual widgets in topology that were added for reusing the legacy HDA machine driver with SOF. Signed-off-by: Ranjani Sridharan Reviewed-by: Rander Wang Signed-off-by: Peter Ujfalusi --- sound/soc/sof/sof-audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 721de96fdb83..5c878788dedb 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -274,7 +274,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg struct snd_soc_dapm_path *p; /* skip if the widget is in use or if it is already unprepared */ - if (!swidget->prepared || swidget->use_count > 0) + if (!swidget || !swidget->prepared || swidget->use_count > 0) goto sink_unprepare; widget_ops = tplg_ops ? tplg_ops->widget : NULL; @@ -311,7 +311,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget if (!widget_ops) return 0; - if (!widget_ops[widget->id].ipc_prepare || swidget->prepared) + if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared) goto sink_prepare; /* prepare the source widget */