
# Android ALSA configuration file for rockchip reference platform using the jettaB(RK616/RK618) ASoC audio.

##
## Mixer Devices
##
ctl.AndroidOut{
    type hw
    card 0
}
ctl.AndroidIn{
    type hw
    card 0
}

ctl.AndroidPlayback {
    type hw
}

ctl.AndroidRecord {
    type hw
}

pcm.AndroidPlayback {
    type hw
}

##
## # Speaker
##

pcm.AndroidPlayback_Speaker_normal {
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'High'}
            {name 'HP GPIO Control' value 'Low'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'Headphone Playback Switch' value [off off]}
            {name 'Headphone Jack Switch' value off}

            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'Speaker Playback Volume' value [22 22]}
            {name 'Ext Spk Switch' value on}
            {name 'Speaker Playback Switch' value [on on]}
        ]
    }
}

pcm.AndroidPlayback_Speaker_incall{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'High'}
            {name 'HP GPIO Control' value 'Low'}
            {name 'RCV GPIO Control' value 'Low'}

            #mic1-->line1/2
            {name 'Mic Jack Switch' value on}
            {name 'Mic Mux' value 'BSTL'}
            {name 'MIXINL MUXMIC Switch' value on}
            {name 'Micbias1 Voltage' value 7}
            {name 'BST_L Mode' value 0}
            {name 'Main Mic Capture Volume' value 1}
            {name 'Main Mic Capture Switch' value on}
            {name 'MUXMIC to MIXINL Volume' value 7}
            {name 'MIXINL Switch' value on}
            {name 'PGAL Capture Volume' value 29}
            {name 'PGAL Capture Switch' value on}
            {name 'LINEMIX PGAL Switch' value on}
            {name 'LINEOUT1 Playback Volume' value 31}
            {name 'LINEOUT2 Playback Volume' value 31}
            {name 'LINEOUT1 Playback Switch' value on}
            {name 'LINEOUT2 Playback Switch' value on}
            #IN1N/P ---> SPK
            {name 'HPMix Mux' value 'DIFFIN'}
            {name 'HPMIXR HPMix Mux Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPMIXL HPMix Mux Switch' value on}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Ext Spk Switch' value on}
            {name 'DIFFIN Mode' value 0}
            {name 'DIFFIN Capture Volume' value 1}
            {name 'DIFFIN Capture Switch' value on}
            {name 'HPMIX MUX to HPMIXL Volume' value 7}
            {name 'HPMIX MUX to HPMIXR Volume' value 7}
            {name 'Speaker Playback Volume' value [31 31]}
            {name 'Speaker Playback Switch' value [on on]}
        ]
    }
}


pcm.AndroidPlayback_Speaker_ringtone{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'High'}
            {name 'HP GPIO Control' value 'Low'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'Headphone Playback Switch' value [off off]}
            {name 'Headphone Jack Switch' value off}

            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'Speaker Playback Volume' value [31 31]}
            {name 'Ext Spk Switch' value on}
            {name 'Speaker Playback Switch' value [on on]}
        ]
    }
}


##
## # Earpiece(SPK)
##
pcm.AndroidPlayback_Earpiece_normal{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'Low'}
            {name 'HP GPIO Control' value 'Low'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'Headphone Playback Switch' value [off off]}
            {name 'Headphone Jack Switch' value off}

            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'Speaker Playback Volume' value [31 31]}
            {name 'Ext Spk Switch' value on}
            {name 'Speaker Playback Switch' value [on on]}
        ]
    }
}

pcm.AndroidPlayback_Earpiece_incall{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'High'}
            {name 'HP GPIO Control' value 'Low'}
            {name 'RCV GPIO Control' value 'Low'}

            #mic1-->line1/2
            {name 'Mic Jack Switch' value on}
            {name 'Mic Mux' value 'BSTL'}
            {name 'MIXINL MUXMIC Switch' value on}
            {name 'Micbias1 Voltage' value 7}
            {name 'BST_L Mode' value 0}
            {name 'Main Mic Capture Volume' value 1}
            {name 'Main Mic Capture Switch' value on}
            {name 'MUXMIC to MIXINL Volume' value 7}
            {name 'MIXINL Switch' value on}
            {name 'PGAL Capture Volume' value 29}
            {name 'PGAL Capture Switch' value on}
            {name 'LINEMIX PGAL Switch' value on}
            {name 'LINEOUT1 Playback Volume' value 31}
            {name 'LINEOUT2 Playback Volume' value 31}
            {name 'LINEOUT1 Playback Switch' value on}
            {name 'LINEOUT2 Playback Switch' value on}
            #IN1N/P ---> SPK
            {name 'HPMix Mux' value 'DIFFIN'}
            {name 'HPMIXR HPMix Mux Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPMIXL HPMix Mux Switch' value on}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Ext Spk Switch' value on}
            {name 'DIFFIN Mode' value 0}
            {name 'DIFFIN Capture Volume' value 1}
            {name 'DIFFIN Capture Switch' value on}
            {name 'HPMIX MUX to HPMIXL Volume' value 7}
            {name 'HPMIX MUX to HPMIXR Volume' value 7}
            {name 'Speaker Playback Volume' value [31 31]}
            {name 'Speaker Playback Switch' value [on on]}
        ]
    }
}

pcm.AndroidPlayback_Earpiece_ringtone{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'High'}
            {name 'HP GPIO Control' value 'Low'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'Headphone Playback Switch' value [off off]}
            {name 'Headphone Jack Switch' value off}

            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'Speaker Playback Volume' value [31 31]}
            {name 'Ext Spk Switch' value on}
            {name 'Speaker Playback Switch' value [on on]}
        ]
    }
}


##
## # Headphone
##
pcm.AndroidPlayback_Headphone_normal {
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'Low'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'Speaker Playback Switch' value [off off]}
            {name 'Ext Spk Switch' value off}

            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXL DACL Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Jack Switch' value on}
            {name 'Headphone Playback Switch' value [on on]}
        ]
    }
}

pcm.AndroidPlayback_Headphone_incall{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'Low'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            #mic1-->line1/2
            {name 'Mic Jack Switch' value on}
            {name 'Mic Mux' value 'BSTL'}
            {name 'MIXINL MUXMIC Switch' value on}
            {name 'Micbias1 Voltage' value 7}
            {name 'BST_L Mode' value 0}
            {name 'Main Mic Capture Volume' value 1}
            {name 'Main Mic Capture Switch' value on}
            {name 'MUXMIC to MIXINL Volume' value 7}
            {name 'MIXINL Switch' value on}
            {name 'PGAL Capture Volume' value 29}
            {name 'PGAL Capture Switch' value on}
            {name 'LINEMIX PGAL Switch' value on}
            {name 'LINEOUT1 Playback Volume' value 31}
            {name 'LINEOUT2 Playback Volume' value 31}
            {name 'LINEOUT1 Playback Switch' value on}
            {name 'LINEOUT2 Playback Switch' value on}
            #IN1N/P ---> HP
            {name 'HPMix Mux' value 'DIFFIN'}
            {name 'HPMIXR HPMix Mux Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPMIXL HPMix Mux Switch' value on}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Jack Switch' value on}
            {name 'DIFFIN Mode' value 0}
            {name 'DIFFIN Capture Volume' value 1}
            {name 'DIFFIN Capture Switch' value on}
            {name 'HPMIX MUX to HPMIXL Volume' value 7}
            {name 'HPMIX MUX to HPMIXR Volume' value 7}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Playback Switch' value [on on]}
        ]
    }
}

pcm.AndroidPlayback_Speaker_Headphone_normal{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'High'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Jack Switch' value on}
            {name 'Headphone Playback Switch' value [on on]}
            {name 'Speaker Playback Switch' value [on on]}
            {name 'Ext Spk Switch' value on}
        ]
    }
}

pcm.AndroidPlayback_Speaker_Headphone_ringtone{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'High'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Jack Switch' value on}
            {name 'Headphone Playback Switch' value [on on]}
            {name 'Speaker Playback Switch' value [on on]}
            {name 'Ext Spk Switch' value on}
        ]
    }
}

pcm.AndroidPlayback_Headphone_ringtone{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'Low'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'Speaker Playback Switch' value [off off]}
            {name 'Ext Spk Switch' value off}

            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Jack Switch' value on}
            {name 'Headphone Playback Switch' value [on on]}
        ]
    }
}


##
## # Headset
##
pcm.AndroidPlayback_Headset_normal {
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'Low'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'Speaker Playback Switch' value [off off]}
            {name 'Ext Spk Switch' value off}

            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Jack Switch' value on}
            {name 'Headphone Playback Switch' value [on on]}
        ]
    }
}

pcm.AndroidPlayback_Headset_incall{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'Low'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            #mic2-->line1/2
            {name 'Mic Jack Switch' value on}
            {name 'Mic Mux' value 'BSTR'}
            {name 'MIXINL MUXMIC Switch' value on}
            {name 'Micbias2 Voltage' value 0}
            {name 'BST_R Mode' value 1}
            {name 'Headset Mic Capture Volume' value 1}
            {name 'Headset Mic Capture Switch' value on}
            {name 'MUXMIC to MIXINL Volume' value 7}
            {name 'MIXINL Switch' value on}
            {name 'PGAL Capture Volume' value 29}
            {name 'PGAL Capture Switch' value on}
            {name 'LINEMIX PGAL Switch' value on}
            {name 'LINEOUT1 Playback Volume' value 31}
            {name 'LINEOUT2 Playback Volume' value 31}
            {name 'LINEOUT1 Playback Switch' value on}
            {name 'LINEOUT2 Playback Switch' value on}
            #IN1N/P ---> HP
            {name 'HPMix Mux' value 'DIFFIN'}
            {name 'HPMIXR HPMix Mux Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPMIXL HPMix Mux Switch' value on}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Jack Switch' value on}
            {name 'DIFFIN Mode' value 0}
            {name 'DIFFIN Capture Volume' value 1}
            {name 'DIFFIN Capture Switch' value on}
            {name 'HPMIX MUX to HPMIXL Volume' value 7}
            {name 'HPMIX MUX to HPMIXR Volume' value 7}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Playback Switch' value [on on]}
        ]
    }
}

pcm.AndroidPlayback_Speaker_Headset_normal{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'High'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Jack Switch' value on}
            {name 'Headphone Playback Switch' value [on on]}
            {name 'Speaker Playback Switch' value [on on]}
            {name 'Ext Spk Switch' value on}
        ]
    }
}

pcm.AndroidPlayback_Speaker_Headset_ringtone{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'High'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Jack Switch' value on}
            {name 'Headphone Playback Switch' value [on on]}
            {name 'Speaker Playback Switch' value [on on]}
            {name 'Ext Spk Switch' value on}
        ]
    }
}

pcm.AndroidPlayback_Headset_ringtone{
    type hooks
    slave.pcm {
        type hw
        card 0
        device 0
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            {name 'SPK GPIO Control' value 'Low'}
            {name 'HP GPIO Control' value 'High'}
            {name 'RCV GPIO Control' value 'Low'}

            {name 'Speaker Playback Switch' value [off off]}
            {name 'Ext Spk Switch' value off}

            {name 'HPMIXL DACL Switch' value on}
            {name 'HPMIXR DACR Switch' value on}
            {name 'HPR Mux' value 'HPMIXR'}
            {name 'HPL Mux' value 'HPMIXL'}
            {name 'Headphone Playback Volume' value [31 31]}
            {name 'Headphone Jack Switch' value on}
            {name 'Headphone Playback Switch' value [on on]}
        ]
    }
}

##
## # AndroidCapture
##
pcm.AndroidCapture {
    type hooks
    slave.pcm default
    hooks.0 {
        type ctl_elems
        hook_args [
            {name 'Headset Mic Capture Switch' value off}
            {name 'Micbias2 Voltage' value 0}

            {name 'Main Mic Capture Switch' value on}
            {name 'Mic Mux' value 'BSTL'}
            {name 'MUXMIC to MIXINL Volume' value 7}#
            {name 'MIXINL MUXMIC Switch' value on}
            {name 'MIXINL Switch' value on}
            {name 'Main Mic Capture Volume' value 1}
            {name 'BST_L Mode' value 0}
            {name 'Micbias1 Voltage' value 7}
            {name 'PGAL Capture Volume' value 31}
            {name 'Mic Jack Switch' value on}
            {name 'PGAL Capture Switch' value on}
        ]
    }
}

pcm.AndroidCapture_Headset_normal {
    type hooks
    slave.pcm default
    hooks.0 {
        type ctl_elems
        hook_args [
            {name 'Mic Jack Switch' value off}
            {name 'Main Mic Capture Switch' value off}
            {name 'Micbias1 Voltage' value 0}

            {name 'Headset Mic Capture Switch' value on}
            {name 'Mic Mux' value 'BSTR'}
            {name 'MUXMIC to MIXINL Volume' value 7}
            {name 'MIXINL MUXMIC Switch' value on}
            {name 'MIXINL Switch' value on}
            {name 'Headset Mic Capture Volume' value 1}
            {name 'BST_R Mode' value 1}
            {name 'Micbias2 Voltage' value 7}
            {name 'PGAL Capture Volume' value 25}
            {name 'Headset Jack Switch' value on}
            {name 'PGAL Capture Switch' value on}
        ]
    }
}


##
## # BT
##
pcm.AndroidPlayback_Bluetooth_incall {
    type hooks
    slave {
        pcm{
            type hw
            card 0
            device 1
        }
        #rate 8000
    }
    hooks.0 {
        type ctl_elems

        hook_args [
            #DACL --> line1/2
            {name 'LINEMIX DACL Switch' value on}
            {name 'LINEOUT1 Playback Volume' value 31}
            {name 'LINEOUT2 Playback Volume' value 31}
            {name 'LINEOUT1 Playback Switch' value on}
            {name 'LINEOUT2 Playback Switch' value on}
            #IN1N/P-->ADCL
            {name 'MIXINL IN1P Switch' value on}
            {name 'MIXINL Switch' value on}
            {name 'IN1P to MIXINL Volume' value 7}
            {name 'PGAL Capture Volume' value 31}
            {name 'PGAL Capture Switch' value on}
        ]
    }
}

pcm.AndroidPlayback_Bluetooth_normal {
    type hooks
    slave {
        pcm{
            type hw
            card 0
            device 1
        }
    }
    hooks.0 {
        type ctl_elems

        hook_args [
        ]
    }
}

##
## # HDMI
##
pcm.AndroidPlayback_Speaker_HDMI_normal{
    type hooks
    slave.pcm{
        type hw
        card 1
        device 0
    }
    hooks.0 {
        type ctl_elems
        hook_args [
        ]
    }
}
pcm.AndroidPlayback_HDMI_normal{
    type hooks
    slave.pcm{
        type hw
        card 1
        device 0
    }
    hooks.0 {
        type ctl_elems
        hook_args [
        ]
    }
}
