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

Commit fce04f75 authored by Weiyin Jiang's avatar Weiyin Jiang Committed by Gerrit - the friendly Code Review server
Browse files

asoc: fix offload PBE failure in sending calibration to lpass



PBE values are misinterpreted when transferring from userspace to kernel
via mixer ctl interface. Config values have to be copied one by one rather
than copying through continuous memory.

CRs-Fixed: 2458428
Change-Id: I375498f0f511d21bd14873cc9394305acbc25e50
Signed-off-by: default avatarWeiyin Jiang <wjiang@codeaurora.org>
parent 9142ab92
Loading
Loading
Loading
Loading
+67 −1
Original line number Diff line number Diff line
@@ -890,6 +890,9 @@ int msm_audio_effects_pbe_handler(struct audio_client *ac,
	struct param_hdr_v3 param_hdr;
	u8 *param_data = NULL;
	u32 packed_data_size = 0;
	int32_t *p_coeffs = NULL;
	uint32_t lpf_len = 0, hpf_len = 0, bpf_len = 0;
	uint32_t bsf_len = 0, tsf_len = 0, total_coeffs_len = 0;

	pr_debug("%s\n", __func__);
	if (!ac || (devices == -EINVAL) || (num_commands == -EINVAL)) {
@@ -949,8 +952,71 @@ int msm_audio_effects_pbe_handler(struct audio_client *ac,
				rc = -EINVAL;
				goto invalid_config;
			}

			pbe->config.real_bass_mix =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.bass_color_control =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.main_chain_delay =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.xover_filter_order =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.bandpass_filter_order =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.drc_delay =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.rms_tav =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.exp_threshold =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.exp_slope =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.comp_threshold =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.comp_slope =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.makeup_gain =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.comp_attack =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.comp_release =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.exp_attack =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.exp_release =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.limiter_bass_threshold =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.limiter_high_threshold =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.limiter_bass_makeup_gain =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.limiter_high_makeup_gain =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.limiter_bass_gc =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.limiter_high_gc =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.limiter_delay =
				GET_NEXT(values, param_max_offset, rc);
			pbe->config.reserved =
				GET_NEXT(values, param_max_offset, rc);

			p_coeffs = &pbe->config.p1LowPassCoeffs[0];
			lpf_len = (pbe->config.xover_filter_order == 3) ? 10 : 5;
			hpf_len = (pbe->config.xover_filter_order == 3) ? 10 : 5;
			bpf_len = pbe->config.bandpass_filter_order * 5;
			bsf_len = 5;
			tsf_len = 5;
			total_coeffs_len = lpf_len + hpf_len + bpf_len + bsf_len + tsf_len;

			for (i = 0; i < total_coeffs_len; i++) {
				*p_coeffs++ = GET_NEXT(values, param_max_offset, rc);
			}

			if (command_config_state != CONFIG_SET)
				break;

			max_params_length =
				params_length + COMMAND_IID_PAYLOAD_SZ + length;
			CHECK_PARAM_LEN(max_params_length, MAX_INBAND_PARAM_SZ,
@@ -959,7 +1025,7 @@ int msm_audio_effects_pbe_handler(struct audio_client *ac,
				break;
			param_hdr.param_id = AUDPROC_PARAM_ID_PBE_PARAM_CONFIG;
			param_hdr.param_size = length;
			param_data = (u8 *) values;
			param_data = (u8 *) &pbe->config;
			break;
		default:
			pr_err_ratelimited("%s: Invalid command to set config\n",