[Letux-kernel] Letux/Alpha 400: small progress with sound

H. Nikolaus Schaller hns at goldelico.com
Wed Apr 28 20:45:44 CEST 2021


> Am 28.04.2021 um 20:19 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi Paul,
> 
> 
>> Am 27.04.2021 um 13:12 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>> 
>> Hi Paul,
>> I have managed to get the headset detection work with lewtux-5.12 by modifying the DTS [1]:
>> 
>> Still no success with I2S/Codec/DMA/aplay/arecord:
>> 
>> root at letux:~# aplay /usr/share/sounds/alsa/Front_Center.wav
>> [ 7637.981286] jz4740_i2s_startup
>> [ 7637.984612] ak4642_dai_startup: play=1
>> Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
>> [ 7638.024581] ak4642_dai_hw_params mcko=12000000
>> [ 7638.029615] ak4642_set_mcko: freq=12000000
>> [ 7638.033961] jz4740_i2s_hw_params
>> [ 7638.039801] jz4780_dma_config
>> [ 7638.054218] jz4780_dma_prep_dma_cyclic
>> [ 7638.058211] jz4780_dma_desc_alloc
>> [ 7638.061724] jz4780_dma_setup_hwdesc
>> [ 7638.065403] jz4780_dma_transfer_size
>> [ 7638.069167] jz4780_dma_setup_hwdesc
>> [ 7638.072841] jz4780_dma_transfer_size
>> [ 7638.076603] jz4780_dma_setup_hwdesc
>> [ 7638.080277] jz4780_dma_transfer_size
>> [ 7638.084038] jz4780_dma_setup_hwdesc
>> [ 7638.087713] jz4780_dma_transfer_size
>> [ 7638.091482] jz4780_dma_begin
>> [ 7638.094547] jz4780_dma_chan_enable
>> [ 7638.098145] jz4740_i2s_trigger
>> [ 7638.106437] jz4780_dma_tx_status
>> ^CAborted by signal Interrupt...
>> [ 7641.548540] jz4740_i2s_trigger
>> [ 7641.553011] jz4780_dma_terminate_all
>> [ 7641.556778] jz4780_dma_chan_disable
>> [ 7641.560456] jz4780_dma_desc_free
>> aplay: pcm_write:1939: write error: Inte[ 7641.567445] jz4740_i2s_shutdown
>> rrupted system c[ 7641.571680] ak4642_dai_shutdown: play=1
>> all
>> [ 7641.577012] jz4780_dma_synchronize
>> [ 7641.583599] jz4780_dma_chan_disable
>> root at letux:~#
>> 
>> Most likely the clocks of the I2S interface are not enabled properly or the pinctrl
>> function / direction is wrong. The fact that aplay gets stuck indicates that the
>> jz4730 I2S is in slave mode (waiting for external clock) which is not provided by
>> the codec (master). If it were the other way round, sound data would be emitted
>> independently of the codec listening or not.
> 
> I have hacked some ioremap() into jz4740_i2s_trigger() to be able to modify
> pinctrl on the fly and read the gpio bits directly.
> 
> There is clock activity on both BITCLK and SYNC obviously coming from the codec.
> And switching to ping function 0x2 makes these pins an output.

s/ping/pin/

> 
> So I think we can rule out codec and pinctrl problems as the main blocking point
> for completely stuck communication. It still may happen that there is no sound
> if we fix that but aplay Front_Center.wav should finish playing after ca. 3 seconds.
> 
> There remains only the AC97/I2S driver as the location of the issue.
> 
> I have now checked the register model of jz4730 and jz4740 and there is a handful
> of extra bits for the jz4740. Mainly it is possible to control input and output
> channel which separately and jz4740 can do fancy things linke swapping byte order

s/which/width/

> or outputting stereo for mono etc.
> 
> Maybe the driver is setting some register under the wrong assumption that it is
> a jz4740.
> 
> Next, I'll try to dump the AC97 registers in jz4740_i2s_trigger() where everything
> should have been set up properly...
> 
> Modifying code isn't difficult. We already have a DT compatible for jz4730-i2s and
> a ->version field in the device struct. Small differences are already handled
> for jz4760 and jz4770 by this mechanism.
> 
> BR,
> Nikolaus

s/Nikolaus/Nikolaus, please do more proofreading :)/

> 
> -- 
> You received this message because you are subscribed to the Google Groups "MIPS Creator CI20 Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mips-creator-ci20-dev+unsubscribe at googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/mips-creator-ci20-dev/6CB989ED-5B6D-4C71-9824-FD7DE4172C6D%40goldelico.com.



More information about the Letux-kernel mailing list