No sound Ubuntu 20.04 Lenovo Yoga 7i

This "hack" from the Arch Wiki for the Lenovo Yoga 7i helped me. I'm currently running Arch, but it is something that can be tried on other distro bases. No guarantees, but it might be worth a try.

Speaker audio

This laptop requires firmware in order for the soundcard to work. See Advanced Linux Sound Architecture#ALSA firmware.

Due to this bug, the speakers do not work without modification. They do however work after suspending to RAM if audio playback is started within a short period of time of resuming (about 7 seconds), but they stop working if playback is interrupted for longer than this period of time. This allows for a hackish solution:

  1. Make sure to activate S3 sleep.

  2. Create a shell script to briefly suspend and then keep playing silent audio in the background to keep the speakers alive, for example:

activate_audio
#!/bin/bash
sudo rtcwake -m mem -s 1
while true
do
  echo -n -e '\x00' | padsp tee /dev/audio
  sleep 5
done
  1. Bind this script to a key, or execute it automatically after logging in.