Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5467317e authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dsp: q6afe: add tws mono switch for aptx adaptive encoder"

parents 2a6d4e54 450ee1b7
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -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__);
+12 −2
Original line number Diff line number Diff line
@@ -4330,18 +4330,28 @@ static int q6afe_send_enc_config(u16 port_id,
	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(&param_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;
+2 −0
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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,