ThinkPad W540 audio disappearing: how to disable NVIDIA GPU?

I recently got a good deal on a W540 i7-4800MQ with NVIDIA K2100M, and it’s running Qubes 4.1 with the 5.14.63-1.fc32 kernel, for the most part, without any issues. The only major problem I am experiencing is that sometimes the audio will stop working after disconnecting a secondary display via the Mini Display Port or the VGA. I cannot always replicate the problem, and a reboot will solve the issue.

I have checked the PulseAudio control and everything indicates that it’s working and is not on mute. I can only guess this is due to the NVIDIA K2100M taking over when a second display is detected.

If I understand correctly, Qubes doesn’t work well with NVIDIA. Therefore, I would like to persistently disable the NVIDIA graphics to see if NVIDIA is the culprit. Would anyone know the best way to disable the NVIDIA graphics, so it will only run on the integrated Intel HD 4600 graphics?

If any other W540/W541 users out there have a similar experience, I would be grateful for any tips. Thank you.

Graphic outputs such as HDMI usually also transmit sound, i.e. they are sound outputs as well.

So whenever you connect a new graphic output, pulseaudio may decide that it should be the default.
This is not specific to Qubes OS by the way.

You can observe the currently set pulseaudio default sink from pacmd stat. If it changes when you attach the second display, that’s the issue.

Whether or not you can disable the Nvidia GPU without losing that output port depends on whether Lenovo put a hardware GPU multiplexer in front of the GPU output port. IIRC they usually didn’t do that, i.e. you’d probably make the port unusable as it’s hardwired to the nvidia GPU.