mbox series

[0/9] ASoC: tidyup snd_soc_of_parse_daifmt()

Message ID 875yypdxlm.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
Headers show
Series ASoC: tidyup snd_soc_of_parse_daifmt() | expand

Message

Kuninori Morimoto June 8, 2021, 12:11 a.m. UTC
Hi Mark

I want to add new audio-graph-card2 sound card driver,
and this is last part of necessary soc-core cleanup for it.

Current some drivers are using DT, and Then,
snd_soc_of_parse_daifmt() parses daifmt, but bitclock/frame provider
parsing part is one of headache, because we are assuming below both cases.

A)	node {
		bitclock-master;
		frame-master;
		...
	};
    
B)	link {
		bitclock-master = <&xxx>;
		frame-master = <&xxx>;
		...
	};

The original was style A), and style B) was added later.

snd_soc_of_parse_daifmt() parses A) style as original style,
and user need to update to B) style for clock_provider part if needed.
In such case, user need to re-parse it, like below.
    
	daifmt = snd_soc_of_parse_daifmt(..., &bitclkmaster, &framemaster);
	daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
    
	if (codec == bitclkmaster)
		daifmt |= (codec == framemaster) ?
			SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
	else
		daifmt |= (codec == framemaster) ?
			SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;

This patch-set adds new functions, and handle these more simply.
Unfortunately, there are too many use-case, do it by 1 function was implessible.

style A)
	bit_frame = snd_soc_daifmt_parse_clock_provider();
	daifmt = snd_soc_daifmt_parse_format(...) |              /* format part */
		snd_soc_daifmt_clock_provider_pickup(bit_frame); /* clock  part */
    
style B)
	snd_soc_daifmt_parse_clock_provider(..., &bit, &frame);
	daifmt = snd_soc_daifmt_parse_format(...) |    /* format part */
		snd_soc_daifmt_clock_provider_pickup(  /* clock  part */
			((codec == bit) << 4) + (codec == frame));


Kuninori Morimoto (9):
  ASoC: soc-core: don't use discriminatory terms on snd_soc_runtime_get_dai_fmt()
  ASoC: soc-core: add snd_soc_daifmt_clock_provider_pickup()
  ASoC: soc-core: add snd_soc_daifmt_clock_provider_fliped()
  ASoC: soc-core: add snd_soc_daifmt_parse_format/clock_provider()
  ASoC: atmel: switch to use snd_soc_daifmt_parse_format/clock_provider()
  ASoC: fsl: switch to use snd_soc_daifmt_parse_format/clock_provider()
  ASoC: meson: switch to use snd_soc_daifmt_parse_format/clock_provider()
  ASoC: simple-card-utils: switch to use snd_soc_daifmt_parse_format/clock_provider()
  ASoC: soc-core: remove snd_soc_of_parse_daifmt()

 include/sound/soc.h                   |  13 +++-
 sound/soc/atmel/mikroe-proto.c        |  18 ++---
 sound/soc/fsl/fsl-asoc-card.c         |  16 +---
 sound/soc/generic/simple-card-utils.c |  19 ++---
 sound/soc/meson/meson-card-utils.c    |  15 ++--
 sound/soc/soc-core.c                  | 103 ++++++++++++++++----------
 6 files changed, 99 insertions(+), 85 deletions(-)

Comments

Mark Brown June 8, 2021, 4:06 p.m. UTC | #1
On 08 Jun 2021 09:11:17 +0900, Kuninori Morimoto wrote:
> I want to add new audio-graph-card2 sound card driver,
> and this is last part of necessary soc-core cleanup for it.
> 
> Current some drivers are using DT, and Then,
> snd_soc_of_parse_daifmt() parses daifmt, but bitclock/frame provider
> parsing part is one of headache, because we are assuming below both cases.
> 
> [...]

Applied to

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

Thanks!

[1/9] ASoC: soc-core: don't use discriminatory terms on snd_soc_runtime_get_dai_fmt()
      commit: 640eac4c849d6390f272862ba8db14f28d423670

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