Hi,
We're developing a board with two audio codecs SGTL5000 using a IMX6 Solo System On Module (Toradex Colibri IMX6). (Kernel 3.10.17)
The SOM has one sgtl5000 integrated connected at the ssi in the slave mode, We add a new sgtl5000 on the base board connected at the ssi master mode.
I modified all my device tree to adapt to I2S Master mode.
When I remove the sgtl5000 from the SoM manually (de-soldering) the kernel could attach my second sgtl5000 (base board).
When I use a SoM with sgtl5000 + a base board with sgtl5000 , the kernel could attach just one sgtl5000.
Using 2 sgtl5000 (SoM + Base Board)
Last login: Tue Jan 26 04:10:46 UTC 2016 on ttymxc0
root@colibri-imx6:~# dmesg | grep sgtl
[ 2.367998] sgtl5000 1-000a: sgtl5000 revision 0x11
[ 2.390062] sgtl5000 2-000a: sgtl5000 revision 0x11
[ 2.435627] sgtl5000 1-000a: Failed to get supply 'VDDD': -19
[ 2.447995] sgtl5000 1-000a: Using internal LDO instead of VDDD
[ 2.469102] imx-sgtl5000 sound1.27: sgtl5000 <-> 2028000.ssi mapping ok
[ 2.479305] sgtl5000 2-000a: Failed to get supply 'VDDD': -19
[ 2.491893] sgtl5000 2-000a: Failed to set supply VDDD_LDO
[ 2.499109] sgtl5000 2-000a: failed to register regulator
[ 2.506160] sgtl5000 2-000a: Failed to register vddd internal supplies: -16
[ 2.514727] sgtl5000 2-000a: ASoC: failed to probe CODEC -16
[ 2.522002] imx-sgtl5000 sound2.28: ASoC: failed to instantiate card -16
[ 2.530371] imx-sgtl5000 sound2.28: snd_soc_register_card failed (-16)
[ 2.538556] imx-sgtl5000: probe of sound2.28 failed with error -16
[ 2.739346] #0: imx6-colibri-sgtl5000
Using Only one Sgtl5000 (Removinf the Sgtl5000 from SoM)
root@colibri-imx6:~# dmesg | grep sgtl
[ 2.216757] sgtl5000_read16: ret=-5 reg=0 addr=a
[ 2.221669] sgtl5000_read16: ret=-5 reg=0 addr=a
[ 2.226604] sgtl5000_read16: ret=-5 reg=0 addr=a
[ 2.232226] sgtl5000 2-000a: sgtl5000 revision 0x11
[ 2.259945] imx-sgtl5000 sound1.27: ASoC: CODEC (null) not registered
[ 2.266589] imx-sgtl5000 sound1.27: snd_soc_register_card failed (-517)
[ 2.273354] platform sound1.27: Driver imx-sgtl5000 requests probe deferral
[ 2.280835] sgtl5000 2-000a: Failed to get supply 'VDDD': -19
[ 2.290665] sgtl5000 2-000a: Using internal LDO instead of VDDD
[ 2.309579] imx-sgtl5000 sound2.28: sgtl5000 <-> 202c000.ssi mapping ok
[ 2.417388] imx-sgtl5000 sound1.27: ASoC: Failed to create card debugfs directory
[ 2.425044] imx-sgtl5000 sound1.27: ASoC: CODEC (null) not registered
[ 2.431595] imx-sgtl5000 sound1.27: snd_soc_register_card failed (-517)
[ 2.438347] platform sound1.27: Driver imx-sgtl5000 requests probe deferral
[ 2.475710] imx-sgtl5000 sound1.27: ASoC: Failed to create card debugfs directory
[ 2.483370] imx-sgtl5000 sound1.27: ASoC: CODEC (null) not registered
[ 2.489937] imx-sgtl5000 sound1.27: snd_soc_register_card failed (-517)
[ 2.496702] platform sound1.27: Driver imx-sgtl5000 requests probe deferral
[ 2.523435] #0: imx6-colibri-sgtl5000
[ 5.794814] imx-sgtl5000 sound1.27: ASoC: Failed to create card debugfs directory
[ 5.982093] imx-sgtl5000 sound1.27: ASoC: CODEC (null) not registered **Ok there's no sgtl5000
[ 5.988763] imx-sgtl5000 sound1.27: snd_soc_register_card failed (-517)
[ 6.084338] platform sound1.27: Driver imx-sgtl5000 requests probe deferral
Pinout
Signal | Pin (SoM) | iMX6 Function | iMX6 Note1 | iMX6 Note2 | iMX6 ALT | iMX6 Pin SoC | |
DIGITAL_AUDIO_2_I2S_MASTER_DIN | 159 | AUD3_RXD | ALT4 | CSI0_DATA07 | |||
DIGITAL_AUDIO_2_I2S_MASTER_DOUT | 155 | AUD3_TXD | ALT4 | CSI0_DATA05 | |||
DIGITAL_AUDIO_2_I2S_MASTER_LRCLK | 157 | AUD3_TXFS | ALT4 | CSI0_DATA06 | |||
DIGITAL_AUDIO_2_I2S_MASTER_SCLK | 153 | AUD3_TXC | ALT4 | CSI0_DATA04 |
Using two sgtl5000
root@colibri-imx6:~# i2cdetect -y 1 (SoM i2c sgtl5000 at 0x0a)
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- 08 -- UU -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@colibri-imx6:~# i2cdetect -y 2 (external board i2c sgtl5000 at 0x0a)
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- UU -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- 21 -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@colibri-imx6:~#
Some device tree modifications
imx6dl-colibri-eval-v7.dts
&i2c3 {
status = "okay";
/* M41T0M6 real time clock on carrier board */
rtc_i2c: rtc@68 {
compatible = "st,m41t00";
reg = <0x68>;
};
audioclk: ext12Mhz {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <12288000>;
};
codec2: sgtl5000@0a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&audioclk 0>;
VDDA-supply = <®_2p5v>;
VDDIO-supply = <®_3p3v>;
};
};
Imx6qdl-colibri-v7.dtsi
audmux {
pinctrl_audmux_t1: audmux-t1 {
fsl,pins = <
MX6QDL_PAD_KEY_COL0__AUD5_TXC 0x130b0
MX6QDL_PAD_KEY_ROW0__AUD5_TXD 0x130b0
MX6QDL_PAD_KEY_COL1__AUD5_TXFS 0x130b0
MX6QDL_PAD_KEY_ROW1__AUD5_RXD 0x130b0
>;
};
pinctrl_audmux_t2: audmux-t2 {
fsl,pins = <
MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x130b0
MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
>;
};
};
&ssi1 {
fsl,mode = "i2s-slave";
status = "okay";
};
&ssi2 {
fsl,mode = "i2s-master";
status = "okay";
};
sound1 {
compatible = "fsl,imx6-colibri-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6-colibri-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec1>;
audio-routing =
"MIC_IN", "Mic Jack",
"Mic Jack", "Mic Bias",
"Headphone Jack", "HP_OUT";
mux-int-port = <1>;
mux-ext-port = <5>;
};
sound2 {
compatible = "fsl,imx6-colibri-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6-colibri-sgtl5000"; //I testes with other name too, imx6-colibri-sgt5000-2
ssi-controller = <&ssi2>;
audio-codec = <&codec2>;
audio-routing =
"MIC_IN", "Mic Jack",
"Mic Jack", "Mic Bias",
"Headphone Jack", "HP_OUT";
mux-int-port = <2>;
mux-ext-port = <3>;
};
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux_t1 &pinctrl_audmux_mclk_2 &pinctrl_mic_gnd
&pinctrl_audmux_t2 >;
status = "okay";
};
Someone could help to fix this problem?
Thank you very much!
Best Regards,
Caio Pereira
Thank you Jimmy,
We already decide to use the I2S Slave mode.
Hi Caio,
I'm facing the same problem, we are using also an Colibri iMX6 and would like to use a second SGTL5000.
When configuring both SGTL5000 in the device tree the Codecs are not working even I2S is in slave mode.
Configuring only of the codecs in the device tree there is no problem registering the codec.
Did you solve the problem and could you share your solution with me?
Hi josbijma,
Sorry for the delay.
I asked to Toradex support and we wrote a little hack to support 2 devices (It's a ugly hack, sorry for this).
I don't know how to attach a file here , so I will paste the patch.
We're using the 3.10.17 kernel based on Yocto Dizzy , the Codec is working with external Crystal in I2S_SLAVE mode.
sgtl_2nd_codec.patch
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 551151a..841bcc8 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -103,10 +103,12 @@ static const char *supply_names[SGTL5000_SUPPLY_NUM] = {
};
#define LDO_CONSUMER_NAME "VDDD_LDO"
+#define LDO_CONSUMER_NAME2 "VDDD_LDO2"
#define LDO_VOLTAGE 1200000
static struct regulator_consumer_supply ldo_consumer[] = {
REGULATOR_SUPPLY(LDO_CONSUMER_NAME, NULL),
+ REGULATOR_SUPPLY(LDO_CONSUMER_NAME2, NULL),
};
static struct regulator_init_data ldo_init_data = {
@@ -120,6 +122,17 @@ static struct regulator_init_data ldo_init_data = {
.consumer_supplies = &ldo_consumer[0],
};
+static struct regulator_init_data ldo_init_data2 = {
+ .constraints = {
+ .min_uV = 1200000,
+ .max_uV = 1200000,
+ .valid_modes_mask = REGULATOR_MODE_NORMAL,
+ .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+ },
+ .num_consumer_supplies = 1,
+ .consumer_supplies = &ldo_consumer[1],
+};
+
/*
* sgtl5000 internal ldo regulator,
* enabled when VDDD not provided
@@ -1211,14 +1224,19 @@ static int sgtl5000_replace_vddd_with_ldo(struct snd_soc_codec *codec)
/* set internal ldo to 1.2v */
ret = ldo_regulator_register(codec, &ldo_init_data, LDO_VOLTAGE);
- if (ret) {
- dev_err(codec->dev,
- "Failed to register vddd internal supplies: %d\n", ret);
- return ret;
+ if (!ret)
+ sgtl5000->supplies[VDDD].supply = LDO_CONSUMER_NAME;
+ else {
+ ret = ldo_regulator_register(codec, &ldo_init_data2, LDO_VOLTAGE);
+ if (!ret)
+ sgtl5000->supplies[VDDD].supply = LDO_CONSUMER_NAME2;
+ else {
+ dev_err(codec->dev,
+ "Failed to register vddd internal supplies: %d\n", ret);
+ return ret;
+ }
}
- sgtl5000->supplies[VDDD].supply = LDO_CONSUMER_NAME;
-
ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(sgtl5000->supplies),
sgtl5000->supplies);
Modification on imx6qdl-colibri-v3.dtsi (in our test we inverse the sound1 with ssi2)
sound1 {
compatible = "fsl,imx6-colibri-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6-colibri-sgtl5000";
ssi-controller = <&ssi2>;
audio-codec = <&codec2>;
audio-routing =
"MIC_IN", "Mic Jack",
"Mic Jack", "Mic Bias",
"LINE_IN", "Line In Jack",
"Headphone Jack", "HP_OUT",
"Line Out Jack", "LINE_OUT";
mux-int-port = <2>;
mux-ext-port = <3>;
};
sound2 {
compatible = "fsl,imx6-colibri-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6-colibri-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec1>;
audio-routing =
"MIC_IN", "Mic Jack",
"Mic Jack", "Mic Bias",
"Headphone Jack", "HP_OUT";
mux-int-port = <1>;
mux-ext-port = <5>;
};
&ssi2 {
fsl,mode = "i2s-slave";
status = "okay";
};
&iomuxc {
audmux {
pinctrl_audmux_t1: audmux-t1 {
fsl,pins = <
MX6QDL_PAD_KEY_COL0__AUD5_TXC 0x130b0
MX6QDL_PAD_KEY_ROW0__AUD5_TXD 0x130b0
MX6QDL_PAD_KEY_COL1__AUD5_TXFS 0x130b0
MX6QDL_PAD_KEY_ROW1__AUD5_RXD 0x130b0
>;
};
pinctrl_audmux_t2: audmux-t2 {
fsl,pins = <
MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x130b0
MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
>;
};
};
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux_t1 &pinctrl_audmux_mclk_2 >;
//&pinctrl_mic_gnd
status = "okay";
};
imx6dl-colibril-eval-v3.dts
audioclk: ext12Mhz { | ||
compatible = "fixed-clock"; | ||
#clock-cells = <0>; | ||
clock-frequency = <24000000>; //12288000 old value |
};
codec2: sgtl5000@0a {
compatible = "fsl,sgtl5000"; | ||
reg = <0x0a>; | ||
clocks = <&audioclk 0>; | ||
VDDA-supply = <®_2p5v>; | ||
VDDIO-supply = <®_3p3v>; |
};
Best Regards,
Caio Pereira
Hi Caio Pereira,
Thanks for your answer!
I tried the patch and it is working!
I'm not totally sure what the fix does. It seems that LDO initialization data is duplicated, is this needed because otherwise the previous data is overwritten/corrupted?
Do you know if a final solution/patch will be provided by Freescale or somebody else?
Again thanks a lot!
josbijma,
Nice!! We loose sometime to fix the software and hardware.
Yes, it's a problem with LDO initialization, I was thinking that the second sgtl5000 could be a new instance of the driver, so I didn't handle all the LDOs and instane in only one driver. This means I need to study more about device drivers.
I tested with kernel 3.14 and they didn't fix.
Best Regards,
Hi Caio Pereira,
We are planning to use the CLKO2 Signal available on the Colibri socket.
Best regards,
Jos Bijma
Ok thank you!
I already test with CLKO2 and works fine!
I'm having problem with 12288000 Hz crystal.
Regards,
Caio Pereira
Hello ,
Please find the attached file for configuration in dts file and dmesg log.
With this configuration, we are seeing dual sound card detection, but both the sound cards are failing to record the sound.
Please let us know if we are missing something in dts file.
when you using SGTL5000 in slave mode, please check this patch.
[alsa-devel] No sound captured with SGTL5000 on i.MX6 in I²S master mode