Message ID | 20240219093900.644574-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-71046-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1175579dyc; Mon, 19 Feb 2024 01:39:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWC4CKmdFVobREveBwu3negpsQdgYSIaGp22vK5+1qIILYpIo39+ya5JtV3l25WD7WzEOH+5siU58UXuPvned6aXWjVjg== X-Google-Smtp-Source: AGHT+IE+v6was4XwTa8cTgGcpj6A6juCy13N62JHC57MsoTueVNffD7uhhqDqflMeAFZ8ZHDVXLA X-Received: by 2002:a05:6808:1b14:b0:3c1:6005:156a with SMTP id bx20-20020a0568081b1400b003c16005156amr680991oib.3.1708335583566; Mon, 19 Feb 2024 01:39:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708335583; cv=pass; d=google.com; s=arc-20160816; b=Ehdz0xLcGd3emHlqxFkvyZSvhX3nE7T27SXnIHInpRVXIdA82jyOHCufgbulmcx3R9 t0wTh4O/lqH7ghEeMRqhjP+q/UCUWx8bS79JS1czpRWaxHwCyBEJ7DBouV+r4Zu1NwXP GgtsdZLGDv3mGzrRtgFLtoqYyUcW3HhvIQkYcQw+Dsxt2lNmA6a+jrHEm5ofUGsR2+L8 /Cq5V9tBYdbtNbxenJtBjgsS6TBvxG0nL3PST3s/4VJk1d9CEWDn+FFj/IVyhpWpFDw1 JWNTrViWcv7RsIe971cYTiBz+87udfMKM62YnWV61v5w/0XWrnu1ZltlPy1BQ7cVlAjY Lajg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=jPsx4ZkdTQxUo/dKG/txBZPRrRtU/fSvFEwT1X3ffMI=; fh=eqj/tWZIoJrbpMsztj9XJ+lDtgidZEf/IYItazy+nAQ=; b=EZKLlf/x7rlrrALqbBGS+Sp/ZQLY3QBP3c2MRN+CECrulpbQQb38G+lBTAl73rekka 2w6Xd5UkMScbdnmRujEtquNHCWkwYBnNpxcnzRGcv94x6nkECXznpeq0QM5Mx9+a7G/b fu17HofRnH1JBUi6evH3K9ZserK4Nd2ezmh+8ADmi8wQlr8s7bURS0XDNXiYi7muICjT j6GLUO81ydFwzlKGmxXwdOuoIivENdm6MS7e0gyyf1o30tha5qNK3iXlUs9tz/FO7NP4 EPD07oZqNp+mW3vTrxoEd0WnZyWrN87CxCfnvCHHBXb94k7YeRf9LY4c93tD4vMU1A8t wEaQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qQdv/c8W"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71046-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71046-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g28-20020a05620a219c00b00787548de250si4506278qka.386.2024.02.19.01.39.43 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 01:39:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71046-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qQdv/c8W"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71046-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71046-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5AF221C21229 for <ouuuleilei@gmail.com>; Mon, 19 Feb 2024 09:39:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 480D225605; Mon, 19 Feb 2024 09:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qQdv/c8W" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9969423772; Mon, 19 Feb 2024 09:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708335547; cv=none; b=mdpJvDTupyHk2VNDWjLkM8vmvcdSUuohkM/98zvvwObkVNfq12DR0URrapF7rt3BbXKvGHdqpfo+um3JBW/uL3sAniOzTI28gbsjYGAdJf7RAa3VUMmEXhYg+K4Ab8Qx1CMBbtVsIxTmX+I6CTez2lBCInIYU9v09Q1y0YniLjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708335547; c=relaxed/simple; bh=IbE2CDeEgw5qxef5aPRGuFLeArPxpFNa+l8ySOIF6G4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=B70rLh8v49GbMMKorC2EV51ELOrujhPiApcGqNVN6V7bTP8aSGGd6oIbj+FIYsrPaQzgezNyrTJ9WtlIWTbWvntwIswoKgQqtfDRlCxWh+sEHRcLx5m/yX8CpYK1ZvhKofBaw1ZTQoLFjFZQYJ+BbdRw5ZYclf8Mn3KuSCAmpb8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qQdv/c8W; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9927C433C7; Mon, 19 Feb 2024 09:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708335547; bh=IbE2CDeEgw5qxef5aPRGuFLeArPxpFNa+l8ySOIF6G4=; h=From:To:Cc:Subject:Date:From; b=qQdv/c8WkmDH1PuagjECgWbP68kn6jnVdsz8iq6XaV5j3IKTNz0MalEd0KRqpie+v T3U+Dsyi1oc9LnlaO04hejBfBoEYnPbYLqa0OgRRJ+NI8WRW2XpYd+t0wvESzkYKO1 s2YYWbqjRwv6wJE2lNBeB2pg1TD35pwJnm4GlSuLhHtXQ2GqBcR+doA5Yfb5fwD5mX 6A2jFWkkRNmxwlzBEedoI4rQKTILFPKrb5cn9iRbRlmHa3g2BActlGWh9qR2vkBdXc PwKFzqiJBbaEohoEhJr75KzJQI8f3HRSHDnf9yVt7IRebCz8XWDmyJdV22TLXeOmMX MmmostB39UfzQ== From: Arnd Bergmann <arnd@kernel.org> To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Liam Girdwood <lgirdwood@gmail.com>, Peter Ujfalusi <peter.ujfalusi@linux.intel.com>, Bard Liao <yung-chuan.liao@linux.intel.com>, Ranjani Sridharan <ranjani.sridharan@linux.intel.com>, Daniel Baluta <daniel.baluta@nxp.com>, Mark Brown <broonie@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de>, Kai Vehmanen <kai.vehmanen@linux.intel.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, Vijendar Mukunda <Vijendar.Mukunda@amd.com>, V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>, Venkata Prasad Potturu <venkataprasad.potturu@amd.com>, sound-open-firmware@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: SOF: amd: fix soundwire dependencies Date: Mon, 19 Feb 2024 10:38:45 +0100 Message-Id: <20240219093900.644574-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791319693040720514 X-GMAIL-MSGID: 1791319693040720514 |
Series |
ASoC: SOF: amd: fix soundwire dependencies
|
|
Commit Message
Arnd Bergmann
Feb. 19, 2024, 9:38 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de> The soundwire-amd driver has a bit of a layering violation requiring the SOF driver to directly call into its exported symbols rather than through an abstraction. The SND_SOC_SOF_AMD_SOUNDWIRE Kconfig symbol tries to deal with the dependency by selecting SOUNDWIRE_AMD in a complicated set of conditions, but gets it wrong for a configuration involving SND_SOC_SOF_AMD_COMMON=y, SND_SOC_SOF_AMD_ACP63=m, and SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE=m SOUNDWIRE_AMD=m, which results in a link failure: ld.lld: error: undefined symbol: sdw_amd_get_slave_info >>> referenced by acp-common.c ld.lld: error: undefined symbol: amd_sdw_scan_controller ld.lld: error: undefined symbol: sdw_amd_probe ld.lld: error: undefined symbol: sdw_amd_exit >>> referenced by acp.c >>> sound/soc/sof/amd/acp.o:(amd_sof_acp_remove) in archive vmlinux.a In essence, the SND_SOC_SOF_AMD_COMMON option cannot be built-in when trying to link against a modular SOUNDWIRE_AMD driver. Since CONFIG_SOUNDWIRE_AMD is a user-visible option, it really should never be selected by another driver in the first place, so replace the extra complexity with a normal Kconfig dependency in SND_SOC_SOF_AMD_SOUNDWIRE, plus a top-level check that forbids any of the AMD SOF drivers from being built-in with CONFIG_SOUNDWIRE_AMD=m. In normal configs, they should all either be built-in or all loadable modules anyway, so this simplification does not limit any real usecases. Fixes: d948218424bf ("ASoC: SOF: amd: add code for invoking soundwire manager helper functions") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- sound/soc/sof/amd/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On 19/02/24 15:08, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > The soundwire-amd driver has a bit of a layering violation requiring > the SOF driver to directly call into its exported symbols rather than > through an abstraction. > > The SND_SOC_SOF_AMD_SOUNDWIRE Kconfig symbol tries to deal with the > dependency by selecting SOUNDWIRE_AMD in a complicated set of conditions, > but gets it wrong for a configuration involving SND_SOC_SOF_AMD_COMMON=y, > SND_SOC_SOF_AMD_ACP63=m, and SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE=m > SOUNDWIRE_AMD=m, which results in a link failure: > > ld.lld: error: undefined symbol: sdw_amd_get_slave_info >>>> referenced by acp-common.c > ld.lld: error: undefined symbol: amd_sdw_scan_controller > ld.lld: error: undefined symbol: sdw_amd_probe > ld.lld: error: undefined symbol: sdw_amd_exit >>>> referenced by acp.c >>>> sound/soc/sof/amd/acp.o:(amd_sof_acp_remove) in archive vmlinux.a > In essence, the SND_SOC_SOF_AMD_COMMON option cannot be built-in when > trying to link against a modular SOUNDWIRE_AMD driver. > > Since CONFIG_SOUNDWIRE_AMD is a user-visible option, it really should > never be selected by another driver in the first place, so replace the > extra complexity with a normal Kconfig dependency in SND_SOC_SOF_AMD_SOUNDWIRE, > plus a top-level check that forbids any of the AMD SOF drivers from being > built-in with CONFIG_SOUNDWIRE_AMD=m. > > In normal configs, they should all either be built-in or all loadable > modules anyway, so this simplification does not limit any real usecases. Tested this patch. SOUNWIRE_AMD flag is not selected by default causing AMD SOF driver for ACP 6.3 platform is build without enabling SoundWire. > > Fixes: d948218424bf ("ASoC: SOF: amd: add code for invoking soundwire manager helper functions") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > sound/soc/sof/amd/Kconfig | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/sound/soc/sof/amd/Kconfig b/sound/soc/sof/amd/Kconfig > index c3bbe6c70fb2..2729c6eb3feb 100644 > --- a/sound/soc/sof/amd/Kconfig > +++ b/sound/soc/sof/amd/Kconfig > @@ -6,6 +6,7 @@ > > config SND_SOC_SOF_AMD_TOPLEVEL > tristate "SOF support for AMD audio DSPs" > + depends on SOUNDWIRE_AMD || !SOUNDWIRE_AMD > depends on X86 || COMPILE_TEST > help > This adds support for Sound Open Firmware for AMD platforms. > @@ -62,15 +63,14 @@ config SND_SOC_SOF_ACP_PROBES > > config SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE > tristate > - select SOUNDWIRE_AMD if SND_SOC_SOF_AMD_SOUNDWIRE != n > select SND_AMD_SOUNDWIRE_ACPI if ACPI > > config SND_SOC_SOF_AMD_SOUNDWIRE > tristate "SOF support for SoundWire based AMD platforms" > default SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE > depends on SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE > - depends on ACPI && SOUNDWIRE > - depends on !(SOUNDWIRE=m && SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE=y) > + depends on ACPI > + depends on SOUNDWIRE_AMD > help > This adds support for SoundWire with Sound Open Firmware > for AMD platforms.
On Tue, Feb 20, 2024, at 06:57, Mukunda,Vijendar wrote: > On 19/02/24 15:08, Arnd Bergmann wrote: >> From: Arnd Bergmann <arnd@arndb.de> >> In normal configs, they should all either be built-in or all loadable >> modules anyway, so this simplification does not limit any real usecases. > > Tested this patch. SOUNWIRE_AMD flag is not selected by default causing > AMD SOF driver for ACP 6.3 platform is build without enabling SoundWire. Yes, that is what I described. But as SOUNWIRE_AMD is a user visible symbol, there is no problem in expecting users to enable it when they have this hardware, and distros just enable all the drivers anyway. Arnd
On 20/02/24 11:43, Arnd Bergmann wrote: > On Tue, Feb 20, 2024, at 06:57, Mukunda,Vijendar wrote: >> On 19/02/24 15:08, Arnd Bergmann wrote: >>> From: Arnd Bergmann <arnd@arndb.de> >>> In normal configs, they should all either be built-in or all loadable >>> modules anyway, so this simplification does not limit any real usecases. >> Tested this patch. SOUNWIRE_AMD flag is not selected by default causing >> AMD SOF driver for ACP 6.3 platform is build without enabling SoundWire. > Yes, that is what I described. But as SOUNWIRE_AMD is a user visible > symbol, there is no problem in expecting users to enable it when they > have this hardware, and distros just enable all the drivers anyway. Want to set SOUNDWIRE_AMD flag by default, similar to Intel & Qcom platforms instead of explicitly enabling the Kconfig option. > > Arnd
On Tue, Feb 20, 2024, at 07:23, Mukunda,Vijendar wrote: > On 20/02/24 11:43, Arnd Bergmann wrote: >> On Tue, Feb 20, 2024, at 06:57, Mukunda,Vijendar wrote: >>> On 19/02/24 15:08, Arnd Bergmann wrote: >>>> From: Arnd Bergmann <arnd@arndb.de> >>>> In normal configs, they should all either be built-in or all loadable >>>> modules anyway, so this simplification does not limit any real usecases. >>> Tested this patch. SOUNWIRE_AMD flag is not selected by default causing >>> AMD SOF driver for ACP 6.3 platform is build without enabling SoundWire. >> Yes, that is what I described. But as SOUNWIRE_AMD is a user visible >> symbol, there is no problem in expecting users to enable it when they >> have this hardware, and distros just enable all the drivers anyway. > > Want to set SOUNDWIRE_AMD flag by default, similar to Intel & Qcom > platforms instead of explicitly enabling the Kconfig option. Maybe use 'default SND_SOC_SOF_AMD_TOPLEVEL' then? I don't think copying the mistake from the intel driver is helpful, though I agree it would be nice to be consistent between them. As a general rule, you should not have a Kconfig symbol that is both user visible and also selected by the drivers that depend on it. To avoid the dependency problems from coming back and keep the complexity to a minimum, I think there are two logical ways to handle soundwire: a) keep the current drivers/soundwire/Kconfig contents and change all the 'select SOUNDWIRE_foo' to 'depends on'. b) keep all the 'select SOUNDWIRE_foo' but drop the prompts, requiring that all drivers that use soundwire have the correct select statements, with the main CONFIG_SOUNDWIRE getting selected by the individual drivers. Arnd
On 20/02/24 12:40, Arnd Bergmann wrote: > On Tue, Feb 20, 2024, at 07:23, Mukunda,Vijendar wrote: >> On 20/02/24 11:43, Arnd Bergmann wrote: >>> On Tue, Feb 20, 2024, at 06:57, Mukunda,Vijendar wrote: >>>> On 19/02/24 15:08, Arnd Bergmann wrote: >>>>> From: Arnd Bergmann <arnd@arndb.de> >>>>> In normal configs, they should all either be built-in or all loadable >>>>> modules anyway, so this simplification does not limit any real usecases. >>>> Tested this patch. SOUNWIRE_AMD flag is not selected by default causing >>>> AMD SOF driver for ACP 6.3 platform is build without enabling SoundWire. >>> Yes, that is what I described. But as SOUNWIRE_AMD is a user visible >>> symbol, there is no problem in expecting users to enable it when they >>> have this hardware, and distros just enable all the drivers anyway. >> Want to set SOUNDWIRE_AMD flag by default, similar to Intel & Qcom >> platforms instead of explicitly enabling the Kconfig option. > Maybe use 'default SND_SOC_SOF_AMD_TOPLEVEL' then? Didn't get your point. Even with the current patch, if we select 'SOUNDWIRE_AMD' flag explicitly AMD ACP63 SOF driver Kconfig option is not visible for user configuration. This results in ACP63 SOF driver won't be built at all. > > I don't think copying the mistake from the intel driver > is helpful, though I agree it would be nice to be consistent > between them. > > As a general rule, you should not have a Kconfig symbol that > is both user visible and also selected by the drivers that > depend on it. > > To avoid the dependency problems from coming back and keep > the complexity to a minimum, I think there are two logical > ways to handle soundwire: > > a) keep the current drivers/soundwire/Kconfig contents and > change all the 'select SOUNDWIRE_foo' to 'depends on'. Current patch already using 'depends on SOUNDWIRE_AMD" for SND_SOC_SOF_AMD_SOUNDWIRE Kconfig option. Still we couldn't see SND_SOC_SOF_AMD_ACP63 Kconfig option is enabled. > > b) keep all the 'select SOUNDWIRE_foo' but drop the prompts, > requiring that all drivers that use soundwire have the > correct select statements, with the main CONFIG_SOUNDWIRE > getting selected by the individual drivers. Didn't get your point. Could you please elaborate? > Arnd
On Tue, Feb 20, 2024, at 08:54, Mukunda,Vijendar wrote: > On 20/02/24 12:40, Arnd Bergmann wrote: >> On Tue, Feb 20, 2024, at 07:23, Mukunda,Vijendar wrote: >>> On 20/02/24 11:43, Arnd Bergmann wrote: >>>> On Tue, Feb 20, 2024, at 06:57, Mukunda,Vijendar wrote: >>>>> On 19/02/24 15:08, Arnd Bergmann wrote: >>>>>> From: Arnd Bergmann <arnd@arndb.de> >>>>>> In normal configs, they should all either be built-in or all loadable >>>>>> modules anyway, so this simplification does not limit any real usecases. >>>>> Tested this patch. SOUNWIRE_AMD flag is not selected by default causing >>>>> AMD SOF driver for ACP 6.3 platform is build without enabling SoundWire. >>>> Yes, that is what I described. But as SOUNWIRE_AMD is a user visible >>>> symbol, there is no problem in expecting users to enable it when they >>>> have this hardware, and distros just enable all the drivers anyway. >>> Want to set SOUNDWIRE_AMD flag by default, similar to Intel & Qcom >>> platforms instead of explicitly enabling the Kconfig option. >> Maybe use 'default SND_SOC_SOF_AMD_TOPLEVEL' then? > Didn't get your point. > > Even with the current patch, if we select 'SOUNDWIRE_AMD' flag explicitly > AMD ACP63 SOF driver Kconfig option is not visible for user configuration. > This results in ACP63 SOF driver won't be built at all. I don't understand what you mean here. What I see in linux-next both with and without my patch is config SND_SOC_SOF_AMD_ACP63 tristate "SOF support for ACP6.3 platform" depends on SND_SOC_SOF_PCI so it clearly should be visible as long as SND_SOC_SOF_PCI is enabled. There is still a problem that SND_SOC_SOF_AMD_TOPLEVEL can't use my "depends on SOUNDWIRE_AMD || !SOUNDWIRE_AMD" trick if SOUNDWIRE_AMD in turn uses "default SND_SOC_SOF_AMD_TOPLEVEL", but I don't think you meant that, right? >> I don't think copying the mistake from the intel driver >> is helpful, though I agree it would be nice to be consistent >> between them. >> >> As a general rule, you should not have a Kconfig symbol that >> is both user visible and also selected by the drivers that >> depend on it. >> >> To avoid the dependency problems from coming back and keep >> the complexity to a minimum, I think there are two logical >> ways to handle soundwire: >> >> a) keep the current drivers/soundwire/Kconfig contents and >> change all the 'select SOUNDWIRE_foo' to 'depends on'. > > Current patch already using 'depends on SOUNDWIRE_AMD" for > SND_SOC_SOF_AMD_SOUNDWIRE Kconfig option. Correct, because this is the Kconfig option that actually controls whether sound/soc/sof/amd/acp-common.c calls into the soundwire-amd module. > Still we couldn't see SND_SOC_SOF_AMD_ACP63 Kconfig option > is enabled. I need more information here. Do you have additional patches on top of what is in today's linux-next? I have it enabled on my build here. Arnd
On 20/02/24 13:51, Arnd Bergmann wrote: > On Tue, Feb 20, 2024, at 08:54, Mukunda,Vijendar wrote: >> On 20/02/24 12:40, Arnd Bergmann wrote: >>> On Tue, Feb 20, 2024, at 07:23, Mukunda,Vijendar wrote: >>>> On 20/02/24 11:43, Arnd Bergmann wrote: >>>>> On Tue, Feb 20, 2024, at 06:57, Mukunda,Vijendar wrote: >>>>>> On 19/02/24 15:08, Arnd Bergmann wrote: >>>>>>> From: Arnd Bergmann <arnd@arndb.de> >>>>>>> In normal configs, they should all either be built-in or all loadable >>>>>>> modules anyway, so this simplification does not limit any real usecases. >>>>>> Tested this patch. SOUNWIRE_AMD flag is not selected by default causing >>>>>> AMD SOF driver for ACP 6.3 platform is build without enabling SoundWire. >>>>> Yes, that is what I described. But as SOUNWIRE_AMD is a user visible >>>>> symbol, there is no problem in expecting users to enable it when they >>>>> have this hardware, and distros just enable all the drivers anyway. >>>> Want to set SOUNDWIRE_AMD flag by default, similar to Intel & Qcom >>>> platforms instead of explicitly enabling the Kconfig option. >>> Maybe use 'default SND_SOC_SOF_AMD_TOPLEVEL' then? >> Didn't get your point. >> >> Even with the current patch, if we select 'SOUNDWIRE_AMD' flag explicitly >> AMD ACP63 SOF driver Kconfig option is not visible for user configuration. >> This results in ACP63 SOF driver won't be built at all. > I don't understand what you mean here. What I see > in linux-next both with and without my patch is > > config SND_SOC_SOF_AMD_ACP63 > tristate "SOF support for ACP6.3 platform" > depends on SND_SOC_SOF_PCI > > so it clearly should be visible as long as SND_SOC_SOF_PCI > is enabled. > > There is still a problem that SND_SOC_SOF_AMD_TOPLEVEL > can't use my "depends on SOUNDWIRE_AMD || !SOUNDWIRE_AMD" > trick if SOUNDWIRE_AMD in turn uses > "default SND_SOC_SOF_AMD_TOPLEVEL", but I don't think you > meant that, right? Yes, you are correct. > >>> I don't think copying the mistake from the intel driver >>> is helpful, though I agree it would be nice to be consistent >>> between them. >>> >>> As a general rule, you should not have a Kconfig symbol that >>> is both user visible and also selected by the drivers that >>> depend on it. >>> >>> To avoid the dependency problems from coming back and keep >>> the complexity to a minimum, I think there are two logical >>> ways to handle soundwire: >>> >>> a) keep the current drivers/soundwire/Kconfig contents and >>> change all the 'select SOUNDWIRE_foo' to 'depends on'. >> Current patch already using 'depends on SOUNDWIRE_AMD" for >> SND_SOC_SOF_AMD_SOUNDWIRE Kconfig option. > Correct, because this is the Kconfig option that actually > controls whether sound/soc/sof/amd/acp-common.c calls into > the soundwire-amd module. > >> Still we couldn't see SND_SOC_SOF_AMD_ACP63 Kconfig option >> is enabled. > I need more information here. Do you have additional > patches on top of what is in today's linux-next? > I have it enabled on my build here. Sorry, it's my bad. My local patches created the problem. Validated patch on our side. It's working fine. > > Arnd
On 19/02/24 15:08, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > The soundwire-amd driver has a bit of a layering violation requiring > the SOF driver to directly call into its exported symbols rather than > through an abstraction. > > The SND_SOC_SOF_AMD_SOUNDWIRE Kconfig symbol tries to deal with the > dependency by selecting SOUNDWIRE_AMD in a complicated set of conditions, > but gets it wrong for a configuration involving SND_SOC_SOF_AMD_COMMON=y, > SND_SOC_SOF_AMD_ACP63=m, and SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE=m > SOUNDWIRE_AMD=m, which results in a link failure: > > ld.lld: error: undefined symbol: sdw_amd_get_slave_info >>>> referenced by acp-common.c > ld.lld: error: undefined symbol: amd_sdw_scan_controller > ld.lld: error: undefined symbol: sdw_amd_probe > ld.lld: error: undefined symbol: sdw_amd_exit >>>> referenced by acp.c >>>> sound/soc/sof/amd/acp.o:(amd_sof_acp_remove) in archive vmlinux.a > In essence, the SND_SOC_SOF_AMD_COMMON option cannot be built-in when > trying to link against a modular SOUNDWIRE_AMD driver. > > Since CONFIG_SOUNDWIRE_AMD is a user-visible option, it really should > never be selected by another driver in the first place, so replace the > extra complexity with a normal Kconfig dependency in SND_SOC_SOF_AMD_SOUNDWIRE, > plus a top-level check that forbids any of the AMD SOF drivers from being > built-in with CONFIG_SOUNDWIRE_AMD=m. > > In normal configs, they should all either be built-in or all loadable > modules anyway, so this simplification does not limit any real usecases. Tested-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> > > Fixes: d948218424bf ("ASoC: SOF: amd: add code for invoking soundwire manager helper functions") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > sound/soc/sof/amd/Kconfig | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/sound/soc/sof/amd/Kconfig b/sound/soc/sof/amd/Kconfig > index c3bbe6c70fb2..2729c6eb3feb 100644 > --- a/sound/soc/sof/amd/Kconfig > +++ b/sound/soc/sof/amd/Kconfig > @@ -6,6 +6,7 @@ > > config SND_SOC_SOF_AMD_TOPLEVEL > tristate "SOF support for AMD audio DSPs" > + depends on SOUNDWIRE_AMD || !SOUNDWIRE_AMD > depends on X86 || COMPILE_TEST > help > This adds support for Sound Open Firmware for AMD platforms. > @@ -62,15 +63,14 @@ config SND_SOC_SOF_ACP_PROBES > > config SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE > tristate > - select SOUNDWIRE_AMD if SND_SOC_SOF_AMD_SOUNDWIRE != n > select SND_AMD_SOUNDWIRE_ACPI if ACPI > > config SND_SOC_SOF_AMD_SOUNDWIRE > tristate "SOF support for SoundWire based AMD platforms" > default SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE > depends on SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE > - depends on ACPI && SOUNDWIRE > - depends on !(SOUNDWIRE=m && SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE=y) > + depends on ACPI > + depends on SOUNDWIRE_AMD > help > This adds support for SoundWire with Sound Open Firmware > for AMD platforms.
On Mon, 19 Feb 2024 10:38:45 +0100, Arnd Bergmann wrote: > The soundwire-amd driver has a bit of a layering violation requiring > the SOF driver to directly call into its exported symbols rather than > through an abstraction. > > The SND_SOC_SOF_AMD_SOUNDWIRE Kconfig symbol tries to deal with the > dependency by selecting SOUNDWIRE_AMD in a complicated set of conditions, > but gets it wrong for a configuration involving SND_SOC_SOF_AMD_COMMON=y, > SND_SOC_SOF_AMD_ACP63=m, and SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE=m > SOUNDWIRE_AMD=m, which results in a link failure: > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/1] ASoC: SOF: amd: fix soundwire dependencies commit: a3d543b9e6599fbbb9efc1876919627960c5e97a All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/sound/soc/sof/amd/Kconfig b/sound/soc/sof/amd/Kconfig index c3bbe6c70fb2..2729c6eb3feb 100644 --- a/sound/soc/sof/amd/Kconfig +++ b/sound/soc/sof/amd/Kconfig @@ -6,6 +6,7 @@ config SND_SOC_SOF_AMD_TOPLEVEL tristate "SOF support for AMD audio DSPs" + depends on SOUNDWIRE_AMD || !SOUNDWIRE_AMD depends on X86 || COMPILE_TEST help This adds support for Sound Open Firmware for AMD platforms. @@ -62,15 +63,14 @@ config SND_SOC_SOF_ACP_PROBES config SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE tristate - select SOUNDWIRE_AMD if SND_SOC_SOF_AMD_SOUNDWIRE != n select SND_AMD_SOUNDWIRE_ACPI if ACPI config SND_SOC_SOF_AMD_SOUNDWIRE tristate "SOF support for SoundWire based AMD platforms" default SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE depends on SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE - depends on ACPI && SOUNDWIRE - depends on !(SOUNDWIRE=m && SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE=y) + depends on ACPI + depends on SOUNDWIRE_AMD help This adds support for SoundWire with Sound Open Firmware for AMD platforms.