SGTL5000 Audio CODEC and i.MX6Q

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

SGTL5000 Audio CODEC and i.MX6Q

9,657 Views
PaulDeMetrotion
Senior Contributor I

Have built a custom kernel using LTIB with the following config settings:

  CONFIG_SND_SOC_IMX_SGTL5000=y

  CONFIG_SND_SOC_SGTL5000=y

Problem is that audio does not work, I see no SGTL5000 drivers being loaded during boot and cannot find any in the kernel. The dmesg output indicates that the HDMI audio has been found.

mxc_hdmi_soc mxc_hdmi_soc.0: MXC HDMI Audio

asoc: mxc-hdmi-soc <-> imx-hdmi-soc-dai.0 mapping ok

ALSA device list:

  #0: imx-hdmi-soc

I have modeled my custom board file similar to the Sabre Lite which uses the same CODEC.

Anybody have any experience with a similar issue? Is there a missing configuration setting?

0 Kudos
Reply
17 Replies

3,138 Views
PaulDeMetrotion
Senior Contributor I

Have made significant progress but still cannot get kernel to recognize the SGTL5000. I had to edit the Kconfig file in the arch/arm/mach-mx6 directory for the SGTL5000 driver to be loaded on my custom machine. This added the sgtl5000 driver to the available driver list.

Now the driver is available but the probe function is never executed. Analyzing the code further reveals that the function snd_soc_register_ card is executed twice, once for "sgtl5000-audio" and once for "imx-hdmi-soc". These are the two available audio devices so everything appears fine up to this point. Some time later another function, soc_probe_codec, is executed but only once for the 'imx-hdmi-soc".

Does anybody have any suggestions as to what could be wrong? Is this possibly still a configuration issue?

0 Kudos
Reply

3,138 Views
zhaojianbo
Contributor I

I met the same problem with you! canyou tell me how to solve? thank you!

0 Kudos
Reply

3,138 Views
PaulDeMetrotion
Senior Contributor I

Sorry, didn't see your first post. The final problem I had was the wrong voltage on the VDDA power supply. We had it wired to 3.3V but my structure called out 2.5V.

static struct fixed_voltage_config sgtl5000_sbc35_c398_vdda_reg_config = {

.supply_name  = "VDDA",

.microvolts  = 2500000,     ------->     3300000

.gpio   = -1,

.init_data  = &sgtl5000_sbc35_c398_vdda_reg_initdata,

};

0 Kudos
Reply

3,138 Views
zhaojianbo
Contributor I

hi,Paul,

  Thank you for your help! We encounter the same problem with you.sound has appeared, but, volume is very small.I want to know how about your volume,thank you!

0 Kudos
Reply

3,138 Views
PKZ
Contributor III

Hi Paul, Zhao Jianbo,

I am facing the same issue. I managed to get the sound but the volume is very soft. I am using JB4.3 BSP. (the same codec settings I use in ICS without ALSA, the volume is quite loud. In JB4.3, No sound if i dont use ALSA, with ALSA, there sound but too soft to hear, I hardly can hear!)

Thanks!

PK

0 Kudos
Reply

3,138 Views
PaulDeMetrotion
Senior Contributor I

I can access all other devices on this i2c bus so the iomux settings are fine.

0 Kudos
Reply

3,138 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello,Paul,

      Can you ask hardware engineer to measure R44 waveform by oscilloscope ?  From your schematic, 14.318M OSC is not enabled. If this clock output is ok, Let us continue to check the issue !

clock.png

          In addtion, on mx6q_sabresd card, CLK_O1 is used to supply MCLK for SGTL5000 , So you use 14.318MHz , sys_clk for SGTL5000 should be adjusted like this:

static int mx6_sabrelite_sgtl5000_init(void)
{
mx6_sabrelite_audio_data.sysclk = 14318000;
return 0;
}

  Check it please !

Regards,

Weidong

0 Kudos
Reply

3,138 Views
PaulDeMetrotion
Senior Contributor I

Thanks for your assistance Weidong.

As previously mentioned, this audio circuit works fine with our in-house OBDS test suite. I hear a small musical segment out of the speakers. There is no clock issue. The problem is that the code does not execute any sgtl5000 specific functions even though it is identified on the i2c bus.

I did add the clock fix you suggested but it did not help.

When the i2c_new_device function is executed for the i2c0 bus, the following i2c_board_info structure is one of the arguments:

E9FF3ECC 6C746773 30303035 00000000 00000000 sgtl5000........

E9FF3EDC 00000000 000A0000 00000000 00000000 ................

E9FF3EEC 00000000 00000000 00000000 00000000 ................

So the code knows that this device exists on this bus at address 0x000A! But the device is never accessed on the i2c bus.

I have dug into the code and found that when the function i2c_device_match is executed, the code is searching for a matching device and the sgtl5000 is not in the driver list. My .config file does show that I have enabled this driver in the build.

pauldemet@ubuntu:~/c398/ltib/rpm/BUILD/linux$ cat .config | grep SGTL5000

CONFIG_SND_SOC_IMX_SGTL5000=y

CONFIG_SND_SOC_SGTL5000=y

Is there another configuration setting that I am missing?

0 Kudos
Reply

3,138 Views
fabio_estevam
NXP Employee
NXP Employee

Maybe you could post here a patch with your changes for adding support to your board.

It is easier to review code in patch format.

0 Kudos
Reply

3,138 Views
fabio_estevam
NXP Employee
NXP Employee

Do you see the sgtl5000 driver being probed? In the probe of sgtl5000, the codec ID is read via I2C and printed during the bootlog.

Please make sure you have configured i2c and registered sgtl5000 into the i2c bus.

0 Kudos
Reply

3,138 Views
PaulDeMetrotion
Senior Contributor I

I never see the sgtl5000 driver being probed. I set a breakpoint on the emulator for that specific function (sgtl5000_probe) and it never gets hit. Don't know why because I have indeed registered the I2C bus and the audio device. I see this bus being initialized when the i2c_register_bus_info function is called.

static struct i2c_board_info mxc_i2c0_board_info[] __initdata = {

      {

              I2C_BOARD_INFO("sgtl5000",0x0a),

        },

        {

              I2C_BOARD_INFO("max7310",0x30),

              .platform_data = &max7310_1_platdata,

        },

        {

              I2C_BOARD_INFO("max7310",0x32),

              .platform_data = &max7310_2_platdata,

        },

        {

              I2C_BOARD_INFO("max7310",0x34),

              .platform_data = &max7310_3_platdata,

        },

  };

plus

imx6q_add_imx_i2c(0, &mx6q_sbc35_c398_i2c_data);

imx6q_add_imx_i2c(1, &mx6q_sbc35_c398_i2c_data);

imx6q_add_imx_i2c(2, &mx6q_sbc35_c398_i2c_data);

i2c_register_board_info(0, mxc_i2c0_board_info,

      ARRAY_SIZE(mxc_i2c0_board_info));

i2c_register_board_info(1, mxc_i2c1_board_info,

      ARRAY_SIZE(mxc_i2c1_board_info));

i2c_register_board_info(2, mxc_i2c2_board_info,

      ARRAY_SIZE(mxc_i2c2_board_info));

0 Kudos
Reply

3,138 Views
fabio_estevam
NXP Employee
NXP Employee

So you need to check SGTL5000 signals with a scope:

- I2C control signals (you need to be able to see activity in I2C data and clk lines)

- SGTL5000 system clock (as Weidong suggested previously)

- Check SGTL5000 power supplies (as Weidong suggested previously)

0 Kudos
Reply

3,138 Views
PaulDeMetrotion
Senior Contributor I

System clock and power supplies are good.

Never see any i2c access to address 0x0A which is the SGTL5000 device. Do see i2c accesses to all three MAX7310 devices on the same bus.

In my custom board file, I copied the i2c code from the Sabre-Lite file which also uses this audio device. Compared files again and don't see anything different.

0 Kudos
Reply

3,138 Views
fabio_estevam
NXP Employee
NXP Employee

Please compare the i2c iomux settings of your board against sabrelite.

0 Kudos
Reply

3,138 Views
PaulDeMetrotion
Senior Contributor I

Audio configuration:
static struct mxc_audio_platform_data mx6_sbc35_c398_audio_data = {
.ssi_num = 1,
.src_port = 2,
.ext_port = 5,
.init = mx6_sbc35_c398_sgtl5000_init,
.hp_gpio = -1,

};

Schematic not necessary because audio works in OBDS so there is no hardware issue. Appears to be a config issue since driver does not load.

0 Kudos
Reply

3,138 Views
weidong_sun
NXP TechSupport
NXP TechSupport

If your design is based I.MX6Q-Sabrelite , you should adjust 2 postions , Assume AUD5 signals are routed by KEYPADs .

  1. Modified BSP file

static iomux_v3_cfg_t mx6q_sabrelite_pads[] = {

….

/*AUD5 MUX*/

MX6Q_PAD_KEY_COL0__AUDMUX_AUD5_TXC,

MX6Q_PAD_KEY_ROW0__AUDMUX_AUD5_TXD,

MX6Q_PAD_KEY_COL1__AUDMUX_AUD5_TXFS,

MX6Q_PAD_KEY_ROW1__AUDMUX_AUD5_RXD,

…..

}

…./*you have modified here*/

static struct mxc_audio_platform_data mx6_sabrelite_audio_data = {

       .ssi_num = 1,

       .src_port = 2,

       .ext_port = 5,

       .init = mx6_sabrelite_sgtl5000_init,

       .hp_gpio = -1,

};

2. Configure linux kernel and compile

# cd ltib/rpm/BUILD/linux

# make imx6_defconfig

#make menuconfig

---Device drivers

       --<*>Sound card support---->

              --<*>Advanced Linux Sound Architecture--->

                     --<*>ALSA For SoC audio support-->

                            --<*>SoC Audio for Freescale i.MX CPUs-->

                                   --<*>SoC audio support for i.mx boards with sgtl5000

Save and Exit

#make uImage

<Note>

       If SGTL5000 doesn’t still work, Please check and measure the following :

(1)MCLK( should be 24MHz)

(2)Voltages on SGTL5000

      Then tell results to me ! If you send schematic to me(weidong.sun@freescale.com) , it would be helpful for checking issue !

Regards,

Weidong

0 Kudos
Reply

3,138 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello,Paul,

       Could you tell me which SSI port and AUD port the customer uses?  Would you please paste the schematic for I2S part here ? Let me see !

Regards,

Weidong

0 Kudos
Reply