summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-05-11 00:56:15 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-05-11 00:56:15 +0200
commit0bcd90da87361c7109d02e02950b5fb87674e10d (patch)
tree604edf876577258e93d1667b0b123f3df178bab9
parent415f68a8f66df504a7d5b6337b6765af3fe57695 (diff)
downloaddevice_goldelico_gta04-0bcd90da87361c7109d02e02950b5fb87674e10d.zip
device_goldelico_gta04-0bcd90da87361c7109d02e02950b5fb87674e10d.tar.gz
device_goldelico_gta04-0bcd90da87361c7109d02e02950b5fb87674e10d.tar.bz2
audio: Audio policy, TinyAlsa-Audio config cleanup, headset detection
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--configs/audio_policy.conf27
-rw-r--r--configs/tinyalsa-audio.xml57
-rw-r--r--gta04.mk3
-rw-r--r--overlay/frameworks/base/core/res/res/values/config.xml2
-rw-r--r--rootdir/init.gta04.rc2
-rw-r--r--usr/keylayout/gta04_Headset_Jack.kl1
6 files changed, 70 insertions, 22 deletions
diff --git a/configs/audio_policy.conf b/configs/audio_policy.conf
new file mode 100644
index 0000000..1d87e15
--- /dev/null
+++ b/configs/audio_policy.conf
@@ -0,0 +1,27 @@
+global_configuration {
+ attached_output_devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER
+ default_output_device AUDIO_DEVICE_OUT_SPEAKER
+ attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC
+}
+
+audio_hw_modules {
+ primary {
+ outputs {
+ primary {
+ sampling_rates 44100
+ channel_masks AUDIO_CHANNEL_OUT_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE
+ flags AUDIO_OUTPUT_FLAG_PRIMARY
+ }
+ }
+ inputs {
+ primary {
+ sampling_rates 8000|11025|16000|22050|24000|32000|44100|48000
+ channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET
+ }
+ }
+ }
+}
diff --git a/configs/tinyalsa-audio.xml b/configs/tinyalsa-audio.xml
index b04b510..701ded8 100644
--- a/configs/tinyalsa-audio.xml
+++ b/configs/tinyalsa-audio.xml
@@ -5,37 +5,35 @@
<device type="default">
<path type="enable">
- <ctrl name="DAC1 Digital Fine Playback Volume" value="60" />
+ <ctrl name="Codec Operation Mode" value="Option 1 (audio)" />
+ <ctrl name="DAC1 Analog Playback Switch" value="off" />
+ <ctrl name="DAC2 Analog Playback Switch" value="on" />
+
<ctrl name="DAC2 Digital Fine Playback Volume" value="60" />
- <ctrl name="DAC1 Digital Coarse Playback Volume" value="0" />
<ctrl name="DAC2 Digital Coarse Playback Volume" value="0" />
-
- <ctrl name="Headset Playback Volume" value="1" />
-
- <ctrl name="TX1 Digital Capture Volume" value="12" />
- <ctrl name="TX2 Digital Capture Volume" value="12" />
-
- <ctrl name="Analog Capture Volume" value="5" />
</path>
</device>
<device type="earpiece">
<path type="enable">
<ctrl name="Earpiece Mixer AudioL2" value="on" />
+
+ <ctrl name="DAC2 Analog Playback Volume" value="16" />
<ctrl name="Earpiece Playback Volume" value="3" />
</path>
<path type="disable">
<ctrl name="Earpiece Mixer AudioL2" value="off" />
+
<ctrl name="Earpiece Playback Volume" value="0" />
</path>
</device>
<device type="speaker">
<path type="enable">
- <ctrl name="DAC1 Analog Playback Volume" value="16" />
- <ctrl name="DAC2 Analog Playback Volume" value="16" />
<ctrl name="HandsfreeL Mux" value="AudioL2" />
<ctrl name="HandsfreeR Mux" value="AudioR2" />
<ctrl name="HandsfreeL Switch" value="on" />
<ctrl name="HandsfreeR Switch" value="on" />
+
+ <ctrl name="DAC2 Analog Playback Volume" value="16" />
</path>
<path type="disable">
<ctrl name="HandsfreeL Switch" value="off" />
@@ -45,13 +43,13 @@
<device type="wired-headphone">
<path type="enable">
<write name="/sys/class/gpio/gpio55/value" value="1" />
- <ctrl name="DAC1 Analog Playback Volume" value="10" />
- <ctrl name="DAC2 Analog Playback Volume" value="10" />
<ctrl name="HeadsetR Mixer AudioR2" value="on" />
<ctrl name="HeadsetL Mixer AudioL2" value="on" />
+
+ <ctrl name="DAC2 Analog Playback Volume" value="12" />
+ <ctrl name="Headset Playback Volume" value="1" />
</path>
<path type="disable">
- <write name="/sys/class/gpio/gpio55/value" value="0" />
<ctrl name="HeadsetR Mixer AudioR2" value="off" />
<ctrl name="HeadsetL Mixer AudioL2" value="off" />
</path>
@@ -59,13 +57,13 @@
<device type="wired-headset">
<path type="enable">
<write name="/sys/class/gpio/gpio55/value" value="1" />
- <ctrl name="DAC1 Analog Playback Volume" value="10" />
- <ctrl name="DAC2 Analog Playback Volume" value="10" />
<ctrl name="HeadsetR Mixer AudioR2" value="on" />
<ctrl name="HeadsetL Mixer AudioL2" value="on" />
+
+ <ctrl name="DAC2 Analog Playback Volume" value="12" />
+ <ctrl name="Headset Playback Volume" value="1" />
</path>
<path type="disable">
- <write name="/sys/class/gpio/gpio55/value" value="0" />
<ctrl name="HeadsetR Mixer AudioR2" value="off" />
<ctrl name="HeadsetL Mixer AudioL2" value="off" />
</path>
@@ -76,6 +74,13 @@
rate="44100" channels="2" format="PCM_16"
period_size="1024" period_count="4">
+ <device type="default">
+ <path type="enable">
+ <ctrl name="TX1 Capture Route" value="Analog" />
+ <ctrl name="TX1 Digital Capture Volume" value="12" />
+ <ctrl name="Analog Capture Volume" value="5" />
+ </path>
+ </device>
<device type="builtin-mic">
<path type="enable">
<ctrl name="Analog Left Main Mic Capture Switch" value="on" />
@@ -86,6 +91,7 @@
</device>
<device type="wired-headset">
<path type="enable">
+ <write name="/sys/devices/virtual/gpio/gpio23/value" value="0" />
<ctrl name="Analog Left Headset Mic Capture Switch" value="on" />
</path>
<path type="disable">
@@ -95,23 +101,32 @@
</input>
<modem card="0" device="0">
- <device type="earpiece">
+
+ <device type="default">
<path type="enable">
<ctrl name="Voice route" value="Voice to twl4030" />
+ <ctrl name="DAC Voice Analog Downlink Switch" value="on" />
+ </path>
+ <path type="disable">
+ <ctrl name="Voice route" value="Voice to SoC" />
+ <ctrl name="DAC Voice Analog Downlink Switch" value="off" />
+ </path>
+ </device>
+ <device type="earpiece">
+ <path type="enable">
<ctrl name="Earpiece Mixer Voice" value="on" />
+
<ctrl name="Earpiece Playback Volume" value="3" />
<ctrl name="DAC Voice Digital Downlink Volume" value="40" />
- <ctrl name="DAC Voice Analog Downlink Switch" value="on" />
<ctrl name="Analog Left Main Mic Capture Switch" attr="mic" value="on" />
<ctrl name="DAC Voice Analog Downlink Volume" attr="voice-volume" value="0-15" />
</path>
<path type="disable">
- <ctrl name="Voice route" value="Voice to SoC" />
<ctrl name="Earpiece Mixer Voice" value="off" />
+
<ctrl name="Earpiece Playback Volume" value="0" />
<ctrl name="DAC Voice Digital Downlink Volume" value="0" />
- <ctrl name="DAC Voice Analog Downlink Switch" value="off" />
<ctrl name="Analog Left Main Mic Capture Switch" attr="mic" value="off" />
</path>
diff --git a/gta04.mk b/gta04.mk
index e42d724..26d11f3 100644
--- a/gta04.mk
+++ b/gta04.mk
@@ -59,7 +59,8 @@ PRODUCT_PACKAGES += \
audio.primary.omap3
PRODUCT_COPY_FILES += \
- device/goldelico/gta04/configs/tinyalsa-audio.xml:system/etc/tinyalsa-audio.xml
+ device/goldelico/gta04/configs/tinyalsa-audio.xml:system/etc/tinyalsa-audio.xml \
+ device/goldelico/gta04/configs/audio_policy.conf:system/etc/audio_policy.conf
# Lights
PRODUCT_PACKAGES += \
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index c36abda..452c6be 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -20,4 +20,6 @@
<bool name="config_unplugTurnsOnScreen">true</bool>
<bool name="config_showNavigationBar">true</bool>
+
+ <bool name="config_useDevInputEventForAudioJack">true</bool>
</resources>
diff --git a/rootdir/init.gta04.rc b/rootdir/init.gta04.rc
index e74ac0e..b5d9399 100644
--- a/rootdir/init.gta04.rc
+++ b/rootdir/init.gta04.rc
@@ -44,6 +44,8 @@ on boot
# Audio
chown system audio /sys/class/gpio/gpio55/value
chmod 0660 /sys/class/gpio/gpio55/value
+ chown system audio /sys/class/gpio/gpio23/value
+ chmod 0660 /sys/class/gpio/gpio23/value
# GPS
chown gps gps /sys/class/switch/gps_antenna/state
diff --git a/usr/keylayout/gta04_Headset_Jack.kl b/usr/keylayout/gta04_Headset_Jack.kl
new file mode 100644
index 0000000..35178d1
--- /dev/null
+++ b/usr/keylayout/gta04_Headset_Jack.kl
@@ -0,0 +1 @@
+key 256 HEADSETHOOK