Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3971611pxb; Tue, 25 Jan 2022 00:18:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLbITfO5XIbA5rr4CZmvg1NRGTbv9Jm9/D2SMFIukMqg4LSzhCwbSAEewJ7ohspH4YEFra X-Received: by 2002:a62:64d4:0:b0:4c9:6871:59b2 with SMTP id y203-20020a6264d4000000b004c9687159b2mr7485882pfb.31.1643098739240; Tue, 25 Jan 2022 00:18:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643098739; cv=none; d=google.com; s=arc-20160816; b=GY2I8R+++qb9GkO1WXkLC7VQdWwUCj7fJGeB1+VRimZr4JHzeCIZNEODcT8W8sUBmO ML4ScsUyLdqYR65KdeyVU2Jh/XKrkEi0rDSqpnuW6qD9UhHk4AtxWJ4Wx7EQYiJHdQWZ oHDUAf4vpodbUyHuMnKYQ8F2Pryzh3CwqrU/bv5ET12XjkkzpwSI4uXrnEEAygxL9m0r YIe9O/2xPEa5Kmspde/Z+5At2S80YtuDTfyNRkTKRxHmnSLM4d6DknCg2NJHLUX29Ond mI8W4Q05kZ4hWl7OanBtVvInv700Z5zM0VGNYpRBMCsxoTIknimDFs2h0uCTfmV1h7Bz V4Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QPVrqb/oVENlQXhCnT4Z4CZqi2Lv+hQ8/B1YaxykZ6c=; b=O8ccK0sejJT6GYYRvH7u0jvdq8z64yVHU9xubBrnUEyDQ+hdwlDx68x13m0ILrAQFn oL1KjVe7wj87EmNrSwBkEDG7EC+rmuBhy2tKaeAFZlak+r2NLi5zGlzPmfKwyWL0GJKF 6qeEW6dTDA/RGqzTQ5D9N5m/AKqjQU1yn7Tt0My5Fz8Rmns62qCl9RlBh/gU/mntQc4e zeCG6vcf2+SBNIIZoxhZcXE+UfVuuJQ8uieovNJPFKlzOy0BUYKP365kyGTsTY9TBPsF 1YZ3hXGfUlnfPCAkt++f/1qS36ZP1i0UJ+TIBzbu3iB2MiAoR5Wd1fd8tnGjgfGZF9Ta IrMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BOWLDC0d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k27si11587950pgf.723.2022.01.25.00.18.47; Tue, 25 Jan 2022 00:18:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BOWLDC0d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3412716AbiAYAhj (ORCPT + 99 others); Mon, 24 Jan 2022 19:37:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2366202AbiAXXwa (ORCPT ); Mon, 24 Jan 2022 18:52:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECE79C07A95E; Mon, 24 Jan 2022 13:45:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E75A612E5; Mon, 24 Jan 2022 21:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75912C340E4; Mon, 24 Jan 2022 21:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060712; bh=SOfb4C2ObNwB0Fx6quXOL5rM5gjVI3KB+Of+5+kXXrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BOWLDC0dZFBqo8zIK/cI1QityxP0Kxts4s1oqV6aCqo4Ue/Jzhknodkr6ha1dudeq kjYpZstZe8ryned15u9NfzTS0C1lmc+6u6f3ErulOwLPRaub5bUXj/QklLpqIfhnYT YI0k0vpDaUPiI47ONFLjBl4dOlXZWHSYcqP1Sg0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Ranjani Sridharan , Kai Vehmanen , Mark Brown Subject: [PATCH 5.16 1038/1039] ASoC: SOF: sof-audio: setup sched widgets during pipeline complete step Date: Mon, 24 Jan 2022 19:47:07 +0100 Message-Id: <20220124184200.174533144@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart commit 01429183f479c54c1b5d15453a8ce574ea43e525 upstream. Older firmware prior to ABI 3.19 has a dependency where the scheduler widgets need to be setup last. Moving the call to sof_widget_setup() before the pipeline_complete() call also helps remove the need for the 'reverse' direction when walking through the widget list - this was only working because of the topology macros but the topology does not require any order. Fixes: 5fcdbb2d45df ("ASoC: SOF: Add support for dynamic pipelines") Signed-off-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20211123171606.129350-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/sof/sof-audio.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -596,16 +596,25 @@ const struct sof_ipc_pipe_new *snd_sof_p int sof_set_up_pipelines(struct snd_sof_dev *sdev, bool verify) { + struct sof_ipc_fw_version *v = &sdev->fw_ready.version; struct snd_sof_widget *swidget; struct snd_sof_route *sroute; int ret; /* restore pipeline components */ - list_for_each_entry_reverse(swidget, &sdev->widget_list, list) { + list_for_each_entry(swidget, &sdev->widget_list, list) { /* only set up the widgets belonging to static pipelines */ if (!verify && swidget->dynamic_pipeline_widget) continue; + /* + * For older firmware, skip scheduler widgets in this loop, + * sof_widget_setup() will be called in the 'complete pipeline' loop + */ + if (v->abi_version < SOF_ABI_VER(3, 19, 0) && + swidget->id == snd_soc_dapm_scheduler) + continue; + /* update DAI config. The IPC will be sent in sof_widget_setup() */ if (WIDGET_IS_DAI(swidget->id)) { struct snd_sof_dai *dai = swidget->private; @@ -653,6 +662,12 @@ int sof_set_up_pipelines(struct snd_sof_ if (!verify && swidget->dynamic_pipeline_widget) continue; + if (v->abi_version < SOF_ABI_VER(3, 19, 0)) { + ret = sof_widget_setup(sdev, swidget); + if (ret < 0) + return ret; + } + swidget->complete = snd_sof_complete_pipeline(sdev, swidget); break; @@ -681,7 +696,7 @@ int sof_tear_down_pipelines(struct snd_s * sroute->setup because during suspend all streams are suspended and during topology * loading the sound card unavailable to open PCMs. */ - list_for_each_entry_reverse(swidget, &sdev->widget_list, list) { + list_for_each_entry(swidget, &sdev->widget_list, list) { if (swidget->dynamic_pipeline_widget) continue;