summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisael Lopez Cruz2017-10-19 01:52:02 -0500
committerPraneeth Bajjuri2017-11-28 17:25:36 -0600
commitd278a85d36a08bf527a3990d1a6baedacf156c7b (patch)
treefd750f80506735470d10968836652b4c4c5dbd8d
parent65488d981f7d879f5a37e1131bc295c6a67c003d (diff)
downloaddevice-ti-am57xevm-d278a85d36a08bf527a3990d1a6baedacf156c7b.tar.gz
device-ti-am57xevm-d278a85d36a08bf527a3990d1a6baedacf156c7b.tar.xz
device-ti-am57xevm-d278a85d36a08bf527a3990d1a6baedacf156c7b.zip
audio: Combine the JAMR3 HAL into the primary HAL
JAMR3 line-in audio support was provided through a separate audio HAL which caused significant code duplication. Line-in audio support is now combined into the primary HAL. Change-Id: Ibd1d481954f1ebb71bb543c5a9d8dbd3ba61b002 Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com> Conflicts: audio/primary/jamr3_mixer_paths.xml device.mk
-rw-r--r--audio/Android.mk5
-rw-r--r--audio/primary/audio_hw.c38
-rw-r--r--audio/primary/audio_policy_configuration.xml22
-rw-r--r--device.mk4
4 files changed, 56 insertions, 13 deletions
diff --git a/audio/Android.mk b/audio/Android.mk
index 9e14b16..d73e0c1 100644
--- a/audio/Android.mk
+++ b/audio/Android.mk
@@ -13,4 +13,9 @@
13# limitations under the License. 13# limitations under the License.
14 14
15LOCAL_PATH := $(call my-dir) 15LOCAL_PATH := $(call my-dir)
16
17ifeq ($(APPE_AUDIO),true)
18include $(LOCAL_PATH)/hdmi/Android.mk
19else
16include $(call all-makefiles-under,$(LOCAL_PATH)) 20include $(call all-makefiles-under,$(LOCAL_PATH))
21endif
diff --git a/audio/primary/audio_hw.c b/audio/primary/audio_hw.c
index 0ae1f54..13dca21 100644
--- a/audio/primary/audio_hw.c
+++ b/audio/primary/audio_hw.c
@@ -94,6 +94,7 @@ struct j6_audio_device {
94 struct j6_stream_out *out; 94 struct j6_stream_out *out;
95 struct j6_voice voice; 95 struct j6_voice voice;
96 struct audio_route *route; 96 struct audio_route *route;
97 struct audio_route *jamr_route;
97 audio_devices_t in_device; 98 audio_devices_t in_device;
98 audio_devices_t out_device; 99 audio_devices_t out_device;
99 pthread_mutex_t lock; 100 pthread_mutex_t lock;
@@ -102,6 +103,8 @@ struct j6_audio_device {
102 unsigned int out_port; 103 unsigned int out_port;
103 unsigned int bt_card; 104 unsigned int bt_card;
104 unsigned int bt_port; 105 unsigned int bt_port;
106 unsigned int jamr_card;
107 unsigned int jamr_port;
105 bool mic_mute; 108 bool mic_mute;
106 bool in_call; 109 bool in_call;
107 audio_mode_t mode; 110 audio_mode_t mode;
@@ -120,6 +123,8 @@ struct j6_stream_in {
120 size_t hw_frame_size; 123 size_t hw_frame_size;
121 unsigned int requested_rate; 124 unsigned int requested_rate;
122 unsigned int requested_channels; 125 unsigned int requested_channels;
126 unsigned int card;
127 unsigned int port;
123 int read_status; 128 int read_status;
124 pthread_mutex_t lock; 129 pthread_mutex_t lock;
125 bool standby; 130 bool standby;
@@ -147,10 +152,15 @@ static const char *supported_bt_cards[] = {
147 "DRA7xxWiLink", 152 "DRA7xxWiLink",
148}; 153};
149 154
155static const char *supported_jamr_cards[] = {
156 "DRA7xx-JAMR3",
157};
158
150#define MAX_CARD_COUNT 10 159#define MAX_CARD_COUNT 10
151 160
152#define SUPPORTED_IN_DEVICES (AUDIO_DEVICE_IN_BUILTIN_MIC | \ 161#define SUPPORTED_IN_DEVICES (AUDIO_DEVICE_IN_BUILTIN_MIC | \
153 AUDIO_DEVICE_IN_WIRED_HEADSET | \ 162 AUDIO_DEVICE_IN_WIRED_HEADSET | \
163 AUDIO_DEVICE_IN_LINE | \
154 AUDIO_DEVICE_IN_DEFAULT) 164 AUDIO_DEVICE_IN_DEFAULT)
155#define SUPPORTED_OUT_DEVICES (AUDIO_DEVICE_OUT_SPEAKER | \ 165#define SUPPORTED_OUT_DEVICES (AUDIO_DEVICE_OUT_SPEAKER | \
156 AUDIO_DEVICE_OUT_WIRED_HEADSET | \ 166 AUDIO_DEVICE_OUT_WIRED_HEADSET | \
@@ -173,6 +183,7 @@ static const char *supported_bt_cards[] = {
173#define BT_BUFFER_SIZE (BT_PERIOD_SIZE * BT_PERIOD_COUNT) 183#define BT_BUFFER_SIZE (BT_PERIOD_SIZE * BT_PERIOD_COUNT)
174 184
175#define MIXER_XML_PATH "/vendor/etc/mixer_paths.xml" 185#define MIXER_XML_PATH "/vendor/etc/mixer_paths.xml"
186#define JAMR_MIXER_XML_PATH "/vendor/etc/jamr3_mixer_paths.xml"
176 187
177struct pcm_config pcm_config_capture = { 188struct pcm_config pcm_config_capture = {
178 .channels = 2, 189 .channels = 2,
@@ -1295,8 +1306,8 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
1295 if (in->standby) { 1306 if (in->standby) {
1296 select_input_device(adev); 1307 select_input_device(adev);
1297 1308
1298 ALOGI("in_read() open card %u port %u", adev->card, adev->in_port); 1309 ALOGI("in_read() open card %u port %u", in->card, in->port);
1299 in->pcm = pcm_open(adev->card, adev->in_port, 1310 in->pcm = pcm_open(in->card, in->port,
1300 PCM_IN | PCM_MONOTONIC, 1311 PCM_IN | PCM_MONOTONIC,
1301 &in->config); 1312 &in->config);
1302 if (!pcm_is_ready(in->pcm)) { 1313 if (!pcm_is_ready(in->pcm)) {
@@ -1624,6 +1635,8 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
1624 in->remix = NULL; 1635 in->remix = NULL;
1625 in->resampler = NULL; 1636 in->resampler = NULL;
1626 in->buffer = NULL; 1637 in->buffer = NULL;
1638 in->card = (devices == AUDIO_DEVICE_IN_LINE) ? adev->jamr_card : adev->card;
1639 in->port = 0;
1627 adev->in = in; 1640 adev->in = in;
1628 1641
1629 /* in-place stereo-to-mono remix since capture stream is stereo */ 1642 /* in-place stereo-to-mono remix since capture stream is stereo */
@@ -1721,6 +1734,7 @@ static int adev_close(hw_device_t *device)
1721 ALOGI("adev_close()"); 1734 ALOGI("adev_close()");
1722 1735
1723 audio_route_free(adev->route); 1736 audio_route_free(adev->route);
1737 audio_route_free(adev->jamr_route);
1724 free(device); 1738 free(device);
1725 1739
1726 return 0; 1740 return 0;
@@ -1778,6 +1792,11 @@ static int adev_open(const hw_module_t* module, const char* name,
1778 adev->bt_port = 0; 1792 adev->bt_port = 0;
1779 ALOGI("Bluetooth SCO card is hw:%d\n", adev->bt_card); 1793 ALOGI("Bluetooth SCO card is hw:%d\n", adev->bt_card);
1780 1794
1795 adev->jamr_card = find_card_index(supported_jamr_cards,
1796 ARRAY_SIZE(supported_jamr_cards));
1797 adev->jamr_port = 0;
1798 ALOGI("JAMR card is hw:%d\n", adev->jamr_card);
1799
1781 adev->mic_mute = false; 1800 adev->mic_mute = false;
1782 adev->in_call = false; 1801 adev->in_call = false;
1783 adev->mode = AUDIO_MODE_NORMAL; 1802 adev->mode = AUDIO_MODE_NORMAL;
@@ -1785,13 +1804,24 @@ static int adev_open(const hw_module_t* module, const char* name,
1785 adev->route = audio_route_init(adev->card, MIXER_XML_PATH); 1804 adev->route = audio_route_init(adev->card, MIXER_XML_PATH);
1786 if (!adev->route) { 1805 if (!adev->route) {
1787 ALOGE("Unable to initialize audio routes"); 1806 ALOGE("Unable to initialize audio routes");
1788 free(adev); 1807 goto err1;
1789 return -EINVAL; 1808 }
1809
1810 adev->jamr_route = audio_route_init(adev->jamr_card, JAMR_MIXER_XML_PATH);
1811 if (!adev->jamr_route) {
1812 ALOGE("Unable to initialize JAMR audio routes");
1813 goto err2;
1790 } 1814 }
1791 1815
1792 *device = &adev->device.common; 1816 *device = &adev->device.common;
1793 1817
1794 return 0; 1818 return 0;
1819
1820 err2:
1821 audio_route_free(adev->route);
1822 err1:
1823 free(adev);
1824 return -ENODEV;
1795} 1825}
1796 1826
1797static struct hw_module_methods_t hal_module_methods = { 1827static struct hw_module_methods_t hal_module_methods = {
diff --git a/audio/primary/audio_policy_configuration.xml b/audio/primary/audio_policy_configuration.xml
index f13d1bb..c5fb06e 100644
--- a/audio/primary/audio_policy_configuration.xml
+++ b/audio/primary/audio_policy_configuration.xml
@@ -4,6 +4,7 @@
4 <attachedDevices> 4 <attachedDevices>
5 <item>Speaker</item> 5 <item>Speaker</item>
6 <item>Built-In Mic</item> 6 <item>Built-In Mic</item>
7 <item>Line In</item>
7 </attachedDevices> 8 </attachedDevices>
8 9
9 <defaultOutputDevice>Speaker</defaultOutputDevice> 10 <defaultOutputDevice>Speaker</defaultOutputDevice>
@@ -19,7 +20,11 @@
19 channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/> 20 channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
20 </mixPort> 21 </mixPort>
21 </mixPorts> 22 </mixPorts>
22 23 <mixPort name="line input" role="sink">
24 <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
25 samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
26 channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
27 </mixPort>
23 <devicePorts> 28 <devicePorts>
24 <devicePort tagName="Speaker" type="AUDIO_DEVICE_OUT_SPEAKER" role="sink"> 29 <devicePort tagName="Speaker" type="AUDIO_DEVICE_OUT_SPEAKER" role="sink">
25 </devicePort> 30 </devicePort>
@@ -30,18 +35,17 @@
30 35
31 <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"> 36 <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
32 </devicePort> 37 </devicePort>
38 <devicePort tagName="Line In" type="AUDIO_DEVICE_IN_LINE" role="source">
39 </devicePort>
33 </devicePorts> 40 </devicePorts>
34 41
35 <routes> 42 <routes>
36 <route type="mux" sink="Speaker" 43 <route type="mux" sink="Speaker" sources="primary output"/>
37 sources="primary output"/> 44 <route type="mux" sink="Wired Headset" sources="primary output"/>
38 <route type="mux" sink="Wired Headset" 45 <route type="mux" sink="Wired Headphones" sources="primary output"/>
39 sources="primary output"/>
40 <route type="mux" sink="Wired Headphones"
41 sources="primary output"/>
42 46
43 <route type="mix" sink="primary input" 47 <route type="mix" sink="primary input" sources="Built-In Mic"/>
44 sources="Built-In Mic"/> 48 <route type="mix" sink="line input" sources="Line In"/>
45 </routes> 49 </routes>
46</module> 50</module>
47 51
diff --git a/device.mk b/device.mk
index d7d78ef..87b3501 100644
--- a/device.mk
+++ b/device.mk
@@ -14,6 +14,9 @@
14# limitations under the License. 14# limitations under the License.
15# 15#
16 16
17# Audio Post Processing Engine (APPE)
18APPE_AUDIO := false
19
17ifeq ($(TARGET_PREBUILT_KERNEL),) 20ifeq ($(TARGET_PREBUILT_KERNEL),)
18LOCAL_KERNEL := $(KERNELDIR)/arch/arm/boot/zImage 21LOCAL_KERNEL := $(KERNELDIR)/arch/arm/boot/zImage
19else 22else
@@ -84,6 +87,7 @@ PRODUCT_COPY_FILES += \
84 device/ti/am57xevm/audio/primary/audio_policy_configuration.xml:system/etc/primary_audio_policy_configuration.xml \ 87 device/ti/am57xevm/audio/primary/audio_policy_configuration.xml:system/etc/primary_audio_policy_configuration.xml \
85 device/ti/am57xevm/audio/audio_policy_configuration.xml:system/etc/audio_policy_configuration.xml 88 device/ti/am57xevm/audio/audio_policy_configuration.xml:system/etc/audio_policy_configuration.xml
86 89
90
87# cpuset configuration 91# cpuset configuration
88PRODUCT_COPY_FILES += \ 92PRODUCT_COPY_FILES += \
89 device/ti/am57xevm/init.am57xevmboard.cpuset.sh:system/bin/init.am57xevmboard.cpuset.sh 93 device/ti/am57xevm/init.am57xevmboard.cpuset.sh:system/bin/init.am57xevmboard.cpuset.sh