The {cpu-family} provides two transmit/receive Serial Audio Interfaces (SAI) and another two receive-only SAIs.
On the ConnectCore 8X SBC Pro, the SAI0 interface is connected to a Maxim 98089 low-power stereo codec with the following features:
-
Analog inputs: line-in A, line-in B, microphone:
-
Two line-in audio inputs through the LINE1_IN_ and LINE2_IN_ lines of the expansion connector.
-
Microphone audio input through the MIC_ lines of the expansion connector.
-
-
Analog outputs: line-out, headphone, speakers:
-
Line-out audio output through the LINE_OUT_ lines of the expansion connector.
-
Headphone audio output through the on-board jack connector.
-
Speaker audio output through the SPKL_ and SPKR_ lines of the expansion connector.
-
-
Digital input/out multi-format audio interface.
-
Digital processing, filters, volume control, amplifiers.
The codec is a slave chip that the CPU controls via the SAI0 port of the ConnectCore 8X system-on-chip. The CPU drives audio data using the inter-IC sound bus standard (I2S).
Because the headphone jack connection is not automatically detected, the system always plays audio through all output interfaces. |
All audio output comes out through this codec and can be reproduced using a pair of speakers or headphones.
Kernel configuration
You can manage the audio driver support through the following kernel configuration options:
-
SoC Audio for NXP i.MX CPUs (
CONFIG_SND_IMX_SOC
) -
SoC Audio support for i.MX boards with max98088/max98089 (
CONFIG_SND_SOC_IMX_MAX98088
)
These options are enabled as built-in on the default ConnectCore 8X kernel configuration file.
Kernel driver
The drivers for the audio interface and MAX98089 codec are located at:
File | Description |
---|---|
SAI driver |
|
Driver interface with codec |
|
MAX98088/9 codec driver |
Device tree bindings and customization
The SAI interface is documented at
Documentation/devicetree/bindings/sound/fsl-sai.txt
.
The interface between the SAI and the codec is documented at
Documentation/devicetree/bindings/sound/imx-audio-max98088.txt
.
The MAX98088/9 codec is documented at
Documentation/devicetree/bindings/sound/max98088.txt
.
The device tree must contain entries for:
-
The SAI interface
-
The interface between the SAI and the audio codec
-
The audio codec
Example: SAI0 on ConnectCore 8X SBC Pro
Definition of the SAI
[...]
sai0: sai@59040000 {
compatible = "fsl,imx8qm-sai";
reg = <0x59040000 0x10000>;
interrupts = <GIC_SPI 314 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&sai0_lpcg 1>,
<&clk_dummy>,
<&sai0_lpcg 0>,
<&clk_dummy>,
<&clk_dummy>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
dma-names = "rx", "tx";
dmas = <&edma0 12 0 1>, <&edma0 13 0 0>;
power-domains = <&pd IMX_SC_R_SAI_0>,
<&pd IMX_SC_R_AUDIO_CLK_0>,
<&pd IMX_SC_R_AUDIO_CLK_1>,
<&pd IMX_SC_R_AUDIO_PLL_0>,
<&pd IMX_SC_R_AUDIO_PLL_1>;
status = "disabled";
};
[...]
&sai0 {
assigned-clocks = <&clk IMX8QXP_AUD_PLL0_DIV>,
<&clk IMX8QXP_AUD_ACM_AUD_PLL_CLK0_DIV>,
<&clk IMX8QXP_AUD_ACM_AUD_REC_CLK0_DIV>,
<&clk IMX8QXP_AUD_SAI_0_MCLK>;
assigned-clock-rates = <786432000>, <49152000>, <12288000>, <49152000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai0>;
status = "okay";
};
[...]
/* IOMUX */
&iomuxc {
[...]
pinctrl_sai0: sai0grp {
fsl,pins = <
SC_P_SAI0_RXD_ADMA_SAI0_RXD 0x06000040
SC_P_SAI0_TXD_ADMA_SAI0_TXD 0x06000060
SC_P_SAI0_TXFS_ADMA_SAI0_TXFS 0x06000040
SC_P_SAI0_TXC_ADMA_SAI0_TXC 0x06000040
SC_P_SPI3_CS0_ADMA_ACM_MCLK_OUT1 0x06000040
>;
};
[...]
};
Interface between SAI and audio codec
[...]
sound_max98089: sound-max98089 {
compatible = "fsl,imx-audio-max98088";
model = "imx-max98088";
cpu-dai = <&sai0>;
audio-codec = <&max98089>;
asrc-controller = <&asrc0>;
audio-routing =
"Headphone Jack", "HPL",
"Headphone Jack", "HPR",
"Ext Spk", "SPKL",
"Ext Spk", "SPKR",
"LineOut", "RECL",
"LineOut", "RECR",
"Mic1", "MIC1",
"Mic2", "MIC2",
"LineInA", "INA1",
"LineInA", "INA2",
"LineInB", "INB1",
"LineInB", "INB2";
status = "okay";
};
[...]
&asrc0 {
fsl,asrc-rate = <48000>;
};
Audio codec (I2C3 slave)
&i2c3 {
[...]
max98089: codec@10 {
compatible = "maxim,max98089";
reg = <0x10>;
clocks = <&mclkout1_lpcg 0>;
clock-names = "mclk";
power-domains = <&pd IMX_SC_R_MCLK_OUT_1>;
vcc-supply = <®_3v3_audio>;
dvdd-supply = <®_1v8_ext>;
assigned-clocks = <&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_PLL>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_SLV_BUS>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_MST_BUS>,
<&mclkout1_lpcg 0>;
assigned-clock-rates = <786432000>, <49152000>, <12288000>, <12288000>;
status = "okay";
};
[...]
};
&max98089 {
status = "okay";
};