From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Mark Brown <broonie@kernel.org>
Cc: "Cezary Rojewski" <cezary.rojewski@intel.com>,
linux-sound@vger.kernel.org,
"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
Subject: [PATCH 01/20] ASoC: Intel: avs: boards: Add Kconfig option for obsolete card names
Date: Mon, 7 Apr 2025 14:41:35 +0200 [thread overview]
Message-ID: <20250407124154.1713039-2-amadeuszx.slawinski@linux.intel.com> (raw)
In-Reply-To: <20250407124154.1713039-1-amadeuszx.slawinski@linux.intel.com>
Add backward compatibility Kconfig option to allow for enabling obsolete
card names.
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
sound/soc/intel/avs/board_selection.c | 37 ++++++++++++++++++++++++---
sound/soc/intel/avs/boards/Kconfig | 8 ++++++
sound/soc/intel/avs/pcm.c | 5 +++-
sound/soc/intel/avs/utils.h | 14 ++++++++--
4 files changed, 57 insertions(+), 7 deletions(-)
diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c
index 2d706edcbf924..d00addb24d40a 100644
--- a/sound/soc/intel/avs/board_selection.c
+++ b/sound/soc/intel/avs/board_selection.c
@@ -17,11 +17,16 @@
#include <sound/soc-acpi.h>
#include <sound/soc-component.h>
#include "avs.h"
+#include "utils.h"
static bool i2s_test;
module_param(i2s_test, bool, 0444);
MODULE_PARM_DESC(i2s_test, "Probe I2S test-board and skip all other I2S boards");
+static bool obsolete_card_names = IS_ENABLED(CONFIG_SND_SOC_INTEL_AVS_CARDNAME_OBSOLETE);
+module_param_named(obsolete_card_names, obsolete_card_names, bool, 0444);
+MODULE_PARM_DESC(obsolete_card_names, "Use obsolete card names 0=no, 1=yes");
+
static const struct dmi_system_id kbl_dmi_table[] = {
{
.matches = {
@@ -141,7 +146,7 @@ static struct snd_soc_acpi_mach avs_kbl_i2s_machines[] = {
.mach_params = {
.i2s_link_mask = AVS_SSP(0),
},
- .pdata = (unsigned long[]){ 0x2, 0, 0, 0, 0, 0 }, /* SSP0 TDMs */
+ .pdata = (struct avs_mach_pdata[]){ { .tdms = (unsigned long[]){ 0x2 } } },
.tplg_filename = "rt5514-tplg.bin",
},
{
@@ -202,7 +207,9 @@ static struct snd_soc_acpi_mach avs_apl_i2s_machines[] = {
.mach_params = {
.i2s_link_mask = AVS_SSP_RANGE(0, 5),
},
- .pdata = (unsigned long[]){ 0x1, 0x1, 0x14, 0x1, 0x1, 0x1 }, /* SSP2 TDMs */
+ .pdata = (struct avs_mach_pdata[]){ {
+ .tdms = (unsigned long[]){ 0x1, 0x1, 0x14, 0x1, 0x1, 0x1 }
+ } },
.tplg_filename = "tdf8532-tplg.bin",
},
{
@@ -445,6 +452,7 @@ static int avs_register_dmic_board(struct avs_dev *adev)
{
struct platform_device *codec, *board;
struct snd_soc_acpi_mach mach = {{0}};
+ struct avs_mach_pdata *pdata;
int ret;
if (!acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, -1, -1)) {
@@ -468,6 +476,11 @@ static int avs_register_dmic_board(struct avs_dev *adev)
if (ret < 0)
return ret;
+ pdata = devm_kzalloc(adev->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+ pdata->obsolete_card_names = obsolete_card_names;
+ mach.pdata = pdata;
mach.tplg_filename = "dmic-tplg.bin";
mach.mach_params.platform = "dmic-platform";
@@ -490,6 +503,7 @@ static int avs_register_dmic_board(struct avs_dev *adev)
static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach *mach)
{
struct platform_device *board;
+ struct avs_mach_pdata *pdata;
int num_ssps;
char *name;
int ret;
@@ -507,7 +521,15 @@ static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach
if (!name)
return -ENOMEM;
- ret = avs_i2s_platform_register(adev, name, mach->mach_params.i2s_link_mask, mach->pdata);
+ pdata = mach->pdata;
+ if (!pdata)
+ pdata = devm_kzalloc(adev->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+ pdata->obsolete_card_names = obsolete_card_names;
+ mach->pdata = pdata;
+
+ ret = avs_i2s_platform_register(adev, name, mach->mach_params.i2s_link_mask, pdata->tdms);
if (ret < 0)
return ret;
@@ -584,6 +606,7 @@ static int avs_register_hda_board(struct avs_dev *adev, struct hda_codec *codec)
{
struct snd_soc_acpi_mach mach = {{0}};
struct platform_device *board;
+ struct avs_mach_pdata *pdata;
struct hdac_device *hdev = &codec->core;
char *pname;
int ret, id;
@@ -592,11 +615,17 @@ static int avs_register_hda_board(struct avs_dev *adev, struct hda_codec *codec)
if (!pname)
return -ENOMEM;
+ pdata = devm_kzalloc(adev->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+ pdata->obsolete_card_names = obsolete_card_names;
+ pdata->codec = codec;
+
ret = avs_hda_platform_register(adev, pname);
if (ret < 0)
return ret;
- mach.pdata = codec;
+ mach.pdata = pdata;
mach.mach_params.platform = pname;
mach.tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL, "hda-%08x-tplg.bin",
hdev->vendor_id);
diff --git a/sound/soc/intel/avs/boards/Kconfig b/sound/soc/intel/avs/boards/Kconfig
index ba4bee42124cc..8b654181004e7 100644
--- a/sound/soc/intel/avs/boards/Kconfig
+++ b/sound/soc/intel/avs/boards/Kconfig
@@ -4,6 +4,14 @@ menu "Intel AVS Machine drivers"
comment "Available DSP configurations"
+config SND_SOC_INTEL_AVS_CARDNAME_OBSOLETE
+ bool "Use obsolete card names"
+ default n
+ help
+ Use obsolete names for some of avs cards. This option should be
+ used if your system depends on old card names, for example having
+ not up to date UCM files.
+
config SND_SOC_INTEL_AVS_MACH_DA7219
tristate "da7219 I2S board"
depends on I2C
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index dac463390da13..7e077c97123bb 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -18,6 +18,7 @@
#include "path.h"
#include "pcm.h"
#include "topology.h"
+#include "utils.h"
#include "../../codecs/hda.h"
struct avs_dma_data {
@@ -1480,6 +1481,7 @@ static int avs_component_hda_probe(struct snd_soc_component *component)
struct snd_soc_dapm_context *dapm;
struct snd_soc_dai_driver *dais;
struct snd_soc_acpi_mach *mach;
+ struct avs_mach_pdata *pdata;
struct hda_codec *codec;
struct hda_pcm *pcm;
const char *cname;
@@ -1489,7 +1491,8 @@ static int avs_component_hda_probe(struct snd_soc_component *component)
if (!mach)
return -EINVAL;
- codec = mach->pdata;
+ pdata = mach->pdata;
+ codec = pdata->codec;
if (list_empty(&codec->pcm_list_head))
return -EINVAL;
list_for_each_entry(pcm, &codec->pcm_list_head, list)
diff --git a/sound/soc/intel/avs/utils.h b/sound/soc/intel/avs/utils.h
index 5ee569c39380a..a7aa13a48cf3d 100644
--- a/sound/soc/intel/avs/utils.h
+++ b/sound/soc/intel/avs/utils.h
@@ -11,6 +11,14 @@
#include <sound/soc-acpi.h>
+struct avs_mach_pdata {
+ struct hda_codec *codec;
+ unsigned long *tdms;
+ char *codec_name; /* DMIC only */
+
+ bool obsolete_card_names;
+};
+
static inline bool avs_mach_singular_ssp(struct snd_soc_acpi_mach *mach)
{
return hweight_long(mach->mach_params.i2s_link_mask) == 1;
@@ -23,14 +31,16 @@ static inline u32 avs_mach_ssp_port(struct snd_soc_acpi_mach *mach)
static inline bool avs_mach_singular_tdm(struct snd_soc_acpi_mach *mach, u32 port)
{
- unsigned long *tdms = mach->pdata;
+ struct avs_mach_pdata *pdata = mach->pdata;
+ unsigned long *tdms = pdata->tdms;
return !tdms || (hweight_long(tdms[port]) == 1);
}
static inline u32 avs_mach_ssp_tdm(struct snd_soc_acpi_mach *mach, u32 port)
{
- unsigned long *tdms = mach->pdata;
+ struct avs_mach_pdata *pdata = mach->pdata;
+ unsigned long *tdms = pdata->tdms;
return tdms ? __ffs(tdms[port]) : 0;
}
base-commit: 3a0f0a4355df0240485ed62b6bd6afa5b3e689c5
--
2.34.1
next prev parent reply other threads:[~2025-04-07 12:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 12:41 [PATCH 00/20] ASoC: Intel: avs: Update machine board card names Amadeusz Sławiński
2025-04-07 12:41 ` Amadeusz Sławiński [this message]
2025-04-07 12:41 ` [PATCH 02/20] ASoC: Intel: avs: Use topology information for endpoint numbers Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 03/20] ASoC: Intel: avs: boards: Change da7219 card name Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 04/20] ASoC: Intel: avs: boards: Change DMIC " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 05/20] ASoC: Intel: avs: boards: Change es8336 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 06/20] ASoC: Intel: avs: boards: Change hdaudio " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 07/20] ASoC: Intel: avs: boards: Change sspX-loopback " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 08/20] ASoC: Intel: avs: boards: Change max98357a " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 09/20] ASoC: Intel: avs: boards: Change max98373 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 10/20] ASoC: Intel: avs: boards: Change max98927 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 11/20] ASoC: Intel: avs: boards: Change nau8825 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 12/20] ASoC: Intel: avs: boards: Change pcm3168a " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 13/20] ASoC: Intel: avs: boards: Change probe " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 14/20] ASoC: Intel: avs: boards: Change rt274 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 15/20] ASoC: Intel: avs: boards: Change rt286 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 16/20] ASoC: Intel: avs: boards: Change rt298 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 17/20] ASoC: Intel: avs: boards: Change rt5514 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 18/20] ASoC: Intel: avs: boards: Change rt5663 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 19/20] ASoC: Intel: avs: boards: Change rt5682 " Amadeusz Sławiński
2025-04-07 12:41 ` [PATCH 20/20] ASoC: Intel: avs: boards: Change ssm4567 " Amadeusz Sławiński
2025-04-07 12:46 ` [PATCH 00/20] ASoC: Intel: avs: Update machine board card names Jaroslav Kysela
2025-04-07 13:42 ` Cezary Rojewski
2025-04-08 12:49 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250407124154.1713039-2-amadeuszx.slawinski@linux.intel.com \
--to=amadeuszx.slawinski@linux.intel.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox