iMX6DL with SGTL5000 codec. ALSA doesn't find soundcard.

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

iMX6DL with SGTL5000 codec. ALSA doesn't find soundcard.

5,200 Views
YamilGarcia
Contributor III

Currently 'm working in a custom board using an iMX6DL, the software design is based on sabrelite platform adapted to use an iMX6DL.

Kernel been used is L3.0.35_4.0.0_130424. The issue I have is that ALSA does not list any soundcards.

Everything is working fine (ENET, NAND, GPU, IPU, etc). For example I'm able to play a movie, but of course without audio.

I show my schematic and the changes been done, also I attached the kernel log.

Could someone, please, take a look to my code and hardware to give me a hint on this issue?

 

The codec driver seems to be registered successfully because does not prompt the error to be shown in case of error, as indicated in function shown below from file "sgtl5000.c"

 

static __devinit int sgtl5000_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id))

{

     ...

    dev_err(&client->dev, "Failed to register codec: %d\n", ret);

     ...

}

 

The platform device ssi seems to be added successfully because does not prompt any of the errors to be shown in case of error, as indicated in function shown below from file "imx-ssi.c"

 

static int imx_ssi_probe(struct platform_device *pdev)

{

....

      dev_err(&pdev->dev, "register DAI failed\n");

.....

     dev_err(&pdev->dev, "failed to add platform device\n");

...

}

  

The machine driver seems to be allocated successfully because does not prompt any of the errors to be shown in case of error, as indicated in
function shown below from file "imx-sgtl5000.c"

 

static int __init imx_sgtl5000_init(void)

{

....

printk(KERN_ERR "ASoC: Platform device allocation failed\n");

....

}

 

Schematics is shown below:

 

8007_8007.pngschematic.png

 

Since I'm using different pads for audio, the pad mux definition is shown below:

 

MX6DL_PAD_KEY_COL0__AUDMUX_AUD5_TXC,                   //ALT2

MX6DL_PAD_KEY_ROW0__AUDMUX_AUD5_TXD,                //ALT2

MX6DL_PAD_KEY_COL1__AUDMUX_AUD5_TXFS,                //ALT2

MX6DL_PAD_KEY_ROW1__AUDMUX_AUD5_RXD,               //ALT2

MX6DL_PAD_GPIO_0__CCM_CLKO,                                       //ALT0

 

Since I'm using I2C3, the pad mux definition is shown below:

 

MX6DL_PAD_GPIO_5__I2C3_SCL,                                         //ALT6

MX6DL_PAD_GPIO_6__I2C3_SDA,                                        //ALT3

 

Kernel config to support sgtl5000:

 

---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

 

Sinnce I'm using AUDMUX_AUD5(ext_port = 5), the audio data configuration has been changed to:

 

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, 

};

 

Since sgtl5000 pin CTRL_ADR0_CS is wired to 3.3V, the I2C address for the codec change to 0x2a(0101010) instead of 0x0a.

 

static struct i2c_board_info mxc_i2c2_board_info[] __initdata = {

            {

                         I2C_BOARD_INFO("sgtl5000", 0x2a),   

            },

};

 

Since VDDA is wired to 3.3V, VDDIO is wired to 3.3V and VDDD is wired to 1.35V the registers configuration have changed to:

 

static struct fixed_voltage_config sgtl5000_sabrelite_vdda_reg_config = {

            .supply_name                       = "VDDA",

            .microvolts                 = 3300000, 

            .gpio                           = -1, 

            .init_data                    = &sgtl5000_sabrelite_vdda_reg_initdata,

};

 

static struct fixed_voltage_config sgtl5000_sabrelite_vddio_reg_config = {

            .supply_name                       = "VDDIO",

            .microvolts                 = 3300000,

            .gpio                           = -1,

            .init_data                    = &sgtl5000_sabrelite_vddio_reg_initdata,

};

  

static struct fixed_voltage_config sgtl5000_sabrelite_vddd_reg_config = {

            .supply_name                       = "VDDD",

            .microvolts                 = 1350000,   

            .gpio                           = -1,

            .init_data                    = &sgtl5000_sabrelite_vddd_reg_initdata,

};

 

The clock signal in R44 is ahown below:

 

8009_8009.jpgclock.jpg

 

The codec sgtl5000 is been found in I2C address 0x2a as shown below:

 

8010_8010.pngi2cdetect.png

Original Attachment has been moved to: kernel_log.txt.zip

Labels (4)
0 Kudos
5 Replies

1,423 Views
YixingKong
Senior Contributor IV

Yamil

This discussion is closed since no activity. If you still need help, please feel free to reply with an update to this discussion, or create another discussion.

Thanks,

Yixing

0 Kudos

1,423 Views
teddy123
Contributor III

Hi  Everyone,

I am now facing the same problem mentioned above. I am working on a custom sabresd board and need to enable the audio codec in it. I tried the procedures mentioned in this discussion but didn't work. For enabling audio codec, I have taken reference from the sabrelite board file.

0 Kudos

1,423 Views
YixingKong
Senior Contributor IV

Yamil

Had your issue got resolved? If yes, we are going to close the discussion in 3 days. If you still need help please feel free to contact Freescale.

Thanks,
Yixing

0 Kudos

1,423 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi, Yamil,

     Did you create sound card deivce and register it to linux system in your BSP file ?

(1) create device

static struct platform_device mx6_sabrelite_audio_device = {

.name = "imx-sgtl5000",

};

(2)register sound card in

mxc_register_device(&mx6_sabrelite_audio_device,&mx6_sabrelite_audio_data);

More detail, please see linux/arch/arm/mach-mx6/board-mx6q_sabrelite.c

Regards,

weidong

0 Kudos

1,423 Views
RobertA
Contributor I

Hello Weidong,

I am having a similar issue with a custom board and IMX6q and the SGTL5000.  At first the SGTL5000 was not getting detected, but that was due to me listing it on the wrong I2C bus in the kernel.  Once I corrected the bus it was on it no longer gave me messages with the following:

mxc_hdmi_soc mxc_hdmi_soc.0: MXC HDMI Audio
imx-hdmi-soc-dai imx-hdmi-soc-dai.0: Failed: Load HDMI-video first.
sgtl5000 1-000a: Failed to get supply 'VDDD': -19
print_constraints: 1-000a: 850 <--> 1600 mV at 1200 mV normal
sgtl5000 1-000a: Device with ID register 0 is not a sgtl5000
sgtl5000 1-000a: asoc: failed to probe CODEC sgtl5000.1-000a: -19
asoc: failed to instantiate card sgtl5000-audio: -19
Initialize HDMI-audio failed. Load HDMI-video first!
ALSA device list:
  No soundcards found.

Now I get the following messages:

mxc_hdmi_soc mxc_hdmi_soc.0: MXC HDMI Audio
imx-hdmi-soc-dai imx-hdmi-soc-dai.0: Failed: Load HDMI-video first.
Initialize HDMI-audio failed. Load HDMI-video first!
ALSA device list:
  No soundcards found.

I did create device and register sound card like the board-mx6q_sabrelite.c.

Here is my code for the audio. 

/////////////////////////////////  Eval Board AUDIO Need to be removed  //////////////////////////
static struct regulator_consumer_supply sgtl5000_sabreauto_consumer_vdda = {
    .supply = "VDDA",
    .dev_name = "1-000a",
};

static struct regulator_consumer_supply sgtl5000_sabreauto_consumer_vddio = {
    .supply = "VDDIO",
    .dev_name = "1-000a",
};

static struct regulator_consumer_supply sgtl5000_sabreauto_consumer_vddd = {
    .supply = "VDDD",
    .dev_name = "1-000a",
};

static struct regulator_init_data sgtl5000_sabreauto_vdda_reg_initdata = {
    .num_consumer_supplies = 1,
    .consumer_supplies = &sgtl5000_sabreauto_consumer_vdda,
};

static struct regulator_init_data sgtl5000_sabreauto_vddio_reg_initdata = {
    .num_consumer_supplies = 1,
    .consumer_supplies = &sgtl5000_sabreauto_consumer_vddio,
};

static struct regulator_init_data sgtl5000_sabreauto_vddd_reg_initdata = {
    .num_consumer_supplies = 1,
    .consumer_supplies = &sgtl5000_sabreauto_consumer_vddd,
};

static struct fixed_voltage_config sgtl5000_sabreauto_vdda_reg_config = {
    .supply_name        = "VDDA",
    .microvolts        = 3300000,
    .gpio            = -1,
    .init_data        = &sgtl5000_sabreauto_vdda_reg_initdata,
};

static struct fixed_voltage_config sgtl5000_sabreauto_vddio_reg_config = {
    .supply_name        = "VDDIO",
    .microvolts        = 1800000,
    .gpio            = -1,
    .init_data        = &sgtl5000_sabreauto_vddio_reg_initdata,
};

static struct fixed_voltage_config sgtl5000_sabreauto_vddd_reg_config = {
    .supply_name        = "VDDD",
    .microvolts        = 0,
    .gpio            = -1,
    .init_data        = &sgtl5000_sabreauto_vddd_reg_initdata,
};

static struct platform_device sgtl5000_sabreauto_vdda_reg_devices = {
    .name    = "reg-fixed-voltage",
    .id    = 1,
    .dev    = {
        .platform_data = &sgtl5000_sabreauto_vdda_reg_config,
    },
};

static struct platform_device sgtl5000_sabreauto_vddio_reg_devices = {
    .name    = "reg-fixed-voltage",
    .id    = 2,
    .dev    = {
        .platform_data = &sgtl5000_sabreauto_vddio_reg_config,
    },
};

static struct platform_device sgtl5000_sabreauto_vddd_reg_devices = {
    .name    = "reg-fixed-voltage",
    .id    = 3,
    .dev    = {
        .platform_data = &sgtl5000_sabreauto_vddd_reg_config,
    },
};

static struct mxc_audio_platform_data mx6_sabreauto_audio_data;

static struct imx_ssi_platform_data mx6_sabreauto_ssi_pdata = {
    .flags = IMX_SSI_DMA | IMX_SSI_SYN,
};

static struct mxc_audio_platform_data mx6_sabreauto_audio_data = {
    .ssi_num = 1,
    .src_port = 2,
    .ext_port = 3,
    .hp_gpio = -1,
    .sysclk = 25000000
};

static struct platform_device mx6_sabreauto_audio_device = {
    .name = "imx-sgtl5000",
};

static int imx6q_init_audio(void)
{

    mxc_register_device(&mx6_sabreauto_audio_device,
                &mx6_sabreauto_audio_data);
    imx6q_add_imx_ssi(1, &mx6_sabreauto_ssi_pdata);

    mxc_iomux_v3_setup_multiple_pads(mx6q_sabreauto_audmux_pads,
                    ARRAY_SIZE(mx6q_sabreauto_audmux_pads));

    platform_device_register(&sgtl5000_sabreauto_vdda_reg_devices);
    platform_device_register(&sgtl5000_sabreauto_vddio_reg_devices);
    platform_device_register(&sgtl5000_sabreauto_vddd_reg_devices);

    return 0;
};

0 Kudos