#!/bin/bash
# run with sudo or as root

amlogic_hdmi(){
amixer -c 0 set 'TOHDMITX' 'on'
amixer -c 0 set 'TOHDMITX I2S SRC' 'I2S B'
amixer -c 0 set 'TDMOUT_B SRC SEL' 'IN 0'
amixer -c 0 set 'FRDDR_A SRC 2 EN' 'on'
amixer -c 0 set 'FRDDR_A SINK 1 SEL' 'OUT 0'
amixer -c 0 set 'FRDDR_A SINK 2 SEL' 'OUT 1'
amixer -c 0 set 'FRDDR_A SINK 3 SEL' 'OUT 2'
amixer -c 0 set 'ACODEC' '85%'
# Save
alsactl store
}

amlogic_analog(){
amixer -c 0 set 'TOACODEC OUT EN' 'on'
amixer -c 0 set 'TOACODEC SRC' 'I2S B'
amixer -c 0 set 'TDMOUT_B SRC SEL' 'IN 0'
amixer -c 0 set 'FRDDR_A SRC 2 EN' 'on'
amixer -c 0 set 'FRDDR_A SINK 1 SEL' 'OUT 0'
amixer -c 0 set 'FRDDR_A SINK 2 SEL' 'OUT 1'
amixer -c 0 set 'FRDDR_A SINK 3 SEL' 'OUT 2'
amixer -c 0 set 'ACODEC' '100%'
amixer -c 0 set 'PCM' '100%'
# Save
alsactl store
}

#amlogic_hdmi
amlogic_analog