Ever since getting myself a new HP Spectre x360 13" (late 2019-early 2020 model), I have been plagued by random audio issues in Ubuntu where the speaker and mic will suddenly stop being detected on a kernel update.

When I first encountered the issue after upgrading to 5.4.0.31, I followed a recipe somewhere (lost the link, sorry) that asked me to add this line to /etc/modprobe.d/alsa-base.conf:

# 13 May 2020 - fixing dummy output with 31 kernel upgrade
options snd-hda-intel model=generic

The other oft-suggested answer was to try options snd-hda-intel dmic_detect=1, but this disabled my microphone, so I stuck with the above model=generic variation.

The second file to edit was /etc/modprobe.d/blacklist.conf, where I added this (ref):

# Kernel regression fix
# https://www.linuxuprising.com/2018/06/fix-no-sound-dummy-output-issue-in.html
blacklist snd_soc_skl

However, with the latest 5.4.0.34 upgrade, it appears the standard snd_hda_intel driver has been superseded by the SOF project:

oracology@andromeda:~$ lspci -v | grep -i 'Audio'
00:1f.3 Multimedia audio controller: Intel Corporation Smart Sound Technology Audio Controller (rev 30)
    Subsystem: Hewlett-Packard Company Smart Sound Technology Audio Controller
    Kernel driver in use: sof-audio-pci

From this helpful link, I came to know that the SOF driver requires the aforementioned line in alsa-base.conf to be changed to options snd-intel-dspcfg dsp_driver=1. This re-enabled my audio, but the microphone stopped working again.

By an extension of logic based on the pattern I found with snd_hda_intel, I tried this, which finally worked to re-enable both speakers and microphone:

# 9 June 2020 - Updated as per: 
# https://bugzilla.kernel.org/show_bug.cgi?id=205959
#options snd-intel-dspcfg dsp_driver=1
# Above command disables mic just like dmic_detect=1
# With a little creativity however...
options snd-intel-dspcfg model=generic

Using the model=generic parameter to snd_intel_dspcfg finally seems to be stable, for now. It is also worth mentioning that I do not use the headphone/mic jack, so I have not yet tested whether this part works properly or not. However, pavucontrol seems to show both the jack and built-in inputs for both the speakers and the microphone, so this is at least a promising start.

The one-liner commands for the working setup are:

oracology@andromeda:~$ sudo echo "options snd-intel-dspcfg model=generic" > /etc/modprobe.d/alsa-base.conf
oracology@andromeda:~$ sudo echo "blacklist snd_soc_skl" > /etc/modprobe.d/blacklist.conf

I am not sure if the blacklist snd_soc_skl bit is still required, but I do not particularly feel like messing around with this working setup for a little while..!