MiniDisplay port to HDMI to optical 5.1 audio only has 2-channel output I have a Macbook Air 2017. My goal is to have an optical output capable of 5.1 audio for my home theatre. My series of connections are, mini display port to hdmi and the hdmi connected towards hdmi to optical output and optical connected to my 5.1 home theatre. My midi setup and audio out setting automatically detected the hdmi out and and the hdmi icon appeared in both settings. But in my midi setup, it is showing 8 channels but, volume level of all of them is shown as disabled.

All of the channel volume sliders are disabled.

When I go for configuring, it shows 5.1 out. But when I tried to test each channels, only left and right are heard. All other channels are silent. When I played a 6 channel audio, it is missing every surround except from left &amp; right.
I tried everything like soundflower, soundflowerbed app, MonitorControl etc. Nothing worked, still hearing only 2 channels.
Is there any solution for this? I need a 6 channel audio output.
According to Apple, the 2017 MacBook Air does not support audio over DisplayPort to HDMI devices.  It is only supported on models from 2010 through 2015.  

Send audio and video to HDMI displays through Mini DisplayPort

It explains what you are seeing/experiencing with the audio settings.  It is detecting your HDMI device which is capable of 8.1 audio, but it simply cannot deliver it; thus all the settings are greyed out.  

Now, when I have connected DisplayPort (or mDP) to a DisplayPort monitor with audio capabilities, they have always been stereo (left and right), never more than that.  This corroborates what you’re experiencing - only left and right channels available.  I currently don’t have an MBA to re-verify this, but this appears to be the case.

The 2018 MacBook Air (and on) with Thunderbolt 3 ports fully supports the HDMI 1.4b (minimum) spec with 8.1 audio.