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

Commit 2bc290e8 authored by Avinash Vaish's avatar Avinash Vaish Committed by Matt Wagantall
Browse files

ASoC: qdsp6v2: Update RTC with device pair used in a voice call



Currently, there is no mechanism to intimate rtac driver with rx
and tx device ids used in a voice call which causes inconsistency
in refresh operations of QACT. Also, no device pair information
with QACT leads to uncertainties in the process of tuning cal data
for different devices.
Extract the device information from vocproc cal data in voice driver
and pass it to rtac driver at the start of the call and every device
switch.

CRs-Fixed: 835421
Signed-off-by: default avatarAvinash Vaish <avaish@codeaurora.org>
Change-Id: Id664dfa9843db6e4fefbfdad43732060f6a34e67
parent 386059a5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2011, 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011, 2013-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -50,7 +50,7 @@ void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id,
void rtac_remove_adm_device(u32 port_id, u32 copp_id);
void rtac_remove_popp_from_adm_devices(u32 popp_id);
void rtac_add_voice(u32 cvs_handle, u32 cvp_handle, u32 rx_afe_port,
	u32 tx_afe_port, u32 session_id);
	u32 tx_afe_port, u32 rx_acdb_id, u32 tx_acdb_id, u32 session_id);
void rtac_remove_voice(u32 cvs_handle);
void rtac_set_adm_handle(void *handle);
bool rtac_make_adm_callback(uint32_t *payload, u32 payload_size);
+13 −0
Original line number Diff line number Diff line
@@ -2617,6 +2617,14 @@ static int voice_send_cvp_register_cal_cmd(struct voice_data *v)
		goto unlock;
	}

	v->dev_tx.dev_id = ((struct audio_cal_info_vocproc *)
				cal_block->cal_info)->tx_acdb_id;
	v->dev_rx.dev_id = ((struct audio_cal_info_vocproc *)
				cal_block->cal_info)->rx_acdb_id;
	pr_debug("%s: %s: Tx acdb id = %d and Rx acdb id = %d", __func__,
		 voc_get_session_name(v->session_id), v->dev_tx.dev_id,
		 v->dev_rx.dev_id);

	memcpy(&cvp_reg_cal_cmd.cvp_cal_data.column_info[0],
	       (void *) &((struct audio_cal_info_voc_col *)
	       col_data->cal_info)->data,
@@ -3503,6 +3511,7 @@ static int voice_setup_vocproc(struct voice_data *v)
	rtac_add_voice(voice_get_cvs_handle(v),
		voice_get_cvp_handle(v),
		v->dev_rx.port_id, v->dev_tx.port_id,
		v->dev_rx.dev_id, v->dev_tx.dev_id,
		v->session_id);

	return 0;
@@ -4889,6 +4898,7 @@ static int voice_enable_cvp(uint32_t session_id)
		rtac_add_voice(voice_get_cvs_handle(v),
			voice_get_cvp_handle(v),
			v->dev_rx.port_id, v->dev_tx.port_id,
			v->dev_rx.dev_id, v->dev_tx.dev_id,
			v->session_id);
		v->voc_state = VOC_RUN;
	}
@@ -5443,6 +5453,7 @@ int voc_enable_device(uint32_t session_id)
		rtac_add_voice(voice_get_cvs_handle(v),
			       voice_get_cvp_handle(v),
			       v->dev_rx.port_id, v->dev_tx.port_id,
			       v->dev_rx.dev_id, v->dev_tx.dev_id,
			       v->session_id);

		ret = voice_send_start_voice_cmd(v);
@@ -7826,6 +7837,8 @@ static int __init voice_init(void)

		common.voice[i].dev_tx.port_id = 0x100B;
		common.voice[i].dev_rx.port_id = 0x100A;
		common.voice[i].dev_tx.dev_id = 0;
		common.voice[i].dev_rx.dev_id = 0;
		common.voice[i].sidetone_gain = 0x512;
		common.voice[i].dtmf_rx_detect_en = 0;
		common.voice[i].lch_mode = 0;
+19 −6
Original line number Diff line number Diff line
@@ -102,18 +102,20 @@ static u32 *rtac_asm_buffer;
static u32			*rtac_afe_buffer;

/* Voice info & APR */
struct rtac_voice_data {
struct rtac_voice_data_t {
	uint32_t	tx_topology_id;
	uint32_t	rx_topology_id;
	uint32_t	tx_afe_port;
	uint32_t	rx_afe_port;
	uint16_t	cvs_handle;
	uint16_t	cvp_handle;
	uint32_t	tx_acdb_id;
	uint32_t	rx_acdb_id;
};

struct rtac_voice {
	uint32_t			num_of_voice_combos;
	struct rtac_voice_data	voice[RTAC_MAX_ACTIVE_VOICE_COMBOS];
	struct rtac_voice_data_t	voice[RTAC_MAX_ACTIVE_VOICE_COMBOS];
};

struct rtac_afe_user_data {
@@ -526,6 +528,7 @@ void rtac_remove_popp_from_adm_devices(u32 popp_id)
/* Voice Info */
static void set_rtac_voice_data(int idx, u32 cvs_handle, u32 cvp_handle,
					u32 rx_afe_port, u32 tx_afe_port,
					u32 rx_acdb_id, u32 tx_acdb_id,
					u32 session_id)
{
	rtac_voice_data.voice[idx].tx_topology_id =
@@ -534,15 +537,24 @@ static void set_rtac_voice_data(int idx, u32 cvs_handle, u32 cvp_handle,
		voice_get_topology(CVP_VOC_RX_TOPOLOGY_CAL);
	rtac_voice_data.voice[idx].tx_afe_port = tx_afe_port;
	rtac_voice_data.voice[idx].rx_afe_port = rx_afe_port;
	rtac_voice_data.voice[idx].tx_acdb_id = tx_acdb_id;
	rtac_voice_data.voice[idx].rx_acdb_id = rx_acdb_id;
	rtac_voice_data.voice[idx].cvs_handle = cvs_handle;
	rtac_voice_data.voice[idx].cvp_handle = cvp_handle;
	pr_debug("%s\n%s: %x\n%s: %d %s: %d\n%s: %d %s: %d\n%s: %d %s: %d\n%s",
		 "<---- Voice Data Info ---->", "Session id", session_id,
		 "cvs_handle", cvs_handle, "cvp_handle", cvp_handle,
		 "rx_afe_port", rx_afe_port, "tx_afe_port", tx_afe_port,
		 "rx_acdb_id", rx_acdb_id, "tx_acdb_id", tx_acdb_id,
		 "<-----------End----------->");

	/* Store session ID for voice RTAC */
	voice_session_id[idx] = session_id;
}

void rtac_add_voice(u32 cvs_handle, u32 cvp_handle, u32 rx_afe_port,
			u32 tx_afe_port, u32 session_id)
			u32 tx_afe_port, u32 rx_acdb_id, u32 tx_acdb_id,
			u32 session_id)
{
	u32 i = 0;
	pr_debug("%s\n", __func__);
@@ -560,8 +572,8 @@ void rtac_add_voice(u32 cvs_handle, u32 cvp_handle, u32 rx_afe_port,
			if (rtac_voice_data.voice[i].cvs_handle ==
							cvs_handle) {
				set_rtac_voice_data(i, cvs_handle, cvp_handle,
					rx_afe_port, tx_afe_port,
					session_id);
					rx_afe_port, tx_afe_port, rx_acdb_id,
					tx_acdb_id, session_id);
				goto done;
			}
		}
@@ -571,6 +583,7 @@ void rtac_add_voice(u32 cvs_handle, u32 cvp_handle, u32 rx_afe_port,
	rtac_voice_data.num_of_voice_combos++;
	set_rtac_voice_data(i, cvs_handle, cvp_handle,
				rx_afe_port, tx_afe_port,
				rx_acdb_id, tx_acdb_id,
				session_id);
done:
	mutex_unlock(&rtac_voice_mutex);