* [PATCH 1/2] ASoC: soc_sdw_utils: skip aux device if it is not present
2026-05-08 9:47 [PATCH 0/2] ASoC: soc_sdw_utils: skip aux device if it is not present Bard Liao
@ 2026-05-08 9:47 ` Bard Liao
2026-05-08 9:47 ` [PATCH 2/2] ASoC: soc_sdw_utils: Change comment into proper kernel doc Bard Liao
2026-05-11 1:05 ` [PATCH 0/2] ASoC: soc_sdw_utils: skip aux device if it is not present Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Bard Liao @ 2026-05-08 9:47 UTC (permalink / raw)
To: broonie, tiwai; +Cc: linux-sound, bard.liao, peter.ujfalusi
From: Maciej Strozek <mstrozek@opensource.cirrus.com>
Similarly to codec endpoints that may not be used [1], aux devices (like
HID) also may not be used. Hence skip aux devices which are not present.
[1] https://lore.kernel.org/all/20250414063239.85200-12-yung-chuan.liao@linux.intel.com/
Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
sound/soc/sdw_utils/soc_sdw_utils.c | 76 ++++++++++++++++++++++++++++-
1 file changed, 74 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c
index ede41c532c52..da626969a657 100644
--- a/sound/soc/sdw_utils/soc_sdw_utils.c
+++ b/sound/soc/sdw_utils/soc_sdw_utils.c
@@ -1708,6 +1708,63 @@ int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *d
}
EXPORT_SYMBOL_NS(asoc_sdw_init_simple_dai_link, "SND_SOC_SDW_UTILS");
+/**
+ * is_sdca_aux_dev_present - Check if an SDCA aux device is present on the SDW peripheral
+ * @dev: Device pointer
+ * @aux_codec_name: Aux codec name from the codec info (e.g. "snd_soc_sdca.HID.2")
+ * @adr_link: ACPI link address
+ * @adr_index: Index of the ACPI link address
+ *
+ * Return: 1 if the aux is present, 0 if the aux is not present, or negative error code.
+ */
+static int is_sdca_aux_dev_present(struct device *dev,
+ const char *aux_codec_name,
+ const struct snd_soc_acpi_link_adr *adr_link,
+ int adr_index)
+{
+ struct sdw_slave *slave;
+ struct device *sdw_dev;
+ const char *sdw_codec_name;
+ int ret = 0;
+ int i;
+
+ if (!aux_codec_name)
+ return 0;
+
+ sdw_codec_name = _asoc_sdw_get_codec_name(dev, adr_link, adr_index);
+ if (!sdw_codec_name)
+ return -ENOMEM;
+
+ sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, sdw_codec_name);
+ if (!sdw_dev) {
+ dev_err(dev, "codec %s not found\n", sdw_codec_name);
+ return -EINVAL;
+ }
+
+ slave = dev_to_sdw_dev(sdw_dev);
+
+ if (!slave->sdca_data.interface_revision) {
+ dev_warn(dev, "No SDCA properties, assuming aux '%s' present\n", aux_codec_name);
+ ret = 1;
+ goto put_dev;
+ }
+
+ for (i = 0; i < slave->sdca_data.num_functions; i++) {
+ const char *fname = slave->sdca_data.function[i].name;
+
+ if (fname && strstr(aux_codec_name, fname)) {
+ ret = 1;
+ goto put_dev;
+ }
+ }
+
+ dev_dbg(dev, "SDCA function for aux '%s' NOT FOUND on slave, skipping\n", aux_codec_name);
+
+put_dev:
+ put_device(sdw_dev);
+ return ret;
+}
+
int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card,
int *num_devs, int *num_ends, int *num_aux)
{
@@ -1715,7 +1772,7 @@ int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card,
struct snd_soc_acpi_mach *mach = dev_get_platdata(dev);
struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params;
const struct snd_soc_acpi_link_adr *adr_link;
- int i;
+ int i, j, ret;
for (adr_link = mach_params->links; adr_link->num_adr; adr_link++) {
*num_devs += adr_link->num_adr;
@@ -1730,7 +1787,14 @@ int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card,
if (!codec_info)
return -EINVAL;
- *num_aux += codec_info->aux_num;
+ for (j = 0; j < codec_info->aux_num; j++) {
+ ret = is_sdca_aux_dev_present(dev, codec_info->auxs[j].codec_name,
+ adr_link, i);
+ if (ret < 0)
+ return ret;
+ if (ret)
+ (*num_aux)++;
+ }
}
}
@@ -1894,6 +1958,14 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
for (j = 0; j < codec_info->aux_num; j++) {
struct snd_soc_component *component;
+ ret = is_sdca_aux_dev_present(dev, codec_info->auxs[j].codec_name,
+ adr_link, i);
+ if (ret < 0)
+ return ret;
+
+ if (ret == 0)
+ continue;
+
component = snd_soc_lookup_component_by_name(codec_info->auxs[j].codec_name);
if (component) {
dev_dbg(dev, "%s found component %s for aux name %s\n",
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] ASoC: soc_sdw_utils: Change comment into proper kernel doc
2026-05-08 9:47 [PATCH 0/2] ASoC: soc_sdw_utils: skip aux device if it is not present Bard Liao
2026-05-08 9:47 ` [PATCH 1/2] " Bard Liao
@ 2026-05-08 9:47 ` Bard Liao
2026-05-11 1:05 ` [PATCH 0/2] ASoC: soc_sdw_utils: skip aux device if it is not present Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Bard Liao @ 2026-05-08 9:47 UTC (permalink / raw)
To: broonie, tiwai; +Cc: linux-sound, bard.liao, peter.ujfalusi
From: Maciej Strozek <mstrozek@opensource.cirrus.com>
Update the comment above is_sdca_endpoint_present().
Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
sound/soc/sdw_utils/soc_sdw_utils.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c
index da626969a657..d8378d1b435e 100644
--- a/sound/soc/sdw_utils/soc_sdw_utils.c
+++ b/sound/soc/sdw_utils/soc_sdw_utils.c
@@ -1843,20 +1843,16 @@ int asoc_sdw_get_dai_type(u32 type)
}
EXPORT_SYMBOL_NS(asoc_sdw_get_dai_type, "SND_SOC_SDW_UTILS");
-/*
- * Check if the SDCA endpoint is present by the SDW peripheral
- *
+/**
+ * is_sdca_endpoint_present - Check if an SDCA endpoint is present on the SDW peripheral
* @dev: Device pointer
* @codec_info: Codec info pointer
* @adr_link: ACPI link address
* @adr_index: Index of the ACPI link address
* @end_index: Index of the endpoint
*
- * Return: 1 if the endpoint is present,
- * 0 if the endpoint is not present,
- * negative error code.
+ * Return: 1 if the endpoint is present, 0 if the endpoint is not present, or negative error code.
*/
-
static int is_sdca_endpoint_present(struct device *dev,
struct asoc_sdw_codec_info *codec_info,
const struct snd_soc_acpi_link_adr *adr_link,
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] ASoC: soc_sdw_utils: skip aux device if it is not present
2026-05-08 9:47 [PATCH 0/2] ASoC: soc_sdw_utils: skip aux device if it is not present Bard Liao
2026-05-08 9:47 ` [PATCH 1/2] " Bard Liao
2026-05-08 9:47 ` [PATCH 2/2] ASoC: soc_sdw_utils: Change comment into proper kernel doc Bard Liao
@ 2026-05-11 1:05 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-05-11 1:05 UTC (permalink / raw)
To: tiwai, Bard Liao; +Cc: linux-sound, bard.liao, peter.ujfalusi
On Fri, 08 May 2026 17:47:48 +0800, Bard Liao wrote:
> ASoC: soc_sdw_utils: skip aux device if it is not present
>
> ASoC: soc_sdw_utils: skip aux device if it is not present
>
> Similarly to codec endpoints that may not be used [1], aux devices (like
> HID) also may not be used. Hence skip aux devices which are not present.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2
Thanks!
[1/2] ASoC: soc_sdw_utils: skip aux device if it is not present
https://git.kernel.org/broonie/sound/c/954222bb686d
[2/2] ASoC: soc_sdw_utils: Change comment into proper kernel doc
https://git.kernel.org/broonie/sound/c/21bcd34e70af
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] 4+ messages in thread