mbox series

[v2,0/6] ASoC: extra format on each DAI

Message ID 87r064cxym.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
Headers show
Series ASoC: extra format on each DAI | expand

Message

Kuninori Morimoto Dec. 19, 2024, 12:34 a.m. UTC
Hi Mark
Cc Stephen

Current clock provider/consumer setting is set by dai_link->dai_fmt, and it
is Codec base on Sound Card driver (= SND_SOC_DAIFMT_CBx_CFx).

Current CPU/Codec drivers are already based on its own base
(= SND_SOC_DAIFMT_Bx_Fx). So, Codec clock setting uses dai_link->dai_fmt
as-is, and CPU side clock setting is created from Codec base setting by
flipping. Because of this, we can't set both CPU/Codec clock consumer for
example.

To solve this issue, this patch-set adds new ext_fmt on each DAI.
It can keep compatible with legacy style.

	1. SND_SOC_DAIFMT_FORMAT_MASK
	2. SND_SOC_DAIFMT_CLOCK
	3. SND_SOC_DAIFMT_INV
	4. SND_SOC_DAIFMT_CLOCK_PROVIDER

	dai_fmt : dai_link->dai_fmt = common settings
	ext_fmt : each DAI settings
    
Legacy
	dai_fmt  includes 1, 2, 3, 4
    
New style
	dai_fmt  includes 1, 2, 3
	ext_fmt  includes 4

Audio-Graph-Card2 will use this new style by this patch-set.
By this patch, Card2 default behavior (= no "clock-master / frame-master"
settings on DT) will be changed, but no drivers are using it.

In case of no DAI has "clock-master / frame-master" property on DT,
it will be...

Legacy
	CPU  : provider (because flipped from Codec)
	Codec: consumer

New style
	CPU  : consumer
	Codec: consumer

One note is that Simple-Card, Audio-Graph-Card don't implement
this new style to keep compatiblily.

[1/6] - [4/6] are just cleanup before new feature.

This patch-set needs Stephen's Tested-by

v1 -> v2
	- based on asoc/for-next to avoid conflict issue.
	- Needs Stephen's Tested-by

Link: https://lore.kernel.org/r/8734innkpy.wl-kuninori.morimoto.gx@renesas.com


Kuninori Morimoto (6):
  ASoC: audio-graph-card2: use __free(device_node) for device node
  ASoC: audio-graph-card: use __free(device_node) for device node
  ASoC: simple-card: use __free(device_node) for device node
  ASoC: soc-core: return 0 if np was NULL on snd_soc_daifmt_parse_clock_provider_raw()
  ASoC: soc-core: Enable to use extra format on each DAI
  ASoC: audio-graph-card2: Use extra format on each DAI

 include/sound/soc.h                   |  11 ++
 sound/soc/generic/audio-graph-card.c  |  48 ++---
 sound/soc/generic/audio-graph-card2.c | 248 ++++++++++----------------
 sound/soc/generic/simple-card.c       |  58 ++----
 sound/soc/soc-core.c                  |  30 +++-
 5 files changed, 167 insertions(+), 228 deletions(-)

Comments

Stephen Gordon Dec. 20, 2024, 12:01 a.m. UTC | #1
On Thu, 19 Dec 2024 00:34:27 +0000
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote:

> This patch-set needs Stephen's Tested-by
> 

Hi Morimoto-san,

I am attempting to test this by applying your patchset on top of
6.13-rc3. But I am running into a problem, probably because my
graph-card2 DT is wrong. I've attached the DTS file. I used the
Semi-Multi example.

Here is the output of dmesg when I load it:

[   27.277613] /soc@107c000000/sound/multi: Fixed dependency cycle(s)
with /axi/pcie@120000/rp1/i2s@a4000
[   27.277635] /axi/pcie@120000/rp1/i2s@a4000: Fixed dependency
cycle(s) with /soc@107c000000/sound/multi
[   27.277820] /soc@107c000000/sound/multi: Fixed dependency cycle(s)
with /axi/pcie@120000/rp1/i2c@74000/audio-codec@45
[   27.277841] /axi/pcie@120000/rp1/i2c@74000/audio-codec@45: Fixed
dependency cycle(s) with /soc@107c000000/sound/multi
[   27.304322] designware-i2s 1f000a4000.i2s: ASoC: Registered DAI
'1f000a4000.i2s'
[   27.333791] asoc-audio-graph-card2 soc@107c000000:sound:
/axi/pcie@120000/rp1/i2s@a4000/ports/port@0 (Normal)
[   27.333813] asoc-audio-graph-card2 soc@107c000000:sound: link 1,
dais 3, ccnf 0
[   27.333822] asoc-audio-graph-card2 soc@107c000000:sound:
/axi/pcie@120000/rp1/i2s@a4000/ports/port@0 (Normal)
[   27.333830] asoc-audio-graph-card2 soc@107c000000:sound: probe with
driver asoc-audio-graph-card2 failed with error -12
[   27.346051] pcm3168a 1-0045: ASoC: Registered DAI 'pcm3168a-dac'
[   27.346055] pcm3168a 1-0045: ASoC: Registered DAI 'pcm3168a-adc'


I would appreciate any advice you can give.

Regards
Stephen
Kuninori Morimoto Dec. 23, 2024, 2:01 a.m. UTC | #2
Hi Stephen

Thank you for testing

> I am attempting to test this by applying your patchset on top of
> 6.13-rc3. But I am running into a problem, probably because my
> graph-card2 DT is wrong. I've attached the DTS file. I used the
> Semi-Multi example.

Hmm... It seems the DT setting itself is correct. I have copied your
settings to test-cpu / test-codec, but it could probe without any error.

> [   27.333830] asoc-audio-graph-card2 soc@107c000000:sound: probe with
> driver asoc-audio-graph-card2 failed with error -12

It is -12 = -ENOMEM = kmalloc() error ?


Thank you for your help !!

Best regards
---
Kuninori Morimoto