Amlogic s922 android 9.0 audio is replaced by rt5651 to es8316, there is a strange bug

Due to lack of materials, the codec was changed from rt5651 to es8316. I thought it was bronze, but found that it was the king. In the end, it turned out to be driven by a simple symbol. At this time, I seem to have encountered it before and forgot it. I would like to record it here. There are very few amlogic things in Baidu.

General steps:

1 Put the driver into common\sound\soc\codecs\amlogic

2 Change the Makefile Kconfig under common\sound\soc\codecs\amlogic

3 meson64_a32_defconfig written

4 dts write well:

The next step is to compile and burn, but found no sound,

View card:

# cat proc/asound/pcm

Everything seems to work?

Come to tinyplay again tingplay xxx.wav -D 0 -d 1 is to call the pcm1p device under AMLAUGESOUND. Because AMLAUGESOUND is 0.

At this time, the earphone has sound output, which means that the card can be played normally by directly opening the card with the command, and the hardware and tdm are normal. The suspicion now is that the upper layer did not open this card.

logcat looks:

The full screen pcm_handle is null must be problematic.

Find and find under hardware\amlogic\audio\audio_hal\audio_port.c:

Why port->pcm_handle = null ?

Find pcm_handle and find static ssize_t output_port_start(struct output_port *port) in port->pcm_handle = pcm;

Check again why this function did not go to the place where the value is assigned. The following shows that the value of device is always -1, and the problem arises that the device has not been obtained.

Find where there is a call to ->start and find

in amlAudioMixer.c

Continue to look for mixer_output_startup and find it in static int initSubMixngOutput:

Then look at alsa_device_update_pcm_index:

Check alsa_device_parser_pcm_string and find that the character configuration corresponding to DTS can be seen here, for example

Found related prints here

Here intercept part of the log red line part is suspicious.

Seeing the words HiFi found here, I was inspired, and quickly compared the two dai_name 

It was only then that it was discovered that the dai_name recognition error was caused by spaces. Modify to .name = "ES8316-HiFi", it works fine.

The above is purely hand-made, I hope it can help you.

Guess you like

Origin blog.csdn.net/m0_56343264/article/details/118524838