From patchwork Sat Dec 9 20:53:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486078 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Vc96KMna" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6201E5; Sat, 9 Dec 2023 12:54:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155243; bh=xw0Z9G6P6/9GD35fi7UmgEcXakf2yM/DrhCkyvNuWRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vc96KMna3yO5G2XXYkNfOe46dqv56EBmIgLuKXN3IBahIDc0/mby273YIYxd9XXUp THSyCUl1lk6n/EoGvYIpTGQm+jMF+G0/vEjSvTVMQBGM9DOCaQlbsXMAUWFIl2d6X6 Xa1QnEGb0lGRshuByMXQWSLiBsshjorE9ZAtKvlPi39z1V8fPk/7c6o4IZWoIGBlRi z+P0rd+zEjKtj/yw7g2yoo/I1jz90Xq3vbsdKVbzb4/2bqqW5Mh1krvIVoRQPR1VFQ M6Jw8KL6XVMBLGsvhW94NYXkXm6L9wr1/ghCWXaicyBhWRuqQwcg5+qgeMfsqFTWIH wmc0l6UQdF67g== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 2CAEC37813DA; Sat, 9 Dec 2023 20:54:03 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 01/11] ASoC: amd: acp: Drop redundant initialization of machine driver data Date: Sat, 9 Dec 2023 22:53:40 +0200 Message-ID: <20231209205351.880797-2-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Simplify driver data configuration by removing redundant initialization of members in static structs. Signed-off-by: Cristian Ciocaltea --- sound/soc/amd/acp/acp-sof-mach.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c index 2a9fd3275e42..1d313fcb5f2d 100644 --- a/sound/soc/amd/acp/acp-sof-mach.c +++ b/sound/soc/amd/acp/acp-sof-mach.c @@ -28,7 +28,6 @@ static struct acp_card_drvdata sof_rt5682_rt1019_data = { .hs_codec_id = RT5682, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, - .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682_max_data = { @@ -38,7 +37,6 @@ static struct acp_card_drvdata sof_rt5682_max_data = { .hs_codec_id = RT5682, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, - .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682s_rt1019_data = { @@ -48,7 +46,6 @@ static struct acp_card_drvdata sof_rt5682s_rt1019_data = { .hs_codec_id = RT5682S, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, - .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682s_max_data = { @@ -58,7 +55,6 @@ static struct acp_card_drvdata sof_rt5682s_max_data = { .hs_codec_id = RT5682S, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, - .tdm_mode = false, }; static struct acp_card_drvdata sof_nau8825_data = { @@ -69,7 +65,6 @@ static struct acp_card_drvdata sof_nau8825_data = { .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, .soc_mclk = true, - .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682s_hs_rt1019_data = { @@ -80,20 +75,15 @@ static struct acp_card_drvdata sof_rt5682s_hs_rt1019_data = { .amp_codec_id = RT1019, .dmic_codec_id = DMIC, .soc_mclk = true, - .tdm_mode = false, }; static struct acp_card_drvdata sof_nau8821_max98388_data = { .hs_cpu_id = I2S_SP, .amp_cpu_id = I2S_HS, .bt_cpu_id = I2S_BT, - .dmic_cpu_id = NONE, .hs_codec_id = NAU8821, .amp_codec_id = MAX98388, - .bt_codec_id = NONE, - .dmic_codec_id = NONE, .soc_mclk = true, - .tdm_mode = false, }; static int acp_sof_probe(struct platform_device *pdev) From patchwork Sat Dec 9 20:53:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486079 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="hb1tucFH" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09BD610E; Sat, 9 Dec 2023 12:54:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155244; bh=S3lSsYPoY4wxI/kfv2j5W1QtfvDEhUSxemjQq9PNSFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hb1tucFHItmP7GsGeZj9EpHQRCoVyF11SXdZd42UQ5ol0CfZuSRvqsX3ireCuF0Tn w3ccJBSXwAjX9zHCQzntJNUSCeUi1MVMlJBn5fyP68U2dSoR0p/93kzVCBpTyFGxOZ FwDYDBP0ivhNJ28/pG0VqANtnlWBgzs5qiKq+T0Dj3KqCVUX39z7kJPC2VdNG4O9eD 0u9O8jMxitu1GmLvba9EAl8rqIfSoLhXArkvnvAhfE9J5qAkmOO2GJwA/H8j0XqVrN hVG9eEtBQxXkfPkp6VCW+JyO9D/1UzcYDPFaOg7eP3f+Q7AAeB6jf9LJ8PDxx/Z4LJ o5zhXPq96KnEQ== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 5E99937813DB; Sat, 9 Dec 2023 20:54:04 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 02/11] ASoC: amd: acp: Make use of existing *_CODEC_DAI macros Date: Sat, 9 Dec 2023 22:53:41 +0200 Message-ID: <20231209205351.880797-3-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The generic ACP machine driver provides macros for NAU88221 and MAX98388 codec DAI names, but in places it is still using directly the related strings. For consistency, replace all strings with the equivalent macros. Signed-off-by: Cristian Ciocaltea --- sound/soc/amd/acp/acp-mach-common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index c90ec3419247..346f7514c81a 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -821,8 +821,8 @@ static const struct snd_soc_ops acp_card_maxim_ops = { }; SND_SOC_DAILINK_DEF(max98388, - DAILINK_COMP_ARRAY(COMP_CODEC("i2c-ADS8388:00", "max98388-aif1"), - COMP_CODEC("i2c-ADS8388:01", "max98388-aif1"))); + DAILINK_COMP_ARRAY(COMP_CODEC("i2c-ADS8388:00", MAX98388_CODEC_DAI), + COMP_CODEC("i2c-ADS8388:01", MAX98388_CODEC_DAI))); static const struct snd_kcontrol_new max98388_controls[] = { SOC_DAPM_PIN_SWITCH("Left Spk"), @@ -1273,7 +1273,7 @@ static const struct snd_soc_ops acp_8821_ops = { SND_SOC_DAILINK_DEF(nau8821, DAILINK_COMP_ARRAY(COMP_CODEC("i2c-NVTN2020:00", - "nau8821-hifi"))); + NAU8821_CODEC_DAI))); /* Declare DMIC codec components */ SND_SOC_DAILINK_DEF(dmic_codec, From patchwork Sat Dec 9 20:53:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486080 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="ez+KkUY/" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ECCFE1; Sat, 9 Dec 2023 12:54:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155245; bh=Uzyzme1p3X66fqRyIz81KnujYtpDW+X/POMynZA7CsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ez+KkUY/Mctyu+Il5OAscxfygxVAXr0MyAj8VUhaMowHF/cXZglw6BSp8PStaAbCk naQOFKrMDZ5urm2BOKiMbej+gsyGUucUEfg7E/+tz2/B75oJPLds4u6Q0UYCQ0VAHp 7BjI+Wch/+y1qjAgjmi/hU9UA5z+74AuuQQ5BLnVD05La5xEvYKLrFqUxEI9zzmIR8 ISQjCRVUDQ1FzaJOM9YzRWeXpVaVCGSg+u1sAieZHY+Tliq47eBmXYHTF89E4AESmk x5Wz8vZokHdUG+wAU4/CPb3Smb6OGWQS7T4USbQDyO2JNm+zkxDP+zp524Bz6U2Ihy dN/fpBpSGDFJg== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 8DB3937813E0; Sat, 9 Dec 2023 20:54:05 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 03/11] ASoC: amd: acp: Add missing error handling in sof-mach Date: Sat, 9 Dec 2023 22:53:42 +0200 Message-ID: <20231209205351.880797-4-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Handle potential acp_sofdsp_dai_links_create() errors in ACP SOF machine driver's probe function. Additionally, switch to dev_err_probe(). Fixes: 9f84940f5004 ("ASoC: amd: acp: Add SOF audio support on Chrome board") Signed-off-by: Cristian Ciocaltea Reviewed-by: Emil Velikov --- sound/soc/amd/acp/acp-sof-mach.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c index 1d313fcb5f2d..6f0ca23638af 100644 --- a/sound/soc/amd/acp/acp-sof-mach.c +++ b/sound/soc/amd/acp/acp-sof-mach.c @@ -112,16 +112,14 @@ static int acp_sof_probe(struct platform_device *pdev) if (dmi_id && dmi_id->driver_data) acp_card_drvdata->tdm_mode = dmi_id->driver_data; - acp_sofdsp_dai_links_create(card); + ret = acp_sofdsp_dai_links_create(card); + if (ret) + return dev_err_probe(&pdev->dev, ret, "Failed to create DAI links\n"); ret = devm_snd_soc_register_card(&pdev->dev, card); - if (ret) { - dev_err(&pdev->dev, - "devm_snd_soc_register_card(%s) failed: %d\n", - card->name, ret); - return ret; - } - + if (ret) + return dev_err_probe(&pdev->dev, ret, + "Failed to register card(%s)\n", card->name); return 0; } From patchwork Sat Dec 9 20:53:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486081 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="rfd3OPX/" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5212DE5; Sat, 9 Dec 2023 12:54:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155247; bh=7CzCzac5cmO2jGM6VStYbZvLilLqPqRoSSC4o4Btjfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rfd3OPX/DkJaYAA1IcJCQVo90e0x7b9wA6kgig0eMPt398yGiSuYOa1CuI4NEf0fD 2kbp0D9aPIkPkO2spXWV9LzA0H/sec4IMQI32PnAt/w2ZVXEFHsZpM3QIMl/6ZkX6z OHfd7uoZXjKWjtgCHrUej714vQGKH185wA/Z1gkh+28S23anVhDwRS8seJqukSdJ8X cKG/rkRNn8U6jQ5SJlWI+XYw4jYarfWnESkjpPTvc6SIVFdbDOYzpw+AwSMW1WOCEK V38nNMtGyMZt6UyMYtFTwIKedK7QAFYUhFzipmIUbC+icjCPtZ+EfdYMqukUNdrDxL N/tWuOX2hf76w== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id BBE0437813DD; Sat, 9 Dec 2023 20:54:06 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 04/11] ASoC: amd: acp: Update MODULE_DESCRIPTION for sof-mach Date: Sat, 9 Dec 2023 22:53:43 +0200 Message-ID: <20231209205351.880797-5-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The current MODULE_DESCRIPTION relates to a Chrome board, as that was what the driver initially supported. Nonetheless, it has since progressed incrementally and evolved into a more comprehensive machine driver. Hence, update MODULE_DESCRIPTION to better reflect this. Signed-off-by: Cristian Ciocaltea --- sound/soc/amd/acp/acp-sof-mach.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c index 6f0ca23638af..19ff4fe5b1ea 100644 --- a/sound/soc/amd/acp/acp-sof-mach.c +++ b/sound/soc/amd/acp/acp-sof-mach.c @@ -166,7 +166,7 @@ static struct platform_driver acp_asoc_audio = { module_platform_driver(acp_asoc_audio); MODULE_IMPORT_NS(SND_SOC_AMD_MACH); -MODULE_DESCRIPTION("ACP chrome SOF audio support"); +MODULE_DESCRIPTION("ACP SOF Machine Driver"); MODULE_ALIAS("platform:rt5682-rt1019"); MODULE_ALIAS("platform:rt5682-max"); MODULE_ALIAS("platform:rt5682s-max"); From patchwork Sat Dec 9 20:53:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486082 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="rxyt+4iK" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A8F3D54; Sat, 9 Dec 2023 12:54:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155248; bh=K7+F8UBwdHP2JyxVJukQdnPKrvxHr2vYJDtD03JJZ0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rxyt+4iKg2AcLD96VI3OwQILuScYANkQyEo/mPCV0OKSYEOAGdh6SybPeA8+qmdqS CvHkop353eV/VcRY8O2Dg93sn9+HXOlWlA2fYVhQKjsqxlVQ7puD5Vxd+OK0HWRxQo G6KZ7dSUnThcJ0EPxqRYJxsstp2CqNzTlA9OD6Js9jcCkJpoa+VyaXN65HDdk15I2u O+oMcAipSkRYB54ZKONhwCTyV37wBJ8t3Q/rNk5px0RZHxZosZlPmv8pTnJdGQL+WC oO3yNsFAi+kLlNEj+riYE34f0ht5odZQ7KXn47P1TQGNgLOw/1+4/m2FLde+uwhsjT G07+CssTpEG3Q== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id D19E837813E3; Sat, 9 Dec 2023 20:54:07 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 05/11] ASoC: SOF: amd: Fix memory leak in amd_sof_acp_probe() Date: Sat, 9 Dec 2023 22:53:44 +0200 Message-ID: <20231209205351.880797-6-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Driver uses kasprintf() to initialize fw_{code,data}_bin members of struct acp_dev_data, but kfree() is never called to deallocate the memory, which results in a memory leak. Fix the issue by switching to devm_kasprintf(). Additionally, ensure the allocation was successful by checking the pointer validity. Fixes: f7da88003c53 ("ASoC: SOF: amd: Enable signed firmware image loading for Vangogh platform") Signed-off-by: Cristian Ciocaltea --- sound/soc/sof/amd/acp.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index 603ea5fc0d0d..c6f637f29847 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -547,17 +547,27 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) adata->signed_fw_image = false; dmi_id = dmi_first_match(acp_sof_quirk_table); if (dmi_id && dmi_id->driver_data) { - adata->fw_code_bin = kasprintf(GFP_KERNEL, "%s/sof-%s-code.bin", - plat_data->fw_filename_prefix, - chip->name); - adata->fw_data_bin = kasprintf(GFP_KERNEL, "%s/sof-%s-data.bin", - plat_data->fw_filename_prefix, - chip->name); - adata->signed_fw_image = dmi_id->driver_data; + adata->fw_code_bin = devm_kasprintf(sdev->dev, GFP_KERNEL, + "%s/sof-%s-code.bin", + plat_data->fw_filename_prefix, + chip->name); + if (!adata->fw_code_bin) { + ret = -ENOMEM; + goto free_ipc_irq; + } + + adata->fw_data_bin = devm_kasprintf(sdev->dev, GFP_KERNEL, + "%s/sof-%s-data.bin", + plat_data->fw_filename_prefix, + chip->name); + if (!adata->fw_data_bin) { + ret = -ENOMEM; + goto free_ipc_irq; + } - dev_dbg(sdev->dev, "fw_code_bin:%s, fw_data_bin:%s\n", adata->fw_code_bin, - adata->fw_data_bin); + adata->signed_fw_image = dmi_id->driver_data; } + adata->enable_fw_debug = enable_fw_debug; acp_memory_init(sdev); From patchwork Sat Dec 9 20:53:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486083 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="tMyVa0w9" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACD3E1BB; Sat, 9 Dec 2023 12:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155249; bh=4/ljxDEHtTvIlqAZ4vM3o3PXrWgZstPeEiyPFB52jiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMyVa0w9ssaQ4z2ta6GYiFSLZdAZzG6yiwDP9gWn5XrGdJDQCH+Eh9Si3zcfz2lmC sp9w+Fs9GHs4XfG4ovXDzzc3hOT2+iJZepIbbe2dtxomSOjXFU1pppqEUxS8g9wr21 C5sOYcBqZY7MvkEzHA+EYhCNS208rPtgTdaGOEu2/C43dT8k9bAYywI18CLOwLMOmk 0AsWWQTM8aJWiT5aCPJE2zqO/hhqwKRYc5upHlYMnpbCTlIfBhT7niaTz2aQmOTDl2 k/u0bVMrq7AJVO/t3nFZJj7TFRzY+8yLPscxnzpcsrcpMhklK49DPP8NDrULDh4DQF Yr60aIHteyFKQ== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 1031037813E1; Sat, 9 Dec 2023 20:54:09 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 06/11] ASoC: SOF: amd: Optimize quirk for Valve Galileo Date: Sat, 9 Dec 2023 22:53:45 +0200 Message-ID: <20231209205351.880797-7-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Valve's Steam Deck OLED is uniquely identified by vendor and product name (Galileo) DMI fields. Simplify the quirk by removing the unnecessary match on product family. Additionally, fix the related comment as it points to the old product variant. Signed-off-by: Cristian Ciocaltea --- sound/soc/sof/amd/acp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index c6f637f29847..1e9840ae8938 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -28,11 +28,10 @@ MODULE_PARM_DESC(enable_fw_debug, "Enable Firmware debug"); const struct dmi_system_id acp_sof_quirk_table[] = { { - /* Valve Jupiter device */ + /* Steam Deck OLED device */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Valve"), DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"), - DMI_MATCH(DMI_PRODUCT_FAMILY, "Sephiroth"), }, .driver_data = (void *)SECURED_FIRMWARE, }, From patchwork Sat Dec 9 20:53:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486084 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Id69ZyID" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 644AD10C7; Sat, 9 Dec 2023 12:54:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155250; bh=6CEHnbgdwJYVfipM0adU97EnT1wECk7R50CpX/0QHJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Id69ZyIDTAm3eTwaAMpObLY7Pfvb6t2SroKMHWS/GNl4eASvs3AODZdJo1MgYBzfV QPBxLhM3s0sbsu1URy5UST72rHUNLWndJ3X74dgM7qMWZVFHqewC4qkYvAxyNGqieX PCGW3w7aPuLW0Vz7NR7HoAWAqgDfx88TAWzGbnU7qem+ekTG9agiVJYk+Xv0gDqnoL u+CiA+lW8Xywq+/oilR2AEEds90QmQMPUgZXF7WboCYQr0JOrZt7zc9vg/VOE1pYZV kPepGinJUExbvcD79cBXMARcD00oP8c+NVWrAV9oIICG5CnKU8yFsQiFU16Dl9vPo8 iVdCqQ/FhubdQ== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 3E62337813E6; Sat, 9 Dec 2023 20:54:10 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 07/11] ASoC: SOF: core: Skip firmware test for undefined fw_name Date: Sat, 9 Dec 2023 22:53:46 +0200 Message-ID: <20231209205351.880797-8-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some SOF drivers like AMD ACP do not always rely on a single static firmware file, but may require multiple files having their names dynamically computed on probe time, e.g. based on chip name. In those cases, providing an invalid default_fw_filename in their sof_dev_desc struct will prevent probing due to 'SOF firmware and/or topology file not found' error. Fix the issue by allowing drivers to omit initialization for this member (or alternatively provide a dynamic override via ipc_file_profile_base) and update sof_test_firmware_file() to verify the given profile data and skip firmware testing if either fw_path or fw_name is not defined. Fixes: 6c393ebbd74a ("ASoC: SOF: core: Implement IPC version fallback if firmware files are missing") Signed-off-by: Cristian Ciocaltea --- sound/soc/sof/fw-file-profile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/sof/fw-file-profile.c b/sound/soc/sof/fw-file-profile.c index 138a1ca2c4a8..e63700234df0 100644 --- a/sound/soc/sof/fw-file-profile.c +++ b/sound/soc/sof/fw-file-profile.c @@ -21,6 +21,9 @@ static int sof_test_firmware_file(struct device *dev, const u32 *magic; int ret; + if (!profile->fw_path || !profile->fw_name || !*profile->fw_name) + return 0; + fw_filename = kasprintf(GFP_KERNEL, "%s/%s", profile->fw_path, profile->fw_name); if (!fw_filename) From patchwork Sat Dec 9 20:53:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486085 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="dmDDoM7D" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA5261700; Sat, 9 Dec 2023 12:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155251; bh=UoqvFkaEAiG7kyRT5ZdtctH0/Mb0yDTsfGCKAKoC8Dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmDDoM7D8lYjc+7UCUEnEFx8lXJdPtzd9zfFMJtjvvDErifqsb7bO2AfgE7510dBB m18vz0bHGZq6wpUKmdz4X84iBKF3Z+VYR17Jj9by1zDQ9YAH5v6I70MZlmAbuQpbg8 d5hDFEzxCo6l0H2QyTk1sbxbeEYSDjuuk7OZNwj3puCcHkt/4zEz5unzusJ/fPhGcB Cjp0WA2/h6gXAxtHxvPkUDZ1qB0+zf3kQQynIHpWN2PD8t0mFgMW4nCeKYnVx9O/I0 e4+vDEJPAS0QvuVBcduDAKFmhP6nlLKIniQXv5riUrGW8itC8mR133cfoficcmBbJq HHPjCtHiDiIZg== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 77FD637813DF; Sat, 9 Dec 2023 20:54:11 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 08/11] ASoC: SOF: amd: Override default fw name for Valve Galileo Date: Sat, 9 Dec 2023 22:53:47 +0200 Message-ID: <20231209205351.880797-9-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The ACP driver for Vangogh platform uses a quirk for Valve Galileo device to setup a custom firmware loader, which neither requires nor uses the firmware file indicated via the default_fw_filename member of struct sof_dev_desc. Since commit 6c393ebbd74a ("ASoC: SOF: core: Implement IPC version fallback if firmware files are missing"), the provided filename gets verified and triggers a fatal error on probe: [ 7.719337] snd_sof_amd_vangogh 0000:04:00.5: enabling device (0000 -> 0002) [ 7.721486] snd_sof_amd_vangogh 0000:04:00.5: SOF firmware and/or topology file not found. [ 7.721565] snd_sof_amd_vangogh 0000:04:00.5: Supported default profiles [ 7.721569] snd_sof_amd_vangogh 0000:04:00.5: - ipc type 0 (Requested): [ 7.721573] snd_sof_amd_vangogh 0000:04:00.5: Firmware file: amd/sof/sof-vangogh.ri [ 7.721577] snd_sof_amd_vangogh 0000:04:00.5: Topology file: amd/sof-tplg/sof-vangogh-nau8821-max.tplg [ 7.721582] snd_sof_amd_vangogh 0000:04:00.5: Check if you have 'sof-firmware' package installed. [ 7.721585] snd_sof_amd_vangogh 0000:04:00.5: Optionally it can be manually downloaded from: [ 7.721589] snd_sof_amd_vangogh 0000:04:00.5: https://github.com/thesofproject/sof-bin/ [ 7.721997] snd_sof_amd_vangogh: probe of 0000:04:00.5 failed with error -2 Skip testing the default firmware by overriding fw_name in sof_vangogh_ops_init(). Fixes: d0dab6b76a9f ("ASoC: SOF: amd: Add sof support for vangogh platform") Signed-off-by: Cristian Ciocaltea --- sound/soc/sof/amd/vangogh.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/amd/vangogh.c b/sound/soc/sof/amd/vangogh.c index de15d21aa6d9..5843ff8a8b40 100644 --- a/sound/soc/sof/amd/vangogh.c +++ b/sound/soc/sof/amd/vangogh.c @@ -151,8 +151,14 @@ int sof_vangogh_ops_init(struct snd_sof_dev *sdev) sof_vangogh_ops.num_drv = ARRAY_SIZE(vangogh_sof_dai); dmi_id = dmi_first_match(acp_sof_quirk_table); - if (dmi_id && dmi_id->driver_data) + if (dmi_id && dmi_id->driver_data) { sof_vangogh_ops.load_firmware = acp_sof_load_signed_firmware; + /* + * Board doesn't use the default firmware, hence override + * its name to prevent probe error due to fw validation. + */ + sdev->pdata->ipc_file_profile_base.fw_name = ""; + } return 0; } From patchwork Sat Dec 9 20:53:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486086 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="kOjWMlwe" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B78C1706; Sat, 9 Dec 2023 12:54:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155252; bh=BLSj6AA16cSdujVBYYq70bIqHuGyTU5UrfHixq/ymCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kOjWMlwetMwCh9GBKJNyjH+0D7xrtmX9ul5G6aBQ0omyXemNjzithDJNZ61ue00Q3 hr2hdRNNeM6fdMqtHy0KosrC2q40e1Xr519BQL7AMzHTegAokhJIZOP6mHnI4POmxi HpVmkpcH5d8R6pXBO9LuK7nLp8JnPoAvu8V11gKWmdju9bdkYEQHRy9tzsAcir04ap TWio7/EXM0mVcsVFrE1nplEU1Z8C3bDHQZkA7RibairQl7WddG03QqDiUaXAEgzxfs XJvRE5nks39I6zAMxAcPGzWVCazMOdZdwouxIkzU0MjYv21vdV7XCy1HRjMe3KQVzl f4uFsHkbkQTBg== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id A10B437813E8; Sat, 9 Dec 2023 20:54:12 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 09/11] ASoC: SOF: amd: Compute file paths on firmware load Date: Sat, 9 Dec 2023 22:53:48 +0200 Message-ID: <20231209205351.880797-10-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 6c393ebbd74a ("ASoC: SOF: core: Implement IPC version fallback if firmware files are missing") changed the order of some operations and the firmware paths are not available anymore at snd_sof_probe() time. Precisely, fw_filename_prefix is set by sof_select_ipc_and_paths() via plat_data->fw_filename_prefix = out_profile.fw_path; but sof_init_environment() which calls this function was moved from snd_sof_device_probe() to sof_probe_continue(). Moreover, snd_sof_probe() was moved from sof_probe_continue() to sof_init_environment(), but before the call to sof_select_ipc_and_paths(). The problem here is that amd_sof_acp_probe() uses fw_filename_prefix to compute fw_code_bin and fw_data_bin paths, and because the field is not yet initialized, the paths end up containing (null): snd_sof_amd_vangogh 0000:04:00.5: Direct firmware load for (null)/sof-vangogh-code.bin failed with error -2 snd_sof_amd_vangogh 0000:04:00.5: sof signed firmware code bin is missing snd_sof_amd_vangogh 0000:04:00.5: error: failed to load DSP firmware -2 snd_sof_amd_vangogh: probe of 0000:04:00.5 failed with error -2 Move usage of fw_filename_prefix right before request_firmware() calls in acp_sof_load_signed_firmware(). Fixes: 6c393ebbd74a ("ASoC: SOF: core: Implement IPC version fallback if firmware files are missing") Signed-off-by: Cristian Ciocaltea --- sound/soc/sof/amd/acp-loader.c | 32 ++++++++++++++++++++++++++------ sound/soc/sof/amd/acp.c | 7 ++----- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/sound/soc/sof/amd/acp-loader.c b/sound/soc/sof/amd/acp-loader.c index e05eb7a86dd4..d2d21478399e 100644 --- a/sound/soc/sof/amd/acp-loader.c +++ b/sound/soc/sof/amd/acp-loader.c @@ -267,29 +267,49 @@ int acp_sof_load_signed_firmware(struct snd_sof_dev *sdev) { struct snd_sof_pdata *plat_data = sdev->pdata; struct acp_dev_data *adata = plat_data->hw_pdata; + const char *fw_filename; int ret; - ret = request_firmware(&sdev->basefw.fw, adata->fw_code_bin, sdev->dev); + fw_filename = kasprintf(GFP_KERNEL, "%s/%s", + plat_data->fw_filename_prefix, + adata->fw_code_bin); + if (!fw_filename) + return -ENOMEM; + + ret = request_firmware(&sdev->basefw.fw, fw_filename, sdev->dev); if (ret < 0) { + kfree(fw_filename); dev_err(sdev->dev, "sof signed firmware code bin is missing\n"); return ret; } else { - dev_dbg(sdev->dev, "request_firmware %s successful\n", adata->fw_code_bin); + dev_dbg(sdev->dev, "request_firmware %s successful\n", fw_filename); } + kfree(fw_filename); + ret = snd_sof_dsp_block_write(sdev, SOF_FW_BLK_TYPE_IRAM, 0, - (void *)sdev->basefw.fw->data, sdev->basefw.fw->size); + (void *)sdev->basefw.fw->data, + sdev->basefw.fw->size); + + fw_filename = kasprintf(GFP_KERNEL, "%s/%s", + plat_data->fw_filename_prefix, + adata->fw_data_bin); + if (!fw_filename) + return -ENOMEM; - ret = request_firmware(&adata->fw_dbin, adata->fw_data_bin, sdev->dev); + ret = request_firmware(&adata->fw_dbin, fw_filename, sdev->dev); if (ret < 0) { + kfree(fw_filename); dev_err(sdev->dev, "sof signed firmware data bin is missing\n"); return ret; } else { - dev_dbg(sdev->dev, "request_firmware %s successful\n", adata->fw_data_bin); + dev_dbg(sdev->dev, "request_firmware %s successful\n", fw_filename); } + kfree(fw_filename); ret = snd_sof_dsp_block_write(sdev, SOF_FW_BLK_TYPE_DRAM, 0, - (void *)adata->fw_dbin->data, adata->fw_dbin->size); + (void *)adata->fw_dbin->data, + adata->fw_dbin->size); return ret; } EXPORT_SYMBOL_NS(acp_sof_load_signed_firmware, SND_SOC_SOF_AMD_COMMON); diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index 1e9840ae8938..87c5c71eac68 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -479,7 +479,6 @@ EXPORT_SYMBOL_NS(amd_sof_acp_resume, SND_SOC_SOF_AMD_COMMON); int amd_sof_acp_probe(struct snd_sof_dev *sdev) { struct pci_dev *pci = to_pci_dev(sdev->dev); - struct snd_sof_pdata *plat_data = sdev->pdata; struct acp_dev_data *adata; const struct sof_amd_acp_desc *chip; const struct dmi_system_id *dmi_id; @@ -547,8 +546,7 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) dmi_id = dmi_first_match(acp_sof_quirk_table); if (dmi_id && dmi_id->driver_data) { adata->fw_code_bin = devm_kasprintf(sdev->dev, GFP_KERNEL, - "%s/sof-%s-code.bin", - plat_data->fw_filename_prefix, + "sof-%s-code.bin", chip->name); if (!adata->fw_code_bin) { ret = -ENOMEM; @@ -556,8 +554,7 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev) } adata->fw_data_bin = devm_kasprintf(sdev->dev, GFP_KERNEL, - "%s/sof-%s-data.bin", - plat_data->fw_filename_prefix, + "sof-%s-data.bin", chip->name); if (!adata->fw_data_bin) { ret = -ENOMEM; From patchwork Sat Dec 9 20:53:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486087 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="l+3Y9LQ2" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B120171C; Sat, 9 Dec 2023 12:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155253; bh=C0xLCzEAO0R7G8da8+2HO7Jslwis2dNNSzbFRoiRry8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l+3Y9LQ2EF/XqWMwdn3rYFEkdeec0wjfN9KT5CfsjqBo761Ajgyfusb8DkmWDDfKT jkc2iN/9i6IcqFtBHZRQYnxGi5g7zWC708Rgs0L79YB/v4ZVrexXk/ElU+TP70051T FnsobtbLEEdOrPTon+cUb19pPOZ8s1ZYGNVvaY0izNPwOYcySdJkizwSmrS9pRd1Ud ZErJ4/ixMM6VN2KcbnZgcyn0PI6UMnLL+j8I0xXUhsEx17u2Jg5Q0BX9oPpflLk35L S/PPfHOJY6EXJCDKw9dWVGROF5skYQxC0CG5j0+pZagHAE+UdwweYbLiEzCdnBGIBK qK8SZW1vhy0eQ== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id BE26837813EA; Sat, 9 Dec 2023 20:54:13 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 10/11] ASoC: amd: acp: Use correct DAI link ID for BT codec Date: Sat, 9 Dec 2023 22:53:49 +0200 Message-ID: <20231209205351.880797-11-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 671dd2ffbd8b ("ASoC: amd: acp: Add new cpu dai and dailink creation for I2S BT instance") added I2S BT support in ACP common machine driver, but using a wrong BT_BE_ID, i.e. 3 instead of 2: [ 7.799659] snd_sof_amd_vangogh 0000:04:00.5: Firmware info: version 0:0:0-7863d [ 7.803906] snd_sof_amd_vangogh 0000:04:00.5: Firmware: ABI 3:26:0 Kernel ABI 3:23:0 [ 7.872873] snd_sof_amd_vangogh 0000:04:00.5: Topology: ABI 3:26:0 Kernel ABI 3:23:0 [ 8.508218] sof_mach nau8821-max: ASoC: physical link acp-bt-codec (id 2) not exist [ 8.513468] sof_mach nau8821-max: ASoC: topology: could not load header: -22 [ 8.518853] snd_sof_amd_vangogh 0000:04:00.5: error: tplg component load failed -22 [ 8.524049] snd_sof_amd_vangogh 0000:04:00.5: error: failed to load DSP topology -22 [ 8.529230] snd_sof_amd_vangogh 0000:04:00.5: ASoC: error at snd_soc_component_probe on 0000:04:00.5: -22 [ 8.534465] sof_mach nau8821-max: ASoC: failed to instantiate card -22 [ 8.539820] sof_mach nau8821-max: error -EINVAL: Failed to register card(sof-nau8821-max) [ 8.545022] sof_mach: probe of nau8821-max failed with error -22 Move BT_BE_ID to the correct position in the enum. Fixes: 671dd2ffbd8b ("ASoC: amd: acp: Add new cpu dai and dailink creation for I2S BT instance") Signed-off-by: Cristian Ciocaltea --- sound/soc/amd/acp/acp-mach.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h index a48546d8d407..0c18ccd29305 100644 --- a/sound/soc/amd/acp/acp-mach.h +++ b/sound/soc/amd/acp/acp-mach.h @@ -27,8 +27,8 @@ enum be_id { HEADSET_BE_ID = 0, AMP_BE_ID, - DMIC_BE_ID, BT_BE_ID, + DMIC_BE_ID, }; enum cpu_endpoints { From patchwork Sat Dec 9 20:53:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 13486088 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="BM1AxB/9" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5116A13A; Sat, 9 Dec 2023 12:54:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702155255; bh=Xs+m1eeyJ8qSJwxEkU2Al7uwFtkLxLKKyx9Q9Aji0SQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BM1AxB/90+ZZf9BPE3xnjreVuHJFGy9SalattDgPSSrF66q6vmhvYZdHx0dPJxHyj EvCObBHwhMyZKBEkp62RGYREpOQdDJjEvkzYRXH4dBrMuxaGO87T/aDpvnz3459VDm tBtOqigUoPuQlYRa9GCUVL4eY4BLgzcxoNBRvSDXofTijK2+Q9Uj1YgpDX5Miievab CPaxcg11RfkJbwP/vb8IR8fgcAusgnBLLZdPP29tjIt6XhlDB3AeIhWcc4ESUfts/p DeHOcnZjaQ5LkFUFklS0ZkOhnwmuQEzsNFHH0+Oijb7mpFOd7mCPThhe3Hl/JwHYnQ aSSJMxewyAStA== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id CCD2537813ED; Sat, 9 Dec 2023 20:54:14 +0000 (UTC) From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com Subject: [PATCH 11/11] ASoC: SOF: topology: Add new DAI type entry for SOF_DAI_AMD_BT Date: Sat, 9 Dec 2023 22:53:50 +0200 Message-ID: <20231209205351.880797-12-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit efb931cdc4b9 ("ASoC: SOF: topology: Add support for AMD ACP DAIs") registered "ACP" name for SOF_DAI_AMD_BT DAI type. However, some boards, i.e. Steam Deck OLED, seem to require "ACPBT" for the same type: [ 467.489680] snd_sof_amd_vangogh 0000:04:00.5: ipc tx error for 0x30030000 (msg/reply size: 16/0): -22 [ 467.492775] snd_sof_amd_vangogh 0000:04:00.5: sof_ipc3_route_setup: route ACPBT2.IN -> BUF5.0 failed [ 467.495839] snd_sof_amd_vangogh 0000:04:00.5: sof_ipc3_set_up_all_pipelines: route set up failed [ 467.499128] snd_sof_amd_vangogh 0000:04:00.5: error: tplg component load failed -22 [ 467.502210] snd_sof_amd_vangogh 0000:04:00.5: error: failed to load DSP topology -22 [ 467.505289] snd_sof_amd_vangogh 0000:04:00.5: ASoC: error at snd_soc_component_probe on 0000:04:00.5: -22 [ 467.508430] sof_mach nau8821-max: ASoC: failed to instantiate card -22 [ 467.511725] sof_mach nau8821-max: error -EINVAL: Failed to register card(sof-nau8821-max) [ 467.514861] sof_mach: probe of nau8821-max failed with error -22 Add "ACPBT" alias for "ACP" SOF DAI type. Signed-off-by: Cristian Ciocaltea --- sound/soc/sof/topology.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index e3e7fbe40fa6..73bf791e7520 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -290,6 +290,7 @@ static const struct sof_dai_types sof_dais[] = { {"SAI", SOF_DAI_IMX_SAI}, {"ESAI", SOF_DAI_IMX_ESAI}, {"ACP", SOF_DAI_AMD_BT}, + {"ACPBT", SOF_DAI_AMD_BT}, {"ACPSP", SOF_DAI_AMD_SP}, {"ACPDMIC", SOF_DAI_AMD_DMIC}, {"ACPHS", SOF_DAI_AMD_HS},