[Letux-kernel] jz4730 sound
H. Nikolaus Schaller
hns at goldelico.com
Sun Mar 21 19:20:45 CET 2021
Hi Paul,
I have now added a lot of printk to all important function entry points
drivers/dma/dma-jz4780.c
sound/soc/jz4740/jz4740-i2s.c
Here is what I get:
root at letux:~# ./l400-sound
[ 109.987399] jz4740_i2s_dev_probe
[ 109.991139] jz4780_of_dma_xlate
[ 109.994503] jz4780_dma_filter_fn
[ 110.000277] jz4780_dma_alloc_chan_resources
[ 110.004851] jz4780_of_dma_xlate
[ 110.010310] jz4780_dma_filter_fn
[ 110.013777] jz4780_dma_alloc_chan_resources
root at letux:~#
[ 110.334997] jz4740_i2s_dai_probe
[ 110.341375] jz4740_i2c_init_pcm_config
[ 110.356100] jz4740_i2s_set_sysclk
[ 110.385685] jz4740_i2s_set_fmt
root at letux:~# aplay /usr/share/sounds/alsa/Front_Center.wav
[ 142.736046] jz4740_i2s_startup
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
[ 142.786473] jz4740_i2s_hw_params
[ 142.789968] jz4780_dma_config
[ 142.818463] jz4780_dma_prep_dma_cyclic
[ 142.822455] jz4780_dma_desc_alloc
[ 142.826043] jz4780_dma_setup_hwdesc
[ 142.829731] jz4780_dma_transfer_size
[ 142.833489] jz4780_dma_setup_hwdesc
[ 142.837158] jz4780_dma_transfer_size
[ 142.840915] jz4780_dma_setup_hwdesc
[ 142.844584] jz4780_dma_transfer_size
[ 142.848341] jz4780_dma_setup_hwdesc
[ 142.852010] jz4780_dma_transfer_size
[ 142.855775] jz4780_dma_begin
[ 142.858836] jz4780_dma_chan_enable
[ 142.862429] jz4740_i2s_trigger
[ 142.870737] jz4780_dma_tx_status
cat
^CAborted by signal Interr[ 314.908735] jz4740_i2s_trigger
[ 314.913193] jz4780_dma_terminate_all
[ 314.916956] jz4780_dma_chan_disable
[ 314.920630] jz4780_dma_desc_free
upt...
aplay: pcm_write:1939: write error: Interrupted [ 314.927862] jz4740_i2s_shutdown
system call
[ 314.932557] jz4780_dma_synchronize
[ 314.939269] jz4780_dma_chan_disable
root at letux:~# cat /proc/interrupts
CPU0
2: 20271 MIPS 2 SoC intc cascade interrupt
9: 1541 INTC 9 ttyS0
14: 7232 INTC 14 10021000.mmc
15: 0 GPIOA 0 matrix-keypad
16: 0 GPIOA 1 matrix-keypad
17: 0 GPIOA 2 matrix-keypad
18: 0 GPIOA 3 matrix-keypad
21: 0 INTC 21 13020000.dma
24: 11523 INTC 24 TCU0
29: 0 GPIOA 4 matrix-keypad
31: 0 GPIOA 5 matrix-keypad
32: 0 GPIOA 6 matrix-keypad
33: 0 GPIOA 7 matrix-keypad
34: 0 GPIOC 0 10021000.mmc cd
35: 0 GPIOA 16 Touchpad Left
36: 0 GPIOA 13 Touchpad Right
ERR: 0
root at letux:~#
This means:
* i2s setup for DAM is done
* DMA setup is done
* ctrl-C explicitly terminates DMA
* but there are no interrupts in /proc/interrupts
Next, I have checked the I2S register AICCR (0x10020004) and it seems to
have a reasonable value while aplay is running.
How good that Ethernet is now running (despite being slow) so
that I can ssh into the machine and inspect from a second shell.
DMAC registers seem to be 0 except for channel 2 and DMAC
Value at address 0x130200F8 (0x77e8a0f8): 0x0
Value at address 0x130200FC (0x77e2d0fc): 0x1
Value at address 0x13020040 (0x77e23040): 0x1800040 <-- some memory buffer
Value at address 0x13020044 (0x77e8d044): 0x10020034 <-- this is AICDR
Value at address 0x13020048 (0x77e39048): 0x2EC <-- transfer size
Value at address 0x1302004C (0x77ed604c): 0x18 <-- 0x18 = 24 means transfer type AIC transfer fifo empty
Value at address 0x13020050 (0x77eb1050): 0x0 <-- channel disabled and more
Well, I did read this after aplay did end. While aplay is running I see:
Value at address 0x130200F8 (0x77eac0f8): 0x0 <-- no interrupt penting
Value at address 0x130200FC (0x77e6a0fc): 0x1 <-- no halt, no address error, DMAE=1
Value at address 0x13020040 (0x77ec5040): 0x1800000 <-- some memory buffer
Value at address 0x13020044 (0x77ebc044): 0x10020034 <-- this is AICDR
Value at address 0x13020048 (0x77e4f048): 0x2EE <-- transfer size
Value at address 0x1302004C (0x77e6204c): 0x18 <-- 0x18 = 24 means transfer type AIC transfer fifo empty
Value at address 0x13020050 (0x77e85050): 0x80A403 <-- External=off, SAI=on, DAI=off, RDIL="interval length=0"?, SP=16bit, DP=16bit, TSZ=32bit, TM=single, AR=0, CT=0, HLT=0 "transfer is in progress!", TIE=1"interrupt enabled", CTE = "channel enabled"
Ok, this means the DMA controller has been set up and except RDIL it looks reasonable.
Seems to be enabled, interrupts enabled and transfer in progress.
Let's now check the interrupt controller:
Value at address 0x10001000 (0x77e5b000): 0x801000
Value at address 0x10001004 (0x77ec5004): 0xE0D7BDFF <-- "D7" means: OST1&OST2 are masked, DMAC unmasked, AIC masked, ETH unmasked, CIM&SSI masked
Value at address 0x10001008 (0x77ed9008): 0x0
Value at address 0x1000100C (0x77ef700c): 0x0
Value at address 0x10001010 (0x77e0d010): 0x0
Hm. Looks all good so far...
This would mean that the AIC is not requesting DMA transfers...
But it didn't work for MMC either.
Is this a common problem or not? We don't know.
Let's assume this are different problems. Then it looks as if the AIC is not
requesting DMA transfers. Maybe an I2S clock issue?
This could be that if the codec is the clock master for I2S it would not provide
Audio Bit Clock...
Or the DMA-Controller does not get bus access.
Let's look into AIC first:
DTS says:
ak4642: codec at 13 {
compatible = "asahi-kasei,ak4642";
reg = <0x13>;
#clock-cells = <0>;
clock-frequency = <12000000>;
clock-output-names = "ak4643_mcko";
#sound-dai-cells = <0>;
};
Well, does it need some clock input provided by the jz4730?
Does it needs some connection referring to "ak4643_mcko"?
Looking into Schematics: there is a separate 12 MHz XTAL. No
clock to enable and "ak4643_mcko" may just be a comment.
But there is an AUD_PDN controlled by jz4730 ACRESET/GP69.
This seems to be used for AC'97 codecs.
Maybe we just keep the codec powered down (although it responds
to I2C?).
Maybe we should change simple-audio-card,format = "i2s";
if that makes the Reset being controlled?
Maybe we should try to check the state of ACRESET/GP69.
So far my findings and thoughts from this debuging session...
BR,
Nikolaus
> Am 26.01.2021 um 13:39 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
>
>> Am 26.01.2021 um 11:37 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>
>> Seems to be an issue with the routing table in:
>>
>> sound: sound {
>> compatible = "simple-scu-audio-card";
>>
>> simple-audio-card,name = "sound";
>> simple-audio-card,format = "left_j";
>> simple-audio-card,bitclock-master = <&sndcodec>;
>> simple-audio-card,frame-master = <&sndcodec>;
>>
>> simple-audio-card,convert-rate = <48000>;
>>
>> simple-audio-card,prefix = "ak4642";
>> simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
>> "DAI0 Capture", "ak4642 Capture";
>>
>> sndcpu: simple-audio-card,cpu {
>> sound-dai = <&i2s>;
>> };
>>
>> sndcodec: simple-audio-card,codec {
>> sound-dai = <&ak4642>;
>> system-clock-frequency = <11289600>;
>> };
>> };
>
> Well, I have commented out the simple-audio-card,routing and now we see a sound card :)
>
> root at letux:~# aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: A400 [Alpha 400], device 0: 10020000.i2s-ak4642-hifi ak4642-hifi-0 [10020000.i2s-ak4642-hifi ak4642-hifi-0]
> Subdevices: 1/1
> Subdevice #0: subdevice #0
> root at letux:~#
>
> arecord thinks it should be doing something:
>
> Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
>
> but does not time out after given duration. Which means that there are no samples arriving in user-space.
> This is to be expected since DMA is likely not working well.
>
> We have a very good start and someone with more experience in ALSA
> should be able to fix it...
>
> BR,
> Nikolaus
>
More information about the Letux-kernel
mailing list