From f6990bb34966422454fce7c8dccb1871046a840b Mon Sep 17 00:00:00 2001 From: Manisha Agarwal Date: Thu, 30 Jan 2020 16:33:37 +0530 Subject: [PATCH] dsp: Bit rate mode support for aac codec Add variable bit rate mode support for aac codec. Change-Id: Iedd9fe0df2d3a12e3d4e6c2916305399da10873f Signed-off-by: Manisha Agarwal --- dsp/q6afe.c | 27 ++++++++++++++++++++++++++- include/dsp/apr_audio-v2.h | 3 ++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/dsp/q6afe.c b/dsp/q6afe.c index 80f6589eab9c..1a1e87604a26 100644 --- a/dsp/q6afe.c +++ b/dsp/q6afe.c @@ -3980,6 +3980,7 @@ static int q6afe_send_enc_config(u16 port_id, struct asm_aptx_ad_speech_mode_cfg_t speech_codec_init_param; struct param_hdr_v3 param_hdr; int ret; + uint32_t frame_size_ctl_value_v2; pr_debug("%s:update DSP for enc format = %d\n", __func__, format); @@ -4067,8 +4068,9 @@ static int q6afe_send_enc_config(u16 port_id, frame_ctl_param.ctl_type = enc_blk_param. enc_blk_config.aac_config.frame_ctl.ctl_type; frame_ctl_param.ctl_value = frame_size_ctl_value; + pr_debug("%s: send AFE_PARAM_ID_AAC_FRM_SIZE_CONTROL\n", - __func__); + __func__); ret = q6afe_pack_and_set_param_in_band(port_id, q6audio_get_port_index(port_id), param_hdr, @@ -4079,6 +4081,29 @@ static int q6afe_send_enc_config(u16 port_id, goto exit; } } + frame_size_ctl_value_v2 = enc_blk_param.enc_blk_config. + aac_config.frame_ctl_v2.ctl_value; + if (frame_size_ctl_value_v2 > 0) { + param_hdr.param_id = + AFE_PARAM_ID_AAC_FRM_SIZE_CONTROL; + param_hdr.param_size = sizeof(frame_ctl_param); + frame_ctl_param.ctl_type = enc_blk_param. + enc_blk_config.aac_config.frame_ctl_v2.ctl_type; + frame_ctl_param.ctl_value = enc_blk_param. + enc_blk_config.aac_config.frame_ctl_v2.ctl_value; + + pr_debug("%s: send AFE_PARAM_ID_AAC_FRM_SIZE_CONTROL V2\n", + __func__); + ret = q6afe_pack_and_set_param_in_band(port_id, + q6audio_get_port_index(port_id), + param_hdr, + (u8 *) &frame_ctl_param); + if (ret) { + pr_err("%s: AAC_FRM_SIZE_CONTROL with VBR support failed %d\n", + __func__, ret); + goto exit; + } + } } if (format == ASM_MEDIA_FMT_APTX) { diff --git a/include/dsp/apr_audio-v2.h b/include/dsp/apr_audio-v2.h index 0fcc76ae842a..90b0383fe9a6 100644 --- a/include/dsp/apr_audio-v2.h +++ b/include/dsp/apr_audio-v2.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ @@ -4338,6 +4338,7 @@ struct asm_aac_frame_size_control_t { struct asm_aac_enc_cfg_t { struct asm_aac_enc_cfg_v2_t aac_cfg; struct asm_aac_frame_size_control_t frame_ctl; + struct asm_aac_frame_size_control_t frame_ctl_v2; } __packed; /* FMT ID for apt-X Classic */