{"id":1387,"date":"2022-12-11T16:45:52","date_gmt":"2022-12-11T15:45:52","guid":{"rendered":"http:\/\/www.thelins.se\/johan\/blog\/?p=1387"},"modified":"2022-12-11T16:45:52","modified_gmt":"2022-12-11T15:45:52","slug":"debian-on-the-xps13-plus-9320","status":"publish","type":"post","link":"https:\/\/www.thelins.se\/johan\/blog\/2022\/12\/debian-on-the-xps13-plus-9320\/","title":{"rendered":"Debian on the XPS13 Plus (9320)"},"content":{"rendered":"\n<p>TL;DR; Still no sound, but I learned a couple of new things&#8230;<\/p>\n\n\n\n<p>So, I finally got around to upgrading my laptop. I decided to go for my fourth XPS13, and this time I opted for a maxed out XPS13 Plus. A really nice machine. However, the driver stack isn&#8217;t quite there yet. Yes, I should have read up more before buying, but I didn&#8217;t and I know it will be sorted out over time.<\/p>\n\n\n\n<p>As a vim user, the touch Esc key will be a challenge. Perhaps this is where I learn to bind to capslock, but I&#8217;ve not come to that point yet.<\/p>\n\n\n\n<p>So, after installing using the netinst image with non-free drivers (and my phone over USB tether for networking since the wifi still didn&#8217;t work), I had to move to testing for anything to work. Then I installed <code>firmware-iwlwifi<\/code>, <code>iwlwifi<\/code> and <code>firmware-sof-signed<\/code> from non-free. This got me into a graphical desktop and most things work (I could configure the touch pad for tap-to-click, and so on). I run a KDE desktop, so I installed some Plymouth stuff, breeze for SDDM and such, but that shouldn&#8217;t affect the issues described here.<\/p>\n\n\n\n<p>My current issues are the sound, the webcam and hibernation. The two latter items aren&#8217;t huge problems, but I do need sound. Both the webcam and sound issues are known. Hibernation is mostly about getting around to configuring it with the encrypted disk setup.<\/p>\n\n\n\n<p>So, let&#8217;s start by diving into the audio issue. The early boot process looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;   20.595666] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class\/subclass\/prog-if info 0x040100\n&#91;   20.595750] sof-audio-pci-intel-tgl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver\n&#91;   20.595778] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -&gt; 0002)\n&#91;   20.596001] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class\/subclass\/prog-if 0x040100\n&#91;   20.596073] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops &#91;i915])\n&#91;   20.602984] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode\n&#91;   20.651283] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 4\n&#91;   20.652476] sof-audio-pci-intel-tgl 0000:00:1f.3: firmware: direct-loading firmware intel\/sof\/sof-adl.ri\n&#91;   20.652482] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864\n&#91;   20.652483] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0\n&#91;   20.652488] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30\n&#91;   20.747032] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864\n&#91;   20.747036] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0\n&#91;   25.758149] sof_sdw sof_sdw: snd_soc_register_card failed -517\n&#91;   25.768995] sof_sdw sof_sdw: snd_soc_register_card failed -517\n&#91;   25.799027] sof_sdw sof_sdw: snd_soc_register_card failed -517<\/code><\/pre>\n\n\n\n<p>If I later force a reload of the module, it all works:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo modprobe -r snd-sof-pci-intel-tgl; sudo modprobe snd-sof-pci-intel-tgl<\/code><\/pre>\n\n\n\n<p>Gives:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;  169.407671] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class\/subclass\/prog-if info 0x040100\n&#91;  169.407784] sof-audio-pci-intel-tgl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver\n&#91;  169.408027] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class\/subclass\/prog-if 0x040100\n&#91;  169.408133] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops &#91;i915])\n&#91;  169.414240] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode\n&#91;  169.428614] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 4\n&#91;  169.428802] sof-audio-pci-intel-tgl 0000:00:1f.3: firmware: direct-loading firmware intel\/sof\/sof-adl.ri\n&#91;  169.428809] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864\n&#91;  169.428810] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0\n&#91;  169.428814] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30\n&#91;  169.547087] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864\n&#91;  169.547115] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0\n&#91;  169.563645] sof-audio-pci-intel-tgl 0000:00:1f.3: firmware: direct-loading firmware intel\/sof-tplg\/sof-adl-rt1316-l12-rt714-l0.tplg\n&#91;  169.563665] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0\n&#91;  169.564019] sof_sdw sof_sdw: ASoC: Parent card not yet available, widget card binding deferred\n&#91;  169.605390] sof_sdw sof_sdw: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3\n&#91;  169.627693] input: sof-soundwire HDMI\/DP,pcm=5 as \/devices\/pci0000:00\/0000:00:1f.3\/sof_sdw\/sound\/card0\/input26\n&#91;  169.627738] input: sof-soundwire HDMI\/DP,pcm=6 as \/devices\/pci0000:00\/0000:00:1f.3\/sof_sdw\/sound\/card0\/input27\n&#91;  169.631375] input: sof-soundwire HDMI\/DP,pcm=7 as \/devices\/pci0000:00\/0000:00:1f.3\/sof_sdw\/sound\/card0\/input28<\/code><\/pre>\n\n\n\n<p>So, something happens after <code>sof-adl.ri<\/code> is loaded. This causes the driver to just stop before loading the <code>sof-adl-rtl316-l12-rt714-l0.tplg<\/code> firmware, causing the <code>snd_soc_register_card<\/code> to fail. Let&#8217;t have a look at the reasons.<\/p>\n\n\n\n<p>First up, the <a href=\"https:\/\/wiki.archlinux.org\/title\/Dell_XPS_13_Plus_(9320)\">excellent Arch Linux Wiki<\/a> says to include the two firmware files and a bunch of modules in the initramfs. However, Arch and Debian uses different tools to build the initramfs, so let&#8217;s confirm the issue first:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lsinitramfs -l \/boot\/initrd.img-6.0.0-5-amd64  | grep 'intel\/sof'<\/code><\/pre>\n\n\n\n<p>This call results in a list of nothing. Just to confirm, grepping for firmware or intel returns long lists of files. So, the firmware is not in the early initramfs image. How do I get the firmware files into the initramfs? Apparently I have to write what is known as an <a href=\"https:\/\/manpages.ubuntu.com\/manpages\/bionic\/en\/man8\/initramfs-tools.8.html\">initramfs-tools hook script<\/a>.<\/p>\n\n\n\n<p>There lives a bunch of them over at <code>\/usr\/share\/initramfs-tools\/hooks<\/code>, so I started a very brute force one called <code>intel-sof-firmware<\/code> and tried to learn from the surrounding scripts and the manpage linked above. The result can be <a href=\"https:\/\/gist.github.com\/e8johan\/93172e19c302983fe9dec0c1e5ee0d27\" data-type=\"URL\" data-id=\"https:\/\/gist.github.com\/e8johan\/93172e19c302983fe9dec0c1e5ee0d27\">found in a gist here<\/a>.<\/p>\n\n\n\n<p>Notice that this is happy code. There is way too few sanity checks in there to make this useful to the general public. Your milage may vary.<\/p>\n\n\n\n<p>So, I added the modules to \/etc\/initramfs\/modules, and then updated the early initramfs images with this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo update-initramfs -k all -u<\/code><\/pre>\n\n\n\n<p>And then verified that the files made it to the image (I also had a look at the file listing in general to ensure that the image is ok):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lsinitramfs -l \/boot\/initrd.img-6.0.0-5-amd64  | grep 'intel\/sof'\n\ndrwxr-xr-x   2 root     root            0 Dec 11 15:51 usr\/lib\/firmware\/intel\/sof\ndrwxr-xr-x   2 root     root            0 Dec 11 15:51 usr\/lib\/firmware\/intel\/sof-tplg\n-rw-r--r--   1 root     root        28907 Dec 11 15:51 usr\/lib\/firmware\/intel\/sof-tplg\/sof-adl-rt1316-l12-rt714-l0.tplg\n-rw-r--r--   1 root     root       525056 Dec 11 15:51 usr\/lib\/firmware\/intel\/sof\/sof-adl.ri<\/code><\/pre>\n\n\n\n<p>It all seems to work, so let&#8217;s reboot and see what comes out the other side. Notice &#8211; this <em><strong>can<\/strong><\/em> brick your computer if you make a mistake. And if something to do with a computer <em><strong>can<\/strong><\/em> brick your computer, you know that it <em><strong>will<\/strong><\/em> brick your computer. <em><strong>Don&#8217;t say I did not tell you.<\/strong><\/em><\/p>\n\n\n\n<p><em>Side note: I run an encrypted lvm setup, and if you try to fix this problem by removing all modules (go from many to netbook in the initramfs.conf) you will enjoy re-installing your machine. I&#8217;m sure you can unbrick it by booting from a USB stick and fixing stuff, but since I&#8217;ve not really installed anything, I don&#8217;t really care.<\/em><\/p>\n\n\n\n<p>Guess what &#8211; after a couple of hours digging at this &#8211; I still have no sound&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dmesg | grep sof<\/code><\/pre>\n\n\n\n<p>Results in this (yay, a new error code &#8211; that must mean that I&#8217;m doing something):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;    1.760559] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class\/subclass\/prog-if info 0x040100\n&#91;    1.760629] sof-audio-pci-intel-tgl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver\n&#91;    1.760643] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)\n&#91;    1.760785] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class\/subclass\/prog-if 0x040100\n&#91;    3.491343] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops &#91;i915])\n&#91;    3.569000] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode\n&#91;    3.585475] sof-audio-pci-intel-tgl 0000:00:1f.3: codec #2 probe error, ret: -2\n&#91;    3.585859] sof-audio-pci-intel-tgl 0000:00:1f.3: no hda codecs found!\n&#91;    3.585990] sof-audio-pci-intel-tgl 0000:00:1f.3: firmware: direct-loading firmware intel\/sof\/sof-adl.ri\n&#91;    3.585996] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864\n&#91;    3.585998] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0\n&#91;    3.586007] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30\n&#91;    3.702740] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864\n&#91;    3.702756] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0\n&#91;    3.709727] sof-audio-pci-intel-tgl 0000:00:1f.3: firmware: direct-loading firmware intel\/sof-tplg\/sof-adl-rt1316-l12-rt714-l0.tplg\n&#91;    3.709742] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0\n&#91;    3.709825] sof-audio-pci-intel-tgl 0000:00:1f.3: error: can't connect DAI HDA0.OUT stream iDisp1\n&#91;    3.709920] sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to add widget id 0 type 27 name : HDA0.OUT stream iDisp1\n&#91;    3.710026] sof_sdw sof_sdw: ASoC: failed to load widget HDA0.OUT\n&#91;    3.710086] sof_sdw sof_sdw: ASoC: topology: could not load header: -22\n&#91;    3.710162] sof-audio-pci-intel-tgl 0000:00:1f.3: error: tplg component load failed -22\n&#91;    3.710247] sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to load DSP topology -22\n&#91;    3.710326] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22\n&#91;    3.710447] sof_sdw sof_sdw: ASoC: failed to instantiate card -22\n&#91;    3.710692] sof_sdw sof_sdw: snd_soc_register_card failed -22\n&#91;    3.710758] sof_sdw: probe of sof_sdw failed with error -22\n<\/code><\/pre>\n\n\n\n<p>I suspect I&#8217;m missing another driver in the initramfs. Still, the modprobe trick shown above still fixes sound, so I guess I&#8217;ll leave it for today&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TL;DR; Still no sound, but I learned a couple of new things&#8230; So, I finally got around to upgrading my laptop. I decided to go for my fourth XPS13, and this time I opted for a maxed out XPS13 Plus. A really nice machine. However, the driver stack isn&#8217;t quite there yet. Yes, I should &hellip; <a href=\"https:\/\/www.thelins.se\/johan\/blog\/2022\/12\/debian-on-the-xps13-plus-9320\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Debian on the XPS13 Plus (9320)<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,11,6],"tags":[],"class_list":["post-1387","post","type-post","status-publish","format-standard","hentry","category-debian","category-kde","category-linux"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts\/1387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/comments?post=1387"}],"version-history":[{"count":3,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts\/1387\/revisions"}],"predecessor-version":[{"id":1390,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts\/1387\/revisions\/1390"}],"wp:attachment":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/media?parent=1387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/categories?post=1387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/tags?post=1387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}