Integration of MAX98089 audio codec on i.mx6

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Integration of MAX98089 audio codec on i.mx6

Jump to solution
5,134 Views
hok
Contributor II

Hello!

I should integrate MAX98089 in conjunction with i.mx6 in our company. Normally i'm working on the behave of logistic controlling systems (headless). Therefore i'm not in common with "multimedia" subsystems, codecs, alsa or SSI interface. So this is a variety for me :-). Because of these fact i (and all other combatants in my company has the same status) i have some questions before i go into detail to clearify things.

After information gathering (schematics, ...) questions cames up....

Starting point:

Kernel: 2.14.28-1.0.0 (linux-imx6)

OS: Own operating system based on yocto (fido release)

Hardware: Own carrier board and with Kontron samx6i smarc module

Status: Nearly all interfaces which are supported by samx6i are used. Except audio codec.

SOC Interface: SSI

Codec: MAX98089

As i understand following parts in kernel are needed for audio.

SOC AUDIO INTERFACE <-> CONNECTOR <-> CODEC

SOC Audio interface: Already available. Regarding to DT bindings: audmux and ssi

Connector: MAX98089 until now is not supported by drivers based on fsl-asoc-card - e.g.: wm8962.
https://www.kernel.org/doc/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt

Codec: Codec is available but without DT Bindings (should not be the showstopper :-))

I also read the i.MX BSP Porting Guide from 2.14.28_1.0.0-ga Release so

Questions:

1.) Do i need a own connector or can i use other solution like ASoc Simple SOund card support?

2.) In conjunction with SSI Interface i'm not really can focus out in which combination (Master - Slave or Slave Master) should be used

3.) What are the best and simplest tools on commandline to play audio with alsa subsystem.

4.) Have i handle also mono / stereo or other modes or is this done automatically?

May someone is on the same project, could give me some code of practice or has background informations for me. I'm happy about all information :-).

So hardware is on desk, oszi behind ....

Thanks in advance

Horst

0 Kudos
1 Solution
2,881 Views
hok
Contributor II

Final patch for MAX98089 sound codec.

br,

View solution in original post

0 Kudos
4 Replies
2,881 Views
hok
Contributor II

igor thx for hints!

I implemented max98089 on base of imx-sgtl5000.c driver. Now following problems exists. I get LRCKL and BCKL but no data output. I checked all settings and registers but don't know how i should go on further...

First of all configuration:

Kernel: 3.14.28-1.0.0ga

Master = MAX98089

Slave = imx6

Patch: see attachment

WAV File: piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
pcm3244s.wav' : Signed 32 bit Little Endian, Rate 44100 Hz, Stereo

Schematics

-> see attachment

I2S0_CK = AUD3_TXC
I2S0_LRCK = AUD3_TXFS
I2S0_SDOUT = AUD3_TXD
I2S0_SDIN = AUD3_RXD

AUDIO_MCK = CCM_CLK02
GPIO6 = GPIO3_IO06

Device Tree:

-> see attachment

pinctrl_samx6i_hog: hoggrp-samx6i {

fsl,pins = <

    MX6QDL_PAD_NANDF_CS2__CCM_CLKO2 0x130b0 /* AUDIO MCLK */

    MX6QDL_PAD_EIM_DA4__GPIO3_IO04 0x80000000 /* AUDIO IRQ */

    >;

};

pinctrl_samx6i_audmux: audmuxgrp-samx6i {

fsl,pins = <

    MX6QDL_PAD_CSI0_DAT7__AUD3_RXD          0x130b0

    MX6QDL_PAD_CSI0_DAT4__AUD3_TXC          0x130b0

    MX6QDL_PAD_CSI0_DAT5__AUD3_TXD          0x110b0

    MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS        0x130b0

    >;

};

&audmux {

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_samx6i_audmux>;

        status = "okay";

};

&ssi2 {

        fsl,mode = "i2s-slave";

        status = "okay";

};

sound {
compatible = "fsl,imx-audio-max98088";

                model = "imx-max98088";

                cpu-dai = <&smarc_i2s1>; /* is define on ssi2 - change to ssi2 comes to same status as described above*/

                audio-codec = <&codec>;

                audio-routing =

                        "Headphone","HPL",

                        "Headphone","HPR",

                        "Speaker","SPKL",

                        "Speaker","SPKR";

                mux-int-port = <2>;

                mux-ext-port = <3>;

        };

      codec: max98088@10 {

                compatible = "maxim,max98088";

                reg=<0x10>;

                clocks = <&clks 200>;

                clock-names = "codec_mclk";

                clock-frequency = <24000000>;

                status = "okay";

        };

Register of max98089 when after playing file.

-> see attachment

Situation:

1.) MAX98089 is recognised and files can be played with aplay

2.) Configuration by i2c on max98089 is done when playing file (see attached register settings which reflects settings when playing file)

3.) Status after boot: AUD3_TXC = no clock, AUD3_TXFS = no clock, AUD3_TXD = high (1.8V) AUD3_RXD = low (0V), AUDIO_MCLK = 24 MHZ as configured, Register 0x10 of MAX98089 for clock is set correctly, Other configurations for max98089 (Reg 0x10 - 0x13, 0x14 - 0x18)  are also fine (acts in master mode)

4.) When i play file AUD3_TXFS = 24 KHZ, AUD3_TXC = Jumps betweeen 1.5 and 1.7 MHZ, AUD3_TXD = high, AUD3_RXD = low.

5.) When audio file is played i get an Input/Output error on console.

6.) When file is finally played clocks on AUD3_TXFS and AUD3_TXC still remains until reboot

7.) Playing a second file only changes TXFS and TXC.

From my information gathering:

AUD3_TXC = BCLK sould be 44.8 x 16 x 2 -> which means 1.5 MHZ
AUD3_TXFS = LRCLK should be 44,8. Because of the (16 (BIT) x 2 (stereo)) / BCLK. TXFS could be wrong because of Register 0x15 Output Frequency of BCLK which is set to 64 x LRCLK.

Trying with file pcm3244.wav is more strange. Here AUD3_TXFS = 22 KHZ and AUD3_TXC jungs between 1.2 and 1.5 MHZ. So this looks strange...

May someone have same issues or could see any error in configuration of DT?

TIA
Horstl

0 Kudos
2,882 Views
hok
Contributor II

Final patch for MAX98089 sound codec.

br,

0 Kudos
2,881 Views
hok
Contributor II

Driver is up and running without problems. Patch will be attached later time. thx

0 Kudos
2,881 Views
igorpadykov
NXP Employee
NXP Employee

Hi hok

one can take some existing driver as reference, for example sgtl5000

and use guidelines in attached Porting Guide Chapter 8 Porting Audio Codecs

to a Custom Board and example below for tlv porting

https://community.freescale.com/thread/323017

BSP porting guide: from a I.mx6q reference Board to a Custom board (in Yocto project)

http://boundarydevices.com/mx6-device-tree-customization/

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos