Sound volume is completely messed up

Expected Behavior

Microphone and speakers should be of some use.

Current Behavior

The various sound volume levels seem to be wildly incorrect on my Galaxy S5.

  • Headphone output is at the same time very low, at the limit of audibility, and extremely saturated. Most of the time it sounds closer to white noise than anything else. This makes impossible to use headphones, be it for phone calling, listening to music or watching videos.
  • Mic input in the basic calling application is low and sounds very remote to the interlocutor. Every person I call has a lot of trouble understanding what I say.
  • Handset output is completely disabled in phone calls. Weirdly enough, the speaker mode does work correctly, both for calls and music.

Changing the various volume levels in the options has no effect. I performed various factory resets and fresh LineageOS installs without any effect either. I have also tried tweaking the infamous mixer_paths.xml file as suggested in various forums, to no avail. The phone is pretty much useless to me since calling is its most important feature.

Possible Solution

This has happened for a long time already, IIRC the problem was already there with LineageOS 14.1. At some point it used to work for a bit of time every time I upgraded the LineageOS version, then the problem would mysteriously reappear again. At that time, clearing cache was surprisingly enough to reset the volume to levels that were OK. This does not work anymore nowadays.

Steps to Reproduce

  1. Plug headphones.
  2. Call somebody or watch a video on the browser

and

  1. Call somebody
  2. Witness that communication is impossible.

/device klte /version lineage-17.1 /date 2021-02-21 /kernel 3.4.113-lineageos-gf6e14b9 /baseband G900FXXU1CQK3 /mods

I have read the directions.