2021-08-06 07:14 AM
Hi All,
i am using stm32mp1 with i2c on sgtl5000 codec and control lines are over carrier i2s
i am getting kernel soc sgtl5000.c error
sgtl5000 0-000a: Error reading chip id -6
<STM32_PINMUX('A', 15, AF5)>; /* I2S1_WS */
<STM32_PINMUX('Z', 0, AF5)>, /* I2S1_CK */
<STM32_PINMUX('Z', 1, AF5)>, /* I2S1_SDI */
<STM32_PINMUX('Z', 2, AF5)>, /* I2S1_SDO */
<STM32_PINMUX('Z', 6, AF5)>; /* I2S1_MCK */
Any reference dts on i2s1 would be helpful.. and suggest on kernel error .
2021-08-30 11:46 PM
Do you confirm you are oin 5.10.x KErnel ?
2021-08-30 11:58 PM
Hi Bernard
no i am on 4.19.49 linux, but i merged latest 5.10.X SOC/ stm32mp1_i2s.c and codec new changes merged.
2021-08-31 12:12 AM
Ok I will check with experts if there are no other dependencies.
On codec driver, we can see, you will never reach I2c read id error while the MCLK is not enabled. Is this also what you saw the first time ?
https://github.com/torvalds/linux/blob/master/sound/soc/codecs/sgtl5000.c#L1608
2021-08-31 04:30 AM
yes i am seeing the same thing, MCLK is not enabled here are few work around made,
a. i add a dummy soc- sound as a master and got MCK 11.3 MHz
b. made sgtl5000 as a kernel module
c. insmod snd-soc-sgtl5000.ko
found only sgtl5000 probed successfully, but codec probe did not got called sgtl5000_probe
2021-08-31 07:12 AM
OK. After review with experts, here are our conclusions:
2021-09-01 04:06 AM
could you brief be how the routing property will makes the always generation of i2s mclk
and will i get patch for Setting I2S as a master clock provider this should be always on while stm32_i2s_probe ?
2021-09-01 08:38 AM
Could you please share your device tree (i2s, I2c and sgtl5000) ?
Because it seems to me you have all (but in separate threads) so I would like to check your latest one.
2021-09-01 07:45 PM
Hi Bernard,
&i2s1 {
#clock-cells = <0>;
clocks = <&rcc SPI1>, <&rcc SPI1_K>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
clock-names = "pclk", "i2sclk", "x8k", "x11k";
#sound-dai-cells = <1>;
status = "okay";
i2s1_port: ports {
#address-cells = <1>;
#size-cells = <0>;
i2s2_endpoint: port@0 {
reg = <0>;
remote-endpoint = <&sgtl5000_tx_endpoint>;
system-clock-frequency = <48000>;
system-clock-direction-out;
frame-master;
bitclock-master;
format = "i2s";
mclk-fs = <256>;
};
};
};
sound0:sound@0 {
compatible = "audio-graph-card";
label = "STM32MP1-I2S1";
routing =
"Playback" , "MCLK1",
"Capture" , "MCLK1";
dais = <&i2s1_port>;
status = "okay";
};
sgtl5000: sgtl5000.0-000a@a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
#sound-dai-cells = <0>;
clocks = <&i2s1>;
clock-names = "mclk";
status = "okay";
VDDD-supply = <&v1v8_audio>;
VDDA-supply = <&v3v3_fix>;
VDDIO-supply = <&v3v3_fix>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
sgtl5000_tx_endpoint: endpoint@0 {
reg = <0>;
remote-endpoint = <&i2s2_endpoint>;
};
};
};
};
2021-09-02 05:47 AM
I/ You should have this structure:
&i2c {
sgtl5000 {
clocks = <&i2s1>;
…
};
};
II/ If not already tested, did you try to increase this delay in codec driver:
https://github.com/torvalds/linux/blob/master/sound/soc/codecs/sgtl5000.c#L1628
2021-09-02 06:43 AM
Sorry it was under i2c node only i missed
i am using 4.19.XX but have the changes of ,mainly mclk provider but looks like
i have tried udelay(), still no MCLK
linux/stm32_i2s.c at master · torvalds/linux · GitHub
and i observe that i2s-mclk clocks out if any codec stream activity, like playback, capture. may you point out how to make always clock enable with configuring 11.XX MHz frequency in following
Observation:
if i made SGTL5000 as a codec as a kernel module it does respond to i2c command, but only i2c probe got success, and still sgtl5000_probe did not get called,
the codec stream activity done by dummy codec, so i have suggestion in following probe requirement which will work.
static int stm32_i2s_probe(struct platform_device *pdev)------------by default always clock enable
{
}
so that SGTL5000 always get MCLK software, and reacts to i2c commands, is that possible ?