Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/8] ASoC: Intel: avs: 16 channels support
@ 2025-04-04  9:03 Cezary Rojewski
  2025-04-04  9:03 ` [PATCH 1/8] lib/string_helpers: Introduce parse_int_array() Cezary Rojewski
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04  9:03 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede,
	Cezary Rojewski

Relatively small delta-wise patchset which raises max channels supported
from 8 to 16.  The existing limitation is software-based, not hardware
based.  The hardware, as per HDAudio specification, section 1.2.2,
(relevant register at SDnFMT, section 3.3.41) supports the
configurations for years.  The avs-driver becomes the first consumer of
that configuration on the Linux kernel side.

Set starts off with update to string_helpers so that functionality added
with parse_int_array_user() can be utilized in kernel-kernel
interactions.

Follow up is rasing the cap on HDAudio-library side.  The format
selection procedure found in the library is good-to-go as is.

Everything that follows these two patches is avs-driver specific:
- raise channels_max for every DAI-driver template
- provide i2s_test module parameter for testing purposes.  When combined
  with I2S loopback card, allows to test 16ch on most Intel hardware post
  Broadwell era
- adjust TDM masks to reflect the 8 -> 16 channels change

Amadeusz Sławiński (5):
  ASoC: Intel: avs: Rename AVS_CHANNELS_MAX define
  ASoC: Intel: avs: Allow to specify custom configurations with i2s_test
  ASoC: Intel: avs: Assign unique ID to platform devices
  ASoC: Intel: avs: Iterate over correct number of TDMs
  ASoC: Intel: avs: Support 16 TDMs in dynamic assignment

Cezary Rojewski (3):
  lib/string_helpers: Introduce parse_int_array()
  ALSA: hda: Allow for 16 channels configuration
  ASoC: Intel: avs: Allow for 16 channels configuration

 include/linux/string_helpers.h        |   1 +
 lib/string_helpers.c                  |  39 +++----
 sound/hda/hdac_device.c               |   2 +-
 sound/soc/intel/avs/board_selection.c | 144 ++++++++++++++------------
 sound/soc/intel/avs/messages.h        |   5 +-
 sound/soc/intel/avs/path.c            |   2 +-
 sound/soc/intel/avs/pcm.c             |  10 +-
 sound/soc/intel/avs/topology.c        |   4 +-
 sound/soc/intel/avs/topology.h        |   2 +-
 9 files changed, 110 insertions(+), 99 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/8] lib/string_helpers: Introduce parse_int_array()
  2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
@ 2025-04-04  9:03 ` Cezary Rojewski
  2025-04-04 11:06   ` Andy Shevchenko
  2025-04-04  9:03 ` [PATCH 2/8] ALSA: hda: Allow for 16 channels configuration Cezary Rojewski
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04  9:03 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede,
	Cezary Rojewski, Andy Shevchenko

Existing parse_inte_array_user() works with __user buffers only.
Separate array parsing from __user bits so the functionality can be
utilized with kernel buffers too.

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 include/linux/string_helpers.h |  1 +
 lib/string_helpers.c           | 39 ++++++++++++++++++----------------
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index e93fbb5b0c01..3fb88a1e9898 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -31,6 +31,7 @@ enum string_size_units {
 int string_get_size(u64 size, u64 blk_size, const enum string_size_units units,
 		    char *buf, int len);
 
+int parse_int_array(const char *buf, size_t count, int **array);
 int parse_int_array_user(const char __user *from, size_t count, int **array);
 
 #define UNESCAPE_SPACE		BIT(0)
diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index 91fa37b5c510..ffb8ead6d4cd 100644
--- a/lib/string_helpers.c
+++ b/lib/string_helpers.c
@@ -138,6 +138,25 @@ int string_get_size(u64 size, u64 blk_size, const enum string_size_units units,
 }
 EXPORT_SYMBOL(string_get_size);
 
+int parse_int_array(const char *buf, size_t count, int **array)
+{
+	int *ints, nints;
+
+	get_options(buf, 0, &nints);
+	if (!nints)
+		return -ENOENT;
+
+	ints = kcalloc(nints + 1, sizeof(*ints), GFP_KERNEL);
+	if (!ints)
+		return -ENOMEM;
+
+	get_options(buf, nints + 1, ints);
+	*array = ints;
+
+	return 0;
+}
+EXPORT_SYMBOL(parse_int_array);
+
 /**
  * parse_int_array_user - Split string into a sequence of integers
  * @from:	The user space buffer to read from
@@ -153,30 +172,14 @@ EXPORT_SYMBOL(string_get_size);
  */
 int parse_int_array_user(const char __user *from, size_t count, int **array)
 {
-	int *ints, nints;
 	char *buf;
-	int ret = 0;
+	int ret;
 
 	buf = memdup_user_nul(from, count);
 	if (IS_ERR(buf))
 		return PTR_ERR(buf);
 
-	get_options(buf, 0, &nints);
-	if (!nints) {
-		ret = -ENOENT;
-		goto free_buf;
-	}
-
-	ints = kcalloc(nints + 1, sizeof(*ints), GFP_KERNEL);
-	if (!ints) {
-		ret = -ENOMEM;
-		goto free_buf;
-	}
-
-	get_options(buf, nints + 1, ints);
-	*array = ints;
-
-free_buf:
+	ret = parse_int_array(buf, count, array);
 	kfree(buf);
 	return ret;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/8] ALSA: hda: Allow for 16 channels configuration
  2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
  2025-04-04  9:03 ` [PATCH 1/8] lib/string_helpers: Introduce parse_int_array() Cezary Rojewski
@ 2025-04-04  9:03 ` Cezary Rojewski
  2025-04-04 14:27   ` Mark Brown
  2025-04-04  9:03 ` [PATCH 3/8] ASoC: Intel: avs: Rename AVS_CHANNELS_MAX define Cezary Rojewski
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04  9:03 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede,
	Cezary Rojewski

As per HDAudio specification, up to 16 channels are supported. Reflect
that in the code.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/hda/hdac_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 3fbb9793dcfc..0053831eed2d 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -801,7 +801,7 @@ unsigned int snd_hdac_stream_format(unsigned int channels, unsigned int bits, un
 	if (!rate_bits[i].hz)
 		return 0;
 
-	if (channels == 0 || channels > 8)
+	if (channels == 0 || channels > 16)
 		return 0;
 	val |= channels - 1;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/8] ASoC: Intel: avs: Rename AVS_CHANNELS_MAX define
  2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
  2025-04-04  9:03 ` [PATCH 1/8] lib/string_helpers: Introduce parse_int_array() Cezary Rojewski
  2025-04-04  9:03 ` [PATCH 2/8] ALSA: hda: Allow for 16 channels configuration Cezary Rojewski
@ 2025-04-04  9:03 ` Cezary Rojewski
  2025-04-04  9:03 ` [PATCH 4/8] ASoC: Intel: avs: Allow for 16 channels configuration Cezary Rojewski
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04  9:03 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede,
	Cezary Rojewski

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

It is used for coefficient table in updown mixer module, which supports
maximum of 8 channels. However it does not represent HW capability.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/messages.h | 4 ++--
 sound/soc/intel/avs/path.c     | 2 +-
 sound/soc/intel/avs/topology.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/avs/messages.h b/sound/soc/intel/avs/messages.h
index 2f243802ccc2..673e4577df14 100644
--- a/sound/soc/intel/avs/messages.h
+++ b/sound/soc/intel/avs/messages.h
@@ -697,7 +697,7 @@ enum avs_sample_type {
 	AVS_SAMPLE_TYPE_FLOAT = 4,
 };
 
-#define AVS_CHANNELS_MAX	8
+#define AVS_COEFF_CHANNELS_MAX	8
 #define AVS_ALL_CHANNELS_MASK	UINT_MAX
 
 struct avs_audio_format {
@@ -846,7 +846,7 @@ struct avs_updown_mixer_cfg {
 	struct avs_modcfg_base base;
 	u32 out_channel_config;
 	u32 coefficients_select;
-	s32 coefficients[AVS_CHANNELS_MAX];
+	s32 coefficients[AVS_COEFF_CHANNELS_MAX];
 	u32 channel_map;
 } __packed;
 static_assert(sizeof(struct avs_updown_mixer_cfg) == 84);
diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index ef0c1d125d66..d5cce357b162 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -452,7 +452,7 @@ static int avs_updown_mix_create(struct avs_dev *adev, struct avs_path_module *m
 	cfg.base.audio_fmt = *t->in_fmt;
 	cfg.out_channel_config = t->cfg_ext->updown_mix.out_channel_config;
 	cfg.coefficients_select = t->cfg_ext->updown_mix.coefficients_select;
-	for (i = 0; i < AVS_CHANNELS_MAX; i++)
+	for (i = 0; i < AVS_COEFF_CHANNELS_MAX; i++)
 		cfg.coefficients[i] = t->cfg_ext->updown_mix.coefficients[i];
 	cfg.channel_map = t->cfg_ext->updown_mix.channel_map;
 
diff --git a/sound/soc/intel/avs/topology.h b/sound/soc/intel/avs/topology.h
index 304880997717..f5601a4e3ec8 100644
--- a/sound/soc/intel/avs/topology.h
+++ b/sound/soc/intel/avs/topology.h
@@ -87,7 +87,7 @@ struct avs_tplg_modcfg_ext {
 		struct {
 			u32 out_channel_config;
 			u32 coefficients_select;
-			s32 coefficients[AVS_CHANNELS_MAX];
+			s32 coefficients[AVS_COEFF_CHANNELS_MAX];
 			u32 channel_map;
 		} updown_mix;
 		struct {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/8] ASoC: Intel: avs: Allow for 16 channels configuration
  2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
                   ` (2 preceding siblings ...)
  2025-04-04  9:03 ` [PATCH 3/8] ASoC: Intel: avs: Rename AVS_CHANNELS_MAX define Cezary Rojewski
@ 2025-04-04  9:03 ` Cezary Rojewski
  2025-04-04  9:03 ` [PATCH 5/8] ASoC: Intel: avs: Allow to specify custom configurations with i2s_test Cezary Rojewski
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04  9:03 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede,
	Cezary Rojewski

Add define representing maximum number of channels that are allowed by
HDAudio standard and as such supported by HW - 16 channels. With that
done, reflect the max in BE DAIs capabilities.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/messages.h | 1 +
 sound/soc/intel/avs/pcm.c      | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/avs/messages.h b/sound/soc/intel/avs/messages.h
index 673e4577df14..e27c7587be9d 100644
--- a/sound/soc/intel/avs/messages.h
+++ b/sound/soc/intel/avs/messages.h
@@ -699,6 +699,7 @@ enum avs_sample_type {
 
 #define AVS_COEFF_CHANNELS_MAX	8
 #define AVS_ALL_CHANNELS_MASK	UINT_MAX
+#define AVS_CHANNELS_MAX	16
 
 struct avs_audio_format {
 	u32 sampling_freq;
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index dac463390da1..7d57a5735157 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -1337,7 +1337,7 @@ static const struct snd_soc_dai_driver i2s_dai_template = {
 	.ops = &avs_dai_nonhda_be_ops,
 	.playback = {
 		.channels_min	= 1,
-		.channels_max	= 8,
+		.channels_max	= AVS_CHANNELS_MAX,
 		.rates		= SNDRV_PCM_RATE_8000_192000 |
 				  SNDRV_PCM_RATE_12000 |
 				  SNDRV_PCM_RATE_24000 |
@@ -1350,7 +1350,7 @@ static const struct snd_soc_dai_driver i2s_dai_template = {
 	},
 	.capture = {
 		.channels_min	= 1,
-		.channels_max	= 8,
+		.channels_max	= AVS_CHANNELS_MAX,
 		.rates		= SNDRV_PCM_RATE_8000_192000 |
 				  SNDRV_PCM_RATE_12000 |
 				  SNDRV_PCM_RATE_24000 |
@@ -1431,7 +1431,7 @@ static const struct snd_soc_dai_driver hda_cpu_dai = {
 	.ops = &avs_dai_hda_be_ops,
 	.playback = {
 		.channels_min	= 1,
-		.channels_max	= 8,
+		.channels_max	= AVS_CHANNELS_MAX,
 		.rates		= SNDRV_PCM_RATE_8000_192000,
 		.formats	= SNDRV_PCM_FMTBIT_S16_LE |
 				  SNDRV_PCM_FMTBIT_S32_LE,
@@ -1441,7 +1441,7 @@ static const struct snd_soc_dai_driver hda_cpu_dai = {
 	},
 	.capture = {
 		.channels_min	= 1,
-		.channels_max	= 8,
+		.channels_max	= AVS_CHANNELS_MAX,
 		.rates		= SNDRV_PCM_RATE_8000_192000,
 		.formats	= SNDRV_PCM_FMTBIT_S16_LE |
 				  SNDRV_PCM_FMTBIT_S32_LE,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/8] ASoC: Intel: avs: Allow to specify custom configurations with i2s_test
  2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
                   ` (3 preceding siblings ...)
  2025-04-04  9:03 ` [PATCH 4/8] ASoC: Intel: avs: Allow for 16 channels configuration Cezary Rojewski
@ 2025-04-04  9:03 ` Cezary Rojewski
  2025-04-04  9:03 ` [PATCH 6/8] ASoC: Intel: avs: Assign unique ID to platform devices Cezary Rojewski
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04  9:03 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede,
	Cezary Rojewski

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

Change 'i2s_test' module option from enable-flag to string allowing to
specify which SSP port and in what TDM configuration should be enabled.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/board_selection.c | 134 +++++++++++++-------------
 1 file changed, 68 insertions(+), 66 deletions(-)

diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c
index 2d706edcbf92..30444b67dd91 100644
--- a/sound/soc/intel/avs/board_selection.c
+++ b/sound/soc/intel/avs/board_selection.c
@@ -17,10 +17,11 @@
 #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 char *i2s_test;
+module_param(i2s_test, charp, 0444);
+MODULE_PARM_DESC(i2s_test, "Use I2S test-board instead of ACPI, i2s_test=ssp0tdm,ssp1tdm,... 0 to ignore port");
 
 static const struct dmi_system_id kbl_dmi_table[] = {
 	{
@@ -324,52 +325,6 @@ static struct snd_soc_acpi_mach avs_mbl_i2s_machines[] = {
 	{}
 };
 
-static struct snd_soc_acpi_mach avs_test_i2s_machines[] = {
-	{
-		.drv_name = "avs_i2s_test",
-		.mach_params = {
-			.i2s_link_mask = AVS_SSP(0),
-		},
-		.tplg_filename = "i2s-test-tplg.bin",
-	},
-	{
-		.drv_name = "avs_i2s_test",
-		.mach_params = {
-			.i2s_link_mask = AVS_SSP(1),
-		},
-		.tplg_filename = "i2s-test-tplg.bin",
-	},
-	{
-		.drv_name = "avs_i2s_test",
-		.mach_params = {
-			.i2s_link_mask = AVS_SSP(2),
-		},
-		.tplg_filename = "i2s-test-tplg.bin",
-	},
-	{
-		.drv_name = "avs_i2s_test",
-		.mach_params = {
-			.i2s_link_mask = AVS_SSP(3),
-		},
-		.tplg_filename = "i2s-test-tplg.bin",
-	},
-	{
-		.drv_name = "avs_i2s_test",
-		.mach_params = {
-			.i2s_link_mask = AVS_SSP(4),
-		},
-		.tplg_filename = "i2s-test-tplg.bin",
-	},
-	{
-		.drv_name = "avs_i2s_test",
-		.mach_params = {
-			.i2s_link_mask = AVS_SSP(5),
-		},
-		.tplg_filename = "i2s-test-tplg.bin",
-	},
-	/* no NULL terminator, as we depend on ARRAY SIZE due to .id == NULL */
-};
-
 struct avs_acpi_boards {
 	int id;
 	struct snd_soc_acpi_mach *machs;
@@ -529,6 +484,68 @@ static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach
 	return 0;
 }
 
+static int avs_register_i2s_test_board(struct avs_dev *adev, int ssp_port, int tdm_slot)
+{
+	struct snd_soc_acpi_mach *mach;
+	int tdm_mask = BIT(tdm_slot);
+	unsigned long *tdm_cfg;
+	char *tplg_name;
+	int ret;
+
+	mach = devm_kzalloc(adev->dev, sizeof(*mach), GFP_KERNEL);
+	tdm_cfg = devm_kcalloc(adev->dev, ssp_port + 1, sizeof(unsigned long), GFP_KERNEL);
+	tplg_name = devm_kasprintf(adev->dev, GFP_KERNEL, AVS_STRING_FMT("i2s", "-test-tplg.bin",
+				   ssp_port, tdm_slot));
+	if (!mach || !tdm_cfg || !tplg_name)
+		return -ENOMEM;
+
+	mach->drv_name = "avs_i2s_test";
+	mach->mach_params.i2s_link_mask = AVS_SSP(ssp_port);
+	tdm_cfg[ssp_port] = tdm_mask;
+	mach->pdata = tdm_cfg;
+	mach->tplg_filename = tplg_name;
+
+	ret = avs_register_i2s_board(adev, mach);
+	if (ret < 0) {
+		dev_warn(adev->dev, "register i2s %s failed: %d\n", mach->drv_name, ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int avs_register_i2s_test_boards(struct avs_dev *adev)
+{
+	int max_ssps = adev->hw_cfg.i2s_caps.ctrl_count;
+	int ssp_port, tdm_slot, ret;
+	unsigned long tdm_slots;
+	u32 *array, num_elems;
+
+	ret = parse_int_array(i2s_test, strlen(i2s_test), (int **)&array);
+	if (ret < 0) {
+		dev_err(adev->dev, "failed to parse i2s_test parameter\n");
+		return ret;
+	}
+
+	num_elems = *array;
+	if (num_elems > max_ssps) {
+		dev_err(adev->dev, "board supports only %d SSP, %d specified\n",
+			max_ssps, num_elems);
+		return -EINVAL;
+	}
+
+	for (ssp_port = 0; ssp_port < num_elems; ssp_port++) {
+		tdm_slots = array[1 + ssp_port];
+		for_each_set_bit(tdm_slot, &tdm_slots, 16) {
+			ret = avs_register_i2s_test_board(adev, ssp_port, tdm_slot);
+			if (ret)
+				return ret;
+		}
+	}
+
+	return 0;
+}
+
 static int avs_register_i2s_boards(struct avs_dev *adev)
 {
 	const struct avs_acpi_boards *boards;
@@ -540,23 +557,8 @@ static int avs_register_i2s_boards(struct avs_dev *adev)
 		return 0;
 	}
 
-	if (i2s_test) {
-		int i, num_ssps;
-
-		num_ssps = adev->hw_cfg.i2s_caps.ctrl_count;
-		/* constrain just in case FW says there can be more SSPs than possible */
-		num_ssps = min_t(int, ARRAY_SIZE(avs_test_i2s_machines), num_ssps);
-
-		mach = avs_test_i2s_machines;
-
-		for (i = 0; i < num_ssps; i++) {
-			ret = avs_register_i2s_board(adev, &mach[i]);
-			if (ret < 0)
-				dev_warn(adev->dev, "register i2s %s failed: %d\n", mach->drv_name,
-					 ret);
-		}
-		return 0;
-	}
+	if (i2s_test)
+		return avs_register_i2s_test_boards(adev);
 
 	boards = avs_get_i2s_boards(adev);
 	if (!boards) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/8] ASoC: Intel: avs: Assign unique ID to platform devices
  2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
                   ` (4 preceding siblings ...)
  2025-04-04  9:03 ` [PATCH 5/8] ASoC: Intel: avs: Allow to specify custom configurations with i2s_test Cezary Rojewski
@ 2025-04-04  9:03 ` Cezary Rojewski
  2025-04-04  9:03 ` [PATCH 7/8] ASoC: Intel: avs: Iterate over correct number of TDMs Cezary Rojewski
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04  9:03 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede,
	Cezary Rojewski

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

When creating machine boards there are two types, per endpoint or
compound board. For compound board we can just use I2S mask as its ID,
however, per endpoint can also be separated per TDM, which causes
problem because two boards would have same I2S mask. Shift it and add
the value of TDM to generate a unique ID.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/board_selection.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c
index 30444b67dd91..286d94df5f46 100644
--- a/sound/soc/intel/avs/board_selection.c
+++ b/sound/soc/intel/avs/board_selection.c
@@ -448,6 +448,7 @@ static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach
 	int num_ssps;
 	char *name;
 	int ret;
+	int uid;
 
 	num_ssps = adev->hw_cfg.i2s_caps.ctrl_count;
 	if (fls(mach->mach_params.i2s_link_mask) > num_ssps) {
@@ -457,8 +458,11 @@ static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach
 		return -ENODEV;
 	}
 
-	name = devm_kasprintf(adev->dev, GFP_KERNEL, "%s.%d-platform", mach->drv_name,
-			      mach->mach_params.i2s_link_mask);
+	uid = mach->mach_params.i2s_link_mask;
+	if (avs_mach_singular_ssp(mach))
+		uid = (uid << AVS_CHANNELS_MAX) + avs_mach_ssp_tdm(mach, avs_mach_ssp_port(mach));
+
+	name = devm_kasprintf(adev->dev, GFP_KERNEL, "%s.%d-platform", mach->drv_name, uid);
 	if (!name)
 		return -ENOMEM;
 
@@ -468,7 +472,7 @@ static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach
 
 	mach->mach_params.platform = name;
 
-	board = platform_device_register_data(NULL, mach->drv_name, mach->mach_params.i2s_link_mask,
+	board = platform_device_register_data(NULL, mach->drv_name, uid,
 					      (const void *)mach, sizeof(*mach));
 	if (IS_ERR(board)) {
 		dev_err(adev->dev, "ssp board register failed\n");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 7/8] ASoC: Intel: avs: Iterate over correct number of TDMs
  2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
                   ` (5 preceding siblings ...)
  2025-04-04  9:03 ` [PATCH 6/8] ASoC: Intel: avs: Assign unique ID to platform devices Cezary Rojewski
@ 2025-04-04  9:03 ` Cezary Rojewski
  2025-04-04  9:03 ` [PATCH 8/8] ASoC: Intel: avs: Support 16 TDMs in dynamic assignment Cezary Rojewski
  2025-04-08 12:49 ` [PATCH 0/8] ASoC: Intel: avs: 16 channels support Mark Brown
  8 siblings, 0 replies; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04  9:03 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede,
	Cezary Rojewski

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

When handling TDMs, don't iterate over number of SSP ports, but over
possible number of TDMs.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index 7d57a5735157..9dd5215b2c72 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -1406,7 +1406,7 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l
 		goto plat_register;
 
 	for_each_set_bit(i, &port_mask, ssp_count) {
-		for_each_set_bit(j, &tdms[i], ssp_count) {
+		for_each_set_bit(j, &tdms[i], AVS_CHANNELS_MAX) {
 			memcpy(dai, &i2s_dai_template, sizeof(*dai));
 
 			dai->name =
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 8/8] ASoC: Intel: avs: Support 16 TDMs in dynamic assignment
  2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
                   ` (6 preceding siblings ...)
  2025-04-04  9:03 ` [PATCH 7/8] ASoC: Intel: avs: Iterate over correct number of TDMs Cezary Rojewski
@ 2025-04-04  9:03 ` Cezary Rojewski
  2025-04-08 12:49 ` [PATCH 0/8] ASoC: Intel: avs: 16 channels support Mark Brown
  8 siblings, 0 replies; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04  9:03 UTC (permalink / raw)
  To: broonie
  Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede,
	Cezary Rojewski

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

When assigning new widget name there needs to be enough place in buffer
to assign name.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/topology.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c
index 3c222c352701..f2e4ad8b8e14 100644
--- a/sound/soc/intel/avs/topology.c
+++ b/sound/soc/intel/avs/topology.c
@@ -1668,8 +1668,8 @@ static int avs_widget_load(struct snd_soc_component *comp, int index,
 
 	/* See parse_link_formatted_string() for dynamic naming when(s). */
 	if (avs_mach_singular_tdm(mach, ssp_port)) {
-		/* size is based on possible %d -> SSP:TDM, where SSP and TDM < 10 + '\0' */
-		size_t size = strlen(dw->name) + 2;
+		/* size is based on possible %d -> SSP:TDM, where SSP and TDM < 16 + '\0' */
+		size_t size = strlen(dw->name) + 3;
 		char *buf;
 
 		tdm_slot = avs_mach_ssp_tdm(mach, ssp_port);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/8] lib/string_helpers: Introduce parse_int_array()
  2025-04-04  9:03 ` [PATCH 1/8] lib/string_helpers: Introduce parse_int_array() Cezary Rojewski
@ 2025-04-04 11:06   ` Andy Shevchenko
  2025-04-04 11:06     ` Andy Shevchenko
  0 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2025-04-04 11:06 UTC (permalink / raw)
  To: Cezary Rojewski
  Cc: broonie, tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede

On Fri, Apr 04, 2025 at 11:03:30AM +0200, Cezary Rojewski wrote:
> Existing parse_inte_array_user() works with __user buffers only.
> Separate array parsing from __user bits so the functionality can be
> utilized with kernel buffers too.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

But do we have a user for this? I believe we don't accept code without a user.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/8] lib/string_helpers: Introduce parse_int_array()
  2025-04-04 11:06   ` Andy Shevchenko
@ 2025-04-04 11:06     ` Andy Shevchenko
  2025-04-04 11:25       ` Cezary Rojewski
  0 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2025-04-04 11:06 UTC (permalink / raw)
  To: Cezary Rojewski
  Cc: broonie, tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede

On Fri, Apr 04, 2025 at 02:06:11PM +0300, Andy Shevchenko wrote:
> On Fri, Apr 04, 2025 at 11:03:30AM +0200, Cezary Rojewski wrote:
> > Existing parse_inte_array_user() works with __user buffers only.
> > Separate array parsing from __user bits so the functionality can be
> > utilized with kernel buffers too.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> But do we have a user for this? I believe we don't accept code without a user.

Okay, this patch 1 out of 8... Next time Cc people at least to the cover letter
where it will be visible.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/8] lib/string_helpers: Introduce parse_int_array()
  2025-04-04 11:06     ` Andy Shevchenko
@ 2025-04-04 11:25       ` Cezary Rojewski
  0 siblings, 0 replies; 14+ messages in thread
From: Cezary Rojewski @ 2025-04-04 11:25 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: broonie, tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede

On 2025-04-04 1:06 PM, Andy Shevchenko wrote:
> On Fri, Apr 04, 2025 at 02:06:11PM +0300, Andy Shevchenko wrote:
>> On Fri, Apr 04, 2025 at 11:03:30AM +0200, Cezary Rojewski wrote:
>>> Existing parse_inte_array_user() works with __user buffers only.
>>> Separate array parsing from __user bits so the functionality can be
>>> utilized with kernel buffers too.
>>
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>
>> But do we have a user for this? I believe we don't accept code without a user.
> 
> Okay, this patch 1 out of 8... Next time Cc people at least to the cover letter
> where it will be visible.
> 

My apologies.

The idea was to add the Cc: tag so you are always pinged when something 
happens to the string_helper change while simultaneously adding 
--cc=Andy when doing git send-email for the entire series. I did forget 
about the latter :(

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/8] ALSA: hda: Allow for 16 channels configuration
  2025-04-04  9:03 ` [PATCH 2/8] ALSA: hda: Allow for 16 channels configuration Cezary Rojewski
@ 2025-04-04 14:27   ` Mark Brown
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2025-04-04 14:27 UTC (permalink / raw)
  To: Cezary Rojewski; +Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

On Fri, Apr 04, 2025 at 11:03:31AM +0200, Cezary Rojewski wrote:
> As per HDAudio specification, up to 16 channels are supported. Reflect
> that in the code.

Takashi, is this OK to merge via ASoC?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/8] ASoC: Intel: avs: 16 channels support
  2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
                   ` (7 preceding siblings ...)
  2025-04-04  9:03 ` [PATCH 8/8] ASoC: Intel: avs: Support 16 TDMs in dynamic assignment Cezary Rojewski
@ 2025-04-08 12:49 ` Mark Brown
  8 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2025-04-08 12:49 UTC (permalink / raw)
  To: Cezary Rojewski; +Cc: tiwai, perex, amadeuszx.slawinski, linux-sound, hdegoede

On Fri, 04 Apr 2025 11:03:29 +0200, Cezary Rojewski wrote:
> Relatively small delta-wise patchset which raises max channels supported
> from 8 to 16.  The existing limitation is software-based, not hardware
> based.  The hardware, as per HDAudio specification, section 1.2.2,
> (relevant register at SDnFMT, section 3.3.41) supports the
> configurations for years.  The avs-driver becomes the first consumer of
> that configuration on the Linux kernel side.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/8] lib/string_helpers: Introduce parse_int_array()
      commit: 83b9ae77f06607d19f7d3dcc6008742051137b27
[2/8] ALSA: hda: Allow for 16 channels configuration
      commit: e6b9c7f5a32b3bde4e24ee74c0d4f954ce086272
[3/8] ASoC: Intel: avs: Rename AVS_CHANNELS_MAX define
      commit: 87bcb08710160bde5712ca0d24c505074b7dfafa
[4/8] ASoC: Intel: avs: Allow for 16 channels configuration
      commit: d360b713727db0093fe9a8cf475d1d536075c12f
[5/8] ASoC: Intel: avs: Allow to specify custom configurations with i2s_test
      commit: 7d859189de13f06fdc511761c745f3b302bed7b6
[6/8] ASoC: Intel: avs: Assign unique ID to platform devices
      commit: 79138dbff53ab0e9891ebdfce8d7b298c3783cd1
[7/8] ASoC: Intel: avs: Iterate over correct number of TDMs
      commit: 6a68cbe09e9a7dc9f53857510bee1bc34bdbbfd9
[8/8] ASoC: Intel: avs: Support 16 TDMs in dynamic assignment
      commit: 8d18e67abbdf380cd1cfd2c313aac625092d7777

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-04-08 12:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-04  9:03 [PATCH 0/8] ASoC: Intel: avs: 16 channels support Cezary Rojewski
2025-04-04  9:03 ` [PATCH 1/8] lib/string_helpers: Introduce parse_int_array() Cezary Rojewski
2025-04-04 11:06   ` Andy Shevchenko
2025-04-04 11:06     ` Andy Shevchenko
2025-04-04 11:25       ` Cezary Rojewski
2025-04-04  9:03 ` [PATCH 2/8] ALSA: hda: Allow for 16 channels configuration Cezary Rojewski
2025-04-04 14:27   ` Mark Brown
2025-04-04  9:03 ` [PATCH 3/8] ASoC: Intel: avs: Rename AVS_CHANNELS_MAX define Cezary Rojewski
2025-04-04  9:03 ` [PATCH 4/8] ASoC: Intel: avs: Allow for 16 channels configuration Cezary Rojewski
2025-04-04  9:03 ` [PATCH 5/8] ASoC: Intel: avs: Allow to specify custom configurations with i2s_test Cezary Rojewski
2025-04-04  9:03 ` [PATCH 6/8] ASoC: Intel: avs: Assign unique ID to platform devices Cezary Rojewski
2025-04-04  9:03 ` [PATCH 7/8] ASoC: Intel: avs: Iterate over correct number of TDMs Cezary Rojewski
2025-04-04  9:03 ` [PATCH 8/8] ASoC: Intel: avs: Support 16 TDMs in dynamic assignment Cezary Rojewski
2025-04-08 12:49 ` [PATCH 0/8] ASoC: Intel: avs: 16 channels support Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox