ES8336 incompatibility with pulseaudio suspend-on-idle
I have finally succeeded in making sound work on the Chuwi Hi10X (N4120 version using he ES8336 codec).
The reason (or maybe one of the reasons) why I was not succeeding before is an incompatibility between the suspend-on-idle functionality provided by pulseaudio and the sound hardware. When PA suspends the sound hardware, then the latter will not get out of the suspended state cleanly. Either the playback will not work (almost always), or the mic will not work, or both, or conversely some strong whistles will be heard (luckily this happens rarely).
A workaround is to edit /etc/pulse/default.pa and comment the load-module module-suspend-on-idle entry. Workaround may need adjustment when working with pipewire/wireplumber, though.
The workaround is just a workaround, though. Some underlining issue remains, and I wonder where. Unfortunately, I havn't managed to understand what happens when the the PA suspend-on-idle module is active. What is actually managing the suspend? Some general alsa code in the kernel? Some code specific to the ES8336 codec?