This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TAC5212 Linux Driver (aplay: pcm_write:2058: write error: Input/output error)

Other Parts Discussed in Thread: TAC5212

[Removed older kernel pre-qual posts to keep to the subject issue]


# insmod snd-soc-tac5x1x.ko
[  203.607549] tac5x1x-codec 2-0051: TAC5x1x driver is looking for supply name: 'iovdd'
[  203.615250] tac5x1x-codec 2-0051: TAC5x1x driver is looking for supply name: 'avdd'
# [  203.666981] tac5x1x-codec 2-0051: TAC5x1x using I2S format
[  203.689895] tac5x1x-codec 2-0051: TAC5x1x bias level set to  1
[  203.695703] tac5x1x-codec 2-0051: TAC5x1x set power level STANDBY ignored

# sh test_stereo.sh
numid=57,iface=MIXER,name='ASI_RX_CH1_EN Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=54,iface=MIXER,name='OUT1x Source'
  ; type=ENUMERATED,access=rw------,values=1,items=6
  ; Item #0 'Disabled'
  ; Item #1 'DAC Input'
  ; Item #2 'Analog Bypass'
  ; Item #3 'DAC + Analog Bypass Mix'
  ; Item #4 'DAC -> OUTxP, INxP -> OUTxM'
  ; Item #5 'INxM -> OUTxP, DAC -> OUTxM'
  : values=0
numid=56,iface=MIXER,name='OUT1x Driver'
  ; type=ENUMERATED,access=rw------,values=1,items=4
  ; Item #0 'Line-out'
  ; Item #1 'He[  210.077928] tac5x1x-codec 2-0051: TAC5x1x using sample rate of 44100 Hz
adphone'
  ; It[  210.085707] tac5x1x-codec 2-0051: TAC5x1x word length is 16 bits
em #2 '4 ohm'
  ; Item #3 'FD Receiver/Debug'
  : values=0
Playing WAVE 'pure_tone_44.1K_16b_stereo.wav' : Signed 16 bit Little Endian, Rate [  210.105426] i2s_clk: 200000000
44100 Hz, Mono
[  210.108566] ma35d1_audio->pdm_decimation: 0
[  210.114119] sample_rate: 44100 bitrate: 1411200
[  210.118628] bclkdiv: 70, mclkdiv: 8
[  210.122089] i2s_clk=200000000
[  210.125035] sample_rate=44100 channels=1 width=16
[  210.129715] target_bclk=1411200 bclkdiv=70 actual_bclk=1408450 error_ppm=-1948
[  210.136925] target_mclk=12000000 mclkdiv=8 actual_mclk=12500000
[  210.142808] I2S_CLKDIV=0x00004608
[  210.146323] tac5x1x-codec 2-0051: TAC5x1x bias level set to  2
[  210.152126] tac5x1x-codec 2-0051: TAC5x1x set power level PREPARE ignored
[  210.166451] tac5x1x-codec 2-0051: TAC5x1x bias level set to  3
[  210.172235] tac5x1x-codec 2-0051: TAC5x1x set power level UP
aplay: pcm_write:2058: write error: Input/output error
# 

Added a few debug statement in the driver to be able to see what is going on.
Things to notice are
1. The drive sets I2S (correct)
2. Bit size 16 bit (correct) and sample rate is correct 44.1K
3. the CODEC is powered up be a PREPARE and then a ON
4. The requested clock is 12MHZ, but something reports it's changed to 12.5MHZ ? Would this case an issue ?
5. The Input/Output error how up  after a few seconds of starting the playback. 
6. The commands to play is:
amixer -c 0 cset iface=MIXER,name='ASI_RX_CH1_EN Switch' on
amixer -c 0 cset iface=MIXER,name='OUT1x Source' 'DAC Input’
amixer -c 0 cset iface=MIXER,name='OUT1x Config' 'Differential’
amixer -c 0 cset iface=MIXER,name='OUT1x Driver' 'Line-out’
amixer -c 0 cset iface=MIXER,name='ASI_RX_CH2_EN Switch' on
amixer -c 0 cset iface=MIXER,name=‘OUT2x Source' 'DAC Input’
amixer -c 0 cset iface=MIXER,name=‘OUT2x Config' 'Differential’
amixer -c 0 cset iface=MIXER,name=‘OUT2x Driver' 'Line-out'
aplay -c 2 -f S16_LE -r 44100 -d 15 --device='hw:0,0' pure_tone_44.1K_16b_stereo.wav
7. The I2S clock is 200000000 ? (200 MHz? )
The following shows up always after 6 seconds, after starting the aplay file (could be because loading the file?)
Red is from aplay, blue and purple added debug output statement in the tac5x1x driver 
aplay: pcm_write[ 375.714443] tac5x1x_set_sysclk 0 0 0
:2058: write err[ 375.719156] tac5x1x-codec 2-0051: recover cclk from bclk
or: Input/output error