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

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


Hi Marten,

> Am 30.04.2021 um 12:32 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi Maarten,
> 
>> Am 29.04.2021 um 14:15 schrieb Maarten ter Huurne <maarten at treewalker.org>:
>> 
>> On Thursday, 29 April 2021 13:48:13 CEST H. Nikolaus Schaller wrote:
>>>> Am 29.04.2021 um 13:31 schrieb Maarten ter Huurne
>>>> <maarten at treewalker.org>:> 
>>>> There is a Linux driver for the JZ4770 internal codec, Paul Cercueil
>>>> is maintaining it. A quick look at both programming manuals
>>>> suggests it won't work as-is, but the 4780 codec is an evolution of
>>>> the 4770 one, so a lot of code could be re-used. Register numbers
>>>> are different, but most of the names and bit fields within the
>>>> registers are the same.
>>> Good to know! So at least this is a good starting point for
>>> debugging...
>>> 
>>> I'll give it a try what happens if we use the ingenic,jz4770-codec on
>>> the CI20.
>> 
>> You would have to at least update the register number enum at the top, 
>> since almost all of the registers got renumbered.
> 
> I have copied the jz4770 driver, added Kconfig&Makefile, renamed everything
> to jz4780 and added some DTS nodes for jz4780.dtsi and ci20.dts.
> 
> As expected I get:
> 
> [    6.233327] jz4780-codec 100200a4.audio-codec: Unable to sync register 0x1. -145
> [    6.236454] asoc-simple-card sound: ASoC: no sink widget found for MIC
> [    6.236475] asoc-simple-card sound: ASoC: Failed to add route Mic -> direct -> MIC
> [    6.236489] asoc-simple-card sound: ASoC: no source widget found for OUTL
> [    6.236498] asoc-simple-card sound: ASoC: Failed to add route OUTL -> direct -> Speaker
> [    6.236509] asoc-simple-card sound: ASoC: no source widget found for OUTR
> [    6.236518] asoc-simple-card sound: ASoC: Failed to add route OUTR -> direct -> Speaker
> [    6.236530] asoc-simple-card sound: ASoC: no sink widget found for INL
> [    6.236539] asoc-simple-card sound: ASoC: Failed to add route LOUT -> direct -> INL
> [    6.236551] asoc-simple-card sound: ASoC: no sink widget found for INR
> [    6.236559] asoc-simple-card sound: ASoC: Failed to add route ROUT -> direct -> INR
> 
> So general setup works and I'll dig into the register numbers to see if I can
> get the codec starting...

Well, the issue is a little earlier. The AIC can't write successfully to the codec
through RGADW (0x100200a4).

RGADW.RGWR stays 1 until there is a timeout in jz4780_codec_io_wait(). So I think
clocks or some other initialization is missing or not running properly or in a wrong
sequence (like I had for the jz4730).

An indication (I had deleted from the log) is that jz4740_i2s_dai_probe is called
*after* jz4780-codec 100200a4.audio-codec probing. So the whole I2S subsystem is
not initialized when jz4780_codec wants to access the codec.

There is one hint: "the CODEC’s internal control and configure registers can be accessed by write/read these memory mapped registers using 12 MHz clock."

So there must be some 12 MHz clock running to be able to access the codec?

> 
>>> Alternatively we could check if one of the other codecs (4725, 4740,
>>> 4760) is more similar to find the best starting point.
>> 
>> I would expect 4770 to be the most similar, since it's the closest on 
>> the timeline and it's a full-featured SoC like the 4780 is. But it 
>> wouldn't hurt to check.

Mapping the registers is >80% similar. The jz4780 has split some registers into two
(e.g. SR -> SR, SR2) and replaced some (e.g. AGC1..5). But nothing which can be solved.

BR and thanks,
Nikolaus



More information about the Letux-kernel mailing list