From 0bcd90da87361c7109d02e02950b5fb87674e10d Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sun, 11 May 2014 00:56:15 +0200 Subject: audio: Audio policy, TinyAlsa-Audio config cleanup, headset detection Signed-off-by: Paul Kocialkowski --- configs/audio_policy.conf | 27 ++++++++++ configs/tinyalsa-audio.xml | 57 ++++++++++++++-------- gta04.mk | 3 +- .../frameworks/base/core/res/res/values/config.xml | 2 + rootdir/init.gta04.rc | 2 + usr/keylayout/gta04_Headset_Jack.kl | 1 + 6 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 configs/audio_policy.conf create mode 100644 usr/keylayout/gta04_Headset_Jack.kl 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 @@ - + + + + - - - - - - - - + + + - - + + @@ -45,13 +43,13 @@ - - + + + - @@ -59,13 +57,13 @@ - - + + + - @@ -76,6 +74,13 @@ rate="44100" channels="2" format="PCM_16" period_size="1024" period_count="4"> + + + + + + + @@ -86,6 +91,7 @@ + @@ -95,23 +101,32 @@ - + + + + + + + + + + + + - - + - 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 @@ true true + + true 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 -- cgit v1.1