All tests below were done with the original patch, as the suggested modification breaks 8ch mode here.
In 8ch mode, do the "Line jack" return true when you plugged "Side
Speaker"
?
Yes, the state reflects whether something is plugged into the blue jack.
pactl list
should "line in" list as not available when channel mode changed to "8
ch" ?
Unfortunately, it is "available" if there is something plugged in and "mot available" if there is nothing plugged in.
https://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Controls.txt
Mic Jack Mode, Line Jack Mode, etc These enum controls the direction and the bias of the input jack pins. Depending on the jack type, it can set as "Mic In" and "Line In", for determining the input bias, or it can be set to "Line Out" when the pin is a multi-I/O jack for surround channels.
the switching from 6ch to 8ch can also be implemented using Line Jack Mode too
Simple mixer control 'Line Jack Mode',0 Items: 'Mic In' 'Line In' 'Side Line Out' Item0: 'Side Line Out'