# Use case configuration for Xiaomi POCO X3 Pro
# Author: Ali Nasrullayev <nesrullayev.ali@gmail.com>
#
# Playback Devices
#  - Earpiece            : TAS2564 driver : MultiMedia1 <-> QUAT_MI2S_RX
#  - Internal Speakers   : TAS2562 driver : MultiMedia1 <-> QUAT_MI2S_RX
# Capture Devices
#  - Internal Bottom Mic : WCD934x driver : MultiMedia2 <-> SLIMBUS_0_TX (AIF1_CAP, ADC1, TX8)
#  - Internal Top Mic   :  WCD934x driver : MultiMedia2 <-> SLIMBUS_0_TX (AIF2_CAP, ADC3, TX7)

SectionVerb {
    EnableSequence [
        # Speaker + Earpiece Playback
        cset "name='QUAT_MI2S_RX Audio Mixer MultiMedia1' 1"
        
        # Internal Microphone Capture
        cset "name='MultiMedia2 Mixer SLIMBUS_0_TX' 1"

        cset "name='AIF1_CAP Mixer SLIM TX8' 1"
        cset "name='CDC_IF TX8 MUX' DEC8"

        cset "name='AIF1_CAP Mixer SLIM TX7' 1"
        cset "name='CDC_IF TX7 MUX' DEC7"
    ]

    DisableSequence [
        cset "name='QUAT_MI2S_RX Audio Mixer MultiMedia1' 0"
        cset "name='MultiMedia2 Mixer SLIMBUS_0_TX' 0"

        cset "name='CDC_IF TX8 MUX' ZERO"
        cset "name='CDC_IF TX7 MUX' ZERO"
    ]

    Value {
        TQ "HiFi"
    }
}

SectionDevice."Speaker" {
    Comment "Primary Speaker Playback"

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

SectionDevice."Mic" {
    Comment "Internal Microphones"

    EnableSequence [
        cset "name='ADC MUX8' AMIC"
        cset "name='AMIC MUX8' ADC1"

        cset "name='ADC MUX7' AMIC"
        cset "name='AMIC MUX7' ADC3"
    ]

    DisableSequence [
        cset "name='ADC MUX8' ZERO"
        cset "name='AMIC MUX8' ZERO"

        cset "name='ADC MUX7' ZERO"
        cset "name='AMIC MUX7' ZERO"
    ]

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