start_audio_amp 761 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. # Check number of args
  3. if [ ${#} -ne 1 ]; then
  4. echo "Usage: $(basename ${0}) [1 for on, 0 for off]"
  5. exit 1
  6. fi
  7. # Check enable arg
  8. enable=${1}
  9. if [ ${enable} -eq 1 ]; then
  10. # Turn ON only if volume is not null
  11. if [ "$(volume_get)" -ne "0" ]; then
  12. echo "Turning audio amplifier ON"
  13. else
  14. exit 0
  15. fi
  16. elif [ ${enable} -eq 0 ]; then
  17. echo "Turning audio amplifier OFF"
  18. else
  19. echo "Usage: $(basename ${0}) [1 for on, 0 for off]"
  20. exit 1
  21. fi
  22. # PA enable GPIO
  23. GPIO_PF6=166
  24. # Export GPIO
  25. if [ ! -d /sys/class/gpio/gpio${GPIO_PF6} ]; then
  26. echo ${GPIO_PF6} > /sys/class/gpio/export
  27. fi
  28. # Enable/disable cmd
  29. echo "out" > /sys/class/gpio/gpio${GPIO_PF6}/direction
  30. echo ${enable} > /sys/class/gpio/gpio${GPIO_PF6}/value
  31. exit 0