asoc: dsp: add support for aptx adaptive speech

Add support for speech codec which is similar to a2dp aptx adaptive.

Change-Id: Ibfbcf086f009fdb561e26aaf92cefc92f1bd16ca
Signed-off-by: Zhou Song <zhous@codeaurora.org>
This commit is contained in:
Zhou Song
2019-02-19 18:37:47 +08:00
parent d14c2dc368
commit caa541d688
4 changed files with 289 additions and 31 deletions

View File

@@ -2487,6 +2487,7 @@ struct afe_port_data_cmd_rt_proxy_port_read_v2 {
#define AFE_MODULE_AUDIO_DEV_INTERFACE 0x0001020C
#define AFE_PORT_SAMPLE_RATE_8K 8000
#define AFE_PORT_SAMPLE_RATE_16K 16000
#define AFE_PORT_SAMPLE_RATE_32K 32000
#define AFE_PORT_SAMPLE_RATE_44_1K 44100
#define AFE_PORT_SAMPLE_RATE_48K 48000
#define AFE_PORT_SAMPLE_RATE_96K 96000
@@ -3909,6 +3910,14 @@ struct afe_id_aptx_adaptive_enc_init
*/
#define AFE_ENCDEC_PARAM_ID_DEC_TO_ENC_COMMUNICATION 0x0001323D
/*
* This is needed to be used only for SWB voice call use case.
* This is needed to be issued for each direction (RX AFE and TX AFE)
* along with AFE_PARAM_ID_PORT_MEDIA_TYPE
* (Issuing AF_PARAM_ID_RATE_MATCHED_PORT param alone is not useful).
*/
#define AFE_PARAM_ID_RATE_MATCHED_PORT 0x000102BE
/*
* Purpose of IMC set up between encoder and decoder.
* Communication instance and purpose together form the
@@ -4149,6 +4158,9 @@ struct asm_aac_enc_cfg_t {
/* FMT ID for apt-X Adaptive */
#define ASM_MEDIA_FMT_APTX_ADAPTIVE 0x00013204
/* FMT ID for apt-X Adaptive speech */
#define ASM_MEDIA_FMT_APTX_AD_SPEECH 0x00013208
#define PCM_CHANNEL_L 1
#define PCM_CHANNEL_R 2
#define PCM_CHANNEL_C 3
@@ -4165,6 +4177,22 @@ struct asm_custom_enc_cfg_t {
uint32_t custom_size;
} __packed;
struct asm_aptx_ad_speech_mode_cfg_t
{
uint32_t speech_mode;
/*
* speech mode of codec.
*
* @values 0x0(swb), 0x4(sswb)
*/
uint32_t swapping;
/*
* byte swapping of codec.
*
* @values 0x1, enable swapping
*/
} __packed;
struct asm_aptx_v2_enc_cfg_ext_t {
/*
* sync mode: 0x0 = stereo sync mode (default)
@@ -4186,6 +4214,19 @@ struct asm_aptx_ad_enc_cfg_t
struct afe_abr_enc_cfg_t abr_cfg;
} __attribute__ ((packed));
struct asm_aptx_ad_speech_enc_cfg_t
{
struct asm_custom_enc_cfg_t custom_cfg;
struct afe_imc_dec_enc_info imc_info;
struct asm_aptx_ad_speech_mode_cfg_t speech_mode;
} __attribute__ ((packed));
struct afe_matched_port_t
{
uint32_t minor_version;
uint32_t enable;
} __attribute__ ((packed));
#define ASM_MEDIA_FMT_CELT 0x00013221
struct asm_celt_specific_enc_cfg_t {
/*
@@ -4462,6 +4503,10 @@ struct asm_aptx_ad_dec_cfg_t {
*/
} __packed;
struct asm_aptx_ad_speech_dec_cfg_t {
struct asm_aptx_ad_speech_mode_cfg_t speech_mode;
};
union afe_enc_config_data {
struct asm_sbc_enc_cfg_t sbc_config;
struct asm_aac_enc_cfg_t aac_config;
@@ -4470,6 +4515,7 @@ union afe_enc_config_data {
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 asm_aptx_ad_speech_enc_cfg_t aptx_ad_speech_config;
};
struct afe_enc_config {
@@ -4484,6 +4530,7 @@ union afe_dec_config_data {
struct asm_aac_dec_cfg_v2_t aac_config;
struct asm_mp3_dec_cfg_t mp3_config;
struct asm_aptx_ad_dec_cfg_t aptx_ad_config;
struct asm_aptx_ad_speech_dec_cfg_t aptx_ad_speech_config;
};
struct afe_dec_config {
@@ -4500,6 +4547,14 @@ struct afe_enc_cfg_blk_param_t {
union afe_enc_config_data enc_blk_config;
};
struct afe_enc_aptx_ad_speech_cfg_blk_param_t {
uint32_t enc_cfg_blk_size;
/*
* Size of the encoder configuration block that follows this member
*/
struct asm_custom_enc_cfg_t custom_cfg;
};
/*
* Payload of the AVS_DECODER_PARAM_ID_DEC_MEDIA_FMT parameter used by
* AVS_MODULE_ID_DECODER.
@@ -4587,6 +4642,18 @@ struct avs_dec_congestion_buffer_param_t {
*/
#define AVS_DECODER_PARAM_ID_DEC_MEDIA_FMT 0x00013232
/*
* ID of the parameter used by #AVS_MODULE_ID_DECODER to configure
* the decoder mode of adaptive speech and byte swap mode
*/
#define AVS_DECODER_PARAM_ID_APTX_AD_SPEECH_DEC_INIT 0x0001334D
/*
* ID of the parameter used by #AVS_MODULE_ID_ENCODER to configure
* the encoder mode of adaptive speech and byte swap mode
*/
#define AVS_DECODER_PARAM_ID_APTX_AD_SPEECH_ENC_INIT 0x0001332B
/* ID of the parameter used by #AFE_MODULE_AUDIO_DEV_INTERFACE to configure
* the island mode for a given AFE port.
*/