[alsa-devel] simple card, asymetrical configuration

Michael Walle michael at walle.cc
Mon Dec 2 14:25:31 CET 2019


Hi Kuninori,

there seems to be a problem in the simple-card using the following 
device tree fragment:

sound {
	compatible = "simple-audio-card";
	simple-audio-card,format = "i2s";
[snip]
	simple-audio-card,bitclock-master = <&dailink0_master>;
	simple-audio-card,frame-master = <&dailink0_master>;

	simple-audio-card,cpu at 0 {
		sound-dai = <&sai6>;
	};

	simple-audio-card,cpu at 1 {
		sound-dai = <&sai5>;
	};

	dailink0_master: simple-audio-card,codec {
		sound-dai = <&wm8904>;
	};
};

Just for the background, I have hardware with the LS1028A which only 
have unidirectional SAIs. But two of those SAIs (one for playback and 
one for capture) are connected to one codec (with a shared bit and frame 
clock).

So I thought the example in the simple-card bindings makes sense for my 
case. Although I don't really know what "(Mixing)" means.

Nevertheless, using the fragment above, the kernel oopses or fails to 
probe the hardware. I've traced that back to the following:
  - the count is correct: the kernel reports "link 2, dais 3, ccnf 0". 
please note the 3 dais here.
  - but simple_dai_link_of() will always "allocate" two dais from the 
pool:

         cpu_dai                 =
         dai_props->cpu_dai      = &priv->dais[li->dais++];
         codec_dai               =
         dai_props->codec_dai    = &priv->dais[li->dais++];

While this still works for the first link, the second one will fail 
because codec_dai will not be valid.

Btw, converting that to two explicit dai-link nodes, the dai count will 
be 4 and it will work.

Is my use case correct or should I use the two explicit dai-link nodes? 
But in any case there seems to be a bug in simple-card.

-michael


More information about the Alsa-devel mailing list