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

H. Nikolaus Schaller hns at goldelico.com
Fri Apr 30 12:45:32 CEST 2021


Hi Paul,

> Am 30.04.2021 um 00:20 schrieb Paul Boddie <paul at boddie.org.uk>:
> 
> On Thursday, 29 April 2021 09:49:47 CEST H. Nikolaus Schaller wrote:
>> 
>> Ok, the jz4780 has (at least 99%) the same i2s as the jz4740 which has 95%
>> the same as jz4730. This is good since it means I can compare the same
>> driver code on both...
>> 
>> What I have found in the programming manuals of all jz47* is:
>> 
>> 	Please set this bit to 1 to stop BIT_CLK when change AICFR.AUSEL and
>> AICFR.BCKD.
>> 
>> But I can't find that in the (new) driver. This might explain why the driver
>> or devmem2 does not set AUSEL.
> 
> It starts to sound like I have to investigate a few different peripherals now. 
> :-)

Indeed...

I seem to have the AUSEL fixed. The problem is that the clock divider must be
initialized first. This does not happen in jz4740_i2s_dai_probe() but
jz4740_i2s_hw_params().

So I only set the JZ_AIC_CONF_RESET in jz4740_i2s_dai_probe() and have moved
the AUSEL setup into jz4740_i2s_hw_params() which seems to be a more logical
place. There, I also have added a condition for the jz4730 so that it does
not try to set bits that were introduced by jz4740 AIC.

> 
>> So my plan was to compare to CI20.
>> 
>> But it turns out that the CI20 has no sound. We can try to port it from
>> FreeBSD:
>> 
>> 	https://github.com/freebsd/freebsd-src/blob/master/sys/gnu/dts/mips/ingenic
>> /jz4780.dtsi
>> 
>> But it uses the internal codec:
>> 
>> 		codec: codec at 100200a4 {
>> 			compatible = "ingenic,jz4780-codec";
>> 			reg = <0x100200a4 0x8>;
>> 
>> 			clocks = <&cgu JZ4780_CLK_I2SPLL>;
>> 			clock-names = "i2s";
>> 
>> 		};
>> 
>> for which we have no Linux driver :(
> 
> Yes, this is very strange. Although there are device tree nodes in the 3.18 
> kernel files, I don't find the corresponding drivers. There is audio support 
> in the HDMI driver, but since I use a DVI monitor, I never tried to use the 
> audio on the CI20 since the cable won't be passing on any audio signal. But I 
> imagine that there must be HDMI audio support because there was some effort to 
> get video playback working with a special version of MPlayer, as I recall.

Well, HDMI audio may be separated. I haven't tried either since I use a 7 inch
touch-screen tablet monitor which has no speakers...

> 
>> BTW: there seem to be two i2s instances on jz4780 (at least from DMA and
>> IRQ) but there is only one base address.
>> 
>> Cul-de-sac...
> 
> Indeed, I don't see how it could be working unless some kind of generic I2S 
> support is clever enough, and the hardware is generic enough, for it all to 
> "just work". The documentation isn't very helpful about the audio socket on 
> the board, however:
> 
> https://www.elinux.org/CI20_Hardware#Audio

Here, the jz4780 data sheet gives some background. The codec is fully integrated
and it just needs some passive components and a jack to get stereo headset
out and microphone in.

So the I2S happens fully inside the jz4780 SoC in this case.

On the Alpha 400 we have an external ak4642 codec so we see the I2S on external
pins. For that a driver exists and it works. At least I could verify that it
provides bit clock and sync clock.

At the moment my plan is to experiment with the hints by Maarten to try
to make the jz4780 codec driver work.

Then, my hope is to understand the interaction of the i2s driver with DMA which
should be exactly the same between jz4730 and jz4780. The different codecs are
then most likely outside the remaining problems.

BR,
Nikolaus



More information about the Letux-kernel mailing list