Good Morning everyone,
I am a software developer at Reichert GmbH in Essen Germany. We use the Wolfson WM8978 as an audio codec for a lot of our devices and use the Toradex colibri module with the iMX6DL in some other embedded devices of ours. Now we are trying to build a new device which combines different features and needs to connect the WM8978 to the iMX6DL.
I am using the codec driver from 2009 which is part of the mainline kernel. The codecs clock is at 24 MHz and I need to configure the needed registers. I know the bare metal configuration for the soc, but I am missing out how to configure the needed parameters with the mentioned codec driver.
The Angstrom linux recognizes the devicetree entries and is loading the right module. The codec driver is also configuring the device, but disabling most of the functions (including the PLL). When trying to play a wave file with aplay following errors occur:
[ 5373.680824] fsl-ssi-dai 202c000.ssi: ASoC: can't set 202c000.ssi hw params: -22
ALSA lib ../../../alsa-lib-1.1.4.1/src/pcm/pcm_direct.c:1271:(snd1_pcm_direct_initialize_slave) unable to install hw params
ALSA lib ../../../alsa-lib-1.1.4.1/src/pcm/pcm_dmix.c:1111:(snd_pcm_dmix_open) unable to initialize slave
aplay: main:807: audio open error: Invalid argument
We connect the audio codec via I2C and four wire I2S. Below is the configuration from our devicetree.
/*
* Audio:
* Audio Multiplexer mit Audiokanal 4
* I2C mit Wolfson WM8978
*/
/ {
sound2 {
compatible = "simple-audio-card";
simple-audio-card,name = "Wolfson WM8978";
simple-audio-card,format = "i2s";
simple-audio-card,widgets =
"Microphone", "AMIC",
"Headphone", "Headphone Jack",
"Speaker", "Line Out Jack";
simple-audio-card,routing =
"LMICN", "AMIC",
"RMICN", "AMIC",
"LMICP", "Mic Bias",
"RMICP", "Mic Bias",
"Headphone Jack", "LHP",
"Headphone Jack", "RHP",
"Line Out Jack", "LSPK",
"Line Out Jack", "RSPK";
simple-audio-card,cpu {
sound-dai = <&ssi2 0>;
};
simple-audio-card,codec {
sound-dai = <&wm8978 0>;
clocks = <&clk24m>;
/*system-clock-frequency = <24000000>;*/
};
};
};
&iomuxc {
imx6dl-colibri {
pinctrl_audmux4: audmux4grp {
fsl,pins = <
MX6QDL_PAD_DISP0_DAT20__AUD4_TXC 0x130b0
MX6QDL_PAD_DISP0_DAT21__AUD4_TXD 0x130b0
MX6QDL_PAD_DISP0_DAT22__AUD4_TXFS 0x130b0
MX6QDL_PAD_DISP0_DAT23__AUD4_RXD 0x130b0
>;
};
pinctrl_i2c4: i2c4grp {
fsl,pins = <
MX6QDL_PAD_NANDF_WP_B__I2C4_SCL 0x4001b8b1
MX6QDL_PAD_NANDF_CS3__I2C4_SDA 0x4001b8b1
>;
};
};
};
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux4>;
status = "okay";
/*
* SSI2 wird auf Port 4 gemapped
* PTCR2: 0x0000 0800
* TFSDIR TFSEL TCLKDIR TCSEL RFSDIR RFSEL RCLKDIR RCSEL SYN RESERVED
* 0 0000 0 0000 1 0011 1 0011 0 00000000000
* PDCR2: 0x0000 6000
* RESERVED RXDSEL TXRXEN RESERVED MODE INMASK
* 0x0000 011 0 000 0 00000000
* PTCR4: 0x8c40 0800
* TFSDIR TFSEL TCLKDIR TCSEL RFSDIR RFSEL RCLKDIR RCSEL SYN RESERVED
* 1 0001 1 0001 0 0000 0 0000 1 00000000000
* PDCR4: 0x0000 2000
* RESERVED RXDSEL TXRXEN RESERVED MODE INMASK
* 0x0000 001 0 000 0 00000000
*/
port2 {
fsl,audmux-port = <2>;
fsl,port-config = <0x00273000 0x00006000>;
};
port4 {
fsl,audmux-port = <4>;
fsl,port-config = <0x8c400800 0x00002000>;
};
};
&ssi2 {
fsl,mode = "i2s-master";
status = "okay";
};
&i2c4 {
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c4>;
status = "okay";
wm8978: wm8978@1a {
#sound-dai-cells = <0>;
compatible = "wlf,wm8978";
reg = <0x1a>;
};
};
My questions in detail are:
- Is there some sort of documentation for the driver? (Usage in the devicetree or in general)
- How to tell the device which systemclock ist used?
- Is it possible to use the WM8978 with ALSA and as simple-audio-card?
- If there is no documentation could you give me some sort of hind how to set up the device?
I am hoping for someone to have any experience with external audio codecs and how to configure them. I would be thankful for every help provided.
thanks in advance.
Best regards
Christoph Biethmann