#!/bin/sh SYS_CLASS_GPIO=/sys/class/gpio AMP_EN_GPIO_NUM=147 AMP_EN_GPIO=${SYS_CLASS_GPIO}/gpio${AMP_EN_GPIO_NUM} AMP_AGC1_GPIO_NUM=217 AMP_AGC1_GPIO=${SYS_CLASS_GPIO}/gpio${AMP_AGC1_GPIO_NUM} AMP_AGC2_GPIO_NUM=216 AMP_AGC2_GPIO=${SYS_CLASS_GPIO}/gpio${AMP_AGC2_GPIO_NUM} if [ "$1" == "1" ]; then if [ "$#" != "6" ]; then echo "Go to the Home~~!" exit fi echo "Play alphaVaud, Turn on Amp!" if [ -d $AMP_AGC1_GPIO ]; then echo ${AMP_AGC1_GPIO_NUM} > ${SYS_CLASS_GPIO}/unexport fi if [ -d $AMP_AGC2_GPIO ]; then echo ${AMP_AGC2_GPIO_NUM} > ${SYS_CLASS_GPIO}/unexport fi if [ -d $AMP_EN_GPIO ]; then echo ${AMP_EN_GPIO_NUM} > ${SYS_CLASS_GPIO}/unexport fi echo ${AMP_AGC1_GPIO_NUM} > ${SYS_CLASS_GPIO}/export echo ${AMP_AGC2_GPIO_NUM} > ${SYS_CLASS_GPIO}/export echo ${AMP_EN_GPIO_NUM} > ${SYS_CLASS_GPIO}/export echo out > ${AMP_AGC1_GPIO}/direction echo out > ${AMP_AGC2_GPIO}/direction echo out > ${AMP_EN_GPIO}/direction echo amixer -c alphaVaud sset 'Left PGA Mixer Mic2L' off echo amixer -c alphaVaud sset 'Right PGA Mixer Mic2R' off echo amixer -c alphaVaud sset 'Left PGA Mixer Line1L' off echo amixer -c alphaVaud sset 'Right PGA Mixer Line1R' off echo amixer -c alphaVaud sset 'PGA' 0 echo amixer -c alphaVaud sset 'HP' off echo amixer -c alphaVaud sset 'Left HP Mixer DACL1' off echo amixer -c alphaVaud sset 'Right HP Mixer DACR1' off echo amixer -c alphaVaud sset 'HP DAC' 0 echo amixer -c alphaVaud sset 'HPCOM' off echo amixer -c alphaVaud sset 'Left HPCOM Mixer DACL1' off echo amixer -c alphaVaud sset 'Right HPCOM Mixer DACR1' off echo amixer -c alphaVaud sset 'HPCOM DAC' 0 echo amixer -c alphaVaud sset PCM $2 echo amixer -c alphaVaud sset 'Line' on echo amixer -c alphaVaud sset 'Left Line Mixer DACL1' on echo amixer -c alphaVaud sset 'Right Line Mixer DACR1' on echo amixer -c alphaVaud sset 'Line DAC' $3 echo if [ "$4" == "1" ]; then echo 1 > ${AMP_AGC1_GPIO}/value echo "AGC1=1" else echo 0 > ${AMP_AGC1_GPIO}/value echo "AGC1=0" fi if [ "$5" == "1" ]; then echo 1 > ${AMP_AGC2_GPIO}/value echo "AGC2=1" else echo 0 > ${AMP_AGC2_GPIO}/value echo "AGC2=0" fi echo 1 > ${AMP_EN_GPIO}/value echo aplay -Dplughw:alphaVaud,0 $6 #if [ "$6" == "1" ]; then # aplay -Dplughw:alphaVaud,0 /home/root/V_test/sound/SineWaveMinus16.wav #else # aplay -Dplughw:alphaVaud,0 /home/root/V_test/sound/kids-playing-1.wav #fi echo elif [ "$1" == "0" ]; then echo "Turn off DAC, Turn off Amp!" if [ -d $AMP_EN_GPIO ]; then echo 0 > ${AMP_EN_GPIO}/value echo ${AMP_EN_GPIO_NUM} > ${SYS_CLASS_GPIO}/unexport fi if [ -d $AMP_AGC1_GPIO ]; then echo ${AMP_AGC1_GPIO_NUM} > ${SYS_CLASS_GPIO}/unexport fi if [ -d $AMP_AGC2_GPIO ]; then echo ${AMP_AGC2_GPIO_NUM} > ${SYS_CLASS_GPIO}/unexport fi echo amixer -c alphaVaud sset 'Line' off echo amixer -c alphaVaud sset 'Left Line Mixer DACL1' off echo amixer -c alphaVaud sset 'Right Line Mixer DACR1' off echo else echo "Go to the Home~~!" fi