This is my ALSA device list
[ 3.300576] ALSA device list:
[ 3.302256] #0: imx-audio-sgtl5000
[ 3.304585] #1: imx-spdif
[ 3.306082] #2: imx-hdmi-soc
I use gstreamer command to play wav file to spdif
"gst-launch playbin2 uri=file:////test.wav audio-sink="alsasink device=plughw:1"
but it will be stuck, and I can't hear sound from spdif.
If I use "aplay -D plughw:1,0 test.wav", it returns "aplay: pcm_write:1947: write error: Input/output error"
Can you help me to solve this issue?
Thank you.
I had nearly the same error with the SGTL5000 connected to SSI. It was just that the SDMA script binary blob 'sdma-imx6q.bin' was not loaded correctly by the SDMA driver. Hence, only the ROM scripts were used. After fixing that the error has gone.
hi, liqiang . I have the same problem. L3.14.52 sgtl5000
root@imx6qdlsolo:~# aplay -D hw:0,0 /usr/share/sounds/alsa/Front_Left.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: pcm_write:1947: write error: Input/output error
root@imx6qdlsolo:~# cat /proc/asound/cards
0 [imx6qsgtl5000 ]: imx6q-sgtl5000 - imx6q-sgtl5000
imx6q-sgtl5000
1 [imxspdif ]: imx-spdif - imx-spdif
imx-spdif
2 [imxhdmisoc ]: imx-hdmi-soc - imx-hdmi-soc
imx-hdmi-soc
I can found the sgtl5000 , but i can not aplay .
Dear Huang:
i have the same issue,what should i do
root@imx6qsabresd:~# cat /proc/asound/cards
0 [sgtl5000audio ]: sgtl5000-audio - sgtl5000-audio
sgtl5000-audio
1 [imxspdif ]: imx-spdif - imx-spdif
imx-spdif
root@imx6qsabresd:~# aplay -D hw:1,0 /unit_tests/audio8k16S.wav
Playing WAVE '/unit_tests/audio8k16S.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
Warning: rate is not accurate (requested = 8000Hz, got = 32000Hz)
please, try the plug plugin
aplay: pcm_write:1947: write error: Input/output error
decided to look at how to set up access to the spdif-out on other board (hummingboard, cubox-i) and found caption
/* IMX6 doesn't implement this yet */
what that means? IMX6 does not support audio output from spdif-out?
sound-spdif { compatible = "fsl,imx-audio-spdif"; model = "imx-spdif"; /* IMX6 doesn't implement this yet */ spdif-controller = <&spdif>; spdif-out; };
Another change for SPDIF clock is needed:
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 047aecc..81bfc27 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -236,7 +236,7 @@
clocks = <&clks IMX6QDL_CLK_SPDIF_GCLK>, <&clks IMX6QDL_CLK_OSC>,
<&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_ASRC>,
<&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_ESAI_EXTAL>,
- <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_MLB>,
+ <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_DUMMY>,
<&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_SPBA>;
clock-names = "core", "rxtx0",
"rxtx1", "rxtx2",
Hi, as you say, i change <&clks IMX6QDL_CLK_MLB> to <&clks IMX6QDL_CLK_DUMMY>, the spdif can work well.
But, Can you explain the reason ? why IMX6QDL_CLK_MLB not ok ?
this is my
spdif: spdif@02004000 {
compatible = "fsl,imx35-spdif";
reg = <0x02004000 0x4000>;
interrupts = <0 52 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&sdma 14 18 0>,
<&sdma 15 18 0>;
dma-names = "rx", "tx";
clocks = <&clks IMX6QDL_CLK_SPDIF_GCLK>, <&clks IMX6QDL_CLK_OSC>,
<&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_ASRC>,
<&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_ESAI_EXTAL>,
<&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_MLB>,
<&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_SPBA>;
clock-names = "core", "rxtx0",
"rxtx1", "rxtx2",
"rxtx3", "rxtx4",
"rxtx5", "rxtx6",
"rxtx7", "dma";
status = "okay";
};
it doesn't solve problem
Change "<&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_MLB>,"
To "<&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_DUMMY>,"
great! problem solved
have same problem after setup spdif out
root@imx6qsabreauto:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: cs42888audio [cs42888-audio], device 0: HiFi cs42888-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: cs42888audio [cs42888-audio], device 1: HiFi-ASRC-FE (*) []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: imxhdmisoc [imx-hdmi-soc], device 0: i.MX HDMI Audio Tx hdmi-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
when trying play file through spdif get error
root@imx6qsabreauto:~# aplay -D hw:1,0 /home/root/media/test.wav
Playing WAVE '/home/root/media/test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: pcm_write:1940: write error: Input/output error
root@imx6qsabreauto:~# uname -a
Linux imx6qsabreauto 4.1.26-fslc+g960f493 #1 SMP PREEMPT Wed Aug 24 14:21:51 MSK 2016 armv7l armv7l armv7l GNU/Linux
The SPIDF supported TX sample rate has no 8KHz, maybe you can try with other sample rate.
/* SPDIF tx rate */
enum spdif_txrate {
SPDIF_TXRATE_32000 = 0,
SPDIF_TXRATE_44100,
SPDIF_TXRATE_48000,
SPDIF_TXRATE_96000,
SPDIF_TXRATE_192000,
};
Charles,
Did you ever fix this? I am having the same issue with my SGTL5000 CODEC. I noticed you also used this CODEC and assumed it is working for you.
Here is my ALSA device list:
ALSA device list:
#0: sgtl5000-audio
#1: imx-hdmi-soc
I can hear audio through the HDMI channel, but cannot get the SGTL5000 channel to play. Here is the output:
root@imx6qc398:~# aplay -vvv /usr/share/sounds/alsa/Front_Left.wav -Dplughw:0,0
Playing WAVE '/usr/share/sounds/alsa/Front_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Plug PCM: Hardware PCM card 0 'sgtl5000-audio' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 1
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 24000
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 1572864000
appl_ptr : 0
hw_ptr : 0
Max peak (6000 samples): 0x000034c8 ######### 41%
Max peak (6000 samples): 0x00002e57 ######## 36%
Max peak (6000 samples): 0x00001f88 ##### 24%
Max peak (6000 samples): 0x000013ef #### 15%
playback write error (DMA or IRQ trouble?)
aplay: pcm_write:1947: write error: Input/output error
Can you provide any assistance?
Some additional debug data:
Here is the DMA debug listing. Looks like four DMA transfers are attempted and then everything comes to a halt for 10 seconds before displaying the error message.
root@imx6qc398:~# dmesg | tail
[ 635.451027] imx-sdma 20ec000.sdma: wml = 0x0000001a
[ 635.451042] imx-sdma 20ec000.sdma: shp_addr = 0x02028000
[ 635.451056] imx-sdma 20ec000.sdma: per_addr = 0x00000000
[ 635.451070] imx-sdma 20ec000.sdma: event_mask0 = 0x00000000
[ 635.451084] imx-sdma 20ec000.sdma: event_mask1 = 0x00000040
[ 635.451114] imx-sdma 20ec000.sdma: entry 0: count: 12000 dma: 0x6a2d0000 intr
[ 635.451131] imx-sdma 20ec000.sdma: entry 1: count: 12000 dma: 0x6a2d2ee0 intr
[ 635.451149] imx-sdma 20ec000.sdma: entry 2: count: 12000 dma: 0x6a2d5dc0 intr
[ 635.451169] imx-sdma 20ec000.sdma: entry 3: count: 12000 dma: 0x6a2d8ca0 wrap intr
[ 645.453505] playback write error (DMA or IRQ trouble?)
this may useful for you.
Hi jimmy
the link you give can't solve my issue, this patch has been in my source code,