<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911307#M137336</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unfortunately Simple Audio Card Driver is not supported by NXP&amp;nbsp;&lt;BR /&gt;in its linux kernels (including 4.14.98), no patches available for SAI or SGTL5000.&lt;/P&gt;&lt;P&gt;One can try to develop it himself using example below and linux documentation&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://bootlin.com/blog/eight-channels-audio-on-i-mx7-with-pcm3168/" title="https://bootlin.com/blog/eight-channels-audio-on-i-mx7-with-pcm3168/"&gt;Eight channels audio on i.MX7 with PCM3168 - Bootlin's blog&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="" href="https://www.nxp.com/webapp/Download?colCode=imx-yocto-L4.14.98_2.0.0_ga" target="_blank"&gt;Linux L4.14.98_2.0.0 Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Aug 2019 23:36:23 GMT</pubDate>
    <dc:creator>igorpadykov</dc:creator>
    <dc:date>2019-08-27T23:36:23Z</dc:date>
    <item>
      <title>Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911306#M137335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We are trying to get an SGTL5000 Audio Codec working, for recording audio&lt;BR /&gt;only, with our i.MX8MM board running the NXP linux-imx 4.14.98 Kernel.&lt;BR /&gt;We are using the Simple Audio Card driver and have set it up using the&lt;BR /&gt;following device tree fragment (which is included from arch/arm64/boot/dts/freescale/fsl-imx8mm-evk.dts):&lt;/P&gt;&lt;P&gt;/ {&lt;BR /&gt; regulators {&lt;BR /&gt; reg_3p3v: regulator-reg3v3 {&lt;BR /&gt; compatible = "regulator-fixed";&lt;BR /&gt; regulator-name = "reg_3p3v";&lt;BR /&gt; regulator-min-microvolt = &amp;lt;3300000&amp;gt;;&lt;BR /&gt; regulator-max-microvolt = &amp;lt;3300000&amp;gt;;&lt;BR /&gt; };&lt;BR /&gt; reg_1p8v: regulator-reg1v8 {&lt;BR /&gt; compatible = "regulator-fixed";&lt;BR /&gt; regulator-name = "reg_1p8v";&lt;BR /&gt; regulator-min-microvolt = &amp;lt;1800000&amp;gt;;&lt;BR /&gt; regulator-max-microvolt = &amp;lt;1800000&amp;gt;;&lt;BR /&gt; };&lt;BR /&gt; };&lt;/P&gt;&lt;P&gt;sound {&lt;BR /&gt; compatible = "simple-audio-card";&lt;BR /&gt; simple-audio-card,format = "i2s";&lt;BR /&gt; simple-audio-card,frame-master = &amp;lt;&amp;amp;codecdai&amp;gt;;&lt;BR /&gt; simple-audio-card,bitclock-master = &amp;lt;&amp;amp;codecdai&amp;gt;;&lt;BR /&gt; simple-audio-card,widgets =&lt;BR /&gt; "Line", "Line In Jack";&lt;BR /&gt; simple-audio-card,routing =&lt;BR /&gt; "LINE_IN", "Line In Jack";&lt;/P&gt;&lt;P&gt;cpudai: simple-audio-card,cpu {&lt;BR /&gt; sound-dai = &amp;lt;&amp;amp;sai3&amp;gt;;&lt;BR /&gt; };&lt;/P&gt;&lt;P&gt;codecdai: simple-audio-card,codec {&lt;BR /&gt; sound-dai = &amp;lt;&amp;amp;codec&amp;gt;;&lt;BR /&gt; clocks = &amp;lt;&amp;amp;clk IMX8MM_CLK_SAI3_ROOT&amp;gt;;&lt;BR /&gt; };&lt;BR /&gt; };&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&amp;amp;iomuxc {&lt;BR /&gt; imx8mm-evk {&lt;BR /&gt; pinctrl_sai3_db: sai3grp {&lt;BR /&gt; fsl,pins = &amp;lt;&lt;BR /&gt; MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0xd6&lt;BR /&gt; MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK 0xd6&lt;BR /&gt; MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK 0xd6&lt;BR /&gt; MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0 0xd6&lt;BR /&gt; MX8MM_IOMUXC_SAI3_RXD_SAI3_RX_DATA0 0xd6&lt;BR /&gt; &amp;gt;;&lt;BR /&gt; };&lt;BR /&gt; };&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&amp;amp;i2c1 {&lt;BR /&gt; status = "okay";&lt;/P&gt;&lt;P&gt;codec: sgtl5000@a {&lt;BR /&gt; #sound-dai-cells = &amp;lt;0&amp;gt;;&lt;BR /&gt; compatible = "fsl,sgtl5000";&lt;BR /&gt; reg = &amp;lt;0xa&amp;gt;;&lt;BR /&gt;#if 0&lt;BR /&gt; micbias-resistor-k-ohms = &amp;lt;2&amp;gt;;&lt;BR /&gt; micbias-voltage-m-volts = &amp;lt;2250&amp;gt;;&lt;BR /&gt;#endif&lt;BR /&gt; VDDA-supply = &amp;lt;&amp;amp;reg_3p3v&amp;gt;;&lt;BR /&gt; VDDIO-supply = &amp;lt;&amp;amp;reg_3p3v&amp;gt;;&lt;BR /&gt; VDDD-supply = &amp;lt;&amp;amp;reg_1p8v&amp;gt;;&lt;BR /&gt; clocks = &amp;lt;&amp;amp;clk IMX8MM_CLK_SAI3_ROOT&amp;gt;;&lt;BR /&gt; clock-names = "sys_mclk";&lt;BR /&gt; };&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&amp;amp;sai3 {&lt;BR /&gt; status = "okay";&lt;BR /&gt; pinctrl-names = "default";&lt;BR /&gt; pinctrl-0 = &amp;lt;&amp;amp;pinctrl_sai3_db&amp;gt;;&lt;/P&gt;&lt;P&gt;#sound-dai-cells = &amp;lt;0&amp;gt;;&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;and added the following kernel configuration:&lt;/P&gt;&lt;P&gt;CONFIG_SND_SOC_IMX_SGTL5000=y&lt;BR /&gt;CONFIG_SND_SOC_SGTL5000=y&lt;/P&gt;&lt;P&gt;You may notice that the SGTL5000 is the I2S master, when we tried to use the&lt;BR /&gt;SAI as I2S master we would get the following error:&lt;/P&gt;&lt;P&gt;root@imx8mmevk:~# arecord -d 10 /tmp/test-mic.wav&lt;BR /&gt;[ 1343.737133] sgtl5000 0-000a: PLL not supported in slave mode&lt;BR /&gt;[ 1343.742855] sgtl5000 0-000a: sgtl5000-&amp;gt;sysclk: 24576000 frame_rate: 44100&lt;BR /&gt;[ 1343.749691] sgtl5000 0-000a: 557 ratio is not supported. SYS_MCLK needs to be 256, 384 or 512 * fs&lt;BR /&gt;[ 1343.758698] sgtl5000 0-000a: ASoC: can't set sgtl5000 hw params: -22&lt;BR /&gt;ALSA lib ../../../alsa-lib-1.1.5/src/pcm/pcm_direct.c:1271:(snd1_pcm_direct_initialize_slave) unable to install hw params&lt;BR /&gt;ALSA lib ../../../alsa-lib-1.1.5/src/pcm/pcm_dsnoop.c:649:(snd_pcm_dsnoop_open) unable to initialize slave&lt;BR /&gt;arecord: main:828: audio open error: Invalid argument&lt;/P&gt;&lt;P&gt;I'm guessing that the SAI interface isn't dividing the clock down to the&lt;BR /&gt;expected value that the audio codec driver is expecting, ie a multiple of 256,&lt;BR /&gt;384 opr 512. With the SGTL5000 as I2S master I think it uses an internal PLL&lt;BR /&gt;and with this setup we don't get the above message but we get silence on the&lt;BR /&gt;captured audio. The I2C interface works as we can read the chip ID, we have&lt;BR /&gt;checked all the signals going into the audio codec and we see&lt;/P&gt;&lt;P&gt;MCLK : 24.5Mhz&lt;BR /&gt;LRCLK : 44.1Khz&lt;BR /&gt;SCLK : 1.4Mhz&lt;BR /&gt;DOUT : There is data here, it is not all 0’s&lt;/P&gt;&lt;P&gt;Here's the recorded audio:&lt;BR /&gt;root@imx8mmevk:~# arecord -l&lt;BR /&gt;**** List of CAPTURE Hardware Devices ****&lt;BR /&gt;card 0: D30030000saisgt [30030000.sai-sgtl5000], device 0: 30030000.sai-sgtl5000 sgtl5000-0 []&lt;BR /&gt; Subdevices: 1/1&lt;BR /&gt; Subdevice #0: subdevice #0&lt;BR /&gt;root@imx8mmevk:~# arecord -L&lt;BR /&gt;null&lt;BR /&gt; Discard all samples (playback) or generate zero samples (capture)&lt;BR /&gt;pulse&lt;BR /&gt; PulseAudio Sound Server&lt;BR /&gt;sysdefault:CARD=D30030000saisgt&lt;BR /&gt; 30030000.sai-sgtl5000, &lt;BR /&gt; Default Audio Device&lt;BR /&gt;root@imx8mmevk:~# arecord -f cd -d 2 -D sysdefault:CARD=D30030000saisgt /tmp/test-mic.wav&lt;BR /&gt;Recording WAVE '/tmp/test-mic.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo&lt;BR /&gt;root@imx8mmevk:~# hexdump -C /tmp/test-mic.wav&lt;BR /&gt;00000000 52 49 46 46 44 62 05 00 57 41 56 45 66 6d 74 20 |RIFFDb..WAVEfmt |&lt;BR /&gt;00000010 10 00 00 00 01 00 02 00 44 ac 00 00 10 b1 02 00 |........D.......|&lt;BR /&gt;00000020 04 00 10 00 64 61 74 61 20 62 05 00 00 00 00 00 |....data b......|&lt;BR /&gt;00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|&lt;BR /&gt;*&lt;BR /&gt;00056240 00 00 00 00 00 00 00 00 00 00 00 00 |............|&lt;BR /&gt;0005624c&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Also, if we change the sample rate to say between 8Mhz and 16Mhz, it doesn’t seem&lt;BR /&gt;to change the above LRCLK and SCLK to match accordingly.&lt;/P&gt;&lt;P&gt;Can you see anything that we are doing wrong? Is the Simple Audio Card Driver&lt;BR /&gt;supported on your vendor specific kernel (4.14.98)? Are their patches available&lt;BR /&gt;for SAI or SGTL5000 for this kernel that we may require?&lt;/P&gt;&lt;P&gt;Many Thanks in Advance,&lt;BR /&gt;Martin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2019 08:01:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911306#M137335</guid>
      <dc:creator>martintownsend</dc:creator>
      <dc:date>2019-08-27T08:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911307#M137336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unfortunately Simple Audio Card Driver is not supported by NXP&amp;nbsp;&lt;BR /&gt;in its linux kernels (including 4.14.98), no patches available for SAI or SGTL5000.&lt;/P&gt;&lt;P&gt;One can try to develop it himself using example below and linux documentation&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://bootlin.com/blog/eight-channels-audio-on-i-mx7-with-pcm3168/" title="https://bootlin.com/blog/eight-channels-audio-on-i-mx7-with-pcm3168/"&gt;Eight channels audio on i.MX7 with PCM3168 - Bootlin's blog&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="" href="https://www.nxp.com/webapp/Download?colCode=imx-yocto-L4.14.98_2.0.0_ga" target="_blank"&gt;Linux L4.14.98_2.0.0 Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2019 23:36:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911307#M137336</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2019-08-27T23:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911308#M137337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Igor,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the response.&amp;nbsp; Does the kernel support the more convoluted method of defining an audio sound device: ie Platform driver, Machine driver and Codec driver? Something like&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 9.5pt; "&gt;/ {&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sound-sgtl5000 {&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compatible = "fsl,imx-audio-sgtl5000";&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model = "sgtl5000-audio";&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN data-contrast="auto" style="margin: 0px; padding: 0px; color: windowtext; font-size: 11pt;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; border-bottom: 1px solid transparent; background-color: inherit;"&gt;cpu-dai&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; background-color: inherit;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= &amp;lt;&amp;amp;sai3&amp;gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; audio-codec = &amp;lt;&amp;amp;sgtl5000&amp;gt;;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; audio-routing =&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&lt;BR style="margin: 0px; padding: 0px;" /&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "MIC_IN", "Mic Jack",&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&lt;BR style="margin: 0px; padding: 0px;" /&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Mic Jack", "Mic Bias";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mux-int-port = &amp;lt;2&amp;gt;;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN data-contrast="auto" style="margin: 0px; padding: 0px; color: windowtext; font-size: 11pt;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mux-&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; border-bottom: 1px solid transparent; background-color: inherit;"&gt;ext&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; background-color: inherit;"&gt;-port = &amp;lt;3&amp;gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;};&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;amp;i2c1 {&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sgtl5000: codec@0a {&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compatible = "fsl,sgtl5000";&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg = &amp;lt;0x0a&amp;gt;;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/SPAN&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&lt;BR style="margin: 0px; padding: 0px;" /&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&lt;SPAN style="margin: 0px; padding: 0px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR style="margin: 0px; padding: 0px;" /&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;};&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: #1f3763;"&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;amp;sai3 {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&lt;SPAN style="margin: 0px; padding: 0px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR style="margin: 0px; padding: 0px;" /&gt;&lt;/SPAN&gt;&lt;SPAN data-contrast="auto" style="margin: 0px; padding: 0px; color: windowtext; font-size: 11pt;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; background-color: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; border-bottom: 1px solid transparent; background-color: inherit;"&gt;fsl,mode&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; background-color: inherit;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= "i2s-slave";&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&lt;SPAN style="margin: 0px; padding: 0px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR style="margin: 0px; padding: 0px;" /&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; status = "okay";&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&lt;SPAN style="margin: 0px; padding: 0px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR style="margin: 0px; padding: 0px;" /&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: inherit; padding: 0px; margin: 0px; color: windowtext; font-size: 11pt; "&gt;};&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; background-color: transparent; color: windowtext;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; font-size: 11pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Also do you know whether the kernel will work with the SGTL5000?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;P&gt;Martin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2019 09:42:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911308#M137337</guid>
      <dc:creator>martintownsend</dc:creator>
      <dc:date>2019-08-28T09:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911309#M137338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes it supports that, for example "sound-wm8524" in&lt;/P&gt;&lt;P&gt;linux/arch/arm64/boot/dts/freescale/fsl-imx8mm-evk.dts&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/fsl-imx8mm-evk.dts?h=imx_4.14.98_2.1.0" title="https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/fsl-imx8mm-evk.dts?h=imx_4.14.98_2.1.0"&gt;fsl-imx8mm-evk.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alsa drivers are described in Chapter 7 Audio attached Linux Manual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2019 10:34:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911309#M137338</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2019-08-28T10:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911310#M137339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Igor,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm looking at the device tree bindings for the The SGTL5000 ALSA SoC Machine Driver for i.MX&lt;/P&gt;&lt;P&gt;Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt&lt;/P&gt;&lt;P&gt;And it has the following required properties&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;Required properties:&lt;/P&gt;&lt;P&gt;[snip]&lt;/P&gt;&lt;P&gt;- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)&lt;/P&gt;&lt;P&gt;- mux-ext-port : The external port of the i.MX audio muxer&lt;/P&gt;&lt;P&gt;Note: The AUDMUX port numbering should start at 1, which is consistent with&lt;BR /&gt;hardware manual.&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I can see the AUDMUX isn't available on the i.MX8MM, it's not in the reference manual and I can't see any reference to it in the device tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure how to get this working, any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;P&gt;Martin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2019 14:34:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911310#M137339</guid>
      <dc:creator>martintownsend</dc:creator>
      <dc:date>2019-08-28T14:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911311#M137340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it can be done using sai module as in&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://linuxppc-dev.ozlabs.narkive.com/pVUAOxGW/patch-0-2-asoc-fsl-make-snd-soc-imx-sgtl5000-driver-useable-on-i-mx6ul" title="https://linuxppc-dev.ozlabs.narkive.com/pVUAOxGW/patch-0-2-asoc-fsl-make-snd-soc-imx-sgtl5000-driver-useable-on-i-mx6ul"&gt;[PATCH 0/2] ASoC: fsl: make snd-soc-imx-sgtl5000 driver useable on i.MX6UL&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2019 15:11:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911311#M137340</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2019-08-28T15:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911312#M137341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I got sidetracked with some other project but I'm back looking into this.&lt;BR /&gt;I went back and checked the schematic and the setup is similar to the WM8524&lt;BR /&gt;that you support on the EVK, ie the SAI is the I2S master and the codec is the&lt;BR /&gt;slave. This means the SAI is the transmitter so the Tx clock signals are&lt;BR /&gt;connected to the codec. The only difference is that we are trying to&lt;BR /&gt;capture audio and not playback audio.&lt;/P&gt;&lt;P&gt;I took out the audmux code from the imx-sgtl5000.c file as that post described.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SGTL5000 failed to probe so I had to add the following&lt;/P&gt;&lt;P&gt;ret = regmap_read(sgtl5000-&amp;gt;regmap, SGTL5000_CHIP_ID, &amp;amp;reg);&lt;BR /&gt; if (ret) {&lt;BR /&gt; dev_err(&amp;amp;client-&amp;gt;dev, "Error reading chip id %d\n", ret);&lt;BR /&gt;+ ret = -EPROBE_DEFER;&lt;BR /&gt; goto disable_clk;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I Had to force the SGTL into slave mode:&lt;/P&gt;&lt;P&gt;/* set codec format */&lt;BR /&gt;static int sgtl5000_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)&lt;BR /&gt;{&lt;BR /&gt; struct snd_soc_codec *codec = codec_dai-&amp;gt;codec;&lt;BR /&gt; struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);&lt;BR /&gt; u16 i2sctl = 0;&lt;/P&gt;&lt;P&gt;fmt = 0x4001;&lt;BR /&gt;printk(KERN_ERR "SGTL5000: sgtl5000_set_dai_fmt: %08x\n", fmt);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the setup should be correct now but I get the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# arecord -v -f cd -d 2 -D sysdefault:CARD=sgtl5000audio /tmp/test-mic.wav&lt;BR /&gt;Recording WAVE '/tmp/test-mic.wav[ 14.935520] sgtl5000 0-000a: PLL not supported in slave mode&lt;BR /&gt;' : Signed 16 bit Little Endian, [ 14.943109] sgtl5000 0-000a: sgtl5000-&amp;gt;sysclk: 24576000 frame_rate: 44100&lt;BR /&gt;Rate 44100 Hz, Stereo&lt;BR /&gt;[ 14.952800] sgtl5000 0-000a: 557 ratio is not supported. SYS_MCLK needs to be 256, 384 or 512 * fs&lt;BR /&gt;[ 14.963721] sgtl5000 0-000a: ASoC: can't set sgtl5000 hw params: -22&lt;BR /&gt;arecord: set_params:1403: Unable to install hw params:&lt;BR /&gt;ACCESS: RW_INTERLEAVED&lt;BR /&gt;FORMAT: S16_LE&lt;BR /&gt;SUBFORMAT: STD&lt;BR /&gt;SAMPLE_BITS: 16&lt;BR /&gt;FRAME_BITS: 32&lt;BR /&gt;CHANNELS: 2&lt;BR /&gt;RATE: 44100&lt;BR /&gt;PERIOD_TIME: (92879 92880)&lt;BR /&gt;PERIOD_SIZE: 4096&lt;BR /&gt;PERIOD_BYTES: 16384&lt;BR /&gt;PERIODS: 4&lt;BR /&gt;BUFFER_TIME: (371519 371520)&lt;BR /&gt;BUFFER_SIZE: 16384&lt;BR /&gt;BUFFER_BYTES: 65536&lt;BR /&gt;TICK_TIME: 0&lt;/P&gt;&lt;P&gt;So it looks like the MCLK coming out of the AUDIO PLL on the i.MX8MM is&lt;BR /&gt;staying at 24576000Hz and MCLK needs to be synchronous to the frame clock which in this&lt;BR /&gt;instance is 44100 (44.1KHz CD quality). 24576000/44100 is 557 (rounded down)&lt;BR /&gt;which is not the ratio that the audio codec is expecting (256, 384 or 512)&lt;/P&gt;&lt;P&gt;First question is why is the SAI not providing an MCLK that is synchronous to&lt;BR /&gt;the Frame Clock.&lt;/P&gt;&lt;P&gt;So if MCLK is staying at 25.576MHz then 48KHz should work 24576000/48000 = 512,&lt;BR /&gt;so using the dat format should get us past this hurdle&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arecord -v -f dat ot@imx8mmevk:~# arecord -v -f dat -d 2 -D sysdefault:CARD=sgtl5000audio /tmp/tes sysdefault:CARD=sgtl5000audio /tmp/testsysdefault:CARD=sgtl5000audio /tmp/test-mic.wav&lt;/P&gt;&lt;P&gt;Recording WAVE '/tmp/test-mic.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo&lt;BR /&gt;Plug PCM: Hardware PCM card 0 'sgtl5000-audio' device 0 subdevice 0audio /tmp/tes&lt;BR /&gt;Its setup is:&lt;BR /&gt; stream : CAPTURE&lt;BR /&gt; access : RW_INTERLEAVED&lt;BR /&gt; format : S16_LE&lt;BR /&gt; subformat : STD&lt;BR /&gt; channels : 2&lt;BR /&gt; rate : 48000&lt;BR /&gt; exact rate : 48000 (48000/1)&lt;BR /&gt; msbits : 16&lt;BR /&gt; buffer_size : 16384&lt;BR /&gt; period_size : 4096&lt;BR /&gt; period_time : 85333&lt;BR /&gt; tstamp_mode : NONE&lt;BR /&gt; tstamp_type : MONOTONIC&lt;BR /&gt; period_step : 1&lt;BR /&gt; avail_min : 4096&lt;BR /&gt; period_event : 0&lt;BR /&gt; start_threshold : 1&lt;BR /&gt; stop_threshold : 16384&lt;BR /&gt; silence_threshold: 0&lt;BR /&gt; silence_size : 0&lt;BR /&gt; boundary : 4611686018427387904&lt;BR /&gt; appl_ptr : 0&lt;BR /&gt; hw_ptr : 0&lt;/P&gt;&lt;P&gt;Then after 6 or so seconds&lt;/P&gt;&lt;P&gt;arecord: pcm_read:2143: read error: Input/output error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a file but it only contains the header:&lt;BR /&gt;~# hexdump -C /tmp/test-mic.wav&lt;BR /&gt;00000000 52 49 46 46 24 dc 05 00 57 41 56 45 66 6d 74 20 |RIFF$...WAVEfmt |&lt;BR /&gt;00000010 10 00 00 00 01 00 02 00 80 bb 00 00 00 ee 02 00 |................|&lt;BR /&gt;00000020 04 00 10 00 64 61 74 61 00 dc 05 00 |....data....|&lt;BR /&gt;0000002c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the following undocumented device tree binding in the SAI driver&lt;/P&gt;&lt;P&gt;fsl,txm-rxs;&lt;/P&gt;&lt;P&gt;so I added this and it sets&lt;BR /&gt;sai-&amp;gt;masterflag[FSL_FMT_TRANSMITTER] = SND_SOC_DAIFMT_CBS_CFS;&lt;/P&gt;&lt;P&gt;which should be what we want (codec bit and frame clocks slave)&lt;/P&gt;&lt;P&gt;Now I get overruns&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;evk:~# arecord -v -f dat -d 2 -D sysdefault:CARD=sgtl5000audio /tmp/test-mic.wav&lt;BR /&gt;Recording WAVE '/tmp/test-mic.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo&lt;BR /&gt;Plug PCM: Hardware PCM card 0 'sgtl5000-audio' device 0 subdevice 0&lt;BR /&gt;Its setup is:&lt;BR /&gt; stream : CAPTURE&lt;BR /&gt; access : RW_INTERLEAVED&lt;BR /&gt; format : S16_LE&lt;BR /&gt; subformat : STD&lt;BR /&gt; channels : 2&lt;BR /&gt; rate : 48000&lt;BR /&gt; exact rate : 48000 (48000/1)&lt;BR /&gt; msbits : 16&lt;BR /&gt; buffer_size : 16384&lt;BR /&gt; period_size : 4096&lt;BR /&gt; period_time : 85333&lt;BR /&gt; tstamp_mode : NONE&lt;BR /&gt; tstamp_type : MONOTONIC&lt;BR /&gt; period_step : 1&lt;BR /&gt; avail_min : 4096&lt;BR /&gt; period_event : 0&lt;BR /&gt; start_threshold : 1&lt;BR /&gt; stop_threshold : 16384&lt;BR /&gt; silence_threshold: 0&lt;BR /&gt; silence_size : 0&lt;BR /&gt; boundary : 4611686018427387904&lt;BR /&gt; appl_ptr : 0&lt;BR /&gt; hw_ptr : 0&lt;BR /&gt;overrun!!! (at least 0.024 ms long)&lt;BR /&gt;Status:&lt;BR /&gt; state : XRUN&lt;BR /&gt; trigger_time: 18.783263&lt;BR /&gt; tstamp : 0.000000&lt;BR /&gt; delay : 0&lt;BR /&gt; avail : 16384&lt;BR /&gt; avail_max : 16384&lt;BR /&gt;overrun!!! (at least 0.012 ms long)&lt;BR /&gt;Status:&lt;BR /&gt; state : XRUN&lt;BR /&gt; trigger_time: 19.198746&lt;BR /&gt; tstamp : 0.000000&lt;BR /&gt; delay : 0&lt;BR /&gt; avail : 16384&lt;BR /&gt; avail_max : 16384&lt;BR /&gt;overrun!!! (at least 0.010 ms long)&lt;BR /&gt;Status:&lt;BR /&gt; state : XRUN&lt;BR /&gt; trigger_time: 19.614743&lt;BR /&gt; tstamp : 0.000000&lt;BR /&gt; delay : 0&lt;BR /&gt; avail : 16384&lt;BR /&gt; avail_max : 16384&lt;BR /&gt;overrun!!! (at least 0.013 ms long)&lt;/P&gt;&lt;P&gt;[..snip]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help appreciated,&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;BR /&gt;Martin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2019 10:03:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911312#M137341</guid>
      <dc:creator>martintownsend</dc:creator>
      <dc:date>2019-09-13T10:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911313#M137342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for sgtl5000 slave mode one can look at&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://mailman.alsa-project.org/pipermail/alsa-devel/2014-September/081417.html" title="https://mailman.alsa-project.org/pipermail/alsa-devel/2014-September/081417.html"&gt;[alsa-devel] No sound captured with SGTL5000 on i.MX6 in I²S master mode&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2019 15:10:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911313#M137342</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2019-09-13T15:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with SGTL5000 audio codec and Simple Audio Card driver on i.MX8MM</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911314#M137343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After looking through the machine driver imx-sgtl5000.c I could see it was setup for the codec being the master so I modified it so that the format was codec slave.&amp;nbsp; I also set the capture_only flag on the DAI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data-&amp;gt;dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |&lt;BR /&gt;- SND_SOC_DAIFMT_CBM_CFM;&lt;BR /&gt;+ SND_SOC_DAIFMT_CBS_CFS;&lt;/P&gt;&lt;P&gt;+ data-&amp;gt;dai.capture_only = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the commands to capture from the Line Input&lt;/P&gt;&lt;P&gt;amixer set 'Capture' 12&lt;BR /&gt;amixer set 'Capture Mux' 'LINE_IN'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Recording with&lt;/P&gt;&lt;P&gt;arecord -v -V mono -D sysdefault:CARD=sgtl5000audio -f S16_LE -r 48000 mic.wav&lt;/P&gt;&lt;P&gt;will capture audio but like before it's complete silence&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;00000000 52 49 46 46 84 2b 0b 00 57 41 56 45 66 6d 74 20 |RIFF.+..WAVEfmt |&lt;BR /&gt;00000010 10 00 00 00 01 00 01 00 80 bb 00 00 00 77 01 00 |.............w..|&lt;BR /&gt;00000020 02 00 10 00 64 61 74 61 60 2b 0b 00 00 00 00 00 |....data`+......|&lt;BR /&gt;00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|&lt;BR /&gt;*&lt;BR /&gt;000b2b80 00 00 00 00 00 00 00 00 00 00 00 00 |............|&lt;BR /&gt;000b2b8c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried setting the symmetric_channels in SAI to 0 as seen on another post but still silence.&amp;nbsp;&lt;/P&gt;&lt;P&gt;@@ -1466,7 +1466,7 @@ static int fsl_sai_probe(struct platform_device *pdev)&lt;BR /&gt; sai-&amp;gt;synchronous[RX] = true;&lt;BR /&gt; sai-&amp;gt;synchronous[TX] = false;&lt;BR /&gt; fsl_sai_dai.symmetric_rates = 1;&lt;BR /&gt;- fsl_sai_dai.symmetric_channels = 1;&lt;BR /&gt;+ fsl_sai_dai.symmetric_channels = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The HW engineers have proved that the line input does have a signal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at the pinmux&lt;/P&gt;&lt;P&gt;&amp;amp;iomuxc {&lt;BR /&gt;&amp;nbsp; imx8mm-evk {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; pinctrl_sai3_db: sai3grp {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fsl,pins = &amp;lt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0xd6&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK 0xd6&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK 0xd6&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0 0xd6&lt;BR /&gt; &lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;MX8MM_IOMUXC_SAI3_RXD_SAI3_RX_DATA0 0xd6&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;gt;;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; };&lt;BR /&gt;&amp;nbsp; };&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure what to do next, I'll check the signals again with a scope and check we still see the correct clocks and data on the&amp;nbsp;&lt;SPAN&gt;MX8MM_IOMUXC_SAI3_RXD_SAI3_RX_DATA0 pin.&amp;nbsp; Do you know where in the code that the data is read out of the SAI?&amp;nbsp; Maybe I could put some debug around this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do I need to set any of the&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fsl,sai-synchronous-rx;&lt;BR /&gt; fsl,sai-asynchronous;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;device tree properties?&amp;nbsp; I don't think I do as we only have the TX_SYNC and TX_BCLK connected to the codec.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;P&gt;Martin.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2019 18:41:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-SGTL5000-audio-codec-and-Simple-Audio-Card-driver/m-p/911314#M137343</guid>
      <dc:creator>martintownsend</dc:creator>
      <dc:date>2019-09-13T18:41:01Z</dc:date>
    </item>
  </channel>
</rss>

