diff mbox series

ASoC: test-component: add set_tdm_slot stub implementation

Message ID 20250410-test-component-tdm-slot-v1-1-9c3a7162fa7a@collabora.com (mailing list archive)
State Accepted
Commit e78e7856d233010e6afef62f15567a8e7777c8bc
Headers show
Series ASoC: test-component: add set_tdm_slot stub implementation | expand

Commit Message

Nicolas Frattaroli April 10, 2025, 7:25 p.m. UTC
The test-component driver implements various stub callbacks. One
of the ones it doesn't implement is set_tdm_slot. This has no
functional impact on whether ASoC core believes test-component to
do TDM or not, it just means that any TDM configuration can't
readily be dumped for debugging purposes like it can with the other
callbacks.

Add a stub implementation to allow for this. The output uses dev_info
rather than dev_dbg, to be in line with the set_fmt stub implementation
above.

Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
---
Quite unlike how I initially thought the code worked, this stub
implementation of the DAI op isn't actually needed to make ASoC core see
it as a TDM-capable DAI. There's no checking of that sort, it seems. I
mistook a different debug print I added for the test-component output
when I was testing this, which lead me down a stray path about 20 shaved
yaks deep.

Still, the stub implementation is useful to make sure DT properties are
set correctly in e.g. an audio-graph-card, meaning the dai properties
are in the endpoint nodes, which wasn't the case for me. In particular,
I can just swap the compatible of a codec out for a test component with
no changes to the rest of the node and immediately get to see whether
ASoC core sees my devicetree the same way I do.
---
 sound/soc/generic/test-component.c | 11 +++++++++++
 1 file changed, 11 insertions(+)


---
base-commit: 64e9fdfc89a76fed38d8ddeed72d42ec71957ed9
change-id: 20250410-test-component-tdm-slot-b44571bc9d22

Best regards,

Comments

Kuninori Morimoto April 10, 2025, 11:47 p.m. UTC | #1
Hi

> The test-component driver implements various stub callbacks. One
> of the ones it doesn't implement is set_tdm_slot. This has no
> functional impact on whether ASoC core believes test-component to
> do TDM or not, it just means that any TDM configuration can't
> readily be dumped for debugging purposes like it can with the other
> callbacks.
> 
> Add a stub implementation to allow for this. The output uses dev_info
> rather than dev_dbg, to be in line with the set_fmt stub implementation
> above.
> 
> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> ---

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto
Mark Brown April 11, 2025, 1:39 p.m. UTC | #2
On Thu, 10 Apr 2025 21:25:32 +0200, Nicolas Frattaroli wrote:
> The test-component driver implements various stub callbacks. One
> of the ones it doesn't implement is set_tdm_slot. This has no
> functional impact on whether ASoC core believes test-component to
> do TDM or not, it just means that any TDM configuration can't
> readily be dumped for debugging purposes like it can with the other
> callbacks.
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: test-component: add set_tdm_slot stub implementation
      commit: e78e7856d233010e6afef62f15567a8e7777c8bc

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
diff mbox series

Patch

diff --git a/sound/soc/generic/test-component.c b/sound/soc/generic/test-component.c
index 5430d25deaef18700bbefc3f297246fe93945472..89b995987e2d46f58e0cbeb81816d233320edaec 100644
--- a/sound/soc/generic/test-component.c
+++ b/sound/soc/generic/test-component.c
@@ -140,6 +140,15 @@  static int test_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 	return 0;
 }
 
+static int test_dai_set_tdm_slot(struct snd_soc_dai *dai,
+				 unsigned int tx_mask, unsigned int rx_mask,
+				 int slots, int slot_width)
+{
+	dev_info(dai->dev, "set tdm slot: tx_mask=0x%08X, rx_mask=0x%08X, slots=%d, slot_width=%d\n",
+		 tx_mask, rx_mask, slots, slot_width);
+	return 0;
+}
+
 static int test_dai_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
 {
 	mile_stone(dai);
@@ -203,6 +212,7 @@  static const u64 test_dai_formats =
 
 static const struct snd_soc_dai_ops test_ops = {
 	.set_fmt		= test_dai_set_fmt,
+	.set_tdm_slot		= test_dai_set_tdm_slot,
 	.startup		= test_dai_startup,
 	.shutdown		= test_dai_shutdown,
 	.auto_selectable_formats	= &test_dai_formats,
@@ -214,6 +224,7 @@  static const struct snd_soc_dai_ops test_verbose_ops = {
 	.set_pll		= test_dai_set_pll,
 	.set_clkdiv		= test_dai_set_clkdiv,
 	.set_fmt		= test_dai_set_fmt,
+	.set_tdm_slot		= test_dai_set_tdm_slot,
 	.mute_stream		= test_dai_mute_stream,
 	.startup		= test_dai_startup,
 	.shutdown		= test_dai_shutdown,