[alsa-devel] ASoC: Using mxs-saif with simple-card

Jörg Krause joerg.krause at embedded.rocks
Sat Jan 7 20:30:20 CET 2017


Hi,

I am trying to use the simple-card framework on a custom i.MX28 board.
There are two SAIF modules (saif0 and saif1) instantiated on the cpu. A
reference for the platform driver is mxs-sgtl5000. The two cpu dais
saif0 and saif1 are connected to the audio codec sgtl5000. saif0 is
used to playback and saif1 is used to capture.

Unfortunately, I do not have a sgtl5000 codec, but a pcm5102a, a wm8524
and wm8731 to play with.

For all those codec I copied the mxs-sgtl5000 driver, e.g. mxs-
pcm5102a, mxs-wm8524, mxs-wm8731. I will refer to these drivers as mxs-
<codec> later. The only difference was in setting the mclk. That's why
I'm interested in using the simple-card driver for this platform.

With the help of Mans Rullgard I came up with these parts of the device
tree node when using the wm8731 codec:

sound {
	compatible = "simple-audio-card";
	simple-audio-card,name = "hbm10-wm8731";
	simple-audio-card,widgets =
				"Headphone", "Headphone Jack",
				"Microphone", "Microphone Jack",
				"Line", "Line Jack";
	simple-audio-card,routing =
				"Headphone Jack", "RHPOUT",
				"Headphone Jack", "LHPOUT",
				"LLINEIN", "Line Jack",
				"MICIN", "Mic Bias",
				"Mic Bias", "Microphone Jack";

	simple-audio-card,dai-link at 0 {
		format = "i2s";
		bitclock-master = <&dai0_master>;
		frame-master = <&dai0_master>;
		mclk-fs = <256>;

		dai0_master: cpu {
			sound-dai = <&saif0>;
		};

		codec {
			sound-dai = <&wm8731>;
			clocks = <&saif0>;
		};
	};

	simple-audio-card,dai-link at 1 {
		format = "i2s";
		bitclock-master = <&dai1_master>;
		frame-master = <&dai1_master>;
		mclk-fs = <256>;

		dai1_master: cpu {
			sound-dai = <&saif1>;
		};

		codec {
			sound-dai = <&wm8731>;
		};
	};
};

&saif0 {
	#sound-dai-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&saif0_pins_a>;
	assigned-clocks = <&clks 53>;
	assigned-clock-rates = <12288000>;
	status = "okay";
};

&saif1 {
	#sound-dai-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&saif1_pins_a>;
	fsl,saif-master = <&saif0>;
	status = "okay";
};

&i2c0 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c0_pins_a>;
	status = "okay";

	wm8731: wm8731 at 1a {
		#sound-dai-cells = <0>;
		compatible = "wlf,wm8731";
		reg = <0x1a>;
	};
};

>From my understanding of the simple-card framework this should connect
saif0 (cpu dai) <-> wm8731 (codec) and saif1 (cpu dai) <-> wm8731
(codec) as it is done in the probe function of the mxs-<codec> driver,
right?

However, this gives me a warning while bringing up the board:

sysfs: cannot create duplicate filename '/devices/soc0/sound/mxs-saif-
wm8731-hifi'.

Note, that the simple-card framework works fine for mxs-saif if using
only the dai0 link (playback) and leaving the dai1 link (capture).

Am I doing something wrong here?

Is it possible to map the two dai links using the current simple-card
framework?

Is anyone using the simple-card framework on mxs-saif using both
playback and capture?

Best regards,
Jörg Krause


More information about the Alsa-devel mailing list