Merge "asoc: dsp: add support for aptX adaptive"
This commit is contained in:
commit
f205f9ccd7
3 changed files with 72 additions and 6 deletions
|
@ -56,6 +56,7 @@ enum {
|
|||
ENC_FMT_APTX_HD = ASM_MEDIA_FMT_APTX_HD,
|
||||
ENC_FMT_CELT = ASM_MEDIA_FMT_CELT,
|
||||
ENC_FMT_LDAC = ASM_MEDIA_FMT_LDAC,
|
||||
ENC_FMT_APTX_ADAPTIVE = ASM_MEDIA_FMT_APTX_ADAPTIVE,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -2445,6 +2446,11 @@ static int msm_dai_q6_afe_enc_cfg_get(struct snd_kcontrol *kcontrol,
|
|||
&dai_data->enc_config.data,
|
||||
sizeof(struct asm_ldac_enc_cfg_t));
|
||||
break;
|
||||
case ENC_FMT_APTX_ADAPTIVE:
|
||||
memcpy(ucontrol->value.bytes.data + format_size,
|
||||
&dai_data->enc_config.data,
|
||||
sizeof(struct asm_aptx_ad_enc_cfg_t));
|
||||
break;
|
||||
default:
|
||||
pr_debug("%s: unknown format = %d\n",
|
||||
__func__, dai_data->enc_config.format);
|
||||
|
@ -2503,6 +2509,11 @@ static int msm_dai_q6_afe_enc_cfg_put(struct snd_kcontrol *kcontrol,
|
|||
ucontrol->value.bytes.data + format_size,
|
||||
sizeof(struct asm_ldac_enc_cfg_t));
|
||||
break;
|
||||
case ENC_FMT_APTX_ADAPTIVE:
|
||||
memcpy(&dai_data->enc_config.data,
|
||||
ucontrol->value.bytes.data + format_size,
|
||||
sizeof(struct asm_aptx_ad_enc_cfg_t));
|
||||
break;
|
||||
default:
|
||||
pr_debug("%s: Ignore enc config for unknown format = %d\n",
|
||||
__func__, dai_data->enc_config.format);
|
||||
|
|
40
dsp/q6afe.c
40
dsp/q6afe.c
|
@ -3178,7 +3178,10 @@ static int q6afe_send_dec_config(u16 port_id,
|
|||
param_hdr.param_id = AFE_DECODER_PARAM_ID_DEPACKETIZER_ID;
|
||||
param_hdr.param_size = sizeof(struct avs_dec_depacketizer_id_param_t);
|
||||
dec_depkt_id_param.dec_depacketizer_id =
|
||||
AFE_MODULE_ID_DEPACKETIZER_COP;
|
||||
AFE_MODULE_ID_DEPACKETIZER_COP;
|
||||
if (cfg->format == ASM_MEDIA_FMT_APTX_ADAPTIVE)
|
||||
dec_depkt_id_param.dec_depacketizer_id =
|
||||
AFE_MODULE_ID_DEPACKETIZER_COP_V1;
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
param_hdr,
|
||||
|
@ -3237,6 +3240,7 @@ static int q6afe_send_enc_config(u16 port_id,
|
|||
u32 enc_fmt;
|
||||
struct afe_enc_cfg_blk_param_t enc_blk_param;
|
||||
struct afe_param_id_aptx_sync_mode sync_mode_param;
|
||||
struct afe_id_aptx_adaptive_enc_init aptx_adaptive_enc_init;
|
||||
struct avs_enc_packetizer_id_param_t enc_pkt_id_param;
|
||||
struct avs_enc_set_scrambler_param_t enc_set_scrambler_param;
|
||||
struct afe_enc_level_to_bitrate_map_param_t map_param;
|
||||
|
@ -3249,6 +3253,7 @@ static int q6afe_send_enc_config(u16 port_id,
|
|||
|
||||
memset(&enc_blk_param, 0, sizeof(enc_blk_param));
|
||||
memset(&sync_mode_param, 0, sizeof(sync_mode_param));
|
||||
memset(&aptx_adaptive_enc_init, 0, sizeof(aptx_adaptive_enc_init));
|
||||
memset(&enc_pkt_id_param, 0, sizeof(enc_pkt_id_param));
|
||||
memset(&enc_set_scrambler_param, 0, sizeof(enc_set_scrambler_param));
|
||||
memset(&map_param, 0, sizeof(map_param));
|
||||
|
@ -3257,8 +3262,9 @@ static int q6afe_send_enc_config(u16 port_id,
|
|||
memset(¶m_hdr, 0, sizeof(param_hdr));
|
||||
|
||||
if (format != ASM_MEDIA_FMT_SBC && format != ASM_MEDIA_FMT_AAC_V2 &&
|
||||
format != ASM_MEDIA_FMT_APTX && format != ASM_MEDIA_FMT_APTX_HD &&
|
||||
format != ASM_MEDIA_FMT_CELT && format != ASM_MEDIA_FMT_LDAC) {
|
||||
format != ASM_MEDIA_FMT_APTX && format != ASM_MEDIA_FMT_APTX_HD &&
|
||||
format != ASM_MEDIA_FMT_CELT && format != ASM_MEDIA_FMT_LDAC &&
|
||||
format != ASM_MEDIA_FMT_APTX_ADAPTIVE) {
|
||||
pr_err("%s:Unsuppported format Ignore AFE config\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
@ -3324,7 +3330,25 @@ static int q6afe_send_enc_config(u16 port_id,
|
|||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (format == ASM_MEDIA_FMT_APTX_ADAPTIVE) {
|
||||
pr_debug("%s: sending AFE_ID_APTX_ADAPTIVE_ENC_INIT to DSP\n",
|
||||
__func__);
|
||||
param_hdr.param_id = AFE_ID_APTX_ADAPTIVE_ENC_INIT;
|
||||
param_hdr.param_size =
|
||||
sizeof(struct afe_id_aptx_adaptive_enc_init);
|
||||
aptx_adaptive_enc_init =
|
||||
enc_blk_param.enc_blk_config.aptx_ad_config.
|
||||
aptx_ad_cfg;
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
param_hdr,
|
||||
(u8 *) &aptx_adaptive_enc_init);
|
||||
if (ret) {
|
||||
pr_err("%s: AFE_ID_APTX_ADAPTIVE_ENC_INIT for port 0x%x failed %d\n",
|
||||
__func__, port_id, ret);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
pr_debug("%s:sending AFE_ENCODER_PARAM_ID_PACKETIZER to DSP\n",
|
||||
__func__);
|
||||
param_hdr.param_id = AFE_ENCODER_PARAM_ID_PACKETIZER_ID;
|
||||
|
@ -3355,7 +3379,7 @@ static int q6afe_send_enc_config(u16 port_id,
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (format == ASM_MEDIA_FMT_LDAC) {
|
||||
if (format == ASM_MEDIA_FMT_LDAC || format == ASM_MEDIA_FMT_APTX_ADAPTIVE) {
|
||||
pr_debug("%s:sending AFE_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP to DSP payload",
|
||||
__func__);
|
||||
param_hdr.param_id = AFE_ENCODER_PARAM_ID_BIT_RATE_LEVEL_MAP;
|
||||
|
@ -3379,7 +3403,11 @@ static int q6afe_send_enc_config(u16 port_id,
|
|||
AFE_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION;
|
||||
param_hdr.param_size =
|
||||
sizeof(struct afe_enc_dec_imc_info_param_t);
|
||||
imc_info_param.imc_info =
|
||||
if (format == ASM_MEDIA_FMT_APTX_ADAPTIVE)
|
||||
imc_info_param.imc_info =
|
||||
cfg->aptx_ad_config.abr_cfg.imc_info;
|
||||
else
|
||||
imc_info_param.imc_info =
|
||||
cfg->ldac_config.abr_config.imc_info;
|
||||
ret = q6afe_pack_and_set_param_in_band(port_id,
|
||||
q6audio_get_port_index(port_id),
|
||||
|
|
|
@ -3439,6 +3439,21 @@ struct afe_param_id_aptx_sync_mode {
|
|||
uint32_t sync_mode;
|
||||
} __packed;
|
||||
|
||||
#define AFE_ID_APTX_ADAPTIVE_ENC_INIT 0x00013324
|
||||
|
||||
struct afe_id_aptx_adaptive_enc_init
|
||||
{
|
||||
uint32_t sampling_freq;
|
||||
uint32_t mtu;
|
||||
uint32_t channel_mode;
|
||||
uint32_t min_sink_modeA;
|
||||
uint32_t max_sink_modeA;
|
||||
uint32_t min_sink_modeB;
|
||||
uint32_t max_sink_modeB;
|
||||
uint32_t min_sink_modeC;
|
||||
uint32_t max_sink_modeC;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/*
|
||||
* Generic encoder module ID.
|
||||
* This module supports the following parameter IDs:
|
||||
|
@ -3504,6 +3519,7 @@ struct afe_param_id_aptx_sync_mode {
|
|||
* Macro for defining the depacketizer ID: COP.
|
||||
*/
|
||||
#define AFE_MODULE_ID_DEPACKETIZER_COP 0x00013233
|
||||
#define AFE_MODULE_ID_DEPACKETIZER_COP_V1 0x000132E9
|
||||
|
||||
/*
|
||||
* Depacketizer type parameter for the #AVS_MODULE_ID_DECODER module.
|
||||
|
@ -3693,6 +3709,9 @@ struct asm_aac_enc_cfg_v2_t {
|
|||
/* FMT ID for apt-X HD */
|
||||
#define ASM_MEDIA_FMT_APTX_HD 0x00013200
|
||||
|
||||
/* FMT ID for apt-X Adaptive */
|
||||
#define ASM_MEDIA_FMT_APTX_ADAPTIVE 0x00013204
|
||||
|
||||
#define PCM_CHANNEL_L 1
|
||||
#define PCM_CHANNEL_R 2
|
||||
#define PCM_CHANNEL_C 3
|
||||
|
@ -3723,6 +3742,13 @@ struct asm_aptx_enc_cfg_t {
|
|||
struct asm_aptx_v2_enc_cfg_ext_t aptx_v2_cfg;
|
||||
} __packed;
|
||||
|
||||
struct asm_aptx_ad_enc_cfg_t
|
||||
{
|
||||
struct asm_custom_enc_cfg_t custom_cfg;
|
||||
struct afe_id_aptx_adaptive_enc_init aptx_ad_cfg;
|
||||
struct afe_abr_enc_cfg_t abr_cfg;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define ASM_MEDIA_FMT_CELT 0x00013221
|
||||
struct asm_celt_specific_enc_cfg_t {
|
||||
/*
|
||||
|
@ -3886,6 +3912,7 @@ union afe_enc_config_data {
|
|||
struct asm_celt_enc_cfg_t celt_config;
|
||||
struct asm_aptx_enc_cfg_t aptx_config;
|
||||
struct asm_ldac_enc_cfg_t ldac_config;
|
||||
struct asm_aptx_ad_enc_cfg_t aptx_ad_config;
|
||||
};
|
||||
|
||||
struct afe_enc_config {
|
||||
|
|
Loading…
Add table
Reference in a new issue