Depending on your sound hardware you may also find the appropriate port to where your digital HDMI sound goes. To list ports of cards available issue:
Usually there are several profiles available to adress different ports. These will also be lsited with the command above. Try if selecting another profile gives you the expected results (replace
<profile-name> with values read above):
pacmd set-card-profile <card-index> <profile-name>
If no profiles adressing different ports are available you can also change the port of a given sink with:
pacmd list-sinks # to read the sink index for the next command
pcmad set-sink-port <sink-index> <port-name>
In case you have a graphical desktop you may also change the card profile with pavucontrol in the "Configuration" tab:
Note that different HDMI-profiles may be listed which all show up having the same name.
If all that fails you may try to disable HDMI-CEC on your TV set or try with a different HDMI cable as flickering of the screen on your TV set may indicate an erroneous electrical input on the HDMI-ports.