Terra: Add cras config files

Update volume table and EQ setting for Terra11.

BUG=chrome-os-partner:48895
BRANCH=firmware-strago-7287.B
TEST=Write customization id ASUS-TERRA2 into VPD, and run
get_device_config_dir to check mapping path correct.

Change-Id: I04c69f6a80f804d6a978ad54b8dd4399b0661216
Signed-off-by: Luke_Yin@asus.com <Luke_Yin@asus.com>
Reviewed-on: https://chromium-review.googlesource.com/320154
Commit-Ready: Guang-Chuen Yin <Luke_Yin@asus.com>
Tested-by: Guang-Chuen Yin <Luke_Yin@asus.com>
Reviewed-by: Yomyung Leem <yungleem@chromium.org>
(cherry picked from commit 0a6a57788e7fca016e5ebe9316919749520cf4f1)
Reviewed-on: https://chromium-review.googlesource.com/325257
Reviewed-by: Agnes Cheng <agnescheng@google.com>
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
diff --git a/overlay-terra/chromeos-base/chromeos-bsp-terra/chromeos-bsp-terra-0.0.1-r3.ebuild b/overlay-terra/chromeos-base/chromeos-bsp-terra/chromeos-bsp-terra-0.0.1-r4.ebuild
similarity index 100%
rename from overlay-terra/chromeos-base/chromeos-bsp-terra/chromeos-bsp-terra-0.0.1-r3.ebuild
rename to overlay-terra/chromeos-base/chromeos-bsp-terra/chromeos-bsp-terra-0.0.1-r4.ebuild
diff --git a/overlay-terra/chromeos-base/chromeos-bsp-terra/files/audio-config/cras-config/TERRA2/chtrt5650 b/overlay-terra/chromeos-base/chromeos-bsp-terra/files/audio-config/cras-config/TERRA2/chtrt5650
new file mode 100644
index 0000000..3eccbcc
--- /dev/null
+++ b/overlay-terra/chromeos-base/chromeos-bsp-terra/files/audio-config/cras-config/TERRA2/chtrt5650
@@ -0,0 +1,107 @@
+[Speaker]
+  volume_curve = explicit
+  db_at_100 = -900
+  db_at_99 = -975
+  db_at_98 = -975
+  db_at_97 = -1050
+  db_at_96 = -1050
+  db_at_95 = -1125
+  db_at_94 = -1200
+  db_at_93 = -1200
+  db_at_92 = -1275
+  db_at_91 = -1275
+  db_at_90 = -1350
+  db_at_89 = -1425
+  db_at_88 = -1425
+  db_at_87 = -1500
+  db_at_86 = -1500
+  db_at_85 = -1575
+  db_at_84 = -1650
+  db_at_83 = -1650
+  db_at_82 = -1725
+  db_at_81 = -1725
+  db_at_80 = -1800
+  db_at_79 = -1800
+  db_at_78 = -1875
+  db_at_77 = -1950
+  db_at_76 = -1950
+  db_at_75 = -2025
+  db_at_74 = -2025
+  db_at_73 = -2100
+  db_at_72 = -2175
+  db_at_71 = -2175
+  db_at_70 = -2250
+  db_at_69 = -2250
+  db_at_68 = -2325
+  db_at_67 = -2400
+  db_at_66 = -2400
+  db_at_65 = -2475
+  db_at_64 = -2475
+  db_at_63 = -2550
+  db_at_62 = -2625
+  db_at_61 = -2625
+  db_at_60 = -2700
+  db_at_59 = -2700
+  db_at_58 = -2775
+  db_at_57 = -2850
+  db_at_56 = -2850
+  db_at_55 = -2925
+  db_at_54 = -2925
+  db_at_53 = -3000
+  db_at_52 = -3075
+  db_at_51 = -3075
+  db_at_50 = -3150
+  db_at_49 = -3150
+  db_at_48 = -3225
+  db_at_47 = -3300
+  db_at_46 = -3300
+  db_at_45 = -3375
+  db_at_44 = -3375
+  db_at_43 = -3450
+  db_at_42 = -3525
+  db_at_41 = -3525
+  db_at_40 = -3600
+  db_at_39 = -3600
+  db_at_38 = -3675
+  db_at_37 = -3675
+  db_at_36 = -3750
+  db_at_35 = -3825
+  db_at_34 = -3825
+  db_at_33 = -3900
+  db_at_32 = -3900
+  db_at_31 = -3975
+  db_at_30 = -4050
+  db_at_29 = -4050
+  db_at_28 = -4125
+  db_at_27 = -4125
+  db_at_26 = -4200
+  db_at_25 = -4275
+  db_at_24 = -4275
+  db_at_23 = -4350
+  db_at_22 = -4350
+  db_at_21 = -4425
+  db_at_20 = -4500
+  db_at_19 = -4500
+  db_at_18 = -4575
+  db_at_17 = -4575
+  db_at_16 = -4650
+  db_at_15 = -4725
+  db_at_14 = -4800
+  db_at_13 = -4950
+  db_at_12 = -5025
+  db_at_11 = -5100
+  db_at_10 = -5175
+  db_at_9 = -5325
+  db_at_8 = -5400
+  db_at_7 = -5550
+  db_at_6 = -5625
+  db_at_5 = -5775
+  db_at_4 = -5925
+  db_at_3 = -6075
+  db_at_2 = -6225
+  db_at_1 = -6375
+  db_at_0 = -6525
+[Headphone]
+  volume_curve = simple_step
+  volume_step = 50
+  max_volume = -1350
diff --git a/overlay-terra/chromeos-base/chromeos-bsp-terra/files/audio-config/cras-config/TERRA2/dsp.ini b/overlay-terra/chromeos-base/chromeos-bsp-terra/files/audio-config/cras-config/TERRA2/dsp.ini
new file mode 100644
index 0000000..75d835d
--- /dev/null
+++ b/overlay-terra/chromeos-base/chromeos-bsp-terra/files/audio-config/cras-config/TERRA2/dsp.ini
@@ -0,0 +1,119 @@
+[output_source]
+library=builtin
+label=source
+purpose=playback
+disable=(not (equal? dsp_name "speaker_eq"))
+output_0={src:0}
+output_1={src:1}
+
+[output_sink]
+library=builtin
+label=sink
+purpose=playback
+input_0={dst:0}
+input_1={dst:1}
+
+[drc]
+library=builtin
+label=drc
+input_0={src:0}
+input_1={src:1}
+output_2={intermediate:0}
+output_3={intermediate:1}
+input_4=1         ; emphasis_disabled
+input_5=0         ; f
+input_6=1         ; enable
+input_7=-24       ; threshold
+input_8=30        ; knee
+input_9=12        ; ratio
+input_10=0.023     ; attack
+input_11=0.291     ; release
+input_12=-7        ; boost
+input_13=200       ; f
+input_14=1         ; enable
+input_15=-24       ; threshold
+input_16=30        ; knee
+input_17=12        ; ratio
+input_18=0.027     ; attack
+input_19=0.282     ; release
+input_20=-7        ; boost
+input_21=2000      ; f
+input_22=1         ; enable
+input_23=-24       ; threshold
+input_24=30        ; knee
+input_25=12        ; ratio
+input_26=0.044     ; attack
+input_27=0.269     ; release
+input_28=-7        ; boost
+
+[eq2]
+library=builtin
+label=eq2
+input_0={intermediate:0}
+input_1={intermediate:1}
+output_2={dst:0}
+output_3={dst:1}
+input_4=2       ; highpass
+input_5=280     ; freq
+input_6=0       ; Q
+input_7=0       ; gain
+input_8=2       ; highpass
+input_9=250     ; freq
+input_10=0       ; Q
+input_11=0       ; gain
+input_12=6       ; peaking
+input_13=660     ; freq
+input_14=2.5     ; Q
+input_15=-8.5    ; gain
+input_16=6       ; peaking
+input_17=660     ; freq
+input_18=3       ; Q
+input_19=-2      ; gain
+input_20=6       ; peaking
+input_21=3800    ; freq
+input_22=2       ; Q
+input_23=-4      ; gain
+input_24=6       ; peaking
+input_25=900     ; freq
+input_26=2       ; Q
+input_27=-7      ; gain
+input_28=5       ; highshelf
+input_29=880     ; freq
+input_30=1       ; Q
+input_31=-4      ; gain
+input_32=6       ; peaking
+input_33=3800    ; freq
+input_34=3       ; Q
+input_35=-3      ; gain
+input_36=5       ; highshelf
+input_37=1350    ; freq
+input_38=1       ; Q
+input_39=4       ; gain
+input_40=6       ; peaking
+input_41=350     ; freq
+input_42=1       ; Q
+input_43=0       ; gain
+input_44=6       ; peaking
+input_45=1200    ; freq
+input_46=4       ; Q
+input_47=-4      ; gain
+input_48=6       ; peaking
+input_49=350     ; freq
+input_50=1       ; Q
+input_51=0       ; gain
+input_52=6       ; peaking
+input_53=1000    ; freq
+input_54=4       ; Q
+input_55=-2      ; gain
+input_56=6       ; peaking
+input_57=350     ; freq
+input_58=1       ; Q
+input_59=0       ; gain
+input_60=6       ; peaking
+input_61=390     ; freq
+input_62=3       ; Q
+input_63=-4      ; gain
+input_64=6       ; peaking
+input_65=350     ; freq
+input_66=1       ; Q
+input_67=0       ; gain
diff --git a/overlay-terra/chromeos-base/chromeos-bsp-terra/files/audio-config/cras-config/get_device_config_dir b/overlay-terra/chromeos-base/chromeos-bsp-terra/files/audio-config/cras-config/get_device_config_dir
new file mode 100755
index 0000000..f14288f
--- /dev/null
+++ b/overlay-terra/chromeos-base/chromeos-bsp-terra/files/audio-config/cras-config/get_device_config_dir
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+VPD_CACHE_FILE="/mnt/stateful_partition/unencrypted/cache/vpd/filtered.txt"
+if [ -e "${VPD_CACHE_FILE}" ]; then
+  CUSTOMIZATION_ID="$(sed -nre 's/^"customization_id"="(.+)"$/\1/p' \
+                      <"${VPD_CACHE_FILE}")"
+  SERIES="${CUSTOMIZATION_ID##*-}"
+fi
+echo "/etc/cras/${SERIES}"