* [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks
@ 2026-01-12 14:07 Richard Fitzgerald
2026-01-12 14:07 ` [PATCH 1/2] soundwire: Add missing EXPORT for sdw_slave_type Richard Fitzgerald
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Richard Fitzgerald @ 2026-01-12 14:07 UTC (permalink / raw)
To: vkoul, broonie, yung-chuan.liao; +Cc: linux-sound, linux-kernel, patches
This series fixes a problem with soc_sdw_utils.c calling the wrong
codec init callbacks, because it assumed that the DAI name could be
used to uniquely identify the codec. This isn't the case, especially
on SDCA which is a generic driver for many parts.
The second patch is the actual fix.
The first patch is needed to add a missing export to SoundWire core.
Richard Fitzgerald (2):
soundwire: Add missing EXPORT for sdw_slave_type
ASoC: sdw_utils: Call init callbacks on the correct codec DAI
drivers/soundwire/slave.c | 1 +
sound/soc/sdw_utils/soc_sdw_utils.c | 43 ++++++++++++++++++++++++++++-
2 files changed, 43 insertions(+), 1 deletion(-)
--
2.47.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] soundwire: Add missing EXPORT for sdw_slave_type
2026-01-12 14:07 [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks Richard Fitzgerald
@ 2026-01-12 14:07 ` Richard Fitzgerald
2026-01-14 5:26 ` Vinod Koul
2026-01-12 14:07 ` [PATCH 2/2] ASoC: sdw_utils: Call init callbacks on the correct codec DAI Richard Fitzgerald
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Richard Fitzgerald @ 2026-01-12 14:07 UTC (permalink / raw)
To: vkoul, broonie, yung-chuan.liao; +Cc: linux-sound, linux-kernel, patches
include/sdw_type.h provides the function is_sdw_slave() which
requires sdw_slave_type. But sdw_slave_type was not exported.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
drivers/soundwire/slave.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c
index 3d4d00188c26..d933cebad52b 100644
--- a/drivers/soundwire/slave.c
+++ b/drivers/soundwire/slave.c
@@ -23,6 +23,7 @@ const struct device_type sdw_slave_type = {
.release = sdw_slave_release,
.uevent = sdw_slave_uevent,
};
+EXPORT_SYMBOL_GPL(sdw_slave_type);
int sdw_slave_add(struct sdw_bus *bus,
struct sdw_slave_id *id, struct fwnode_handle *fwnode)
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ASoC: sdw_utils: Call init callbacks on the correct codec DAI
2026-01-12 14:07 [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks Richard Fitzgerald
2026-01-12 14:07 ` [PATCH 1/2] soundwire: Add missing EXPORT for sdw_slave_type Richard Fitzgerald
@ 2026-01-12 14:07 ` Richard Fitzgerald
2026-01-13 11:12 ` [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks Charles Keepax
2026-01-14 21:36 ` Mark Brown
3 siblings, 0 replies; 7+ messages in thread
From: Richard Fitzgerald @ 2026-01-12 14:07 UTC (permalink / raw)
To: vkoul, broonie, yung-chuan.liao; +Cc: linux-sound, linux-kernel, patches
asoc_sdw_rtd_init() needs to call the rtd_init() callbacks for each
codec in a dailink. It was finding the codecs by looking for the
matching DAI name in codec_info_list[] but this isn't correct, because
the DAI name isn't guaranteed to be unique. Parts using the same codec
driver (so the same DAI names) might require different machine driver
setup.
Instead, get the struct sdw_slave and extract the SoundWire part ID.
Use this to lookup the entry in codec_info_list[]. This is the same
identity info that was used to find the entry when the machine driver
created the dailink.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: e377c9477317 ("ASoC: intel/sdw_utils: move soundwire codec_info_list structure")
---
sound/soc/sdw_utils/soc_sdw_utils.c | 43 ++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c
index e4ce952e56aa..6bf81ed132d8 100644
--- a/sound/soc/sdw_utils/soc_sdw_utils.c
+++ b/sound/soc/sdw_utils/soc_sdw_utils.c
@@ -855,6 +855,19 @@ struct asoc_sdw_codec_info *asoc_sdw_find_codec_info_part(const u64 adr)
}
EXPORT_SYMBOL_NS(asoc_sdw_find_codec_info_part, "SND_SOC_SDW_UTILS");
+static struct asoc_sdw_codec_info *asoc_sdw_find_codec_info_sdw_id(const struct sdw_slave_id *id)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(codec_info_list); i++)
+ if (id->part_id == codec_info_list[i].part_id &&
+ (!codec_info_list[i].version_id ||
+ id->sdw_version == codec_info_list[i].version_id))
+ return &codec_info_list[i];
+
+ return NULL;
+}
+
struct asoc_sdw_codec_info *asoc_sdw_find_codec_info_acpi(const u8 *acpi_id)
{
int i;
@@ -887,22 +900,46 @@ struct asoc_sdw_codec_info *asoc_sdw_find_codec_info_dai(const char *dai_name, i
}
EXPORT_SYMBOL_NS(asoc_sdw_find_codec_info_dai, "SND_SOC_SDW_UTILS");
+static int asoc_sdw_find_codec_info_dai_index(const struct asoc_sdw_codec_info *codec_info,
+ const char *dai_name)
+{
+ int i;
+
+ for (i = 0; i < codec_info->dai_num; i++) {
+ if (!strcmp(codec_info->dais[i].dai_name, dai_name))
+ return i;
+ }
+
+ return -ENOENT;
+}
+
int asoc_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct asoc_sdw_codec_info *codec_info;
struct snd_soc_dai *dai;
+ struct sdw_slave *sdw_peripheral;
const char *spk_components="";
int dai_index;
int ret;
int i;
for_each_rtd_codec_dais(rtd, i, dai) {
- codec_info = asoc_sdw_find_codec_info_dai(dai->name, &dai_index);
+ if (is_sdw_slave(dai->component->dev))
+ sdw_peripheral = dev_to_sdw_dev(dai->component->dev);
+ else if (dai->component->dev->parent && is_sdw_slave(dai->component->dev->parent))
+ sdw_peripheral = dev_to_sdw_dev(dai->component->dev->parent);
+ else
+ continue;
+
+ codec_info = asoc_sdw_find_codec_info_sdw_id(&sdw_peripheral->id);
if (!codec_info)
return -EINVAL;
+ dai_index = asoc_sdw_find_codec_info_dai_index(codec_info, dai->name);
+ WARN_ON(dai_index < 0);
+
/*
* A codec dai can be connected to different dai links for capture and playback,
* but we only need to call the rtd_init function once.
@@ -912,6 +949,10 @@ int asoc_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (codec_info->dais[dai_index].rtd_init_done)
continue;
+ dev_dbg(card->dev, "%#x/%s initializing for %s/%s\n",
+ codec_info->part_id, codec_info->dais[dai_index].dai_name,
+ dai->component->name, dai->name);
+
/*
* Add card controls and dapm widgets for the first codec dai.
* The controls and widgets will be used for all codec dais.
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks
2026-01-12 14:07 [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks Richard Fitzgerald
2026-01-12 14:07 ` [PATCH 1/2] soundwire: Add missing EXPORT for sdw_slave_type Richard Fitzgerald
2026-01-12 14:07 ` [PATCH 2/2] ASoC: sdw_utils: Call init callbacks on the correct codec DAI Richard Fitzgerald
@ 2026-01-13 11:12 ` Charles Keepax
2026-01-13 22:17 ` Pierre-Louis Bossart
2026-01-14 21:36 ` Mark Brown
3 siblings, 1 reply; 7+ messages in thread
From: Charles Keepax @ 2026-01-13 11:12 UTC (permalink / raw)
To: Richard Fitzgerald
Cc: vkoul, broonie, yung-chuan.liao, linux-sound, linux-kernel,
patches
On Mon, Jan 12, 2026 at 02:07:55PM +0000, Richard Fitzgerald wrote:
> This series fixes a problem with soc_sdw_utils.c calling the wrong
> codec init callbacks, because it assumed that the DAI name could be
> used to uniquely identify the codec. This isn't the case, especially
> on SDCA which is a generic driver for many parts.
>
> The second patch is the actual fix.
> The first patch is needed to add a missing export to SoundWire core.
>
> Richard Fitzgerald (2):
> soundwire: Add missing EXPORT for sdw_slave_type
> ASoC: sdw_utils: Call init callbacks on the correct codec DAI
>
> drivers/soundwire/slave.c | 1 +
> sound/soc/sdw_utils/soc_sdw_utils.c | 43 ++++++++++++++++++++++++++++-
> 2 files changed, 43 insertions(+), 1 deletion(-)
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks
2026-01-13 11:12 ` [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks Charles Keepax
@ 2026-01-13 22:17 ` Pierre-Louis Bossart
0 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2026-01-13 22:17 UTC (permalink / raw)
To: Charles Keepax, Richard Fitzgerald, vkoul
Cc: broonie, yung-chuan.liao, linux-sound, linux-kernel, patches
On 1/13/26 12:12, Charles Keepax wrote:
> On Mon, Jan 12, 2026 at 02:07:55PM +0000, Richard Fitzgerald wrote:
>> This series fixes a problem with soc_sdw_utils.c calling the wrong
>> codec init callbacks, because it assumed that the DAI name could be
>> used to uniquely identify the codec. This isn't the case, especially
>> on SDCA which is a generic driver for many parts.
>>
>> The second patch is the actual fix.
>> The first patch is needed to add a missing export to SoundWire core.
>>
>> Richard Fitzgerald (2):
>> soundwire: Add missing EXPORT for sdw_slave_type
>> ASoC: sdw_utils: Call init callbacks on the correct codec DAI
>>
>> drivers/soundwire/slave.c | 1 +
>> sound/soc/sdw_utils/soc_sdw_utils.c | 43 ++++++++++++++++++++++++++++-
>> 2 files changed, 43 insertions(+), 1 deletion(-)
>
> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
It's not obvious from the patchset title that the first patch probably needs Vinod's Acked-by tag
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] soundwire: Add missing EXPORT for sdw_slave_type
2026-01-12 14:07 ` [PATCH 1/2] soundwire: Add missing EXPORT for sdw_slave_type Richard Fitzgerald
@ 2026-01-14 5:26 ` Vinod Koul
0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2026-01-14 5:26 UTC (permalink / raw)
To: Richard Fitzgerald
Cc: broonie, yung-chuan.liao, linux-sound, linux-kernel, patches
On 12-01-26, 14:07, Richard Fitzgerald wrote:
> include/sdw_type.h provides the function is_sdw_slave() which
> requires sdw_slave_type. But sdw_slave_type was not exported.
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks
2026-01-12 14:07 [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks Richard Fitzgerald
` (2 preceding siblings ...)
2026-01-13 11:12 ` [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks Charles Keepax
@ 2026-01-14 21:36 ` Mark Brown
3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2026-01-14 21:36 UTC (permalink / raw)
To: vkoul, yung-chuan.liao, Richard Fitzgerald
Cc: linux-sound, linux-kernel, patches
On Mon, 12 Jan 2026 14:07:55 +0000, Richard Fitzgerald wrote:
> This series fixes a problem with soc_sdw_utils.c calling the wrong
> codec init callbacks, because it assumed that the DAI name could be
> used to uniquely identify the codec. This isn't the case, especially
> on SDCA which is a generic driver for many parts.
>
> The second patch is the actual fix.
> The first patch is needed to add a missing export to SoundWire core.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] soundwire: Add missing EXPORT for sdw_slave_type
commit: 1ddbcb910a06f53fc2b14e1743c6ad4ccfd7107f
[2/2] ASoC: sdw_utils: Call init callbacks on the correct codec DAI
commit: 5b027c74f3ee8979193c50d31187edfa31acc0db
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] 7+ messages in thread
end of thread, other threads:[~2026-01-14 21:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 14:07 [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks Richard Fitzgerald
2026-01-12 14:07 ` [PATCH 1/2] soundwire: Add missing EXPORT for sdw_slave_type Richard Fitzgerald
2026-01-14 5:26 ` Vinod Koul
2026-01-12 14:07 ` [PATCH 2/2] ASoC: sdw_utils: Call init callbacks on the correct codec DAI Richard Fitzgerald
2026-01-13 11:12 ` [PATCH 0/2] ASoC: Fix sdw_utils calling wrong codec init callbacks Charles Keepax
2026-01-13 22:17 ` Pierre-Louis Bossart
2026-01-14 21:36 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox