# Use case configuration for Realme X3
# Author: Patriot-06 <mbmc172@gmail.com>
#
# Playback Devices
#  - Internal Speakers   : TFA987x driver : MultiMedia1 <-> QUAT_MI2S_RX
#
# Capture Devices
#  - Internal Bottom Mic : WCD934x driver : MultiMedia2 <-> SLIMBUS_0_TX (AIF1_CAP, ADC1, TX6)
#  - Internal Top Mic    : WCD934x driver : MultiMedia2 <-> SLIMBUS_0_TX (AIF1_CAP, ADC3, TX5)

SectionVerb {
        EnableSequence [
                # Speaker
                cset "name='QUAT_MI2S_RX Audio Mixer MultiMedia1' 1"

                # Bottom Mic
                cset "name='ADC1 Volume' 8"
                cset "name='AIF1_CAP Mixer SLIM TX6' 1"
                cset "name='CDC_IF TX6 MUX' DEC6"

                # Top Mic
                cset "name='ADC3 Volume' 8"
                cset "name='AIF1_CAP Mixer SLIM TX5' 1"
                cset "name='CDC_IF TX5 MUX' DEC5"
                cset "name='AMIC4_5 SEL' AMIC4"

                cset "name='MultiMedia2 Mixer SLIMBUS_0_TX' 1"
        ]

        DisableSequence [
                # Speaker
                cset "name='QUAT_MI2S_RX Audio Mixer MultiMedia1' 0"

                # Bottom Mic
                cset "name='ADC1 Volume' 0"
                cset "name='AIF1_CAP Mixer SLIM TX6' 0"
                cset "name='CDC_IF TX6 MUX' ZERO"

                # Top Mic
                cset "name='ADC3 Volume' 0"
                cset "name='AIF1_CAP Mixer SLIM TX5' 0"
                cset "name='CDC_IF TX5 MUX' ZERO"
                cset "name='AMIC4_5 SEL' ZERO"

                cset "name='MultiMedia2 Mixer SLIMBUS_0_TX' 0"
        ]

        Value {
                TQ "HiFi"
        }
}

SectionDevice."Speaker" {
        Comment "Internal Speaker"

        Value {
                PlaybackPriority 200
                PlaybackPCM "hw:${CardId},0" # MultiMedia1
        }
}

SectionDevice."Mic" {
        Comment "Internal Microphones"

        EnableSequence [
                cset "name='ADC MUX6' AMIC"
                cset "name='ADC MUX5' AMIC"
                cset "name='AMIC MUX6' ADC1"
                cset "name='AMIC MUX5' ADC3"
                cset "name='ADC1 Volume' 8"
                cset "name='ADC3 Volume' 8"
        ]

        DisableSequence [
                cset "name='AMIC MUX6' ZERO"
                cset "name='AMIC MUX5' ZERO"
                cset "name='ADC1 Volume' 0"
                cset "name='ADC3 Volume' 0"
        ]

        Value {
                CapturePriority 200
                CapturePCM "hw:${CardId},1" # MultiMedia2
                PlaybackChannels 2
        }
}
