Merge "dsp: q6afe: add tws mono switch for aptx adaptive encoder"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
5467317e15
@@ -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
@@ -4330,18 +4330,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;
|
||||
|
@@ -4035,6 +4035,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,
|
||||
|
Reference in New Issue
Block a user