Loading configs/msm8937/audio_policy_configuration_sdm429w.xml +47 −1 Original line number Diff line number Diff line Loading @@ -120,13 +120,34 @@ <devicePort tagName="Speaker Safe" type="AUDIO_DEVICE_OUT_SPEAKER_SAFE" role="sink"> </devicePort> <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/> </devicePort> <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/> </devicePort> <devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/> </devicePort> <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink"> </devicePort> <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink" encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> </devicePort> <devicePort tagName="BT A2DP Headphones" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES" role="sink" encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> </devicePort> <devicePort tagName="BT A2DP Speaker" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER" role="sink" encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> </devicePort> <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"> </devicePort> <devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source"> Loading Loading @@ -156,11 +177,36 @@ sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic"/> <route type="mix" sink="voice_rx" sources="Telephony Rx"/> <route type="mix" sink="BT A2DP Out" sources="primary output,deep_buffer,compressed_offload"/> <route type="mix" sink="BT A2DP Headphones" sources="primary output,deep_buffer,compressed_offload"/> <route type="mix" sink="BT A2DP Speaker" sources="primary output,deep_buffer,compressed_offload"/> </routes> </module> <!-- A2dp Audio HAL --> <xi:include href="/vendor/etc/a2dp_audio_policy_configuration.xml"/> <module name="a2dp" halVersion="2.0"> <mixPorts> <mixPort name="a2dp input" role="sink"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="44100,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/> </mixPort> </mixPorts> <devicePorts> <devicePort tagName="BT A2DP In" type="AUDIO_DEVICE_IN_BLUETOOTH_A2DP" role="source"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="44100,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/> </devicePort> </devicePorts> <routes> <route type="mix" sink="a2dp input" sources="BT A2DP In"/> </routes> </module> <!-- Usb Audio HAL --> <xi:include href="/vendor/etc/usb_audio_policy_configuration.xml"/> Loading hal/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,10 @@ ifeq ($(TARGET_BOARD_AUTO),true) LOCAL_CFLAGS += -DPLATFORM_AUTO endif ifeq ($(TARGET_SUPPORTS_WEARABLES),true) LOCAL_CFLAGS += -DENABLE_HFP_CALIBRATION endif ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DAEMON_SUPPORT)), true) LOCAL_CFLAGS += -DDAEMON_SUPPORT_AUTO endif Loading hal/audio_extn/hfp.c +21 −3 Original line number Diff line number Diff line /* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are Loading Loading @@ -50,6 +50,8 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/ #define AUDIO_PARAMETER_HFP_SET_SAMPLING_RATE "hfp_set_sampling_rate" #define AUDIO_PARAMETER_KEY_HFP_VOLUME "hfp_volume" #define AUDIO_PARAMETER_HFP_PCM_DEV_ID "hfp_pcm_dev_id" #define AUDIO_PARAMETER_HFP_VOL_MIXER_CTL "hfp_vol_mixer_ctl" #define AUDIO_PARAMETER_HFP_VALUE_MAX 128 #define AUDIO_PARAMETER_KEY_HFP_MIC_VOLUME "hfp_mic_volume" #define PLAYBACK_VOLUME_MAX 0x2000 Loading Loading @@ -85,6 +87,7 @@ struct hfp_module { struct pcm *hfp_pcm_tx; bool is_hfp_running; float hfp_volume; char hfp_vol_mixer_ctl[AUDIO_PARAMETER_HFP_VALUE_MAX]; int32_t hfp_pcm_dev_id; audio_usecase_t ucid; float mic_volume; Loading @@ -98,6 +101,7 @@ static struct hfp_module hfpmod = { .hfp_pcm_tx = NULL, .is_hfp_running = 0, .hfp_volume = 0, .hfp_vol_mixer_ctl = {0, }, .hfp_pcm_dev_id = HFP_ASM_RX_TX, .ucid = USECASE_AUDIO_HFP_SCO, .mic_volume = CAPTURE_VOLUME_DEFAULT, Loading Loading @@ -155,7 +159,12 @@ static int32_t hfp_set_volume(struct audio_device *adev, float value) } ALOGD("%s: Setting HFP volume to %d \n", __func__, vol); if (0 == hfpmod.hfp_vol_mixer_ctl[0]) ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); else ctl = mixer_get_ctl_by_name(adev->mixer, hfpmod.hfp_vol_mixer_ctl); if(!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, mixer_ctl_name); Loading Loading @@ -583,6 +592,15 @@ void hfp_set_parameters(struct audio_device *adev, struct str_parms *parms) } } memset(value, 0, sizeof(value)); ret = str_parms_get_str(parms, AUDIO_PARAMETER_HFP_VOL_MIXER_CTL, value, sizeof(value)); if (ret >= 0) { ALOGD("%s: mixer ctl name: %s", __func__, value); strlcpy(hfpmod.hfp_vol_mixer_ctl, value, sizeof(value)); str_parms_del(parms, AUDIO_PARAMETER_HFP_VOL_MIXER_CTL); } memset(value, 0, sizeof(value)); ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_HFP_VOLUME, value, sizeof(value)); Loading hal/audio_extn/utils.c +13 −2 Original line number Diff line number Diff line /* * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2014 The Android Open Source Project Loading Loading @@ -1669,6 +1669,9 @@ int audio_extn_utils_send_app_type_cfg(struct audio_device *adev, num_devices = 1; } break; case PCM_HFP_CALL: rc = audio_extn_utils_send_app_type_cfg_hfp(adev,usecase); return rc; default: ALOGI("%s: not a playback/capture path, no need to cfg app type", __func__); rc = 0; Loading Loading @@ -2040,7 +2043,15 @@ void audio_extn_utils_send_audio_calibration(struct audio_device *adev, } else if (type == PCM_CAPTURE && usecase->stream.in != NULL) { platform_send_audio_calibration(adev->platform, usecase, usecase->stream.in->app_type_cfg.app_type); } else if ((type == PCM_HFP_CALL) || (type == PCM_CAPTURE) || } else if (type == PCM_HFP_CALL) { /* when app type is default. the sample rate is not used to send cal */ #ifdef ENABLE_HFP_CALIBRATION platform_send_audio_calibration_hfp(adev->platform, usecase->in_snd_device); #else platform_send_audio_calibration(adev->platform, usecase, platform_get_default_app_type_v2(adev->platform, usecase->type)); #endif } else if ((type == PCM_CAPTURE) || (type == TRANSCODE_LOOPBACK_RX && usecase->stream.inout != NULL) || (type == ICC_CALL) || (type == SYNTH_LOOPBACK)) { platform_send_audio_calibration(adev->platform, usecase, Loading hal/msm8916/platform.c +6 −0 Original line number Diff line number Diff line Loading @@ -3780,6 +3780,12 @@ int platform_send_audio_calibration(void *platform, struct audio_usecase *usecas return 0; } int platform_send_audio_calibration_hfp(void *platform __unused, snd_device_t snd_device __unused) { return 0; } int platform_switch_voice_call_device_pre(void *platform) { struct platform_data *my_data = (struct platform_data *)platform; Loading Loading
configs/msm8937/audio_policy_configuration_sdm429w.xml +47 −1 Original line number Diff line number Diff line Loading @@ -120,13 +120,34 @@ <devicePort tagName="Speaker Safe" type="AUDIO_DEVICE_OUT_SPEAKER_SAFE" role="sink"> </devicePort> <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/> </devicePort> <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/> </devicePort> <devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/> </devicePort> <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink"> </devicePort> <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink" encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> </devicePort> <devicePort tagName="BT A2DP Headphones" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES" role="sink" encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> </devicePort> <devicePort tagName="BT A2DP Speaker" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER" role="sink" encodedFormats="AUDIO_FORMAT_SBC AUDIO_FORMAT_AAC AUDIO_FORMAT_APTX AUDIO_FORMAT_APTX_HD AUDIO_FORMAT_LDAC AUDIO_FORMAT_CELT AUDIO_FORMAT_APTX_ADAPTIVE"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/> </devicePort> <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"> </devicePort> <devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source"> Loading Loading @@ -156,11 +177,36 @@ sources="Built-In Mic,Built-In Back Mic,BT SCO Headset Mic"/> <route type="mix" sink="voice_rx" sources="Telephony Rx"/> <route type="mix" sink="BT A2DP Out" sources="primary output,deep_buffer,compressed_offload"/> <route type="mix" sink="BT A2DP Headphones" sources="primary output,deep_buffer,compressed_offload"/> <route type="mix" sink="BT A2DP Speaker" sources="primary output,deep_buffer,compressed_offload"/> </routes> </module> <!-- A2dp Audio HAL --> <xi:include href="/vendor/etc/a2dp_audio_policy_configuration.xml"/> <module name="a2dp" halVersion="2.0"> <mixPorts> <mixPort name="a2dp input" role="sink"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="44100,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/> </mixPort> </mixPorts> <devicePorts> <devicePort tagName="BT A2DP In" type="AUDIO_DEVICE_IN_BLUETOOTH_A2DP" role="source"> <profile name="" format="AUDIO_FORMAT_PCM_16_BIT" samplingRates="44100,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/> </devicePort> </devicePorts> <routes> <route type="mix" sink="a2dp input" sources="BT A2DP In"/> </routes> </module> <!-- Usb Audio HAL --> <xi:include href="/vendor/etc/usb_audio_policy_configuration.xml"/> Loading
hal/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,10 @@ ifeq ($(TARGET_BOARD_AUTO),true) LOCAL_CFLAGS += -DPLATFORM_AUTO endif ifeq ($(TARGET_SUPPORTS_WEARABLES),true) LOCAL_CFLAGS += -DENABLE_HFP_CALIBRATION endif ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DAEMON_SUPPORT)), true) LOCAL_CFLAGS += -DDAEMON_SUPPORT_AUTO endif Loading
hal/audio_extn/hfp.c +21 −3 Original line number Diff line number Diff line /* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. /* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are Loading Loading @@ -50,6 +50,8 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/ #define AUDIO_PARAMETER_HFP_SET_SAMPLING_RATE "hfp_set_sampling_rate" #define AUDIO_PARAMETER_KEY_HFP_VOLUME "hfp_volume" #define AUDIO_PARAMETER_HFP_PCM_DEV_ID "hfp_pcm_dev_id" #define AUDIO_PARAMETER_HFP_VOL_MIXER_CTL "hfp_vol_mixer_ctl" #define AUDIO_PARAMETER_HFP_VALUE_MAX 128 #define AUDIO_PARAMETER_KEY_HFP_MIC_VOLUME "hfp_mic_volume" #define PLAYBACK_VOLUME_MAX 0x2000 Loading Loading @@ -85,6 +87,7 @@ struct hfp_module { struct pcm *hfp_pcm_tx; bool is_hfp_running; float hfp_volume; char hfp_vol_mixer_ctl[AUDIO_PARAMETER_HFP_VALUE_MAX]; int32_t hfp_pcm_dev_id; audio_usecase_t ucid; float mic_volume; Loading @@ -98,6 +101,7 @@ static struct hfp_module hfpmod = { .hfp_pcm_tx = NULL, .is_hfp_running = 0, .hfp_volume = 0, .hfp_vol_mixer_ctl = {0, }, .hfp_pcm_dev_id = HFP_ASM_RX_TX, .ucid = USECASE_AUDIO_HFP_SCO, .mic_volume = CAPTURE_VOLUME_DEFAULT, Loading Loading @@ -155,7 +159,12 @@ static int32_t hfp_set_volume(struct audio_device *adev, float value) } ALOGD("%s: Setting HFP volume to %d \n", __func__, vol); if (0 == hfpmod.hfp_vol_mixer_ctl[0]) ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); else ctl = mixer_get_ctl_by_name(adev->mixer, hfpmod.hfp_vol_mixer_ctl); if(!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, mixer_ctl_name); Loading Loading @@ -583,6 +592,15 @@ void hfp_set_parameters(struct audio_device *adev, struct str_parms *parms) } } memset(value, 0, sizeof(value)); ret = str_parms_get_str(parms, AUDIO_PARAMETER_HFP_VOL_MIXER_CTL, value, sizeof(value)); if (ret >= 0) { ALOGD("%s: mixer ctl name: %s", __func__, value); strlcpy(hfpmod.hfp_vol_mixer_ctl, value, sizeof(value)); str_parms_del(parms, AUDIO_PARAMETER_HFP_VOL_MIXER_CTL); } memset(value, 0, sizeof(value)); ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_HFP_VOLUME, value, sizeof(value)); Loading
hal/audio_extn/utils.c +13 −2 Original line number Diff line number Diff line /* * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2014 The Android Open Source Project Loading Loading @@ -1669,6 +1669,9 @@ int audio_extn_utils_send_app_type_cfg(struct audio_device *adev, num_devices = 1; } break; case PCM_HFP_CALL: rc = audio_extn_utils_send_app_type_cfg_hfp(adev,usecase); return rc; default: ALOGI("%s: not a playback/capture path, no need to cfg app type", __func__); rc = 0; Loading Loading @@ -2040,7 +2043,15 @@ void audio_extn_utils_send_audio_calibration(struct audio_device *adev, } else if (type == PCM_CAPTURE && usecase->stream.in != NULL) { platform_send_audio_calibration(adev->platform, usecase, usecase->stream.in->app_type_cfg.app_type); } else if ((type == PCM_HFP_CALL) || (type == PCM_CAPTURE) || } else if (type == PCM_HFP_CALL) { /* when app type is default. the sample rate is not used to send cal */ #ifdef ENABLE_HFP_CALIBRATION platform_send_audio_calibration_hfp(adev->platform, usecase->in_snd_device); #else platform_send_audio_calibration(adev->platform, usecase, platform_get_default_app_type_v2(adev->platform, usecase->type)); #endif } else if ((type == PCM_CAPTURE) || (type == TRANSCODE_LOOPBACK_RX && usecase->stream.inout != NULL) || (type == ICC_CALL) || (type == SYNTH_LOOPBACK)) { platform_send_audio_calibration(adev->platform, usecase, Loading
hal/msm8916/platform.c +6 −0 Original line number Diff line number Diff line Loading @@ -3780,6 +3780,12 @@ int platform_send_audio_calibration(void *platform, struct audio_usecase *usecas return 0; } int platform_send_audio_calibration_hfp(void *platform __unused, snd_device_t snd_device __unused) { return 0; } int platform_switch_voice_call_device_pre(void *platform) { struct platform_data *my_data = (struct platform_data *)platform; Loading