From f7d6571d0ae33902082bb6327bf0301d73b0dc8d Mon Sep 17 00:00:00 2001 From: Satya Krishna Pindiproli Date: Wed, 26 Apr 2017 14:24:53 +0530 Subject: [PATCH] hal: Add support for BT encoder configuration Add structures for SBC, AAC, APTX encoder configurations which are used between audio HAL and BT IPC library for proper DSP configuration. Also enable the feature flag for split a2dp on supported targets. Change-Id: If126c6764cfd7a2e46cb7784ad899681de581b56 --- configs/msm8998/msm8998.mk | 2 +- configs/sdm660/sdm660.mk | 2 +- configs/sdm845/sdm845.mk | 2 +- hal/audio_extn/a2dp.c | 40 +++++++++++++++++++++++++++++++++++++ hal/audio_extn/audio_extn.h | 2 +- 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/configs/msm8998/msm8998.mk b/configs/msm8998/msm8998.mk index 90dfc0f3..1dfd3676 100644 --- a/configs/msm8998/msm8998.mk +++ b/configs/msm8998/msm8998.mk @@ -29,7 +29,7 @@ MM_AUDIO_ENABLED_SAFX := true AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true AUDIO_FEATURE_ENABLED_USB_TUNNEL_AUDIO := true -AUDIO_FEATURE_ENABLED_SPLIT_A2DP := false +AUDIO_FEATURE_ENABLED_SPLIT_A2DP := true AUDIO_FEATURE_ENABLED_3D_AUDIO := false AUDIO_FEATURE_ENABLED_VOICE_PRINT := false USE_LEGACY_AUDIO_DAEMON := false diff --git a/configs/sdm660/sdm660.mk b/configs/sdm660/sdm660.mk index c0bbd862..a0ae641a 100644 --- a/configs/sdm660/sdm660.mk +++ b/configs/sdm660/sdm660.mk @@ -29,7 +29,7 @@ MM_AUDIO_ENABLED_SAFX := true AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true AUDIO_FEATURE_ENABLED_USB_TUNNEL_AUDIO := true -AUDIO_FEATURE_ENABLED_SPLIT_A2DP := false +AUDIO_FEATURE_ENABLED_SPLIT_A2DP := true AUDIO_FEATURE_ENABLED_3D_AUDIO := false AUDIO_FEATURE_ENABLED_VOICE_PRINT := false USE_LEGACY_AUDIO_DAEMON := false diff --git a/configs/sdm845/sdm845.mk b/configs/sdm845/sdm845.mk index d69a6fdb..257115a8 100644 --- a/configs/sdm845/sdm845.mk +++ b/configs/sdm845/sdm845.mk @@ -29,7 +29,7 @@ MM_AUDIO_ENABLED_SAFX := true AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true AUDIO_FEATURE_ENABLED_USB_TUNNEL_AUDIO := true -AUDIO_FEATURE_ENABLED_SPLIT_A2DP := false +AUDIO_FEATURE_ENABLED_SPLIT_A2DP := true AUDIO_FEATURE_ENABLED_3D_AUDIO := false DOLBY_ENABLE := false endif diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c index fba7e6c5..b665adb6 100644 --- a/hal/audio_extn/a2dp.c +++ b/hal/audio_extn/a2dp.c @@ -172,6 +172,46 @@ struct custom_enc_cfg_aptx_t uint32_t custom_size; }; +/* TODO: Define the following structures only for O using PLATFORM_VERSION */ +/* Information about BT SBC encoder configuration + * This data is used between audio HAL module and + * BT IPC library to configure DSP encoder + */ +typedef struct { + uint32_t subband; /* 4, 8 */ + uint32_t blk_len; /* 4, 8, 12, 16 */ + uint16_t sampling_rate; /*44.1khz,48khz*/ + uint8_t channels; /*0(Mono),1(Dual_mono),2(Stereo),3(JS)*/ + uint8_t alloc; /*0(Loudness),1(SNR)*/ + uint8_t min_bitpool; /* 2 */ + uint8_t max_bitpool; /*53(44.1khz),51 (48khz) */ + uint32_t bitrate; /* 320kbps to 512kbps */ +} audio_sbc_encoder_config; + + +/* Information about BT APTX encoder configuration + * This data is used between audio HAL module and + * BT IPC library to configure DSP encoder + */ +typedef struct { + uint16_t sampling_rate; + uint8_t channels; + uint32_t bitrate; +} audio_aptx_encoder_config; + + +/* Information about BT AAC encoder configuration + * This data is used between audio HAL module and + * BT IPC library to configure DSP encoder + */ +typedef struct { + uint32_t enc_mode; /* LC, SBR, PS */ + uint16_t format_flag; /* RAW, ADTS */ + uint16_t channels; /* 1-Mono, 2-Stereo */ + uint32_t sampling_rate; + uint32_t bitrate; +} audio_aac_encoder_config; + /*********** END of DSP configurable structures ********************/ /* API to identify DSP encoder captabilities */ diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h index bdb039f5..8d0c3d09 100644 --- a/hal/audio_extn/audio_extn.h +++ b/hal/audio_extn/audio_extn.h @@ -224,7 +224,7 @@ bool audio_extn_usb_is_capture_supported(); #else void audio_extn_a2dp_init(void *adev); int audio_extn_a2dp_start_playback(); -void audio_extn_a2dp_stop_playback(); +int audio_extn_a2dp_stop_playback(); void audio_extn_a2dp_set_parameters(struct str_parms *parms); bool audio_extn_a2dp_is_force_device_switch(); void audio_extn_a2dp_set_handoff_mode(bool is_on);