Discussion:
No sound captured with SGTL5000 on i.MX6 in I²S master mode
Jean-Michel Hautbois
2014-09-18 12:56:25 UTC
Permalink
Hi,

Sorry if double posting, I have not received confirmation on
subscription yesterday... So I try again :/.

I have a custom i.MX6 board, and have a sgtl5000 connected on it. I
would like to have it used in master mode (it is used only for audio
capture) but I get a "pcm_read:2031: read error: Input/output error"
when using arecord.
I have checked my signals and I get something on I²S which seems to be good.
I launch :
$> arecord -f cd -Dhw:0,0 -v -V stereo
Receive Frame Sync is 44.1KHz
Receive Clock Signal is ~1MHz (I can be more precise if needed)
Data Receive is present, only when arecord is launched. It stops when
there is no capture asked.
Both clocks are still present even when no arecord is running.

This suggests, for me, that master mode is working.
So, I don't know why I can't get any data to my arecord. Is this a
left/right justified master mode ? Anything else ?

I am wondering if I forgot something in my DT or if I need to do
something else :

sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6q-vbx3-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"LINE_IN", "Line In Jack";
mux-int-port = <1>;
mux-ext-port = <5>;
};

&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
status = "okay";
};

&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";

codec: ***@0a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 201>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&vgen6_reg>;
sysclk = <24000000>;
};
};

&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;

imx6qdl-vbx3 {
pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDLPAD_DISP0_DAT13__AUD5_RXFS 0x130b0
MX6QDL_PAD_DISP0_DAT14__AUD5_RXC 0x130b0
MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
;
};
};

&ssi1 {
status = "okay";
codec-handle = <&codec>;
fsl,mode = "i2s-master";
fsl,ssi-asynchronous; /* Not sure about it, but does not change anything */
};

Here is the dmesg part :
[ 6.026803] sgtl5000 1-000a: sgtl5000 revision 0x11
[ 6.129380] imx-sgtl5000 sound: snd_soc_register_card failed (-517)
[ 6.248849] platform sound: Driver imx-sgtl5000 requests probe deferral
[ 6.311643] sgtl5000 1-000a: Using internal LDO instead of VDDD
[ 6.393196] imx-sgtl5000 sound: sgtl5000 <-> 2028000.ssi mapping ok

And the user space commands :
$> arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imx6qvbx3sgtl50 [imx6q-vbx3-sgtl5000], device 0: HiFi sgtl5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

$> arecord -v -V stereo -fdat -D hw:0,0 somefile.wav
Recording WAVE 'somefile.wav' : Signed 16 bit Little Endian, Rate
48000 Hz, Stereo
Hardware PCM card 0 'imx6q-vbx3-sgtl5000' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 16384
period_size : 4096
period_time : 85333
tstamp_mode : NONE
period_step : 1
avail_min : 4096
period_event : 0
start_threshold : 1
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
arecord: pcm_read:2031: read error: Input/output error

The kernel is 3.17-rc5.

Thanks for reading all this, and for any advice :).
JM
Fabio Estevam
2014-09-18 13:30:18 UTC
Permalink
Hi Jean-Michel,

On Thu, Sep 18, 2014 at 9:56 AM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Hi,
Sorry if double posting, I have not received confirmation on
subscription yesterday... So I try again :/.
I have a custom i.MX6 board, and have a sgtl5000 connected on it. I
would like to have it used in master mode (it is used only for audio
capture) but I get a "pcm_read:2031: read error: Input/output error"
when using arecord.
I have checked my signals and I get something on I²S which seems to be good.
$> arecord -f cd -Dhw:0,0 -v -V stereo
Receive Frame Sync is 44.1KHz
Receive Clock Signal is ~1MHz (I can be more precise if needed)
Data Receive is present, only when arecord is launched. It stops when
there is no capture asked.
Both clocks are still present even when no arecord is running.
This suggests, for me, that master mode is working.
So, I don't know why I can't get any data to my arecord. Is this a
left/right justified master mode ? Anything else ?
I am also trying to test fsl_ssi in master mode.

I am running linux-next 20140912 with the following changes to get SSI
in master mode:

--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -532,6 +532,7 @@
};

&ssi2 {
+ fsl,mode = "i2s-master";
status = "okay";
};

diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index 3a3d17c..09ea6a5 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -247,7 +247,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
data->dai.platform_of_node = ssi_np;
data->dai.ops = &imx_hifi_ops;
data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
- SND_SOC_DAIFMT_CBM_CFM;
+ SND_SOC_DAIFMT_CBS_CFS;

data->card.dev = &pdev->dev;
ret = snd_soc_of_parse_card_name(&data->card, "model");

,but when I do aplay I do not get any sound.
Post by Jean-Michel Hautbois
I am wondering if I forgot something in my DT or if I need to do
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6q-vbx3-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"LINE_IN", "Line In Jack";
mux-int-port = <1>;
mux-ext-port = <5>;
};
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
status = "okay";
};
&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 201>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&vgen6_reg>;
sysclk = <24000000>;
};
};
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;
imx6qdl-vbx3 {
pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDLPAD_DISP0_DAT13__AUD5_RXFS 0x130b0
MX6QDL_PAD_DISP0_DAT14__AUD5_RXC 0x130b0
MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
;
};
};
&ssi1 {
status = "okay";
codec-handle = <&codec>;
I think this codec-handle is not needed here.
Post by Jean-Michel Hautbois
fsl,mode = "i2s-master";
fsl,ssi-asynchronous; /* Not sure about it, but does not change anything */
};
[ 6.026803] sgtl5000 1-000a: sgtl5000 revision 0x11
[ 6.129380] imx-sgtl5000 sound: snd_soc_register_card failed (-517)
[ 6.248849] platform sound: Driver imx-sgtl5000 requests probe deferral
[ 6.311643] sgtl5000 1-000a: Using internal LDO instead of VDDD
[ 6.393196] imx-sgtl5000 sound: sgtl5000 <-> 2028000.ssi mapping ok
$> arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imx6qvbx3sgtl50 [imx6q-vbx3-sgtl5000], device 0: HiFi sgtl5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
$> arecord -v -V stereo -fdat -D hw:0,0 somefile.wav
Recording WAVE 'somefile.wav' : Signed 16 bit Little Endian, Rate
48000 Hz, Stereo
Hardware PCM card 0 'imx6q-vbx3-sgtl5000' device 0 subdevice 0
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 16384
period_size : 4096
period_time : 85333
tstamp_mode : NONE
period_step : 1
avail_min : 4096
period_event : 0
start_threshold : 1
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
arecord: pcm_read:2031: read error: Input/output error
The kernel is 3.17-rc5.
Thanks for reading all this, and for any advice :).
I am adding some more folks in Cc in case they have some suggestions.

Regards,

Fabio Estevam
Michael Trimarchi
2014-09-18 13:35:15 UTC
Permalink
Hi
Post by Fabio Estevam
Hi Jean-Michel,
On Thu, Sep 18, 2014 at 9:56 AM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Hi,
Sorry if double posting, I have not received confirmation on
subscription yesterday... So I try again :/.
I have a custom i.MX6 board, and have a sgtl5000 connected on it. I
would like to have it used in master mode (it is used only for audio
capture) but I get a "pcm_read:2031: read error: Input/output error"
when using arecord.
I have checked my signals and I get something on I²S which seems to be good.
$> arecord -f cd -Dhw:0,0 -v -V stereo
Receive Frame Sync is 44.1KHz
Receive Clock Signal is ~1MHz (I can be more precise if needed)
Data Receive is present, only when arecord is launched. It stops when
there is no capture asked.
Both clocks are still present even when no arecord is running.
This suggests, for me, that master mode is working.
So, I don't know why I can't get any data to my arecord. Is this a
left/right justified master mode ? Anything else ?
Yes, can you check if the direction of the mux-port is correct and you
are really get data.
Post by Fabio Estevam
I am also trying to test fsl_ssi in master mode.
I am running linux-next 20140912 with the following changes to get SSI
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -532,6 +532,7 @@
};
&ssi2 {
+ fsl,mode = "i2s-master";
status = "okay";
};
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index 3a3d17c..09ea6a5 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -247,7 +247,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
data->dai.platform_of_node = ssi_np;
data->dai.ops = &imx_hifi_ops;
data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
- SND_SOC_DAIFMT_CBM_CFM;
+ SND_SOC_DAIFMT_CBS_CFS;
data->card.dev = &pdev->dev;
ret = snd_soc_of_parse_card_name(&data->card, "model");
,but when I do aplay I do not get any sound.
Post by Jean-Michel Hautbois
I am wondering if I forgot something in my DT or if I need to do
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6q-vbx3-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"LINE_IN", "Line In Jack";
mux-int-port = <1>;
mux-ext-port = <5>;
};
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
status = "okay";
};
&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 201>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&vgen6_reg>;
sysclk = <24000000>;
};
};
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;
imx6qdl-vbx3 {
pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDLPAD_DISP0_DAT13__AUD5_RXFS 0x130b0
MX6QDL_PAD_DISP0_DAT14__AUD5_RXC 0x130b0
MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
;
};
};
&ssi1 {
status = "okay";
codec-handle = <&codec>;
I think this codec-handle is not needed here.
Post by Jean-Michel Hautbois
fsl,mode = "i2s-master";
fsl,ssi-asynchronous; /* Not sure about it, but does not change anything */
};
[ 6.026803] sgtl5000 1-000a: sgtl5000 revision 0x11
[ 6.129380] imx-sgtl5000 sound: snd_soc_register_card failed (-517)
[ 6.248849] platform sound: Driver imx-sgtl5000 requests probe deferral
[ 6.311643] sgtl5000 1-000a: Using internal LDO instead of VDDD
[ 6.393196] imx-sgtl5000 sound: sgtl5000 <-> 2028000.ssi mapping ok
$> arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imx6qvbx3sgtl50 [imx6q-vbx3-sgtl5000], device 0: HiFi sgtl5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
$> arecord -v -V stereo -fdat -D hw:0,0 somefile.wav
Recording WAVE 'somefile.wav' : Signed 16 bit Little Endian, Rate
48000 Hz, Stereo
Hardware PCM card 0 'imx6q-vbx3-sgtl5000' device 0 subdevice 0
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 16384
period_size : 4096
period_time : 85333
tstamp_mode : NONE
period_step : 1
avail_min : 4096
period_event : 0
start_threshold : 1
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
arecord: pcm_read:2031: read error: Input/output error
The clock is not get in

Michael
Post by Fabio Estevam
Post by Jean-Michel Hautbois
The kernel is 3.17-rc5.
Thanks for reading all this, and for any advice :).
I am adding some more folks in Cc in case they have some suggestions.
Regards,
Fabio Estevam
_______________________________________________
Alsa-devel mailing list
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO - Founder Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
| [`as] http://www.amarulasolutions.com |
Jean-Michel Hautbois
2014-09-18 13:45:47 UTC
Permalink
Post by Michael Trimarchi
Hi
Post by Fabio Estevam
Hi Jean-Michel,
On Thu, Sep 18, 2014 at 9:56 AM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Hi,
Sorry if double posting, I have not received confirmation on
subscription yesterday... So I try again :/.
I have a custom i.MX6 board, and have a sgtl5000 connected on it. I
would like to have it used in master mode (it is used only for audio
capture) but I get a "pcm_read:2031: read error: Input/output error"
when using arecord.
I have checked my signals and I get something on I²S which seems to be good.
$> arecord -f cd -Dhw:0,0 -v -V stereo
Receive Frame Sync is 44.1KHz
Receive Clock Signal is ~1MHz (I can be more precise if needed)
Data Receive is present, only when arecord is launched. It stops when
there is no capture asked.
Both clocks are still present even when no arecord is running.
This suggests, for me, that master mode is working.
So, I don't know why I can't get any data to my arecord. Is this a
left/right justified master mode ? Anything else ?
Yes, can you check if the direction of the mux-port is correct and you
are really get data.
Mmh, can you explain in more details, I don't get it...
Post by Michael Trimarchi
Post by Fabio Estevam
I am also trying to test fsl_ssi in master mode.
I am running linux-next 20140912 with the following changes to get SSI
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -532,6 +532,7 @@
};
&ssi2 {
+ fsl,mode = "i2s-master";
status = "okay";
};
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index 3a3d17c..09ea6a5 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -247,7 +247,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
data->dai.platform_of_node = ssi_np;
data->dai.ops = &imx_hifi_ops;
data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
- SND_SOC_DAIFMT_CBM_CFM;
+ SND_SOC_DAIFMT_CBS_CFS;
data->card.dev = &pdev->dev;
ret = snd_soc_of_parse_card_name(&data->card, "model");
,but when I do aplay I do not get any sound.
Post by Jean-Michel Hautbois
I am wondering if I forgot something in my DT or if I need to do
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6q-vbx3-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"LINE_IN", "Line In Jack";
mux-int-port = <1>;
mux-ext-port = <5>;
};
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
status = "okay";
};
&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 201>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&vgen6_reg>;
sysclk = <24000000>;
};
};
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;
imx6qdl-vbx3 {
pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDLPAD_DISP0_DAT13__AUD5_RXFS 0x130b0
MX6QDL_PAD_DISP0_DAT14__AUD5_RXC 0x130b0
MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
;
};
};
&ssi1 {
status = "okay";
codec-handle = <&codec>;
I think this codec-handle is not needed here.
Post by Jean-Michel Hautbois
fsl,mode = "i2s-master";
fsl,ssi-asynchronous; /* Not sure about it, but does not change anything */
};
[ 6.026803] sgtl5000 1-000a: sgtl5000 revision 0x11
[ 6.129380] imx-sgtl5000 sound: snd_soc_register_card failed (-517)
[ 6.248849] platform sound: Driver imx-sgtl5000 requests probe deferral
[ 6.311643] sgtl5000 1-000a: Using internal LDO instead of VDDD
[ 6.393196] imx-sgtl5000 sound: sgtl5000 <-> 2028000.ssi mapping ok
$> arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imx6qvbx3sgtl50 [imx6q-vbx3-sgtl5000], device 0: HiFi sgtl5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
$> arecord -v -V stereo -fdat -D hw:0,0 somefile.wav
Recording WAVE 'somefile.wav' : Signed 16 bit Little Endian, Rate
48000 Hz, Stereo
Hardware PCM card 0 'imx6q-vbx3-sgtl5000' device 0 subdevice 0
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 16384
period_size : 4096
period_time : 85333
tstamp_mode : NONE
period_step : 1
avail_min : 4096
period_event : 0
start_threshold : 1
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
arecord: pcm_read:2031: read error: Input/output error
The clock is not get in
And what can this mean from a driver/mux perspective ?
Thanks,
JM
Michael Trimarchi
2014-09-18 13:55:56 UTC
Permalink
Hi

On Thu, Sep 18, 2014 at 3:45 PM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Post by Michael Trimarchi
Hi
Post by Fabio Estevam
Hi Jean-Michel,
On Thu, Sep 18, 2014 at 9:56 AM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Hi,
Sorry if double posting, I have not received confirmation on
subscription yesterday... So I try again :/.
I have a custom i.MX6 board, and have a sgtl5000 connected on it. I
would like to have it used in master mode (it is used only for audio
capture) but I get a "pcm_read:2031: read error: Input/output error"
when using arecord.
I have checked my signals and I get something on I²S which seems to be good.
$> arecord -f cd -Dhw:0,0 -v -V stereo
Receive Frame Sync is 44.1KHz
Receive Clock Signal is ~1MHz (I can be more precise if needed)
Data Receive is present, only when arecord is launched. It stops when
there is no capture asked.
Both clocks are still present even when no arecord is running.
This suggests, for me, that master mode is working.
So, I don't know why I can't get any data to my arecord. Is this a
left/right justified master mode ? Anything else ?
Yes, can you check if the direction of the mux-port is correct and you
are really get data.
Mmh, can you explain in more details, I don't get it...
ssi is the peripheral that is rooted from the pins outside (audmux) and audmux
should configured according to clock direction and data direction etc. I don't
remember now is done now in the latest kernel, because I have in the
head too much architecture,
but it should be possible to dump it from sysfs how is configured. So
you need to check if it match
Post by Jean-Michel Hautbois
Post by Michael Trimarchi
Post by Fabio Estevam
I am also trying to test fsl_ssi in master mode.
I am running linux-next 20140912 with the following changes to get SSI
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -532,6 +532,7 @@
};
&ssi2 {
+ fsl,mode = "i2s-master";
status = "okay";
};
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index 3a3d17c..09ea6a5 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -247,7 +247,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
data->dai.platform_of_node = ssi_np;
data->dai.ops = &imx_hifi_ops;
data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
- SND_SOC_DAIFMT_CBM_CFM;
+ SND_SOC_DAIFMT_CBS_CFS;
data->card.dev = &pdev->dev;
ret = snd_soc_of_parse_card_name(&data->card, "model");
,but when I do aplay I do not get any sound.
Post by Jean-Michel Hautbois
I am wondering if I forgot something in my DT or if I need to do
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6q-vbx3-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"LINE_IN", "Line In Jack";
mux-int-port = <1>;
mux-ext-port = <5>;
};
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
status = "okay";
};
&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 201>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&vgen6_reg>;
sysclk = <24000000>;
};
};
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;
imx6qdl-vbx3 {
pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDLPAD_DISP0_DAT13__AUD5_RXFS 0x130b0
MX6QDL_PAD_DISP0_DAT14__AUD5_RXC 0x130b0
MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
;
};
};
&ssi1 {
status = "okay";
codec-handle = <&codec>;
I think this codec-handle is not needed here.
Post by Jean-Michel Hautbois
fsl,mode = "i2s-master";
fsl,ssi-asynchronous; /* Not sure about it, but does not change anything */
};
[ 6.026803] sgtl5000 1-000a: sgtl5000 revision 0x11
[ 6.129380] imx-sgtl5000 sound: snd_soc_register_card failed (-517)
[ 6.248849] platform sound: Driver imx-sgtl5000 requests probe deferral
[ 6.311643] sgtl5000 1-000a: Using internal LDO instead of VDDD
[ 6.393196] imx-sgtl5000 sound: sgtl5000 <-> 2028000.ssi mapping ok
$> arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imx6qvbx3sgtl50 [imx6q-vbx3-sgtl5000], device 0: HiFi sgtl5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
$> arecord -v -V stereo -fdat -D hw:0,0 somefile.wav
Recording WAVE 'somefile.wav' : Signed 16 bit Little Endian, Rate
48000 Hz, Stereo
Hardware PCM card 0 'imx6q-vbx3-sgtl5000' device 0 subdevice 0
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 16384
period_size : 4096
period_time : 85333
tstamp_mode : NONE
period_step : 1
avail_min : 4096
period_event : 0
start_threshold : 1
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
arecord: pcm_read:2031: read error: Input/output error
The clock is not get in
And what can this mean from a driver/mux perspective ?
ssi <--- audmxux ---> pins (configured by pinctrl)

I forget that you see the clock out. BTW too late. What I'm trying to
said is that even if pins are configured and routed they can be routed
in the wrong direction. Right now you try to generate both clock from
the cpu and you can see them but receive path can be configured in
syncronous mode or it can work take the clock from another pin. What
is your configuration?

Michael
Post by Jean-Michel Hautbois
Thanks,
JM
--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO - Founder Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
| [`as] http://www.amarulasolutions.com |
Jean-Michel Hautbois
2014-09-18 14:09:02 UTC
Permalink
Post by Michael Trimarchi
Hi
On Thu, Sep 18, 2014 at 3:45 PM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Post by Michael Trimarchi
Hi
Post by Fabio Estevam
Hi Jean-Michel,
On Thu, Sep 18, 2014 at 9:56 AM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Hi,
Sorry if double posting, I have not received confirmation on
subscription yesterday... So I try again :/.
I have a custom i.MX6 board, and have a sgtl5000 connected on it. I
would like to have it used in master mode (it is used only for audio
capture) but I get a "pcm_read:2031: read error: Input/output error"
when using arecord.
I have checked my signals and I get something on I²S which seems to be good.
$> arecord -f cd -Dhw:0,0 -v -V stereo
Receive Frame Sync is 44.1KHz
Receive Clock Signal is ~1MHz (I can be more precise if needed)
Data Receive is present, only when arecord is launched. It stops when
there is no capture asked.
Both clocks are still present even when no arecord is running.
This suggests, for me, that master mode is working.
So, I don't know why I can't get any data to my arecord. Is this a
left/right justified master mode ? Anything else ?
Yes, can you check if the direction of the mux-port is correct and you
are really get data.
Mmh, can you explain in more details, I don't get it...
ssi is the peripheral that is rooted from the pins outside (audmux) and audmux
should configured according to clock direction and data direction etc. I don't
remember now is done now in the latest kernel, because I have in the
head too much architecture,
but it should be possible to dump it from sysfs how is configured. So
you need to check if it match
OK, I will try to find out everything I can.
Post by Michael Trimarchi
Post by Jean-Michel Hautbois
Post by Michael Trimarchi
Post by Fabio Estevam
I am also trying to test fsl_ssi in master mode.
I am running linux-next 20140912 with the following changes to get SSI
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -532,6 +532,7 @@
};
&ssi2 {
+ fsl,mode = "i2s-master";
status = "okay";
};
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index 3a3d17c..09ea6a5 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -247,7 +247,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
data->dai.platform_of_node = ssi_np;
data->dai.ops = &imx_hifi_ops;
data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
- SND_SOC_DAIFMT_CBM_CFM;
+ SND_SOC_DAIFMT_CBS_CFS;
data->card.dev = &pdev->dev;
ret = snd_soc_of_parse_card_name(&data->card, "model");
,but when I do aplay I do not get any sound.
Post by Jean-Michel Hautbois
I am wondering if I forgot something in my DT or if I need to do
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6q-vbx3-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"LINE_IN", "Line In Jack";
mux-int-port = <1>;
mux-ext-port = <5>;
};
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
status = "okay";
};
&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 201>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&vgen6_reg>;
sysclk = <24000000>;
};
};
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;
imx6qdl-vbx3 {
pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDLPAD_DISP0_DAT13__AUD5_RXFS 0x130b0
MX6QDL_PAD_DISP0_DAT14__AUD5_RXC 0x130b0
MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
;
};
};
&ssi1 {
status = "okay";
codec-handle = <&codec>;
I think this codec-handle is not needed here.
Post by Jean-Michel Hautbois
fsl,mode = "i2s-master";
fsl,ssi-asynchronous; /* Not sure about it, but does not change anything */
};
[ 6.026803] sgtl5000 1-000a: sgtl5000 revision 0x11
[ 6.129380] imx-sgtl5000 sound: snd_soc_register_card failed (-517)
[ 6.248849] platform sound: Driver imx-sgtl5000 requests probe deferral
[ 6.311643] sgtl5000 1-000a: Using internal LDO instead of VDDD
[ 6.393196] imx-sgtl5000 sound: sgtl5000 <-> 2028000.ssi mapping ok
$> arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imx6qvbx3sgtl50 [imx6q-vbx3-sgtl5000], device 0: HiFi sgtl5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
$> arecord -v -V stereo -fdat -D hw:0,0 somefile.wav
Recording WAVE 'somefile.wav' : Signed 16 bit Little Endian, Rate
48000 Hz, Stereo
Hardware PCM card 0 'imx6q-vbx3-sgtl5000' device 0 subdevice 0
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 16384
period_size : 4096
period_time : 85333
tstamp_mode : NONE
period_step : 1
avail_min : 4096
period_event : 0
start_threshold : 1
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
arecord: pcm_read:2031: read error: Input/output error
The clock is not get in
And what can this mean from a driver/mux perspective ?
ssi <--- audmxux ---> pins (configured by pinctrl)
I forget that you see the clock out. BTW too late. What I'm trying to
said is that even if pins are configured and routed they can be routed
in the wrong direction. Right now you try to generate both clock from
the cpu and you can see them but receive path can be configured in
syncronous mode or it can work take the clock from another pin. What
is your configuration?
The master clock is provided by the CPU but I just found out
something. I have a FPGA between sgtl5000 and i.MX6. It is here in
order to route signals. And when imx-audmux is probed, it does not
find the clock, because the FPGA is not configured yet.
And as this driver is not returning EPROBE_DEFER, it does not try a
little bit later (when the clock will really be here).
I don't know if this is the explanation of my issue, but at least this
is an interesting catch.
I will try and get you informed.

JM
Jean-Michel Hautbois
2014-09-18 16:09:50 UTC
Permalink
<snip>
Post by Jean-Michel Hautbois
Post by Michael Trimarchi
I forget that you see the clock out. BTW too late. What I'm trying to
said is that even if pins are configured and routed they can be routed
in the wrong direction. Right now you try to generate both clock from
the cpu and you can see them but receive path can be configured in
syncronous mode or it can work take the clock from another pin. What
is your configuration?
The master clock is provided by the CPU but I just found out
something. I have a FPGA between sgtl5000 and i.MX6. It is here in
order to route signals. And when imx-audmux is probed, it does not
find the clock, because the FPGA is not configured yet.
And as this driver is not returning EPROBE_DEFER, it does not try a
little bit later (when the clock will really be here).
I don't know if this is the explanation of my issue, but at least this
is an interesting catch.
I will try and get you informed.
Well, audmux is not getting clock, this is normal I think, the clock I
was mentionning is the MCLK of SGTL5000 and this one is linked to
FPGA, but found after all.
I now had a further look into sound/soc/fsl/fsl_ssi.c and I see this :

sprop = of_get_property(np, "fsl,mode", NULL);
if (sprop) {
if (!strcmp(sprop, "ac97-slave"))
ssi_private->dai_fmt = SND_SOC_DAIFMT_AC97;
else if (!strcmp(sprop, "i2s-slave"))
ssi_private->dai_fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_CBM_CFM;
}

I may have missed something, but it seems that i2s-master is not
parsed, and does not set dai_fmt ?
Or maybe is it done later ?
I tried :
else if (!strcmp(sprop, "i2s-slave"))
ssi_private->dai_fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_CBM_CFM;
+ else if (!strcmp(sprop, "i2s-master"))
+ ssi_private->dai_fmt = SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_CBM_CFS;
}

But this is not better :


arecord -v -V stereo -f cd -D hw:0,0 somefile.wav
Recording WAVE 'somefile.wav' : Signed 16 bit Little Endian, Rate
44100 Hz, Stereo
Hardware PCM card 0 'imx6q-vbx3-sgtl5000' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 16384
period_size : 4096
period_time : 92879
tstamp_mode : NONE
period_step : 1
avail_min : 4096
period_event : 0
start_threshold : 1
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 1073741824
appl_ptr : 0
hw_ptr : 0
arecord: pcm_read:2031: read error: Input/output error

JM
Nicolin Chen
2014-09-18 17:05:24 UTC
Permalink
Post by Jean-Michel Hautbois
Well, audmux is not getting clock, this is normal I think, the clock I
was mentionning is the MCLK of SGTL5000 and this one is linked to
FPGA, but found after all.
sprop = of_get_property(np, "fsl,mode", NULL);
if (sprop) {
if (!strcmp(sprop, "ac97-slave"))
ssi_private->dai_fmt = SND_SOC_DAIFMT_AC97;
else if (!strcmp(sprop, "i2s-slave"))
ssi_private->dai_fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_CBM_CFM;
}
I may have missed something, but it seems that i2s-master is not
parsed, and does not set dai_fmt ?
Actually this is kind of obsolete property because initially the SSI
driver only supported i2s-slave. We've put an i2s-slave check here is
to limit the driver by excluding other modes.

But now, the driver has the capability to derive clock from CCM and
output it for external CODEC. So this one could be dropped in fact
rather than adding a new i2s-master case IMO.
Post by Jean-Michel Hautbois
arecord -v -V stereo -f cd -D hw:0,0 somefile.wav
Recording WAVE 'somefile.wav' : Signed 16 bit Little Endian, Rate
44100 Hz, Stereo
arecord: pcm_read:2031: read error: Input/output error
The problem here should be the AUDMUX configuration issue. The imx-
sgtl5000.c driver only supports CODEC in master mode. So if you try
to switch the CODEC slave mode, you shall also change not only the
CBM_CFM to CBS_CFS but also swap the ext_port and int_port of AUDMUX
(a little confusing approach here as the configuration of AUDMUX is
routing the data and clocks from a source port to a destination port
while each of side, external or internal, might be a source port --
When using CBM_CFM, the source port should be external port; while
using CBS_CFS, the source port should be the internal port.)

There may be another topic, however, actually the fsl-asoc-card
driver does handle the master/slave mode supports. So if you are
trying to add the CODEC slave mode support into imx-sgtl5000. I
suggest you to try the fsl-asoc-card instead. Its DT binding's
totally compatible with imx-sgtl5000's. What you need to do is
just enable it (and disable imx-sgtl500) in the menuconfig or
add these enable/disable into imx_v6_v7_defconfig.

Nicolin
Michael Trimarchi
2014-09-18 17:26:11 UTC
Permalink
Hi
Post by Nicolin Chen
Post by Jean-Michel Hautbois
Well, audmux is not getting clock, this is normal I think, the clock I
was mentionning is the MCLK of SGTL5000 and this one is linked to
FPGA, but found after all.
sprop = of_get_property(np, "fsl,mode", NULL);
if (sprop) {
if (!strcmp(sprop, "ac97-slave"))
ssi_private->dai_fmt = SND_SOC_DAIFMT_AC97;
else if (!strcmp(sprop, "i2s-slave"))
ssi_private->dai_fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_CBM_CFM;
}
I may have missed something, but it seems that i2s-master is not
parsed, and does not set dai_fmt ?
Actually this is kind of obsolete property because initially the SSI
driver only supported i2s-slave. We've put an i2s-slave check here is
to limit the driver by excluding other modes.
But now, the driver has the capability to derive clock from CCM and
output it for external CODEC. So this one could be dropped in fact
rather than adding a new i2s-master case IMO.
Post by Jean-Michel Hautbois
arecord -v -V stereo -f cd -D hw:0,0 somefile.wav
Recording WAVE 'somefile.wav' : Signed 16 bit Little Endian, Rate
44100 Hz, Stereo
arecord: pcm_read:2031: read error: Input/output error
The problem here should be the AUDMUX configuration issue. The imx-
sgtl5000.c driver only supports CODEC in master mode. So if you try
to switch the CODEC slave mode, you shall also change not only the
CBM_CFM to CBS_CFS but also swap the ext_port and int_port of AUDMUX
(a little confusing approach here as the configuration of AUDMUX is
routing the data and clocks from a source port to a destination port
while each of side, external or internal, might be a source port --
When using CBM_CFM, the source port should be external port; while
using CBS_CFS, the source port should be the internal port.)
There may be another topic, however, actually the fsl-asoc-card
driver does handle the master/slave mode supports. So if you are
trying to add the CODEC slave mode support into imx-sgtl5000. I
suggest you to try the fsl-asoc-card instead. Its DT binding's
totally compatible with imx-sgtl5000's. What you need to do is
just enable it (and disable imx-sgtl500) in the menuconfig or
add these enable/disable into imx_v6_v7_defconfig.
bug was reported by Jean-Michel. I don't know if it works because I can not
test but seems ok. Do we need this _set_dai_fmt in probe function?

code is a bit broken just because panic on probe path if pdev is null
[...]
/*
* If codec-handle property is missing from SSI node, we assume
* that the machine driver uses new binding which does not require
* SSI driver to trigger machine driver's probe.
*/
if (!of_get_property(np, "codec-handle", NULL))
goto done;
[...]
ssi_private->pdev =
platform_device_register_data(&pdev->dev, name, 0, NULL, 0);
[...]
done:
if (ssi_private->dai_fmt)
_fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);


diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 87eb577..f63bc02 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -758,7 +758,8 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
ssi_private->dai_fmt = fmt;

if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
- dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n");
+ pr_err("baudclk is missing which is necessary"
+ " for master mode\n");
return -EINVAL;
}


Michael
Post by Nicolin Chen
Nicolin
Nicolin Chen
2014-09-18 17:45:27 UTC
Permalink
Post by Michael Trimarchi
bug was reported by Jean-Michel. I don't know if it works because I can not
test but seems ok. Do we need this _set_dai_fmt in probe function?
I think yes. The AC97 part might need this _set_dai_fmt call in the
probe().
Post by Michael Trimarchi
code is a bit broken just because panic on probe path if pdev is null
[...]
/*
* If codec-handle property is missing from SSI node, we assume
* that the machine driver uses new binding which does not require
* SSI driver to trigger machine driver's probe.
*/
if (!of_get_property(np, "codec-handle", NULL))
goto done;
[...]
ssi_private->pdev =
platform_device_register_data(&pdev->dev, name, 0, NULL, 0);
[...]
if (ssi_private->dai_fmt)
_fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 87eb577..f63bc02 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -758,7 +758,8 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
ssi_private->dai_fmt = fmt;
if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
- dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n");
+ pr_err("baudclk is missing which is necessary"
+ " for master mode\n");
Ah, this is a problem. We should not use ssi_private->pdev->dev here.
I think it'll be better if adding a new parameter of *dev pointer to
this _set_dai_fmt() -- passing pdev->dev in probe() and cpu_dai->dev
in fsl_ssi_set_dai_fmt().

Nicolin
Michael Trimarchi
2014-09-18 18:03:31 UTC
Permalink
Hi
Post by Nicolin Chen
Post by Michael Trimarchi
bug was reported by Jean-Michel. I don't know if it works because I can not
test but seems ok. Do we need this _set_dai_fmt in probe function?
I think yes. The AC97 part might need this _set_dai_fmt call in the
probe().
Post by Michael Trimarchi
code is a bit broken just because panic on probe path if pdev is null
[...]
/*
* If codec-handle property is missing from SSI node, we assume
* that the machine driver uses new binding which does not require
* SSI driver to trigger machine driver's probe.
*/
if (!of_get_property(np, "codec-handle", NULL))
goto done;
[...]
ssi_private->pdev =
platform_device_register_data(&pdev->dev, name, 0, NULL, 0);
[...]
if (ssi_private->dai_fmt)
_fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 87eb577..f63bc02 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -758,7 +758,8 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
ssi_private->dai_fmt = fmt;
if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
- dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n");
+ pr_err("baudclk is missing which is necessary"
+ " for master mode\n");
Ah, this is a problem. We should not use ssi_private->pdev->dev here.
I think it'll be better if adding a new parameter of *dev pointer to
this _set_dai_fmt() -- passing pdev->dev in probe() and cpu_dai->dev
in fsl_ssi_set_dai_fmt().
Somenthing like this?

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 87eb577..de6ab06 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
return 0;
}

-static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
- unsigned int fmt)
+static int _fsl_ssi_set_dai_fmt(struct device *dev,
+ struct fsl_ssi_private *ssi_private,
+ unsigned int fmt)
{
struct regmap *regs = ssi_private->regs;
u32 strcr = 0, stcr, srcr, scr, mask;
@@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
ssi_private->dai_fmt = fmt;

if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
- dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n");
+ dev_err(dev, "baudclk is missing which is necessary for master mode\n");
return -EINVAL;
}

@@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
{
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);

- return _fsl_ssi_set_dai_fmt(ssi_private, fmt);
+ return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt);
}

/**
@@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)

done:
if (ssi_private->dai_fmt)
- _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
+ _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private,
+ ssi_private->dai_fmt);

return 0;
Post by Nicolin Chen
Nicolin
--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO - Founder Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
| [`as] http://www.amarulasolutions.com |
Nicolin Chen
2014-09-18 18:13:38 UTC
Permalink
Post by Michael Trimarchi
Post by Nicolin Chen
Ah, this is a problem. We should not use ssi_private->pdev->dev here.
I think it'll be better if adding a new parameter of *dev pointer to
this _set_dai_fmt() -- passing pdev->dev in probe() and cpu_dai->dev
in fsl_ssi_set_dai_fmt().
Somenthing like this?
Yes, would you like to send a separate patch? I think other people
and maintainers'd like to take a look at it and decide if it's a
good shoot. I'll also take a further look at it after I finish my
laundry :)

Thank you
Nicolin
Post by Michael Trimarchi
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 87eb577..de6ab06 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
return 0;
}
-static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
- unsigned int fmt)
+static int _fsl_ssi_set_dai_fmt(struct device *dev,
+ struct fsl_ssi_private *ssi_private,
+ unsigned int fmt)
{
struct regmap *regs = ssi_private->regs;
u32 strcr = 0, stcr, srcr, scr, mask;
@@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
ssi_private->dai_fmt = fmt;
if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
- dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n");
+ dev_err(dev, "baudclk is missing which is necessary for master mode\n");
return -EINVAL;
}
@@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
{
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
- return _fsl_ssi_set_dai_fmt(ssi_private, fmt);
+ return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt);
}
/**
@@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
if (ssi_private->dai_fmt)
- _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
+ _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private,
+ ssi_private->dai_fmt);
return 0;
Post by Nicolin Chen
Nicolin
--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO - Founder Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
| [`as] http://www.amarulasolutions.com |
Michael Trimarchi
2014-09-18 18:18:23 UTC
Permalink
Hi Fabio
Post by Nicolin Chen
Post by Michael Trimarchi
Post by Nicolin Chen
Ah, this is a problem. We should not use ssi_private->pdev->dev here.
I think it'll be better if adding a new parameter of *dev pointer to
this _set_dai_fmt() -- passing pdev->dev in probe() and cpu_dai->dev
in fsl_ssi_set_dai_fmt().
Somenthing like this?
Yes, would you like to send a separate patch? I think other people
and maintainers'd like to take a look at it and decide if it's a
good shoot. I'll also take a further look at it after I finish my
laundry :)
Yes sure

Michael
Post by Nicolin Chen
Thank you
Nicolin
Post by Michael Trimarchi
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 87eb577..de6ab06 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
return 0;
}
-static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
- unsigned int fmt)
+static int _fsl_ssi_set_dai_fmt(struct device *dev,
+ struct fsl_ssi_private *ssi_private,
+ unsigned int fmt)
{
struct regmap *regs = ssi_private->regs;
u32 strcr = 0, stcr, srcr, scr, mask;
@@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
ssi_private->dai_fmt = fmt;
if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
- dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n");
+ dev_err(dev, "baudclk is missing which is necessary for master mode\n");
return -EINVAL;
}
@@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
{
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
- return _fsl_ssi_set_dai_fmt(ssi_private, fmt);
+ return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt);
}
/**
@@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
if (ssi_private->dai_fmt)
- _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
+ _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private,
+ ssi_private->dai_fmt);
return 0;
Post by Nicolin Chen
Nicolin
--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO - Founder Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
| [`as] http://www.amarulasolutions.com |
--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO - Founder Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
| [`as] http://www.amarulasolutions.com |
Fabio Estevam
2014-09-18 17:28:29 UTC
Permalink
Hi Nicolin,
Post by Nicolin Chen
The problem here should be the AUDMUX configuration issue. The imx-
sgtl5000.c driver only supports CODEC in master mode. So if you try
to switch the CODEC slave mode, you shall also change not only the
CBM_CFM to CBS_CFS but also swap the ext_port and int_port of AUDMUX
(a little confusing approach here as the configuration of AUDMUX is
routing the data and clocks from a source port to a destination port
while each of side, external or internal, might be a source port --
When using CBM_CFM, the source port should be external port; while
using CBS_CFS, the source port should be the internal port.)
Thanks for the hint on audmux swap! I can get ssi in master mode to
work correctly with the change below:


--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -111,8 +111,8 @@
"IN3R", "MICBIAS",
"DMIC", "MICBIAS",
"DMICDAT", "DMIC";
- mux-int-port = <2>;
- mux-ext-port = <3>;
+ mux-int-port = <3>;
+ mux-ext-port = <2>;
};

backlight {
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
index 3a3d17c..09ea6a5 100644
--- a/sound/soc/fsl/imx-wm8962.c
+++ b/sound/soc/fsl/imx-wm8962.c
@@ -247,7 +247,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
data->dai.platform_of_node = ssi_np;
data->dai.ops = &imx_hifi_ops;
data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
- SND_SOC_DAIFMT_CBM_CFM;
+ SND_SOC_DAIFMT_CBS_CFS;

data->card.dev = &pdev->dev;
ret = snd_soc_of_parse_card_name(&data->card, "model");
Nicolin Chen
2014-09-18 17:49:37 UTC
Permalink
Hi Fabio,
Post by Fabio Estevam
Thanks for the hint on audmux swap! I can get ssi in master mode to
- mux-int-port = <2>;
- mux-ext-port = <3>;
+ mux-int-port = <3>;
+ mux-ext-port = <2>;
Actually this looks a bit tricky as the internal and external ports
are not physically swapped :)

So that's why I put the swapping code in the fsl-asoc-card based on
CBx_CFx configurations.

Thanks
Nicolin
Fabio Estevam
2014-09-18 17:58:06 UTC
Permalink
Hi Nicolin,
Post by Nicolin Chen
Hi Fabio,
Post by Fabio Estevam
Thanks for the hint on audmux swap! I can get ssi in master mode to
- mux-int-port = <2>;
- mux-ext-port = <3>;
+ mux-int-port = <3>;
+ mux-ext-port = <2>;
Actually this looks a bit tricky as the internal and external ports
are not physically swapped :)
Yes, this change is just for my own testing/debugging.
Post by Nicolin Chen
So that's why I put the swapping code in the fsl-asoc-card based on
CBx_CFx configurations.
Correct, fsl-asoc-card is a nice approach. Good job!
Nicolin Chen
2014-09-18 18:07:43 UTC
Permalink
Post by Fabio Estevam
Post by Nicolin Chen
So that's why I put the swapping code in the fsl-asoc-card based on
CBx_CFx configurations.
Correct, fsl-asoc-card is a nice approach. Good job!
I plan to replace imx-sgtl5000 and imx-wm8962 with it as long as
people are happy about the new driver. Would you like to help me
testing it on sgtl5000 side when you have time? Because I only
have a board with WM8962.

Thank you
Nicolin
Fabio Estevam
2014-09-18 18:14:08 UTC
Permalink
Post by Nicolin Chen
Post by Fabio Estevam
Post by Nicolin Chen
So that's why I put the swapping code in the fsl-asoc-card based on
CBx_CFx configurations.
Correct, fsl-asoc-card is a nice approach. Good job!
I plan to replace imx-sgtl5000 and imx-wm8962 with it as long as
people are happy about the new driver. Would you like to help me
testing it on sgtl5000 side when you have time? Because I only
have a board with WM8962.
Yes, I can test it on a imx53-qsb, which has sgtl5000. Just Cc me when
you have the patch available.

Regards,

Fabio Estevam
Nicolin Chen
2014-09-18 18:39:11 UTC
Permalink
Post by Fabio Estevam
Post by Nicolin Chen
Post by Fabio Estevam
Post by Nicolin Chen
So that's why I put the swapping code in the fsl-asoc-card based on
CBx_CFx configurations.
Correct, fsl-asoc-card is a nice approach. Good job!
I plan to replace imx-sgtl5000 and imx-wm8962 with it as long as
people are happy about the new driver. Would you like to help me
testing it on sgtl5000 side when you have time? Because I only
have a board with WM8962.
Yes, I can test it on a imx53-qsb, which has sgtl5000. Just Cc me when
you have the patch available.
It actually is merged into broonie/for-next and even linux-next I think.
I'll later send a patch to Shawn's tree for imx_v6_v7_defconfig changes
after next merge window's done.

Thank you
Nicolin
Fabio Estevam
2014-09-18 23:35:31 UTC
Permalink
Post by Nicolin Chen
It actually is merged into broonie/for-next and even linux-next I think.
I'll later send a patch to Shawn's tree for imx_v6_v7_defconfig changes
after next merge window's done.
Ok, I see it now, but master/slave configuration is still hardcoded there:

} else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) {
priv->codec_priv.mclk_id = SGTL5000_SYSCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
Nicolin Chen
2014-09-18 23:50:46 UTC
Permalink
Post by Fabio Estevam
Post by Nicolin Chen
It actually is merged into broonie/for-next and even linux-next I think.
I'll later send a patch to Shawn's tree for imx_v6_v7_defconfig changes
after next merge window's done.
} else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) {
priv->codec_priv.mclk_id = SGTL5000_SYSCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
It's just a combinational driver and also made to be compatible with
old DTs. Unless we refine the DT binding like simple-card, this hard-
code is inevitable. As long as this dai_fmt has been defined, at least
AUDMUX part will be automatically configured.

I made this driver was initially to support ASRC for imx-cs42888. But
merging the code from imx-sgtl5000 and imx-wm8962 allows us to omit
a branch of duplicated code. And that's it :)

Nicolin
Jean-Michel Hautbois
2014-09-19 07:42:22 UTC
Permalink
Hi,
Post by Nicolin Chen
Post by Fabio Estevam
Post by Nicolin Chen
It actually is merged into broonie/for-next and even linux-next I think.
I'll later send a patch to Shawn's tree for imx_v6_v7_defconfig changes
after next merge window's done.
} else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) {
priv->codec_priv.mclk_id = SGTL5000_SYSCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
It's just a combinational driver and also made to be compatible with
old DTs. Unless we refine the DT binding like simple-card, this hard-
code is inevitable. As long as this dai_fmt has been defined, at least
AUDMUX part will be automatically configured.
I made this driver was initially to support ASRC for imx-cs42888. But
merging the code from imx-sgtl5000 and imx-wm8962 allows us to omit
a branch of duplicated code. And that's it :)
Well, I may have missed something, I don't have fsl-asoc-card in my
linux tree (vanilla). Where can I find it ? I can test a SGTL5000
master mode on i.MX6Q.

Thanks,
JM
Nicolin Chen
2014-09-19 07:52:28 UTC
Permalink
Post by Jean-Michel Hautbois
Hi,
Post by Nicolin Chen
Post by Fabio Estevam
Post by Nicolin Chen
It actually is merged into broonie/for-next and even linux-next I think.
I'll later send a patch to Shawn's tree for imx_v6_v7_defconfig changes
after next merge window's done.
} else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) {
priv->codec_priv.mclk_id = SGTL5000_SYSCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
It's just a combinational driver and also made to be compatible with
old DTs. Unless we refine the DT binding like simple-card, this hard-
code is inevitable. As long as this dai_fmt has been defined, at least
AUDMUX part will be automatically configured.
I made this driver was initially to support ASRC for imx-cs42888. But
merging the code from imx-sgtl5000 and imx-wm8962 allows us to omit
a branch of duplicated code. And that's it :)
Well, I may have missed something, I don't have fsl-asoc-card in my
linux tree (vanilla). Where can I find it ? I can test a SGTL5000
master mode on i.MX6Q.
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

for-next branch.

Nicolin
Jean-Michel Hautbois
2014-09-19 09:18:40 UTC
Permalink
Post by Nicolin Chen
Post by Jean-Michel Hautbois
Hi,
Post by Nicolin Chen
Post by Fabio Estevam
Post by Nicolin Chen
It actually is merged into broonie/for-next and even linux-next I think.
I'll later send a patch to Shawn's tree for imx_v6_v7_defconfig changes
after next merge window's done.
} else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) {
priv->codec_priv.mclk_id = SGTL5000_SYSCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
It's just a combinational driver and also made to be compatible with
old DTs. Unless we refine the DT binding like simple-card, this hard-
code is inevitable. As long as this dai_fmt has been defined, at least
AUDMUX part will be automatically configured.
I made this driver was initially to support ASRC for imx-cs42888. But
merging the code from imx-sgtl5000 and imx-wm8962 allows us to omit
a branch of duplicated code. And that's it :)
Well, I may have missed something, I don't have fsl-asoc-card in my
linux tree (vanilla). Where can I find it ? I can test a SGTL5000
master mode on i.MX6Q.
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
for-next branch.
Nicolin
Thanks, now I need to modify my DT in order to have fsl-asoc-card loaded :).
JM
Jean-Michel Hautbois
2014-09-19 12:53:41 UTC
Permalink
Hi,

2014-09-19 11:18 GMT+02:00 Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Post by Nicolin Chen
Post by Jean-Michel Hautbois
Hi,
Post by Nicolin Chen
Post by Fabio Estevam
Post by Nicolin Chen
It actually is merged into broonie/for-next and even linux-next I think.
I'll later send a patch to Shawn's tree for imx_v6_v7_defconfig changes
after next merge window's done.
} else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) {
priv->codec_priv.mclk_id = SGTL5000_SYSCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
It's just a combinational driver and also made to be compatible with
old DTs. Unless we refine the DT binding like simple-card, this hard-
code is inevitable. As long as this dai_fmt has been defined, at least
AUDMUX part will be automatically configured.
I made this driver was initially to support ASRC for imx-cs42888. But
merging the code from imx-sgtl5000 and imx-wm8962 allows us to omit
a branch of duplicated code. And that's it :)
Well, I may have missed something, I don't have fsl-asoc-card in my
linux tree (vanilla). Where can I find it ? I can test a SGTL5000
master mode on i.MX6Q.
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
for-next branch.
Nicolin
Thanks, now I need to modify my DT in order to have fsl-asoc-card loaded :).
JM
FYI, This is working !
I can capture my sound from line in with this :
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6q-vbx3-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"A1N1L", "Line In Jack",
"A1N1R", "Line In Jack";
mux-int-port = <1>;
mux-ext-port = <5>;
};

Now, I will add mic support, and I still need to modprobe manually, I
need to know why...

Thanks,
JM
Jean-Michel Hautbois
2014-10-09 14:02:07 UTC
Permalink
Hi

I use fsl-asoc-card now.

This is working when compiling as a module, and when doing a modprobe
manually, but when I compile it as built-in, with these :
CONFIG_SND_SOC_IMX_SGTL5000 is not set
CONFIG_SND_SOC_FSL_ASOC_CARD=y
CONFIG_SND_SOC_SGTL5000=y

I get the following error :
[ 13.561618] fsl-asoc-card sound: ASoC: CODEC DAI sgtl5000 not registered
[ 13.568503] fsl-asoc-card sound: snd_soc_register_card failed (-517)
[ 13.574992] platform sound: Driver fsl-asoc-card requests probe deferral

It loops on it during boot, and never registers...

If I have :
CONFIG_SND_SOC_IMX_SGTL5000 is not set
CONFIG_SND_SOC_FSL_ASOC_CARD=m
CONFIG_SND_SOC_SGTL5000=m

And after login :
$> lsmod
Module Size Used by
snd_soc_sgtl5000 14074 0
$> modprobe snd-soc-fsl-asoc-card
[ 65.300995] fsl-asoc-card sound: ASoC: CODEC DAI sgtl5000 not registered
[ 65.307963] fsl-asoc-card sound: snd_soc_register_card failed (-517)
[ 65.314423] platform sound: Driver fsl-asoc-card requests probe deferral
$> rmmod snd-soc-sgtl5000
$> modprobe snd-soc-sgtl5000
[ 138.936753] sgtl5000 1-000a: sgtl5000 revision 0x11
[ 138.987974] 1-000a: 1200 mV normal
[ 139.000923] sgtl5000 1-000a: Using internal LDO instead of VDDD
[ 139.032169] fsl-asoc-card sound: sgtl5000 <-> 2028000.ssi mapping ok
[ 139.038624] fsl-asoc-card sound: ASoC: no source widget found for
ASRC-Playback
[ 139.045984] fsl-asoc-card sound: ASoC: Failed to add route
ASRC-Playback -> direct -> CPU-Playback
[ 139.055187] fsl-asoc-card sound: ASoC: no sink widget found for ASRC-Capture
[ 139.062253] fsl-asoc-card sound: ASoC: Failed to add route
CPU-Capture -> direct -> ASRC-Capture

The routes are not ok, but I think I read something about it another
thread, but it works.
It seems that if snd-soc-sgtl5000 is already registered then it does
not work. It is probably due to my DT ?

Here is an extract of the DT :
/ {
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
model = "imx6q-vbx3-sgtl5000";
ssi-controller = <&ssi1>;
audio-codec = <&codec>;
audio-routing =
"MIC_IN", "Mic Jack",
"Mic Jack", "Mic Bias",
"A1N1L", "Line In Jack",
"A1N1R", "Line In Jack";
mux-int-port = <1>;
mux-ext-port = <5>;
};
};

&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";

codec: ***@0a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 201>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&vgen6_reg>;
sysclk = <24000000>;
};
};

Thanks,
JM
Fabio Estevam
2014-10-09 14:18:19 UTC
Permalink
On Thu, Oct 9, 2014 at 11:02 AM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
/ {
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
I am confused here: you say you use the simple-card, but your DTS
still shows imx-audio-sgtl5000.

arch/arm/boot/dts/vf610-twr.dts shows an example of the usage of
simple card with sgtl5000.
Post by Jean-Michel Hautbois
&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 201>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&vgen6_reg>;
sysclk = <24000000>;
This 'sysclk' property is unneeded.
Jean-Michel Hautbois
2014-10-09 14:26:49 UTC
Permalink
Post by Fabio Estevam
On Thu, Oct 9, 2014 at 11:02 AM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
/ {
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
I am confused here: you say you use the simple-card, but your DTS
still shows imx-audio-sgtl5000.
I mentioned fsl-asoc-card, not simple card ?
Post by Fabio Estevam
arch/arm/boot/dts/vf610-twr.dts shows an example of the usage of
simple card with sgtl5000.
Post by Jean-Michel Hautbois
&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
compatible = "fsl,sgtl5000";
reg = <0x0a>;
clocks = <&clks 201>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&vgen6_reg>;
sysclk = <24000000>;
This 'sysclk' property is unneeded.
Right, I removed it thanks.
JM
Fabio Estevam
2014-10-09 15:06:25 UTC
Permalink
On Thu, Oct 9, 2014 at 11:26 AM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Post by Fabio Estevam
On Thu, Oct 9, 2014 at 11:02 AM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
/ {
sound {
compatible = "fsl,imx6q-vbx3-sgtl5000",
"fsl,imx-audio-sgtl5000";
I am confused here: you say you use the simple-card, but your DTS
still shows imx-audio-sgtl5000.
I mentioned fsl-asoc-card, not simple card ?
Yes, right, but for using fsl-asoc-card you should reference
'audio-cpu' instead of 'ssi-controller'.

That's what Documentation/devicetree/bindings/sound/fsl-asoc-card.txt mentions.
Jean-Michel Hautbois
2014-10-09 15:14:24 UTC
Permalink
This post might be inappropriate. Click to display it.
Fabio Estevam
2014-10-09 15:19:23 UTC
Permalink
On Thu, Oct 9, 2014 at 12:14 PM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Ouch, nice catch :).
Here is what I understand, in my cas, sgtl5000 has its clock routed
through a FPGA.
[ 4.985762] sgtl5000: probe of 1-000a failed with error -5
This is why after removing it and probing it again manually, it works.
This module should be able to defer probing too, is it going to be
done by someone or do I try to send some patch for this ?
We do defer probing already:

sgtl5000->mclk = devm_clk_get(&client->dev, NULL);
if (IS_ERR(sgtl5000->mclk)) {
ret = PTR_ERR(sgtl5000->mclk);
dev_err(&client->dev, "Failed to get mclock: %d\n", ret);
/* Defer the probe to see if the clk will be provided later */
if (ret == -ENOENT)
return -EPROBE_DEFER;
return ret;
}
Post by Jean-Michel Hautbois
BTW, I don't have sound on the microphone input, and I think there is
no way to select micbias voltage level neither from the source code
nor the DT ?
It could be interetsing to have something like sgtl5000-micbias-vg
which would give control on the voltage bias parameter ?
And maybe also something for bias resistor too ?
I can try to patch something.
That would be great, thanks.
Jean-Michel Hautbois
2014-10-10 15:49:28 UTC
Permalink
Post by Fabio Estevam
On Thu, Oct 9, 2014 at 12:14 PM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Ouch, nice catch :).
Here is what I understand, in my cas, sgtl5000 has its clock routed
through a FPGA.
[ 4.985762] sgtl5000: probe of 1-000a failed with error -5
This is why after removing it and probing it again manually, it works.
This module should be able to defer probing too, is it going to be
done by someone or do I try to send some patch for this ?
sgtl5000->mclk = devm_clk_get(&client->dev, NULL);
if (IS_ERR(sgtl5000->mclk)) {
ret = PTR_ERR(sgtl5000->mclk);
dev_err(&client->dev, "Failed to get mclock: %d\n", ret);
/* Defer the probe to see if the clk will be provided later */
if (ret == -ENOENT)
return -EPROBE_DEFER;
return ret;
}
Yes, sorry about that, missed it.
Post by Fabio Estevam
Post by Jean-Michel Hautbois
BTW, I don't have sound on the microphone input, and I think there is
no way to select micbias voltage level neither from the source code
nor the DT ?
It could be interetsing to have something like sgtl5000-micbias-vg
which would give control on the voltage bias parameter ?
And maybe also something for bias resistor too ?
I can try to patch something.
That would be great, thanks.
Do I need to keep actual defaults if the resistor or voltage are not
specified in DT ?
Or should I set it to off (which is probably more logical) ?
And one or two patches (one resistor and one voltage patch, or both in
the same) ?

JM
Fabio Estevam
2014-10-10 15:54:35 UTC
Permalink
On Fri, Oct 10, 2014 at 12:49 PM, Jean-Michel Hautbois
Post by Jean-Michel Hautbois
Do I need to keep actual defaults if the resistor or voltage are not
specified in DT ?
Better to keep the behaviour unchanged, so that old dtb's can work
exactly in the same way.
Post by Jean-Michel Hautbois
Or should I set it to off (which is probably more logical) ?
And one or two patches (one resistor and one voltage patch, or both in
the same) ?
Splitting in 2 patches is easier for reviewing.

Fabio Estevam
2014-09-22 03:26:21 UTC
Permalink
Post by Nicolin Chen
I plan to replace imx-sgtl5000 and imx-wm8962 with it as long as
people are happy about the new driver. Would you like to help me
testing it on sgtl5000 side when you have time? Because I only
have a board with WM8962.
Just tested fsl-asoc-card with sgtl5000 and it worked fine on my imx53-qsb.

These messages are a bit annoying though:

[ 1.786201] fsl-asoc-card sound: ASoC: no source widget found for
ASRC-Playback
[ 1.796065] fsl-asoc-card sound: ASoC: Failed to add route
ASRC-Playback -> direct -> CPU-Playback
[ 1.807571] fsl-asoc-card sound: ASoC: no sink widget found for ASRC-Capture
[ 1.817112] fsl-asoc-card sound: ASoC: Failed to add route
CPU-Capture -> direct -> ASRC-Capture
Nicolin Chen
2014-09-22 03:41:44 UTC
Permalink
Post by Fabio Estevam
Post by Nicolin Chen
I plan to replace imx-sgtl5000 and imx-wm8962 with it as long as
people are happy about the new driver. Would you like to help me
testing it on sgtl5000 side when you have time? Because I only
have a board with WM8962.
Just tested fsl-asoc-card with sgtl5000 and it worked fine on my imx53-qsb.
Thank you! Then I think we can enable it from the next release version.
Post by Fabio Estevam
[ 1.786201] fsl-asoc-card sound: ASoC: no source widget found for
ASRC-Playback
[ 1.796065] fsl-asoc-card sound: ASoC: Failed to add route
ASRC-Playback -> direct -> CPU-Playback
[ 1.807571] fsl-asoc-card sound: ASoC: no sink widget found for ASRC-Capture
[ 1.817112] fsl-asoc-card sound: ASoC: Failed to add route
CPU-Capture -> direct -> ASRC-Capture
I'll try to find a way to circumvent the ASRC route for non-ASRC links.

Thanks,
Nicolin
Nicolin Chen
2014-09-18 17:19:38 UTC
Permalink
Post by Jean-Michel Hautbois
&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;
imx6qdl-vbx3 {
pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDLPAD_DISP0_DAT13__AUD5_RXFS 0x130b0
MX6QDL_PAD_DISP0_DAT14__AUD5_RXC 0x130b0
MX6QDL_PAD_DISP0_DAT19__AUD5_RXD 0x130b0
The other issue over here is you are using asynchronous mode of SSI,
while imx-sgtl5000 is using synchronous configurations for AUDMUX.

You can try it with fsl-asoc-card because it uses asynchronous mode
of AUDMUX, although I've not tested it with SSI in its asynchronous
mode as I only have a synchronous (SSI) environment.
Post by Jean-Michel Hautbois
&ssi1 {
status = "okay";
codec-handle = <&codec>;
fsl,mode = "i2s-master";
fsl,ssi-asynchronous; /* Not sure about it, but does not change anything */
The driver cares about it. If you look at the symmetric part carefully,
you would find some register configurations of SSI does depends on the
this property via symmetric check. For example:

if (ssi_private->cpu_dai_drv.symmetric_rates) {
/* Need to clear RXDIR when using SYNC mode */
srcr &= ~CCSR_SSI_SRCR_RXDIR;
scr |= CCSR_SSI_SCR_SYN;
}

Nicolin
Loading...