these are some notes from trying to make ucm files from chromeos useable for mainline alsa

- it seems to be a good idea to add all settings of different ports with useful default values (either from enable or disable depending on what it should be by default) to the global enable section of the verb as otherwise some things seem to not be initialized properly all the time (might be related to the next point)

- it looks like something like "alsaucm -c simple-card set _verb HiFi set _enadev Speaker" (example) is required to run the EnableSequence part of SectionVerb, so if changes to the ucm files for some strange reason do not get update properly after changing and reloading them, running such a command might be worth a try

- most of the entries in an ucm file can be verified with the amixer command - example:
  cset "name='Headphone Playback Volume' 2" # in the ucm file
  amixer cset name='Headphone Playback Volume' 2 # same done from the cmdline

- it is a good idea to start with a single port (for instance, speaker) and comment out everything else first and then add them one by one after getting the former ones working

- check the syntax of ucm files via "alsaucm -c mtk-rt5650 reload" (example), it will work if the syntax is fine and fail if not. The config for the "-c" option can be obtained from "cat /proc/asound/cards" (the first string after the ":")

- run pulseaudio in debug mode - this prints out a lot of debug info:
  ```
  systemctl --user stop pulseaudio.socket
  systemctl --user stop pulseaudio.service
  pulseaudio -v
  ```

- software volume boost via pulseaudio:
  ```
  pactl list sources
  pactl set-source-volume 1 400%
  ```
  - https://superuser.com/questions/300178/can-i-increase-the-sound-volume-above-100-in-linux
  - https://askubuntu.com/questions/219739/adjust-max-possible-volume-in-pulseaudio
  - https://unix.stackexchange.com/questions/374085/lower-or-increase-pulseaudio-volume-on-all-outputs
  - https://forums.linuxmint.com/viewtopic.php?t=322621

- check if the "Hifi" profile actually gets loaded at the end of "pacmd list-cards"

- it looks like the chromeos audio system (cras) adds some parts to the ucm files, which are most probably ignored by pulseaudio etc., so it can either be dropped or left in there as a reminder of potential things to keep in mind
  - FullySpecifiedUCM - can be dropped
  - OutputDspName
  - CaptureChannelMap
    - https://www.alsa-project.org/pipermail/alsa-devel/2012-September/054990.html
  - MaxSoftwareGain
  - IntrinsicSensitivity
    - https://chromium.googlesource.com/chromiumos/third_party/adhd/+/master/cras/src/server/cras_alsa_ucm.c#50
    - possible workaround for low sensitivity by adding software gain manually in pulseaudio (see above)
- "ASoC: no backend DAIs enabled for" error resources:
  - https://irclog.whitequark.org/linux-amlogic/2020-10-28#28242490
    "... ASoC: no backend DAIs enabled for xyz - This means that you did not setup a valid route between and an actual output ... Alsa cannot consume the data and is nicely asking you to do something about it"
  - https://irclog.whitequark.org/linux-amlogic/2021-05-10#29866514
    ```
    13:12 <Antitrack> I'm sitting on an odroid c4 and latest ubuntu 21 kernel, 5.11.x ; dmesg says repeatedly "fe.dai-link-0: ASoC: no backend DAIs enabled for fe.dai-link-0" - what does it want to tell me ?
    13:59 <jbrunet> it is telling that something is trying to play audio on the hw:0,0 interface but no route to a valid output have been set for this device
    14:01 <jbrunet> Try something like this: https://www.irccloud.com/pastebin/3763kjSS/
    14:02 <jbrunet> when you get something you are happy with, make sure your distribution saves and restores the alsa settings on reboot
    ```
  - https://www.irccloud.com/pastebin/3763kjSS/ - this is just some example and will only work in that special case!
    ```
    amixer sset 'FRDDR_A SINK 1 SEL' 'OUT 1'
    amixer sset 'FRDDR_A SRC 1 EN' on
    amixer sset 'TDMOUT_B SRC SEL' 'IN 0'
    amixer sset 'TOHDMITX I2S SRC' 'I2S B'
    amixer sset 'TOHDMITX' on
    ```
  - maybe of interest as well:
    - https://freenode.irclog.whitequark.org/linux-amlogic/2020-05-17
    - https://irclog.whitequark.org/linux-amlogic/2020-10-28#28241321
    - https://usercontent.irccloud-cdn.com/file/y0cSFNAx/SM1%20ALSA%20Mixers%20(1).png

- where to get chromeos ucm files from - example links:
  - sometimes to befound in the overlays of the baseboard (kukui below) or of the model (krane below, which has a kukui baseboard too)
  - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/refs/heads/master/overlay-kukui/chromeos-base/chromeos-bsp-kukui/files/kukui/audio/ucm-config
  - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/refs/heads/master/overlay-kukui/chromeos-base/chromeos-bsp-kukui/files/krane/audio/ucm-config

- evtest can be used to listen for headphone jack plug/unplug events to find them
