Skip to contentSkip to conversation

Freescale imx35: sgtl5000 codec not working over i2c

DISCUSSION Johannes Braun 2 participants 5 messages May 2, 2013 – May 3, 2013

lore
Share & tools
lore
#0 lore raw

Hello @all,

I hope this is the right place for my problem. Currently I am trying to get a sigmatel sgtl5000 codec to work on a Freescale imx35 based board. I am using a vanilla kernel 3.7.10. The codec is connected via i2c. I configured the i2c device in /arch/arm/mach-imx/mach-proxmobil2.c. Proxmobil2 is the name of our device. Here is the part which configures the i2c device and the bus.

static const struct imxi2c_platform_data mx35_prox2_i2c0_data

	__initconst = {
        .bitrate = 100000,
};

imx35_add_imx_i2c0(&mx35_prox2_i2c0_data);

static struct i2c_board_info __initdata i2c_devices_prox2[] = {
        {
                I2C_BOARD_INFO("imx-audio-sgtl5000", 0x0a),
        },
};

i2c_register_board_info(0, i2c_devices_prox2,

	ARRAY_SIZE(i2c_devices_prox2));

The i2c bus is working correctly. I can scan the bus in uboot and in linux with i2cdetect. In both cases a device with the address 0x0a is found. This is the address of the sgtl5000 codec. The device is also present in /sys/bus/i2c/devices.The audio codec is the only device on the bus.

I tested the data and clock line with a oszilloscope while booting linux. There was no activity. But when I scan the bus via uboot or via i2cdetect I can seen that there is action on the bus. Also the power supply for the codec looks good. I measured 3.3 V. So I think it is not a problem with the wiring.

The problem I is that the driver imx-audio-sgtl5000 does not start. I tested it with some printk outputs in its probe method. But the probe method is never called.

Then I thought, maybe it is a it is a problem with my board configuration file. So I tested the codec on the Freescale imx35 3stack eval board. But without success. This try ends with the same result. No driver was loaded, alsa did not detect a soundcard and so on.

The result is a non working audio codec on the board. Shure I can use the Freescale kernel. But this kernel I to old. I think it is a 2.6.28 kernel. I want to use an actual kernel with the board. So maybe someone has a running sgtl5000 code in combination with a imx35 board. I am grateful for tips. Thanks for reading.

---
Johannes

#1 lore raw
Quoted 14 lines · Johannes Braun

Hello @all,

I hope this is the right place for my problem. Currently I am trying to get a sigmatel sgtl5000 codec to work on a Freescale imx35 based board. I am using a vanilla kernel 3.7.10. The codec is connected via i2c. I configured the i2c device in /arch/arm/mach-imx/mach-proxmobil2.c. Proxmobil2 is the name of our device. Here is the part which configures the i2c device and the bus.

static const struct imxi2c_platform_data mx35_prox2_i2c0_data

	__initconst = {
        .bitrate = 100000,
};
Quoted 6 lines

imx35_add_imx_i2c0(&mx35_prox2_i2c0_data);

static struct i2c_board_info __initdata i2c_devices_prox2[] = {
        {
                I2C_BOARD_INFO("imx-audio-sgtl5000", 0x0a),
        },

The driver matches "sgtl5000", not "imx-audio-sgtl5000".

You should use devicetree support for new boards. The platform support will vanish sooner or later.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#2 lore raw

Hello Sascha,

Quoted 16 lines · Johannes Braun
Quoted 15 lines

Hello @all,

I hope this is the right place for my problem. Currently I am trying to get a sigmatel sgtl5000 codec to work on a Freescale imx35 based board. I am using a vanilla kernel 3.7.10. The codec is connected via i2c. I configured the i2c device
in /arch/arm/mach-imx/mach-proxmobil2.c. Proxmobil2 is the name of our device. Here is the part which configures the i2c device and the bus.

static const struct imxi2c_platform_data mx35_prox2_i2c0_data

	__initconst = {
        .bitrate = 100000,
};
Quoted 8 lines
Quoted 6 lines

imx35_add_imx_i2c0(&mx35_prox2_i2c0_data);

static struct i2c_board_info __initdata i2c_devices_prox2[] = {
        {
                I2C_BOARD_INFO("imx-audio-sgtl5000", 0x0a),
        },

The driver matches "sgtl5000", not "imx-audio-sgtl5000".

I tried "sgtl5000" and "fsl", both without success.

Quoted 4 lines

You should use devicetree support for new boards. The platform support will vanish sooner or later.

As I wrote before, my board is based on the very old imx35 processor platform and I think this processor type does not support device tree out of the box? Or is it possible to use a device tree with an imx35? Haven`t seen this before. Is the problem realy the missing device tree support?

There are much reasons why I don`t want to spend that much time with this old product. We had so much problems with this board and probably in summer there is a new board coming. Maybe an im6q.

---
Johannes

#3 lore raw
Quoted 20 lines · Johannes Braun

Hello Sascha,

Quoted 18 lines · Johannes Braun
Quoted 17 lines

Hello @all,

I hope this is the right place for my problem. Currently I am trying to get a sigmatel sgtl5000 codec to work on a Freescale imx35 based board. I am using a vanilla kernel 3.7.10. The codec is connected via i2c. I configured the i2c device
in /arch/arm/mach-imx/mach-proxmobil2.c. Proxmobil2 is the name of our device. Here is the part which configures the i2c device and the bus.

static const struct imxi2c_platform_data mx35_prox2_i2c0_data

	__initconst = {
        .bitrate = 100000,
};

imx35_add_imx_i2c0(&mx35_prox2_i2c0_data);

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
static struct i2c_board_info __initdata i2c_devices_prox2[] = {
        {
                I2C_BOARD_INFO("imx-audio-sgtl5000", 0x0a),
        },

The driver matches "sgtl5000", not "imx-audio-sgtl5000".

I tried "sgtl5000" and "fsl", both without success.

With "sgtl5000" at least sgtl5000_i2c_probe should be called. Is the i.MX I2C driver registered correctly. What's in /sys/bus/i2c/devices/?

Quoted 4 lines

As I wrote before, my board is based on the very old imx35 processor platform and I think this processor type does not support device tree out of the box? Or is it possible to use a device tree with an imx35?

you won't need much more than something similar to arch/arm/mach-imx/imx25-dt.c and an auxdata table for the clock lookups. There even is pinctrl support.

That said, your actual problem won't be related to that.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#4 lore raw
Quoted 1 line

With "sgtl5000" at least sgtl5000_i2c_probe should be called.

Ok my fault. I did not see the i2c probe mehtod. I checked whether sgtl5000_i2c_probe is called or not and I can confirm that the method was passed successfully. I tested it with several kernel log messages.

Quoted 1 line

Is the i.MX I2C driver registered correctly. What's in /sys/bus/i2c/devices/?

I think so. The following devices are shown:
ls -la /sys/bus/i2c/devices/
lrwxrwxrwx 1 root root 0 Jan 1 1970 0-000a ->
../../../devices/platform/imx-i2c.0/i2c-0/0-000a/
lrwxrwxrwx 1 root root 0 Jan 1 1970 i2c-0 ->
../../../devices/platform/imx-i2c.0/i2c-0/
lrwxrwxrwx 1 root root 0 Jan 1 1970 i2c-2 ->
../../../devices/platform/imx-i2c.2/i2c-2/

Also I am able to probe the bus via i2cdetect. This is the result:
root at generic-armv6:~$ i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- UU -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

UU shows that this device is use by a driver.

Quoted 3 lines

you won't need much more than something similar to arch/arm/mach-imx/imx25-dt.c and an auxdata table for the clock lookups. There even is pinctrl support.

I will check this out.

---
Johannes