mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
dsp: q6afe: add tws mono switch for aptx adaptive encoder
Add support to switch tws channel mode for aptx adaptive encoder. Change-Id: Ife4170be56b152d34758a1cfd20fa4ec203742db Signed-off-by: Zhou Song <zhous@codeaurora.org>
This commit is contained in:
parent
8410ebe24c
commit
450ee1b712
4 changed files with 24 additions and 6 deletions
|
|
@ -3123,14 +3123,20 @@ static int msm_dai_q6_tws_channel_mode_put(struct snd_kcontrol *kcontrol,
|
|||
struct snd_soc_dai *dai = kcontrol->private_data;
|
||||
struct msm_dai_q6_dai_data *dai_data = NULL;
|
||||
int ret = 0;
|
||||
u32 format = 0;
|
||||
|
||||
if (dai)
|
||||
dai_data = dev_get_drvdata(dai->dev);
|
||||
|
||||
if (dai_data && (dai_data->enc_config.format == ENC_FMT_APTX)) {
|
||||
if (dai_data)
|
||||
format = dai_data->enc_config.format;
|
||||
else
|
||||
goto exit;
|
||||
|
||||
if (format == ENC_FMT_APTX || format == ENC_FMT_APTX_ADAPTIVE) {
|
||||
if (test_bit(STATUS_PORT_STARTED, dai_data->status_mask)) {
|
||||
ret = afe_set_tws_channel_mode(dai->id,
|
||||
ucontrol->value.integer.value[0]);
|
||||
ret = afe_set_tws_channel_mode(format,
|
||||
dai->id, ucontrol->value.integer.value[0]);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: channel mode setting failed for TWS\n",
|
||||
__func__);
|
||||
|
|
|
|||
14
dsp/q6afe.c
14
dsp/q6afe.c
|
|
@ -4293,18 +4293,28 @@ exit:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int afe_set_tws_channel_mode(u16 port_id, u32 channel_mode)
|
||||
int afe_set_tws_channel_mode(u32 format, u16 port_id, u32 channel_mode)
|
||||
{
|
||||
struct aptx_channel_mode_param_t channel_mode_param;
|
||||
struct param_hdr_v3 param_info;
|
||||
int ret = 0;
|
||||
u32 param_id = 0;
|
||||
|
||||
if (format == ASM_MEDIA_FMT_APTX) {
|
||||
param_id = CAPI_V2_PARAM_ID_APTX_ENC_SWITCH_TO_MONO;
|
||||
} else if (format == ASM_MEDIA_FMT_APTX_ADAPTIVE) {
|
||||
param_id = CAPI_V2_PARAM_ID_APTX_AD_ENC_SWITCH_TO_MONO;
|
||||
} else {
|
||||
pr_err("%s: Not supported format 0x%x\n", __func__, format);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memset(¶m_info, 0, sizeof(param_info));
|
||||
memset(&channel_mode_param, 0, sizeof(channel_mode_param));
|
||||
|
||||
param_info.module_id = AFE_MODULE_ID_ENCODER;
|
||||
param_info.instance_id = INSTANCE_ID_0;
|
||||
param_info.param_id = CAPI_V2_PARAM_ID_APTX_ENC_SWITCH_TO_MONO;
|
||||
param_info.param_id = param_id;
|
||||
param_info.param_size = sizeof(channel_mode_param);
|
||||
|
||||
channel_mode_param.channel_mode = channel_mode;
|
||||
|
|
|
|||
|
|
@ -3985,6 +3985,8 @@ struct afe_id_aptx_adaptive_enc_init
|
|||
|
||||
#define CAPI_V2_PARAM_ID_APTX_ENC_SWITCH_TO_MONO 0x0001332A
|
||||
|
||||
#define CAPI_V2_PARAM_ID_APTX_AD_ENC_SWITCH_TO_MONO 0x00013354
|
||||
|
||||
struct aptx_channel_mode_param_t {
|
||||
u32 channel_mode;
|
||||
} __packed;
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ void afe_set_island_mode_cfg(u16 port_id, u32 enable_flag);
|
|||
void afe_get_island_mode_cfg(u16 port_id, u32 *enable_flag);
|
||||
int afe_port_start(u16 port_id, union afe_port_config *afe_config,
|
||||
u32 rate);
|
||||
int afe_set_tws_channel_mode(u16 port_id, u32 channel_mode);
|
||||
int afe_set_tws_channel_mode(u32 foramt, u16 port_id, u32 channel_mode);
|
||||
int afe_port_start_v2(u16 port_id, union afe_port_config *afe_config,
|
||||
u32 rate, u16 afe_in_channels, u16 afe_in_bit_width,
|
||||
struct afe_enc_config *enc_config,
|
||||
|
|
|
|||
Loading…
Reference in a new issue