audio-hal: enable low latency support for playback and record usecase with voice comm usage

Enable low latency support for phone bus playback and record usecase
with voice comm usage for 8, 16, 24, 32 and 48KHz sample rates

Change-Id: I11c85989176dd6db71f56399f0f17acef99ebca8
Signed-off-by: Kogara Naveen Kumar <quic_nkogara@quicinc.com>
This commit is contained in:
Kogara Naveen Kumar 2022-10-14 16:41:04 +05:30 committed by sasevs
parent 6c0065a3b0
commit 65828fec76
16 changed files with 141 additions and 14 deletions

View File

@ -108,7 +108,28 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="phone" role="source">
<mixPort name="phone" role="source"
flags="AUDIO_OUTPUT_FLAG_PRIMARY">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_8k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_16k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="16000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_24k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="24000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_32k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="32000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_48k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
@ -345,7 +366,7 @@
<route type="mix" sink="Nav Guidance Bus"
sources="nav_guidance,mmap_no_irq_out"/>
<route type="mix" sink="Phone Bus"
sources="phone,mmap_no_irq_out"/>
sources="phone,carplay_8k_phone,carplay_16k_phone,carplay_24k_phone,carplay_32k_phone,carplay_48k_phone,mmap_no_irq_out"/>
<route type="mix" sink="Alerts Bus"
sources="alerts"/>
<route type="mix" sink="Front Passenger Bus"

View File

@ -173,4 +173,11 @@ inputs {
bit_width 24
app_type 69942
}
voip_tx {
flags AUDIO_INPUT_FLAG_VOIP_TX
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 8000|16000|24000|32000|48000
bit_width 16
app_type 69938
}
}

View File

@ -108,6 +108,7 @@
<usecase name="USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION" type="out" id="9" fe="4"/>
<usecase name="USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE" type="out" id="1" fe="1"/>
<usecase name="USECASE_AUDIO_PLAYBACK_PHONE" type="out" id="12" fe="9"/>
<usecase name="USECASE_AUDIO_PLAYBACK_PHONE_LL" type="out" id="12" fe="9"/>
<usecase name="USECASE_AUDIO_PLAYBACK_ALERTS" type="out" id="59" fe="30"/>
<usecase name="USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER" type="out" id="55" fe="22"/>
<usecase name="USECASE_AUDIO_PLAYBACK_REAR_SEAT" type="out" id="54" fe="21"/>

View File

@ -103,7 +103,28 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="phone" role="source">
<mixPort name="phone" role="source"
flags="AUDIO_OUTPUT_FLAG_PRIMARY">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_8k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_16k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="16000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_24k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="24000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_32k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="32000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_48k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
@ -474,7 +495,7 @@
<route type="mix" sink="Nav Guidance Bus"
sources="nav_guidance,mmap_no_irq_out"/>
<route type="mix" sink="Phone Bus"
sources="phone,mmap_no_irq_out"/>
sources="phone,mmap_no_irq_out,carplay_8k_phone,carplay_16k_phone,carplay_24k_phone,carplay_32k_phone,carplay_48k_phone"/>
<route type="mix" sink="Alerts Bus"
sources="alerts"/>
<route type="mix" sink="Front Passenger Bus"

View File

@ -312,6 +312,11 @@
<ctl name="TERT_TDM_RX_2 Audio Mixer MultiMedia10" value="1" />
</path>
<path name="phone-playback-ll phone-bus-out">
<ctl name="TERT_TDM_RX_2 Channels" value="One" />
<ctl name="TERT_TDM_RX_2 Audio Mixer MultiMedia10" value="1" />
</path>
<path name="alerts-playback alerts-bus-out">
<ctl name="TERT_TDM_RX_0 Channels" value="Six" />
<ctl name="TERT_TDM_RX_0 Audio Mixer MultiMedia31" value="1" />
@ -394,6 +399,11 @@
<ctl name="MultiMedia8 Mixer TERT_TDM_TX_0" value="1" />
</path>
<path name="audio-record-voip">
<ctl name="TERT_TDM_TX_0 Channels" value="One" />
<ctl name="MultiMedia10 Mixer TERT_TDM_TX_0" value="1" />
</path>
<path name="low-latency-record headset-mic">
<ctl name="TERT_TDM_TX_0 Channels" value="One" />
<ctl name="MultiMedia8 Mixer TERT_TDM_TX_0" value="1" />

View File

@ -172,4 +172,11 @@ inputs {
bit_width 32
app_type 69949
}
voip_tx {
flags AUDIO_INPUT_FLAG_VOIP_TX
formats AUDIO_FORMAT_PCM_16_BIT
sampling_rates 8000|16000|24000|32000|48000
bit_width 16
app_type 69938
}
}

View File

@ -108,6 +108,7 @@
<usecase name="USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION" type="out" id="9" fe="4"/>
<usecase name="USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE" type="out" id="1" fe="1"/>
<usecase name="USECASE_AUDIO_PLAYBACK_PHONE" type="out" id="12" fe="9"/>
<usecase name="USECASE_AUDIO_PLAYBACK_PHONE_LL" type="out" id="12" fe="9"/>
<usecase name="USECASE_AUDIO_PLAYBACK_ALERTS" type="out" id="59" fe="30"/>
<usecase name="USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER" type="out" id="55" fe="22"/>
<usecase name="USECASE_AUDIO_PLAYBACK_REAR_SEAT" type="out" id="54" fe="21"/>

View File

@ -103,7 +103,28 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="phone" role="source">
<mixPort name="phone" role="source"
flags="AUDIO_OUTPUT_FLAG_PRIMARY">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_8k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_16k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="16000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_24k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="24000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_32k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="32000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
<mixPort name="carplay_48k_phone" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
@ -469,7 +490,7 @@
<route type="mix" sink="Nav Guidance Bus"
sources="nav_guidance,mmap_no_irq_out"/>
<route type="mix" sink="Phone Bus"
sources="phone,mmap_no_irq_out"/>
sources="phone,mmap_no_irq_out,carplay_8k_phone,carplay_16k_phone,carplay_24k_phone,carplay_32k_phone,carplay_48k_phone"/>
<route type="mix" sink="Alerts Bus"
sources="alerts"/>
<route type="mix" sink="Front Passenger Bus"

View File

@ -282,6 +282,11 @@
<ctl name="TERT_TDM_RX_2 Audio Mixer MultiMedia10" value="1" />
</path>
<path name="phone-playback-ll phone-bus-out">
<ctl name="TERT_TDM_RX_2 Channels" value="One" />
<ctl name="TERT_TDM_RX_2 Audio Mixer MultiMedia10" value="1" />
</path>
<path name="alerts-playback alerts-bus-out">
<ctl name="TERT_TDM_RX_0 Channels" value="Six" />
<ctl name="TERT_TDM_RX_0 Audio Mixer MultiMedia31" value="1" />
@ -344,6 +349,11 @@
<ctl name="MultiMedia8 Mixer TERT_TDM_TX_0" value="1" />
</path>
<path name="audio-record-voip">
<ctl name="TERT_TDM_TX_0 Channels" value="One" />
<ctl name="MultiMedia10 Mixer TERT_TDM_TX_0" value="1" />
</path>
<path name="low-latency-record capture-fm">
<ctl name="TERT_TDM_TX_0 Channels" value="One" />
<ctl name="MultiMedia8 Mixer TERT_TDM_TX_0" value="1" />

View File

@ -25,6 +25,10 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#define LOG_TAG "auto_hal_extn"
/*#define LOG_NDEBUG 0*/
@ -432,7 +436,13 @@ int auto_hal_open_output_stream(struct stream_out *out)
out->volume_l = out->volume_r = MAX_VOLUME_GAIN;
break;
case CAR_AUDIO_STREAM_PHONE:
out->usecase = USECASE_AUDIO_PLAYBACK_PHONE;
if (out->flags == AUDIO_OUTPUT_FLAG_PRIMARY) {
out->usecase = USECASE_AUDIO_PLAYBACK_PHONE;
out->flags = AUDIO_OUTPUT_FLAG_PHONE;
}
else if (out->flags == AUDIO_OUTPUT_FLAG_NONE) {
out->usecase = USECASE_AUDIO_PLAYBACK_PHONE_LL;
}
switch(out->sample_rate)
{
case 48000:
@ -1072,6 +1082,7 @@ snd_device_t auto_hal_get_output_snd_device(struct audio_device *adev,
snd_device = SND_DEVICE_OUT_BUS_NAV;
break;
case USECASE_AUDIO_PLAYBACK_PHONE:
case USECASE_AUDIO_PLAYBACK_PHONE_LL:
snd_device = SND_DEVICE_OUT_BUS_PHN;
break;
case USECASE_AUDIO_PLAYBACK_ALERTS:

View File

@ -15,6 +15,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Not a contribution.
*/
#include <audio_hw.h>
#include "platform.h"
@ -115,6 +118,7 @@ static const audio_usecase_t bus_device_usecases[] = {
USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION,
USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE,
USECASE_AUDIO_PLAYBACK_PHONE,
USECASE_AUDIO_PLAYBACK_PHONE_LL,
USECASE_AUDIO_PLAYBACK_ALERTS,
USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER,
USECASE_AUDIO_PLAYBACK_REAR_SEAT,

View File

@ -25,6 +25,10 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#define LOG_TAG "audio_ext_hw_plugin"
@ -199,6 +203,7 @@ static int32_t ext_hw_plugin_check_plugin_usecase(audio_usecase_t hal_usecase,
*plugin_usecase = AUDIO_HAL_PLUGIN_USECASE_DRIVER_SIDE_PLAYBACK;
break;
case USECASE_AUDIO_PLAYBACK_PHONE:
case USECASE_AUDIO_PLAYBACK_PHONE_LL:
*plugin_usecase = AUDIO_HAL_PLUGIN_USECASE_PHONE_PLAYBACK;
break;
case USECASE_AUDIO_FM_TUNER_EXT:

View File

@ -15,6 +15,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Not a contribution.
*/
#define LOG_TAG "audio_hw_utils"
@ -943,10 +946,6 @@ void audio_extn_utils_update_stream_app_type_cfg_for_usecase(
ALOGV("%s Selected apptype: %d", __func__, usecase->stream.out->app_type_cfg.app_type);
break;
case PCM_CAPTURE:
if (usecase->id == USECASE_AUDIO_RECORD_VOIP
|| usecase->id == USECASE_AUDIO_RECORD_VOIP_LOW_LATENCY)
usecase->stream.in->app_type_cfg.app_type = APP_TYPE_VOIP_AUDIO;
else
audio_extn_utils_update_stream_input_app_type_cfg(adev->platform,
&adev->streams_input_cfg_list,
&usecase->stream.in->device_list,

View File

@ -494,6 +494,7 @@ const char * const use_case_table[AUDIO_USECASE_MAX] = {
[USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION] = "sys-notification-playback",
[USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE] = "nav-guidance-playback",
[USECASE_AUDIO_PLAYBACK_PHONE] = "phone-playback",
[USECASE_AUDIO_PLAYBACK_PHONE_LL] = "phone-playback-ll",
[USECASE_AUDIO_PLAYBACK_ALERTS] = "alerts-playback",
[USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER] = "front-passenger-playback",
[USECASE_AUDIO_PLAYBACK_REAR_SEAT] = "rear-seat-playback",
@ -8892,8 +8893,8 @@ int adev_open_output_stream(struct audio_hw_device *dev,
out->hal_op_format, out->sample_rate,
out->bit_width, out->channel_mask, out->profile,
&out->app_type_cfg);
if ((out->usecase == (audio_usecase_t)(GET_USECASE_AUDIO_PLAYBACK_PRIMARY(use_db_as_primary))) ||
(flags & AUDIO_OUTPUT_FLAG_PRIMARY)) {
if (((out->usecase == (audio_usecase_t)(GET_USECASE_AUDIO_PLAYBACK_PRIMARY(use_db_as_primary))) ||
(flags & AUDIO_OUTPUT_FLAG_PRIMARY)) && (!compare_device_type(&out->device_list, AUDIO_DEVICE_OUT_BUS))) {
/* Ensure the default output is not selected twice */
if(adev->primary_output == NULL)
adev->primary_output = out;

View File

@ -36,7 +36,7 @@
* Changes from Qualcomm Innovation Center are provided under the following license:
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
@ -302,6 +302,7 @@ enum {
USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION,
USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE,
USECASE_AUDIO_PLAYBACK_PHONE,
USECASE_AUDIO_PLAYBACK_PHONE_LL,
USECASE_AUDIO_PLAYBACK_ALERTS,
USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER,
USECASE_AUDIO_PLAYBACK_REAR_SEAT,

View File

@ -15,6 +15,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Not a contribution.
*/
#define LOG_TAG "msm8974_platform"
@ -579,6 +582,8 @@ static int pcm_device_table[AUDIO_USECASE_MAX][4] = {
MSM_FRONTEND_DAI_MULTIMEDIA2, MSM_FRONTEND_DAI_MULTIMEDIA2},
[USECASE_AUDIO_PLAYBACK_PHONE] = {PHONE_PCM_DEVICE, PHONE_PCM_DEVICE,
MSM_FRONTEND_DAI_MULTIMEDIA10, MSM_FRONTEND_DAI_MULTIMEDIA10},
[USECASE_AUDIO_PLAYBACK_PHONE_LL] = {PHONE_PCM_DEVICE, PHONE_PCM_DEVICE,
MSM_FRONTEND_DAI_MULTIMEDIA10, MSM_FRONTEND_DAI_MULTIMEDIA10},
[USECASE_AUDIO_PLAYBACK_ALERTS] = {ALERTS_PCM_DEVICE, ALERTS_PCM_DEVICE,
MSM_FRONTEND_DAI_MULTIMEDIA31, MSM_FRONTEND_DAI_MULTIMEDIA31},
[USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER] = {FRONT_PASSENGER_PCM_DEVICE, FRONT_PASSENGER_PCM_DEVICE,
@ -1524,6 +1529,7 @@ static struct name_to_index usecase_name_index[AUDIO_USECASE_MAX] = {
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_PHONE)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_PHONE_LL)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_ALERTS)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER)},
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_REAR_SEAT)},
@ -9332,6 +9338,7 @@ int64_t platform_render_latency(struct stream_out *out)
case USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION:
case USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER:
case USECASE_AUDIO_PLAYBACK_PHONE:
case USECASE_AUDIO_PLAYBACK_PHONE_LL:
case USECASE_AUDIO_PLAYBACK_ALERTS:
delay = LOW_LATENCY_PLATFORM_DELAY;
break;