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

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

Merge "dsp: adm: ensure hyp assgin is called when FNN module is used"

parents f8b4b87d 2d347e8d
Loading
Loading
Loading
Loading
+19 −21
Original line number Diff line number Diff line
@@ -2314,7 +2314,7 @@ static void send_adm_cal_type(int cal_index, int path, int port_id,
			      int acdb_id, int sample_rate)
{
	struct cal_block_data		*cal_block = NULL;
	int ret, port_idx, topology;
	int ret;
	int dest_perms[2] = {PERM_READ | PERM_WRITE, PERM_READ | PERM_WRITE};
	int source_vm[1] = {VMID_HLOS};
	int dest_vm[2] = {VMID_LPASS, VMID_ADSP_HEAP};
@@ -2327,21 +2327,13 @@ static void send_adm_cal_type(int cal_index, int path, int port_id,
		goto done;
	}

	port_idx = adm_validate_and_get_port_index(port_id);
	if (port_idx < 0) {
		pr_err("%s: Invalid port id: 0x%x", __func__, port_id);
		goto done;
	}

	mutex_lock(&this_adm.cal_data[cal_index]->lock);
	cal_block = adm_find_cal(cal_index, path, app_type, acdb_id,
				sample_rate);
	if (cal_block == NULL)
		goto unlock;

	topology = atomic_read(&this_adm.copp.topology[port_idx][copp_idx]);
	if (cal_block->cma_mem &&
	    topology == VPM_TX_VOICE_FLUENCE_NN_COPP_TOPOLOGY) {
	if (cal_block->cma_mem) {
		if (cal_block->cal_data.paddr == 0 ||
		    cal_block->map_data.map_size <= 0) {
			pr_err("%s: No address to map!\n", __func__);
@@ -3130,7 +3122,8 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
	}

	if ((topology == VPM_TX_SM_ECNS_V2_COPP_TOPOLOGY) ||
	    (topology == VPM_TX_DM_FLUENCE_EF_COPP_TOPOLOGY)) {
	    (topology == VPM_TX_DM_FLUENCE_EF_COPP_TOPOLOGY) ||
	    (topology == VPM_TX_VOICE_FLUENCE_NN_COPP_TOPOLOGY)) {
		if ((rate != ADM_CMD_COPP_OPEN_SAMPLE_RATE_8K) &&
		    (rate != ADM_CMD_COPP_OPEN_SAMPLE_RATE_16K) &&
		    (rate != ADM_CMD_COPP_OPEN_SAMPLE_RATE_32K) &&
@@ -3887,13 +3880,14 @@ int adm_close(int port_id, int perf_mode, int copp_idx)
{
	struct apr_hdr close;

	int ret = 0, port_idx, app_type, topology;
	int ret = 0, port_idx, app_type;
	int copp_id = RESET_COPP_ID;
	bool result = false;
	int dest_perms[1] = {PERM_READ | PERM_WRITE | PERM_EXEC};
	int source_vm[2] = {VMID_LPASS, VMID_ADSP_HEAP};
	int dest_vm[1] = {VMID_HLOS};
	struct cal_block_data *cal_block = NULL;
	struct audio_cal_info_audproc *audproc_cal_info = NULL;
	int cal_index = ADM_AUDPROC_PERSISTENT_CAL;

	pr_debug("%s: port_id=0x%x perf_mode: %d copp_idx: %d\n", __func__,
@@ -3913,7 +3907,6 @@ int adm_close(int port_id, int perf_mode, int copp_idx)
	}

	port_channel_map[port_idx].set_channel_map = false;
	topology = atomic_read(&this_adm.copp.topology[port_idx][copp_idx]);
	app_type = atomic_read(&this_adm.copp.app_type[port_idx][copp_idx]);
	if (this_adm.copp.adm_delay[port_idx][copp_idx] && perf_mode
		== LEGACY_PCM_MODE) {
@@ -3996,9 +3989,7 @@ int adm_close(int port_id, int perf_mode, int copp_idx)
		ret = apr_send_pkt(this_adm.apr, (uint32_t *)&close);
		if (ret < 0) {
			pr_err("%s: ADM close failed %d\n", __func__, ret);
			if (this_adm.tx_port_id == port_id &&
			    this_adm.fnn_app_type == app_type &&
			    topology == VPM_TX_VOICE_FLUENCE_NN_COPP_TOPOLOGY) {
			if (this_adm.tx_port_id == port_id) {
				mutex_lock(&this_adm.cal_data[cal_index]->lock);
				cal_block = cal_utils_get_only_cal_block(
						this_adm.cal_data[cal_index]);
@@ -4007,7 +3998,12 @@ int adm_close(int port_id, int perf_mode, int copp_idx)
					pr_debug("%s: cma_alloc %d\n",
						 __func__, cal_block->cma_mem);
				}
				if (result) {
				if (app_type == 0) {
					audproc_cal_info = cal_block->cal_info;
					app_type = audproc_cal_info->app_type;
				}

				if (result && this_adm.fnn_app_type == app_type) {
					pr_debug("%s: use hyp assigned %d, use buffer %d\n",
						 __func__, this_adm.hyp_assigned,
						cal_block->buffer_number);
@@ -4083,9 +4079,7 @@ int adm_close(int port_id, int perf_mode, int copp_idx)
		rtac_remove_adm_device(port_id, copp_id);
	}

	if (this_adm.tx_port_id == port_id &&
	    this_adm.fnn_app_type == app_type &&
	    topology == VPM_TX_VOICE_FLUENCE_NN_COPP_TOPOLOGY) {
	if (this_adm.tx_port_id == port_id) {
		mutex_lock(&this_adm.cal_data[cal_index]->lock);
		cal_block = cal_utils_get_only_cal_block(
				this_adm.cal_data[cal_index]);
@@ -4094,8 +4088,12 @@ int adm_close(int port_id, int perf_mode, int copp_idx)
			pr_debug("%s: cma_alloc %d\n",
				 __func__, cal_block->cma_mem);
		}
		if (app_type == 0) {
			audproc_cal_info = cal_block->cal_info;
			app_type = audproc_cal_info->app_type;
		}

		if (result) {
		if (result && this_adm.fnn_app_type == app_type) {
			pr_debug("%s: use hyp assigned %d, use buffer %d\n",
				  __func__, this_adm.hyp_assigned,
				  cal_block->buffer_number);