Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/9] ASoC: don't use array if single pattarn
@ 2026-06-08  0:57 Kuninori Morimoto
  2026-06-08  0:57 ` [PATCH v2 1/9] ASoC: remove SND_SOC_POSSIBLE_xBx_xFx Kuninori Morimoto
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: Kuninori Morimoto @ 2026-06-08  0:57 UTC (permalink / raw)
  To: Baojun Xu, Geert Uytterhoeven, Herve Codina, Jaroslav Kysela,
	Kevin Lu, Liam Girdwood, linux-renesas-soc, linux-sound,
	Mark Brown, Sen Wang, Shenghao Ding, Support Opensource,
	Takashi Iwai, "Uwe Kleine-König (The Capable Hub)"


Hi Mark, all

I have posted this patch-set as [RFC] and v1 before.
This is v2.

v1
Link: https://lore.kernel.org/r/8733zfj5jj.wl-kuninori.morimoto.gx@renesas.com

It was too huge patch-set, thus I have separated it into 3 part.
(A)	- Update existing driver which is already using auto format
	- Add auto format support to not-yet used driver
(B)	 - Already got Reivewed-by / Acked-by
(C)	 - No yet reviewed

This is (A).

------- 8< ------- 8< ------- 8< ------- 8< ------- 8< -------

Current ASoC supports snd_soc_daifmt_parse_format() which can specify DAI
format by "dai-format" property from DT.
But strictly speaking, it is SW settings, so doesn't match to DT's policy.

Current ASoC is supporting auto format select via
snd_soc_dai_ops :: .auto_selectable_formats.
But the user is very few today.

DT doesn't need to specify the DAI format via "dai-format", if both CPU
and Codec drivers were supporting .auto_selectable_formats. It will be
automatically selected from .auto_selectable_formats.

But, I noticed that current auto format select method can't handle all cases.
For example, current .auto_selectable_formats is like below

	static u64 xxx_auto_formats[] = {
(A)		/* First Priority */
		SND_SOC_POSSIBLE_DAIFMT_I2S	|
		SND_SOC_POSSIBLE_DAIFMT_LEFT_J	|
		SND_SOC_POSSIBLE_DAIFMT_NB_NF	|
		SND_SOC_POSSIBLE_DAIFMT_NB_IF	|	(x)
		SND_SOC_POSSIBLE_DAIFMT_IB_NF	|
		SND_SOC_POSSIBLE_DAIFMT_IB_IF,		(x)

		/* Second Priority */
(B)		SND_SOC_POSSIBLE_DAIFMT_DSP_A	|	(y)
		SND_SOC_POSSIBLE_DAIFMT_DSP_B,		(y)
	};

It try to find DAI format from (A) first, and next it will use (A | B).
But it can't handle the format if some format were independent.
For example, DSP_x (y) can't use with xB_IF (x), etc.

So, I would like to update the method. New method doesn't use OR.
It try to find DAI format from (a), next it will use (b).

	static u64 xxx_auto_formats[] = {
(a)		/* First Priority */
		SND_SOC_POSSIBLE_DAIFMT_I2S	|
		SND_SOC_POSSIBLE_DAIFMT_LEFT_J	|
		SND_SOC_POSSIBLE_DAIFMT_NB_NF	|
		SND_SOC_POSSIBLE_DAIFMT_NB_IF	|
		SND_SOC_POSSIBLE_DAIFMT_IB_NF	|
		SND_SOC_POSSIBLE_DAIFMT_IB_IF,

		/* Second Priority */
(b)		SND_SOC_POSSIBLE_DAIFMT_DSP_A	|
		SND_SOC_POSSIBLE_DAIFMT_DSP_B	|
		SND_SOC_POSSIBLE_DAIFMT_NB_NF	|
		SND_SOC_POSSIBLE_DAIFMT_IB_NF,
	};

Switch old method to new method, Current auto select user need to update
.auto_selectable_formats. Fortunately, current few users doesn't have
above limitation. update (A)(B) to (a)(b) style is possible.

	a = A
	b = A | B

I would like to update method, and add .auto_selectable_formats
support on all drivers.

One note is that auto select might not find best format on some CPU/Codec
combination. So "dai-format" is necessary anyway.

And, there haven't been any big problems on .auto_selectable_formats,
because there were few users.
But if all drivers try to use this, it cannot be denied that they may
encounter unknown problems... In such case, "dai-format" can help, though.


Kuninori Morimoto (9):
  ASoC: remove SND_SOC_POSSIBLE_xBx_xFx
  ASoC: codecs: framer-codec: don't use array if single pattarn
  ASoC: codecs: idt821034: don't use array if single pattarn
  ASoC: codecs: peb2466: don't use array if single pattarn
  ASoC: codecs: ak4619: update auto select format
  ASoC: codecs: pcm3168a: update auto select format
  ASoC: renesas: rcar: update auto select format
  ASoC: update auto format selection method
  ASoC: audio-graph-card2: recommend to use auto select DAI format

 include/sound/soc-dai.h               |  15 +-
 sound/soc/codecs/ak4613.c             |   5 -
 sound/soc/codecs/ak4619.c             |   8 +-
 sound/soc/codecs/da7213.c             |   5 -
 sound/soc/codecs/framer-codec.c       |   8 +-
 sound/soc/codecs/idt821034.c          |   9 +-
 sound/soc/codecs/pcm3168a.c           |   8 +-
 sound/soc/codecs/peb2466.c            |   9 +-
 sound/soc/generic/audio-graph-card2.c |  12 ++
 sound/soc/generic/test-component.c    |   7 -
 sound/soc/renesas/fsi.c               |   5 -
 sound/soc/renesas/rcar/core.c         |  12 +-
 sound/soc/renesas/rcar/msiof.c        |   5 -
 sound/soc/soc-core.c                  | 160 +-------------------
 sound/soc/soc-dai.c                   | 207 ++++++++++++++++++++------
 sound/soc/soc-utils.c                 |   7 -
 16 files changed, 201 insertions(+), 281 deletions(-)

-- 
2.53.0


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

end of thread, other threads:[~2026-06-08 23:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08  0:57 [PATCH v2 0/9] ASoC: don't use array if single pattarn Kuninori Morimoto
2026-06-08  0:57 ` [PATCH v2 1/9] ASoC: remove SND_SOC_POSSIBLE_xBx_xFx Kuninori Morimoto
2026-06-08  0:57 ` [PATCH v2 2/9] ASoC: codecs: framer-codec: don't use array if single pattarn Kuninori Morimoto
2026-06-08 13:33   ` Herve Codina
2026-06-08 23:12     ` Kuninori Morimoto
2026-06-08  0:57 ` [PATCH v2 3/9] ASoC: codecs: idt821034: " Kuninori Morimoto
2026-06-08 13:33   ` Herve Codina
2026-06-08  0:58 ` [PATCH v2 4/9] ASoC: codecs: peb2466: " Kuninori Morimoto
2026-06-08 13:34   ` Herve Codina
2026-06-08  0:58 ` [PATCH v2 5/9] ASoC: codecs: ak4619: update auto select format Kuninori Morimoto
2026-06-08  0:58 ` [PATCH v2 6/9] ASoC: codecs: pcm3168a: " Kuninori Morimoto
2026-06-08  0:58 ` [PATCH v2 7/9] ASoC: renesas: rcar: " Kuninori Morimoto
2026-06-08  0:58 ` [PATCH v2 8/9] ASoC: update auto format selection method Kuninori Morimoto
2026-06-08  0:58 ` [PATCH v2 9/9] ASoC: audio-graph-card2: recommend to use auto select DAI format Kuninori Morimoto

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