I guess when you computer suspends and resumes, the hdmi/dp has a process like plugging out (suspend) and plugging in (resume), so it should have the same behaviour of plugging out and replugging in, no need to run suspend and resume.
And the s/pdif audio will be active after plugging in, this is because the s/pdif belong to <alsa_output.pci-0000_00_1b.0.iec958-stereo> which has higher priority than <alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1>.
You could do a test, update the gnome-control-center to 3.36.4-0ubuntu1 (already done), reboot, plug in the hdmi/dp cable, open the gnome-control-center, select HDMI/DP1 or 2 in the gnome-control-center, then plug out the hdmi/dp cable, now the output will switch to s/pdif automatically, plug in the hdmi/dp cable, does the output switch back to HDMI/DP1 or 2 automatcally?
I guess when you computer suspends and resumes, the hdmi/dp has a process like plugging out (suspend) and plugging in (resume), so it should have the same behaviour of plugging out and replugging in, no need to run suspend and resume.
And the s/pdif audio will be active after plugging in, this is because the s/pdif belong to <alsa_output. pci-0000_ 00_1b.0. iec958- stereo> which has higher priority than <alsa_output. pci-0000_ 01_00.1. hdmi-stereo- extra1> .
You could do a test, update the gnome-control- center to 3.36.4-0ubuntu1 (already done), reboot, plug in the hdmi/dp cable, open the gnome-control- center, select HDMI/DP1 or 2 in the gnome-control- center, then plug out the hdmi/dp cable, now the output will switch to s/pdif automatically, plug in the hdmi/dp cable, does the output switch back to HDMI/DP1 or 2 automatcally?