snd_soc_dai_set_tdm_slot with slot=0 broken since 6.12.31 kernel

Hello,
Since Raspberry Pi's kernel version 6.12.31, I noticed that snd_soc_dai_set_tdm_slot returns -EINVAL when slots=0 is provided to the function, even though it's a documented legal use case:
* TDM mode can be disabled by passing 0 for @slots. In this case @tx_mask, * @rx_mask and @slot_width will be ignored.
https://elixir.bootlin.com/linux/v6.12.31/source/sound/soc/soc-dai.c#L260
The issue was introduced by this commit:
https://lore.kernel.org/all/87o6z7yk61.wl-kuninori.morimoto.gx@renesas.com/#...
Which adds checking of snd_soc_xlate_tdm_slot_mask result which is -EINVAL in case of slots=0, therefore stopping the snd_soc_dai_set_tdm_slot execution.
The 6.12.30 was still fine: https://elixir.bootlin.com/linux/v6.12.30/source/sound/soc/soc-dai.c#L281
I would suggest skipping the xlate call in case slots is 0 in snd_soc_dai_set_tdm_slot.
Thank you, Giedrius.

Hi Giedrius
Since Raspberry Pi's kernel version 6.12.31, I noticed that snd_soc_dai_set_tdm_slot returns -EINVAL when slots=0 is provided to the function, even though it's a documented legal use case:
- TDM mode can be disabled by passing 0 for @slots. In this case @tx_mask,
- @rx_mask and @slot_width will be ignored.
https://elixir.bootlin.com/linux/v6.12.31/source/sound/soc/soc-dai.c#L260
The issue was introduced by this commit:
https://lore.kernel.org/all/87o6z7yk61.wl-kuninori.morimoto.gx@renesas.com/#...
Which adds checking of snd_soc_xlate_tdm_slot_mask result which is -EINVAL in case of slots=0, therefore stopping the snd_soc_dai_set_tdm_slot execution.
The 6.12.30 was still fine: https://elixir.bootlin.com/linux/v6.12.30/source/sound/soc/soc-dai.c#L281
I would suggest skipping the xlate call in case slots is 0 in snd_soc_dai_set_tdm_slot.
Thank you for your report. I will post fixup patch. I'm happy if you can test it.
Best regards --- Kuninori Morimoto
participants (2)
-
Giedrius Trainavičius
-
Kuninori Morimoto