diff options
| author | LuK1337 <priv.luk@gmail.com> | 2018-01-01 23:10:58 +0100 |
|---|---|---|
| committer | celtare21 <celtare21@gmail.com> | 2019-06-14 13:54:14 +0300 |
| commit | d72caba186cbe640e9bd62aa0b41c3b3874a161b (patch) | |
| tree | 17eecab24faab0437faf4cb847b4ff48d83b3e59 /rootdir | |
| parent | 25a9fb0a7d59d176f8e434727bf06ae8c26c5583 (diff) | |
mata: Implement on boot TFA98xx calibration
* TFA amplifier requires to play a calibration
sound file on each boot otherwise it calibrates
on the first played sound eg: unlock phone sound.
Change-Id: Ice91c29d14e30ed688007cffff56375b178106c2
Signed-off-by: celtare21 <celtare21@gmail.com>
Diffstat (limited to 'rootdir')
| -rw-r--r-- | rootdir/etc/init.mata.rc | 9 | ||||
| -rw-r--r-- | rootdir/etc/init.tfa.sh | 39 |
2 files changed, 48 insertions, 0 deletions
diff --git a/rootdir/etc/init.mata.rc b/rootdir/etc/init.mata.rc index 749c041c..ece40d98 100644 --- a/rootdir/etc/init.mata.rc +++ b/rootdir/etc/init.mata.rc @@ -614,6 +614,8 @@ on property:sys.boot_completed=1 # Enable PowerHAL hint processing setprop vendor.powerhal.init 1 + start tfa-sh + on property:vendor.usb.config=* start usbd @@ -633,6 +635,13 @@ service vendor.adsprpcd /vendor/bin/adsprpcd group media writepid /dev/cpuset/system-background/tasks +service tfa-sh /system/bin/init.tfa.sh /etc/silence_short.wav 15 1 + class main + user system + group system + disabled + oneshot + service vendor.atfwd /vendor/bin/ATFWD-daemon class late_start user system diff --git a/rootdir/etc/init.tfa.sh b/rootdir/etc/init.tfa.sh new file mode 100644 index 00000000..1eaf98d1 --- /dev/null +++ b/rootdir/etc/init.tfa.sh @@ -0,0 +1,39 @@ +#!/system/bin/sh + +# $1: wave file to read +# $2: volume(0-15) +# $3: device for output +# 0: current +# 1: speaker +# 12: earpiece +# -1: raw speaker +# -2: raw earpiece +# -3: headphone-48khz-16bit + +# tinyplay file.wav [-D card] [-d device] [-p period_size] [-n n_periods] +# sample usage: playback_audio.sh 2000.wav 15 -1 + +function enable_speaker { + echo "enabling speaker" + tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 1 + tinymix 'X Profile' 'hq' +} + +function disable_speaker { + echo "disabling speaker" + tinymix 'SLIMBUS_0_RX Audio Mixer MultiMedia1' 0 +} + +echo "Volume is ignored by this script for now" + +if [ "$3" -eq "1" -o "$3" -eq "-1" ]; then + enable_speaker +fi + +tinyplay $1 + +if [ "$3" -eq "1" -o "$3" -eq "-1" ]; then + disable_speaker +fi + +exit 0 |
