Hello,
I'm working on a custom board based on i.MX25 PDK. All devices in my board are working with kernel 3.2.60 except audio, because this kernel doesn't have support for the SGTL5000. I don't use device tree, all my hardware configuration is in the board file.
Now, I am trying to use device tree with a superior kernel version (3.14.12) to have the audio codec working, but I'm having a lot of problems with that. So my question is if it possible to give support for the audio codec in the board file with kernel 3.14.12, without using device tree, and in that case, how would I do it.
Thanks,
Fernando.
I would not recommend you to try to get audio to work with a non-dt kernel.
Take a look at imx25-pdk.dts as it supports sgtl5000 audio via dt.
What is the problem you are having with dt on your board?
Hi Fabio,
The first problem is I can't boot from Nand Flash. With u-boot-2009.08 I can do it without problem, but I have to update u-boot in order to use device tree. I'm using u-boot-2013.10 and trying to give support for Nand in the configuration board file (taking other boards as reference), but unsuccessfully. I don't know whether I have to copy the image in any offset or what. I can boot from SD card, but I need boot from Nand.
If I boot from SD, I can boot kernel and use device tree, but there are problems with the audio codec. I'm using imx25-pdk.dts from 3.17.2 (although my kernel is 3.14.12), with few changes (I only remove devices like CAN, KPP... that I don't use). I don't understand how regulators are defined (because VDDIO is 1.8V and VDDA is 3.3V, both in PDK and in my board ), but I let them as they are. This is dmesg (referred to audio codec):
i2c i2c-0: IMX I2C adapter registered
Advanced Linux Sound Architecture Driver Initialized.
of_clk_src_onecell_get: invalid clock index 129
sgtl5000 0-000a: Failed to get mclock: -2
i2c 0-000a: Driver sgtl5000 requests probe deferral
fsl-ssi-dai 50034000.ssi: fsl,mode property is necessary
fsl-ssi-dai: probe of 50034000.ssi failed with error -22
of_clk_src_onecell_get: invalid clock index 129
imx-sgtl5000: probe of sound.3 failed with error -2
of_clk_src_onecell_get: invalid clock index 129
sgtl5000 0-000a: Failed to get mclock: -2
of_clk_src_onecell_get: invalid clock index 129
sgtl5000 0-000a: Failed to get mclock: -2
i2c 0-000a: Driver sgtl5000 requests probe deferral
ALSA device list:
No soundcards found.
Some help, please?
Ok, there are two issues then:
1. Boot from NAND on a recent U-boot
2. Get audio to work
For 1: yes, you need to flash u-boot.imx at 0x400 offset in NAND, just like SD card.
For 2: It is not finding the mclock, which is the clock that drives the sgtl5000. You need to provide it in the dts.
Also, I would recommend that for 2. you try 3.17.2 first.
Thanks for your answer, but:
1. I already tried , but it doesn't work. Offset is 0x400 (1K) and page size of my NAND is 2K, so I think it would be an issue. Anyway, I also tried to make RAM initialization in lowlevel_init.S , instead of imximage.cfg, and flash u-boot.bin (instead of u-boot.imx) at offset 0x0. That does not work.
2. This is another reason why I wanted to avoid device tree. I understand it roughly, but I'm not very skilled in it. Could you be a little more specific? The dts file has the following:
&i2c1 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c1>;
status = "okay";
codec: sgtl5000@0a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 129>;
VDDA-supply = <®_2p5v>;
VDDIO-supply = <®_3p3v>;
};
};
The line clocks = <&clks 129>; is not doing what you say?
I'm using kenel 3.14.12 because I need a kernel version where real time patch can be applied (it's a requeriment from software people), and this is the last version where I can do it.
I'm not triying to give support for all board devices in the device tree file, I'm only triying to see if I'm able to have audio. So I still have to deal with the other devices. This is why I didn't want to use dt. I'll keep trying with dt, but I would need more help.
Thanks.
Fernando,
Let's attack one problem at time and let's start with the audio: please do as suggested and try kernel 3.17.2. It is much easier to start with a base that it is known to work 'out-of-the-box'.
After you get audio on 3.17.2, then you can port the required changes to 3.14.
The reason for the clock failure is that on 3.14 there is no support for it.
I added such support it here:
commit 46ae42498ef6febdaa6b51359f1ede38cd6b5a47
Author: Fabio Estevam <fabio.estevam@freescale.com>
Date: Wed Mar 12 02:55:46 2014 +0800
ARM: mx25: Add CLKO support
CLKO support is a clock output on mx25 which can output many of the internal
clock sources. It is useful for debugging purpose or also for driving the
audio codec for example.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
,which appeared only in 3.16. On mx25pdk the sgtl5000 codec is clocked from mx27 CLKO pin.
Good luck ;-)
Thanks to your information, I can detect the audio device on kernel 3.14.12. I've modified clk-imx25.c to add support for CLKO, just like you did for 3.16. I have also had to add the following line to ssi1 node in dt file:
&ssi1 {
codec-handle = <&codec>;
fsl,mode = "i2s-slave";
status = "okay";
};
Now I have audio, but the problem is it isn't working very well. The sound is heard slowed down. I'm testing sound with alsa-utils (aplay). Possibly the problem has to do with this tool (it works fine with kernel 2.6.31) or with the driver, but I think it has to do with the signal CKLO. Maybe the clock rate is not the appropriate for this signal. Any idea?
Yes, the same idea as before: please try on 3.17.2 first ;-)
Hi again,
I have tried on 3.17.2, but the result was de same: I detect audio device, but the sound is slow. Then, with a JTAG, I've checked CCM MCR register on 3.14.12 and on 2.6.31 (where audio works fine), and I've seen that CLKO DIV value was 32 on 3.14.12 and 6 on 2.6.31. So I've added the initialization of this register to lowlevel_init.S file in u-boot to set clock divider at 6. Now, the audio works fine. Thanks for your help.
I still have to solve the NAND boot problem. Can you help me with this? Maybe it's better that I open a new thread for this issue.
Good news, Fernando.
We are probably missing to set the CLKO rate in the kernel, so that it works independently of the rate setting in U-boot.
I will try to fix it when time permits.
About the NAND problem I would suggest the following approach:
- Do you have access to a mx25pdk? If so, please try adding NAND support and boot from NAND on this board using U-boot 2014.10, since this board is already supported in mainline U-boot.
- In case of problems, report them in the u-boot mailing list and we can discuss there.
Yes, I have a mx25pdk. I will try U-boot 2014.10 with PDK and my board.
Thanks for all.
OK, I'll try it when I can (now I'm busy with other work issues) and I'll tell you the result. Thanks.
Also, if you use 3.17.2 then audio works out of the box with dt.
This commit is the one that adds audio support on imx25-pdk.dts:
Hope this helps.