Merge "asoc: Add support for Aptx Adaptive decoder"

This commit is contained in:
Linux Build Service Account
2019-02-27 01:15:33 -08:00
committed by Gerrit - the friendly Code Review server
3 changed files with 141 additions and 18 deletions

View File

@@ -75,6 +75,11 @@ enum {
Q6AFE_MSM_SPKR_FTM_MODE
};
enum {
APTX_AD_48 = 0,
APTX_AD_44_1 = 1
};
struct wlock {
struct wakeup_source ws;
};
@@ -3564,6 +3569,29 @@ static int q6afe_send_dec_config(u16 port_id,
goto exit;
}
break;
case ASM_MEDIA_FMT_APTX_ADAPTIVE:
if (!cfg->abr_dec_cfg.is_abr_enabled) {
pr_debug("%s: sending aptx adaptive congestion buffer size to dsp\n",
__func__);
param_hdr.param_id =
AFE_DECODER_PARAM_ID_CONGESTION_BUFFER_SIZE;
param_hdr.param_size =
sizeof(struct avs_dec_congestion_buffer_param_t);
dec_buffer_id_param.version = 0;
dec_buffer_id_param.max_nr_buffers = 226;
dec_buffer_id_param.pre_buffer_size = 226;
ret = q6afe_pack_and_set_param_in_band(port_id,
q6audio_get_port_index(port_id),
param_hdr,
(u8 *) &dec_buffer_id_param);
if (ret) {
pr_err("%s: aptx adaptive congestion buffer size for port 0x%x failed %d\n",
__func__, port_id, ret);
goto exit;
}
break;
}
/* fall through for abr enabled case */
default:
pr_debug("%s:sending AFE_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION to DSP payload\n",
__func__);
@@ -3584,7 +3612,7 @@ static int q6afe_send_dec_config(u16 port_id,
break;
}
pr_debug("%s:Sending AFE_API_VERSION_PORT_MEDIA_TYPE to DSP", __func__);
pr_debug("%s: Send AFE_API_VERSION_PORT_MEDIA_TYPE to DSP\n", __func__);
param_hdr.module_id = AFE_MODULE_PORT;
param_hdr.param_id = AFE_PARAM_ID_PORT_MEDIA_TYPE;
param_hdr.param_size = sizeof(struct afe_port_media_type_t);
@@ -3598,6 +3626,15 @@ static int q6afe_send_dec_config(u16 port_id,
media_type.sample_rate =
cfg->data.sbc_config.sample_rate;
break;
case ASM_MEDIA_FMT_APTX_ADAPTIVE:
if (!cfg->abr_dec_cfg.is_abr_enabled) {
media_type.sample_rate =
(cfg->data.aptx_ad_config.sample_rate == APTX_AD_44_1) ?
AFE_PORT_SAMPLE_RATE_44_1K :
AFE_PORT_SAMPLE_RATE_48K;
break;
}
/* fall through for abr enabled case */
default:
media_type.sample_rate =
afe_config.slim_sch.sample_rate;
@@ -3623,11 +3660,19 @@ static int q6afe_send_dec_config(u16 port_id,
goto exit;
}
if (format != ASM_MEDIA_FMT_SBC && format != ASM_MEDIA_FMT_AAC_V2) {
if (format != ASM_MEDIA_FMT_SBC && format != ASM_MEDIA_FMT_AAC_V2 &&
format != ASM_MEDIA_FMT_APTX_ADAPTIVE) {
pr_debug("%s:Unsuppported dec format. Ignore AFE config %u\n",
__func__, format);
goto exit;
}
if (format == ASM_MEDIA_FMT_APTX_ADAPTIVE &&
cfg->abr_dec_cfg.is_abr_enabled) {
pr_debug("%s: Ignore AFE config for abr case\n", __func__);
goto exit;
}
pr_debug("%s: sending AFE_DECODER_PARAM_ID_DEC_MEDIA_FMT to DSP payload\n",
__func__);
param_hdr.module_id = AFE_MODULE_ID_DECODER;
@@ -3646,9 +3691,10 @@ static int q6afe_send_dec_config(u16 port_id,
switch (cfg->format) {
case ASM_MEDIA_FMT_AAC_V2:
case ASM_MEDIA_FMT_APTX_ADAPTIVE:
param_hdr.param_size = sizeof(struct afe_dec_media_fmt_t);
pr_debug("%s:send AFE_DECODER_PARAM_ID DEC_MEDIA_FMT to DSP payload\n",
pr_debug("%s:send AVS_DECODER_PARAM_ID DEC_MEDIA_FMT to DSP payload\n",
__func__);
param_hdr.param_id = AVS_DECODER_PARAM_ID_DEC_MEDIA_FMT;
dec_media_fmt.dec_media_config = cfg->data;
@@ -3657,7 +3703,7 @@ static int q6afe_send_dec_config(u16 port_id,
param_hdr,
(u8 *) &dec_media_fmt);
if (ret) {
pr_err("%s: AFE_DECODER_PARAM_ID DEC_MEDIA_FMT for port 0x%x failed %d\n",
pr_err("%s: AVS_DECODER_PARAM_ID DEC_MEDIA_FMT for port 0x%x failed %d\n",
__func__, port_id, ret);
goto exit;
}