diff options
author | Misael Lopez Cruz <misael.lopez@ti.com> | 2017-10-19 01:52:02 -0500 |
---|---|---|
committer | Praneeth Bajjuri <praneeth@ti.com> | 2017-11-28 17:25:36 -0600 |
commit | d278a85d36a08bf527a3990d1a6baedacf156c7b (patch) | |
tree | fd750f80506735470d10968836652b4c4c5dbd8d | |
parent | 65488d981f7d879f5a37e1131bc295c6a67c003d (diff) | |
download | am57xevm-d278a85d36a08bf527a3990d1a6baedacf156c7b.tar.gz |
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.mk | 5 | ||||
-rw-r--r-- | audio/primary/audio_hw.c | 38 | ||||
-rw-r--r-- | audio/primary/audio_policy_configuration.xml | 22 | ||||
-rw-r--r-- | device.mk | 4 |
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 @@ # limitations under the License. LOCAL_PATH := $(call my-dir) + +ifeq ($(APPE_AUDIO),true) +include $(LOCAL_PATH)/hdmi/Android.mk +else include $(call all-makefiles-under,$(LOCAL_PATH)) +endif 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 { struct j6_stream_out *out; struct j6_voice voice; struct audio_route *route; + struct audio_route *jamr_route; audio_devices_t in_device; audio_devices_t out_device; pthread_mutex_t lock; @@ -102,6 +103,8 @@ struct j6_audio_device { unsigned int out_port; unsigned int bt_card; unsigned int bt_port; + unsigned int jamr_card; + unsigned int jamr_port; bool mic_mute; bool in_call; audio_mode_t mode; @@ -120,6 +123,8 @@ struct j6_stream_in { size_t hw_frame_size; unsigned int requested_rate; unsigned int requested_channels; + unsigned int card; + unsigned int port; int read_status; pthread_mutex_t lock; bool standby; @@ -147,10 +152,15 @@ static const char *supported_bt_cards[] = { "DRA7xxWiLink", }; +static const char *supported_jamr_cards[] = { + "DRA7xx-JAMR3", +}; + #define MAX_CARD_COUNT 10 #define SUPPORTED_IN_DEVICES (AUDIO_DEVICE_IN_BUILTIN_MIC | \ AUDIO_DEVICE_IN_WIRED_HEADSET | \ + AUDIO_DEVICE_IN_LINE | \ AUDIO_DEVICE_IN_DEFAULT) #define SUPPORTED_OUT_DEVICES (AUDIO_DEVICE_OUT_SPEAKER | \ AUDIO_DEVICE_OUT_WIRED_HEADSET | \ @@ -173,6 +183,7 @@ static const char *supported_bt_cards[] = { #define BT_BUFFER_SIZE (BT_PERIOD_SIZE * BT_PERIOD_COUNT) #define MIXER_XML_PATH "/vendor/etc/mixer_paths.xml" +#define JAMR_MIXER_XML_PATH "/vendor/etc/jamr3_mixer_paths.xml" struct pcm_config pcm_config_capture = { .channels = 2, @@ -1295,8 +1306,8 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, if (in->standby) { select_input_device(adev); - ALOGI("in_read() open card %u port %u", adev->card, adev->in_port); - in->pcm = pcm_open(adev->card, adev->in_port, + ALOGI("in_read() open card %u port %u", in->card, in->port); + in->pcm = pcm_open(in->card, in->port, PCM_IN | PCM_MONOTONIC, &in->config); if (!pcm_is_ready(in->pcm)) { @@ -1624,6 +1635,8 @@ static int adev_open_input_stream(struct audio_hw_device *dev, in->remix = NULL; in->resampler = NULL; in->buffer = NULL; + in->card = (devices == AUDIO_DEVICE_IN_LINE) ? adev->jamr_card : adev->card; + in->port = 0; adev->in = in; /* in-place stereo-to-mono remix since capture stream is stereo */ @@ -1721,6 +1734,7 @@ static int adev_close(hw_device_t *device) ALOGI("adev_close()"); audio_route_free(adev->route); + audio_route_free(adev->jamr_route); free(device); return 0; @@ -1778,6 +1792,11 @@ static int adev_open(const hw_module_t* module, const char* name, adev->bt_port = 0; ALOGI("Bluetooth SCO card is hw:%d\n", adev->bt_card); + adev->jamr_card = find_card_index(supported_jamr_cards, + ARRAY_SIZE(supported_jamr_cards)); + adev->jamr_port = 0; + ALOGI("JAMR card is hw:%d\n", adev->jamr_card); + adev->mic_mute = false; adev->in_call = false; adev->mode = AUDIO_MODE_NORMAL; @@ -1785,13 +1804,24 @@ static int adev_open(const hw_module_t* module, const char* name, adev->route = audio_route_init(adev->card, MIXER_XML_PATH); if (!adev->route) { ALOGE("Unable to initialize audio routes"); - free(adev); - return -EINVAL; + goto err1; + } + + adev->jamr_route = audio_route_init(adev->jamr_card, JAMR_MIXER_XML_PATH); + if (!adev->jamr_route) { + ALOGE("Unable to initialize JAMR audio routes"); + goto err2; } *device = &adev->device.common; return 0; + + err2: + audio_route_free(adev->route); + err1: + free(adev); + return -ENODEV; } static 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 @@ <attachedDevices> <item>Speaker</item> <item>Built-In Mic</item> + <item>Line In</item> </attachedDevices> <defaultOutputDevice>Speaker</defaultOutputDevice> @@ -19,7 +20,11 @@ channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/> </mixPort> </mixPorts> - + <mixPort name="line input" role="sink"> + <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" + samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000" + channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/> + </mixPort> <devicePorts> <devicePort tagName="Speaker" type="AUDIO_DEVICE_OUT_SPEAKER" role="sink"> </devicePort> @@ -30,18 +35,17 @@ <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"> </devicePort> + <devicePort tagName="Line In" type="AUDIO_DEVICE_IN_LINE" role="source"> + </devicePort> </devicePorts> <routes> - <route type="mux" sink="Speaker" - sources="primary output"/> - <route type="mux" sink="Wired Headset" - sources="primary output"/> - <route type="mux" sink="Wired Headphones" - sources="primary output"/> + <route type="mux" sink="Speaker" sources="primary output"/> + <route type="mux" sink="Wired Headset" sources="primary output"/> + <route type="mux" sink="Wired Headphones" sources="primary output"/> - <route type="mix" sink="primary input" - sources="Built-In Mic"/> + <route type="mix" sink="primary input" sources="Built-In Mic"/> + <route type="mix" sink="line input" sources="Line In"/> </routes> </module> @@ -14,6 +14,9 @@ # limitations under the License. # +# Audio Post Processing Engine (APPE) +APPE_AUDIO := false + ifeq ($(TARGET_PREBUILT_KERNEL),) LOCAL_KERNEL := $(KERNELDIR)/arch/arm/boot/zImage else @@ -84,6 +87,7 @@ PRODUCT_COPY_FILES += \ device/ti/am57xevm/audio/primary/audio_policy_configuration.xml:system/etc/primary_audio_policy_configuration.xml \ device/ti/am57xevm/audio/audio_policy_configuration.xml:system/etc/audio_policy_configuration.xml + # cpuset configuration PRODUCT_COPY_FILES += \ device/ti/am57xevm/init.am57xevmboard.cpuset.sh:system/bin/init.am57xevmboard.cpuset.sh |