Hi there,
First of all, please feel free to direct me to any other forum where it
would be more appropriate to ask these questions.
I am building a soundcard based on the PCM3168A codec. This codec has
a DAC and ADC,each with separate LRCK/BCK lines. The codec's system
clock is from an external crystal and the codec will produce the I2S
clocks. Since the target CPU only has a single pair of I2S clock lines,
the two pairs of clock lines from the PCM3168A are tied together, and
the codec DAC will be clock producer, with the codec ADC and the CPU as
clock consumers.
-------------------
--------- ------------| LRCK DAC
LRCK|-------+--/ -------| BCK producer C
CPU | | / | O
BCK|-------|---+--/ | ------------ D
consumer | \ | | E
---------| ---------------| LRCK ADC C
`-----------| BCK consumer
--------------------
Importantly, the CPU's I2S peripheral is constrained to be a clock
consumer (it has another peripheral that can be a clock provider).
As far as I can see, this needs two DAI links:
1. Playback DAI link: CPU (clock consumer) - codec DAC (clock provider)
2. Capture DAI link: codec ADC (clock consumer) - CPU (clock consumer)
The PCM3168A is connected via I2C, and I have successfully tested it
using the dummy codecs (linux,spdif-dir and linux,spdif-dit) and
manually setting the codec's registers using i2cset. In that setup, the
codec was set as clock producer on both DAI links, but it didn't matter
because the codec driver didn't do anything.
However, I am unsure how I would get this working properly with the
PCM3168A codec driver.
When I set up soc_simple_card with no clock provider specified in the
capture DAI link (see DTS at bottom), it throws this error:
[ 792.329694] designware-i2s 1f000a4000.i2s: ASoC: error at
snd_soc_dai_set_fmt on 1f000a4000.i2s: -22
[ 792.329833] asoc-simple-card: probe of soc:sound failed with error -22
The function in the I2S driver is pretty simple:
https://github.com/torvalds/linux/blob/bcc8eda6d34934d80b96adb8dc4ff5dfc632a53a/sound/soc/dwc/dwc-i2s.c#L390
As far as I can see, this error would result from trying to set the
I2S interface as clock provider when it doesn't have the ability to be
a clock provider.
This raises the following questions on how best to proceed:
1. Does SoC support DAI links that have clock consumers at both ends?
2. Does soc_simple_card support specification of these links?
3. Is there some other DT setting that would make this work?
Thanks for your time and any advice you can provide.
Stephen
fragment@2 {
target = <&sound>;
__overlay__ {
compatible = "simple-audio-card";
#address-cells = <1>;
#size-cells = <0>;
i2s-controller = <&i2s_clk_consumer>;
status="okay";
simple-audio-card,name = "i2smulti";
simple-audio-card,format = "i2s";
dailink_out_master: simple-audio-card,dai-link@0 {
reg = <0>;
format = "i2s";
bitclock-master = <&pcm3168_playback>;
frame-master = <&pcm3168_playback>;
cpu {
sound-dai = <&i2s_clk_consumer>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
pcm3168_playback: codec {
sound-dai = <&pcm3168a 0>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
};
dailink_in_slave: simple-audio-card,dai-link@1 {
reg = <1>;
format = "i2s";
cpu {
sound-dai = <&i2s_clk_consumer>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
pcm3168_capture: codec {
sound-dai = <&pcm3168a 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
};
};
};
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]