From patchwork Tue Jun 25 20:23:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 13712019 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 155F8C30653 for ; Tue, 25 Jun 2024 20:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=R7FsUKOArf86IC7Cxo1tRwIF4qTBuFrD2i25143URIA=; b=PgWonBAJxqE0WiFpOaeP89W+iM qmK8btL+Dz+EQ9wIcNIbSu3vA1Y0VxF7c7qz0jJmtyOvjsfPMqmaOekDwoPWJeSOw12aT2CfnZtLX v0v6Z3l7UyPqEV5IgSRgPIAjvBK230bhuJjyQ7ytO5EK2X8yads7UqTTSbPwZvmMDIJiQ7XoId1Wb rS5Z3DGztbmyRIBlv/rCgkC57zGfeNKGAsBmouV/OeTQCw+Pz5GbFtU18SzFY3DRVLpzYDZ9m3AsO TuoZV0IIpHNI7mgmH3leS+guPWIfZ3I7zSfSl0Cc0bylQP9VjLn4sQZUexsgtKEKqA+HmCLpeXHSx 7B0d5lbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMChp-00000004PAx-2DF2; Tue, 25 Jun 2024 20:23:57 +0000 Received: from madrid.collaboradmins.com ([2a00:1098:ed:100::25]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMChi-00000004P8X-3Y7v; Tue, 25 Jun 2024 20:23:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1719347027; bh=4Y2K9fzKsaz1yUzi3lh2Xb0dtktE++nAVQ7c/mxGOXc=; h=From:Date:Subject:To:Cc:From; b=KEdeYEh7sPwbXXlKKO88E3RNFSJY9dpfBsjgr3aJAm9eOwXqfuuRwV0b3aHZcmQ3P j9TgVmxZtqDT96FVGPKq5aC5Eqq5qJIzvbcYC9XFVf4e7aStriR4FcBrpTUqhQVk74 HNuTpzzRffyxSUTXX8+v0dNrBUZ47EsBor58AOumVGwU/H3E2ioE7PmU4SlHQZgfwg +JiaFqdyjyW/ynMRVS5GLhvEtkgjdHfrrUVKvRHoq2szgO1lDw3tpSxtorfrm5S21P a0helf5KX+Dl/7JZ9/lEczsC1nKFpVkS9WKzlLDB2ifUtrWPQIHcZ77472AJkCt4Gs JGejl8g3DcSiQ== Received: from [192.168.1.56] (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madrid.collaboradmins.com (Postfix) with ESMTPSA id AD571378217F; Tue, 25 Jun 2024 20:23:44 +0000 (UTC) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Tue, 25 Jun 2024 16:23:32 -0400 Subject: [PATCH] ASoC: mediatek: Allow setting readable driver names through kconfig MIME-Version: 1.0 Message-Id: <20240625-mt8195-driver-name-too-long-v1-1-8573b43a9868@collabora.com> X-B4-Tracking: v=1; b=H4sIAEMne2YC/x3MwQpAQBAA0F/RnE2NZYVfkcPGYIpdzUpK/t3m+ C7vgcgqHKHLHlC+JErwCUWewbg6vzDKlAyGTEW1sbifTdFanFQuVvRuZzxDwC34Bam1jkpyhps a0nAoz3L/ez+87wcwyXB9bQAAAA== To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Matthias Brugger , AngeloGioacchino Del Regno Cc: kernel@collabora.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJh?= =?utf-8?b?ZG8=?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240625_132351_066700_C7CF2A78 X-CRM114-Status: GOOD ( 18.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit c8d18e440225 ("ASoC: core: clarify the driver name initialization") introduced an error message when driver names are automatically generated and result in truncated names. For example, this error message is printed on mt8195-cherry-tomato-rev2: mt8195_mt6359 mt8195-sound: ASoC: driver name too long 'sof-mt8195_r1019_5682' -> 'sof-mt8195_r101' Since that truncated driver name is already used by userspace (eg UCM), it can't be unconditionally updated. As suggested by Jaroslav, update the driver name but hide it behind a kernel config option, which Linux distributions can enable once the corresponding support in userspace audio configuration software lands. This ensures that audio doesn't regress, while still allowing the error to be fixed. Suggested-by: Jaroslav Kysela Link: https://lore.kernel.org/all/8d0ccf4a-a6d9-f914-70a9-c2ad55af3a04@perex.cz Signed-off-by: NĂ­colas F. R. A. Prado --- sound/soc/mediatek/Kconfig | 10 ++++++++++ sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 3 +++ sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 3 +++ sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 13 ++++++++++++- sound/soc/mediatek/mt8186/mt8186-mt6366.c | 16 +++++++++++++++- sound/soc/mediatek/mt8188/mt8188-mt6359.c | 7 ++++++- sound/soc/mediatek/mt8195/mt8195-mt6359.c | 7 ++++++- 7 files changed, 55 insertions(+), 4 deletions(-) --- base-commit: 0fc4bfab2cd45f9acb86c4f04b5191e114e901ed change-id: 20240625-mt8195-driver-name-too-long-095a030a2e86 Best regards, diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig index 5a8476e1ecca..396d558bc75b 100644 --- a/sound/soc/mediatek/Kconfig +++ b/sound/soc/mediatek/Kconfig @@ -281,6 +281,16 @@ config SND_SOC_MT8195 Select Y if you have such device. If unsure select "N". +config SND_SOC_MTK_READABLE_DRIVER_NAME + bool "Readable driver name for MediaTek sound cards" + help + This explicitly sets the driver name for the MediaTek sound cards to + prevent it from potentially being truncated and harder to read. The + new names require support in the audio configuration userspace + utilities (like UCM), so only select this once they have been updated + to support the new names to ensure working audio. + If unsure select "N". + config SND_SOC_MT8195_MT6359 tristate "ASoC Audio driver for MT8195 with MT6359 and I2S codecs" depends on I2C && GPIOLIB diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c index 4ed06c269065..9155bb29c0a2 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c @@ -173,6 +173,9 @@ static struct snd_soc_codec_conf mt8173_rt5650_rt5514_codec_conf[] = { static struct snd_soc_card mt8173_rt5650_rt5514_card = { .name = "mtk-rt5650-rt5514", +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = "mtk-rt5514", +#endif .owner = THIS_MODULE, .dai_link = mt8173_rt5650_rt5514_dais, .num_links = ARRAY_SIZE(mt8173_rt5650_rt5514_dais), diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c index 763067c21153..212b36a0559f 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -229,6 +229,9 @@ static struct snd_soc_codec_conf mt8173_rt5650_rt5676_codec_conf[] = { static struct snd_soc_card mt8173_rt5650_rt5676_card = { .name = "mtk-rt5650-rt5676", +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = "mtk-rt5676", +#endif .owner = THIS_MODULE, .dai_link = mt8173_rt5650_rt5676_dais, .num_links = ARRAY_SIZE(mt8173_rt5650_rt5676_dais), diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index f848e14b091a..2664e3d14fec 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -19,6 +19,8 @@ #include "../common/mtk-afe-platform-driver.h" #include "mt8183-afe-common.h" +#define DRIVER_NAME "mt8183_da7219" + #define DA7219_CODEC_DAI "da7219-hifi" #define DA7219_DEV_NAME "da7219.5-001a" #define RT1015_CODEC_DAI "rt1015-aif" @@ -649,6 +651,9 @@ static const struct snd_soc_dapm_route mt8183_da7219_max98357_dapm_routes[] = { static struct snd_soc_card mt8183_da7219_max98357_card = { .name = "mt8183_da7219_max98357", +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = DRIVER_NAME, +#endif .owner = THIS_MODULE, .controls = mt8183_da7219_max98357_snd_controls, .num_controls = ARRAY_SIZE(mt8183_da7219_max98357_snd_controls), @@ -706,6 +711,9 @@ static const struct snd_soc_dapm_route mt8183_da7219_rt1015_dapm_routes[] = { static struct snd_soc_card mt8183_da7219_rt1015_card = { .name = "mt8183_da7219_rt1015", +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = DRIVER_NAME, +#endif .owner = THIS_MODULE, .controls = mt8183_da7219_rt1015_snd_controls, .num_controls = ARRAY_SIZE(mt8183_da7219_rt1015_snd_controls), @@ -723,6 +731,9 @@ static struct snd_soc_card mt8183_da7219_rt1015_card = { static struct snd_soc_card mt8183_da7219_rt1015p_card = { .name = "mt8183_da7219_rt1015p", +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = DRIVER_NAME, +#endif .owner = THIS_MODULE, .controls = mt8183_da7219_max98357_snd_controls, .num_controls = ARRAY_SIZE(mt8183_da7219_max98357_snd_controls), @@ -875,7 +886,7 @@ MODULE_DEVICE_TABLE(of, mt8183_da7219_max98357_dt_match); static struct platform_driver mt8183_da7219_max98357_driver = { .driver = { - .name = "mt8183_da7219", + .name = DRIVER_NAME, #ifdef CONFIG_OF .of_match_table = mt8183_da7219_max98357_dt_match, #endif diff --git a/sound/soc/mediatek/mt8186/mt8186-mt6366.c b/sound/soc/mediatek/mt8186/mt8186-mt6366.c index 771d53611c2a..29f17dfb8f1b 100644 --- a/sound/soc/mediatek/mt8186/mt8186-mt6366.c +++ b/sound/soc/mediatek/mt8186/mt8186-mt6366.c @@ -31,6 +31,8 @@ #include "mt8186-afe-gpio.h" #include "mt8186-mt6366-common.h" +#define DRIVER_NAME "mt8186_mt6366" + #define RT1019_CODEC_DAI "HiFi" #define RT1019_DEV0_NAME "rt1019p" @@ -1119,6 +1121,9 @@ mt8186_mt6366_rt1019_rt5682s_controls[] = { static struct snd_soc_card mt8186_mt6366_da7219_max98357_soc_card = { .name = "mt8186_da7219_max98357", +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = DRIVER_NAME, +#endif .owner = THIS_MODULE, .dai_link = mt8186_mt6366_rt1019_rt5682s_dai_links, .num_links = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_dai_links), @@ -1134,6 +1139,9 @@ static struct snd_soc_card mt8186_mt6366_da7219_max98357_soc_card = { static struct snd_soc_card mt8186_mt6366_rt1019_rt5682s_soc_card = { .name = "mt8186_rt1019_rt5682s", +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = DRIVER_NAME, +#endif .owner = THIS_MODULE, .dai_link = mt8186_mt6366_rt1019_rt5682s_dai_links, .num_links = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_dai_links), @@ -1149,6 +1157,9 @@ static struct snd_soc_card mt8186_mt6366_rt1019_rt5682s_soc_card = { static struct snd_soc_card mt8186_mt6366_rt5682s_max98360_soc_card = { .name = "mt8186_rt5682s_max98360", +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = DRIVER_NAME, +#endif .owner = THIS_MODULE, .dai_link = mt8186_mt6366_rt1019_rt5682s_dai_links, .num_links = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_dai_links), @@ -1164,6 +1175,9 @@ static struct snd_soc_card mt8186_mt6366_rt5682s_max98360_soc_card = { static struct snd_soc_card mt8186_mt6366_rt5650_soc_card = { .name = "mt8186_rt5650", +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = DRIVER_NAME, +#endif .owner = THIS_MODULE, .dai_link = mt8186_mt6366_rt1019_rt5682s_dai_links, .num_links = ARRAY_SIZE(mt8186_mt6366_rt1019_rt5682s_dai_links), @@ -1380,7 +1394,7 @@ MODULE_DEVICE_TABLE(of, mt8186_mt6366_dt_match); static struct platform_driver mt8186_mt6366_driver = { .driver = { - .name = "mt8186_mt6366", + .name = DRIVER_NAME, #if IS_ENABLED(CONFIG_OF) .of_match_table = mt8186_mt6366_dt_match, #endif diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c index eba6f4c445ff..2640981a2463 100644 --- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c +++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c @@ -23,6 +23,8 @@ #include "../common/mtk-dsp-sof-common.h" #include "../common/mtk-soc-card.h" +#define DRIVER_NAME "mt8188_mt6359" + #define CKSYS_AUD_TOP_CFG 0x032c #define RG_TEST_ON BIT(0) #define RG_TEST_TYPE BIT(2) @@ -1240,6 +1242,9 @@ static void mt8188_fixup_controls(struct snd_soc_card *card) } static struct snd_soc_card mt8188_mt6359_soc_card = { +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = DRIVER_NAME, +#endif .owner = THIS_MODULE, .dai_link = mt8188_mt6359_dai_links, .num_links = ARRAY_SIZE(mt8188_mt6359_dai_links), @@ -1392,7 +1397,7 @@ MODULE_DEVICE_TABLE(of, mt8188_mt6359_dt_match); static struct platform_driver mt8188_mt6359_driver = { .driver = { - .name = "mt8188_mt6359", + .name = DRIVER_NAME, .of_match_table = mt8188_mt6359_dt_match, .pm = &snd_soc_pm_ops, }, diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359.c b/sound/soc/mediatek/mt8195/mt8195-mt6359.c index ca8751190520..da406cbb40f6 100644 --- a/sound/soc/mediatek/mt8195/mt8195-mt6359.c +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359.c @@ -26,6 +26,8 @@ #include "mt8195-afe-clk.h" #include "mt8195-afe-common.h" +#define DRIVER_NAME "mt8195_mt6359" + #define RT1011_SPEAKER_AMP_PRESENT BIT(0) #define RT1019_SPEAKER_AMP_PRESENT BIT(1) #define MAX98390_SPEAKER_AMP_PRESENT BIT(2) @@ -1231,6 +1233,9 @@ static struct snd_soc_codec_conf max98390_codec_conf[] = { }; static struct snd_soc_card mt8195_mt6359_soc_card = { +#if IS_ENABLED(CONFIG_SND_SOC_MTK_READABLE_DRIVER_NAME) + .driver_name = DRIVER_NAME, +#endif .owner = THIS_MODULE, .dai_link = mt8195_mt6359_dai_links, .num_links = ARRAY_SIZE(mt8195_mt6359_dai_links), @@ -1530,7 +1535,7 @@ MODULE_DEVICE_TABLE(of, mt8195_mt6359_dt_match); static struct platform_driver mt8195_mt6359_driver = { .driver = { - .name = "mt8195_mt6359", + .name = DRIVER_NAME, .of_match_table = mt8195_mt6359_dt_match, .pm = &snd_soc_pm_ops, },