Hello,
I have built a carrier board with TI PCM3168A codec which interfaces 6in/8out via tdm. This carrier board supplies a 24.576MHz clock to the PCM3168A’s scki input, and also to the Rock Pi S GPIO header (Pin 7 = GPIO2_A4).
The TRM for the RK3308 indicates that it can either supply mclk from that pin as an output, or accept an external mclk via that pin as an input. However I can’t work out the necessary dt bindings to link it all up.
I’m using Armbian 20.11.6 Focal with Linux 5.9.14-rockchip64. So far my dts overlay will show the card as an ALSA device, with no errors in dmesg but speaker-test does not scroll through the speaker channels - it just gets stuck on ch0 suggesting that the driver stack is not receiving the mclk.
Confirmed that the LRCLK and BCLK is present at the GPIO pins, originating from the PCM3168A as the LRCLK and BCLK master (ie: RK3308 is LRCLK + BCLK slave).
Has anybody successfully sourced mclk externally?
Here is my current pcm3168a.dts:
/dts-v1/;
/plugin/;
/ {
compatible = "radxa,rockpis\0rockchip,rk3308";
fragment@0 {
target = <&acodec>;
__overlay__ {
status = "disabled";
};
};
fragment@1 {
target = <&codec>;
__overlay__ {
status = "disabled";
};
};
fragment@2 {
target = <&pcm5102a>;
__overlay__ {
status = "disabled";
};
};
fragment@3 {
target = <&i2s_8ch_2>; /* i2s@ff320000*/
__overlay__ {
status = "disabled";
};
};
fragment@4 {
target = <&i2s_8ch_0>; /* i2s@ff300000*/
__overlay__ {
#sound-dai-cells = <0x0>;
rockchip,bclk-fs = <0x200>;
rockchip,clk-trcm = <0>; /* 0 = tx_lrck/bclk and rx_lrck/bclk used 1 = only tx 2 = only rx */
status = "okay";
};
};
fragment@5 {
target-path = "/";
__overlay__ {
mclk_i2s0_8ch_in: mclk_i2s0_8ch_in {
compatible = "fixed-clock";
#clock-cells = < 0x00 >;
clock-frequency = < 0x1770000 >;
clock-output-names = "mclk_i2s0_8ch_in";
};
};
};
fragment@6 {
target = <&i2c1>; /* i2c@ff050000 */
__overlay__ {
status = "okay";
pcm3168: codec@44 {
compatible = "ti,pcm3168a";
reg = <0x44>; /* i2c address */
reset-gpios = <&gpio3 10 0>; /* May need to be inverted */
#sound-dai-cells = <1>;
clocks = <&mclk_i2s0_8ch_in>;
clock-names = "scki";
VDD1-supply = <&vcc_io>;
VDD2-supply = <&vcc_io>;
VCCAD1-supply = <&vcc5v0_sys>;
VCCAD2-supply = <&vcc5v0_sys>;
VCCDA1-supply = <&vcc5v0_sys>;
VCCDA2-supply = <&vcc5v0_sys>;
};
};
};
fragment@7 {
target-path = "/sound";
__overlay__ {
compatible = "simple-audio-card";
#address-cells = <1>;
#size-cells = <0>;
simple-audio-card,name = "KimCardashian";
simple-audio-card,mclk-fs = <0x200>;
simple-audio-card,dai-link@1 {
format = "i2s";
bitclock-master = <&pcm3168_dac>;
frame-master = <&pcm3168_dac>;
cpu {
sound-dai = <&i2s_8ch_0>;
dai-tdm-slot-num = <8>;
dai-tdm-slot-width = <32>;
};
pcm3168_dac: codec {
sound-dai = <&pcm3168 0>;
dai-tdm-slot-num = <8>;
dai-tdm-slot-width = <32>;
clocks = <&mclk_i2s0_8ch_in>;
};
};
simple-audio-card,dai-link@2 {
format = "i2s";
bitclock-master = <&pcm3168_adc>;
frame-master = <&pcm3168_adc>;
cpu {
sound-dai = <&i2s_8ch_0>;
dai-tdm-slot-num = <0x08>;
dai-tdm-slot-width = <0x20>;
};
pcm3168_adc: codec {
sound-dai = <&pcm3168 1>;
dai-tdm-slot-num = <0x08>;
dai-tdm-slot-width = <0x20>;
clocks = <&mclk_i2s0_8ch_in>;
};
};
};
};
};