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

Commit 916967ba authored by Vignesh Kulothungan's avatar Vignesh Kulothungan Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: dsp: Update dap driver to support Instance ID



Add support to set and get dap modules params with
Instance ID support for both Dolby and DS2.
Maintain support for non Instance ID set and get param
structures as well. Use common pack and set param
functions to set and get parameters to DSP instead of
handling them at an individual module level.

CRs-Fixed: 2151551
Change-Id: I1633b63a1a598c0e4ea874d00655b09a240a47e3
Signed-off-by: default avatarVignesh Kulothungan <vigneshk@codeaurora.org>
parent 60cc0351
Loading
Loading
Loading
Loading
+286 −256

File changed.

Preview size limit exceeded, changes collapsed.

+29 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 2017-2018 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
 * only version 2 as published by the Free Software Foundation.
@@ -33,7 +33,6 @@ struct dolby_param_license32 {
	compat_uptr_t license_key;
};


#define SNDRV_DEVDEP_DAP_IOCTL_SET_PARAM32\
		_IOWR('U', 0x10, struct dolby_param_data32)
#define SNDRV_DEVDEP_DAP_IOCTL_GET_PARAM32\
@@ -63,6 +62,34 @@ enum {
	DAP_CMD_SET_BYPASS_TYPE    = 5,
};

struct custom_stereo_param {
	/* Index is 32-bit param in little endian */
	u16 index;
	u16 reserved;

	/* For stereo mixing, the number of out channels */
	u16 num_out_ch;
	/* For stereo mixing, the number of in channels */
	u16 num_in_ch;

	/* Out channel map FL/FR*/
	u16 out_fl;
	u16 out_fr;

	/* In channel map FL/FR*/
	u16 in_fl;
	u16 in_fr;

	/*
	 * Weighting coefficients. Mixing will be done according to
	 * these coefficients.
	 */
	u16 op_FL_ip_FL_weight;
	u16 op_FL_ip_FR_weight;
	u16 op_FR_ip_FL_weight;
	u16 op_FR_ip_FR_weight;
};

#define DOLBY_PARAM_INT_ENDP_LENGTH             1
#define DOLBY_PARAM_INT_ENDP_OFFSET		(DOLBY_PARAM_PSTG_OFFSET + \
							DOLBY_PARAM_PSTG_LENGTH)
+0 −51
Original line number Diff line number Diff line
@@ -789,26 +789,6 @@ int adm_set_stereo_to_custom_stereo(int port_id, int copp_idx,
}
EXPORT_SYMBOL(adm_set_stereo_to_custom_stereo);

/**
 * adm_dolby_dap_send_params -
 *        command to send dolby dap params
 *
 * @port_id: Port ID number
 * @copp_idx: copp index of ADM copp
 * @params: params pointer
 * @param_length: length of params
 *
 * Returns 0 on success or error on failure
 */
int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params,
			      uint32_t params_length)
{
	/* Use as wrapper for adm_set_pp_params until no longer used */
	return adm_set_pp_params(port_id, copp_idx, NULL, params,
				 params_length);
}
EXPORT_SYMBOL(adm_dolby_dap_send_params);

/*
 * With pre-packed data, only the opcode differes from V5 and V6.
 * Use q6common_pack_pp_params to pack the data correctly.
@@ -941,29 +921,6 @@ int adm_pack_and_set_one_pp_param(int port_id, int copp_idx,
}
EXPORT_SYMBOL(adm_pack_and_set_one_pp_param);

int adm_get_params_v2(int port_id, int copp_idx, uint32_t module_id,
		      uint32_t param_id, uint32_t params_length, char *params,
		      uint32_t client_id)
{
	struct param_hdr_v3 param_hdr;

	memset(&param_hdr, 0, sizeof(param_hdr));
	param_hdr.module_id = module_id;
	param_hdr.instance_id = INSTANCE_ID_0;
	param_hdr.param_id = param_id;
	param_hdr.param_size = params_length;

	return adm_get_pp_params(port_id, copp_idx, client_id, NULL, &param_hdr,
				 params);
}

int adm_get_params(int port_id, int copp_idx, uint32_t module_id,
		   uint32_t param_id, uint32_t params_length, char *params)
{
	return adm_get_params_v2(port_id, copp_idx, module_id, param_id,
				 params_length, params, 0);
}

/*
 * Only one parameter can be requested at a time. Therefore, packing and sending
 * the request can be handled locally.
@@ -1082,14 +1039,6 @@ int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
}
EXPORT_SYMBOL(adm_get_pp_params);

int adm_get_pp_topo_module_list(int port_id, int copp_idx, int32_t param_length,
				char *params)
{
	return adm_get_pp_topo_module_list_v2(port_id, copp_idx, param_length,
					      (int32_t *) params);
}
EXPORT_SYMBOL(adm_get_pp_topo_module_list);

int adm_get_pp_topo_module_list_v2(int port_id, int copp_idx,
				   int32_t param_length,
				   int32_t *returned_params)
+0 −6
Original line number Diff line number Diff line
@@ -93,9 +93,6 @@ int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,

void adm_copp_mfc_cfg(int port_id, int copp_idx, int dst_sample_rate);

int adm_get_params(int port_id, int copp_idx, uint32_t module_id,
		   uint32_t param_id, uint32_t params_length, char *params);

int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
		      struct mem_mapping_hdr *mem_hdr,
		      struct param_hdr_v3 *param_hdr, u8 *returned_param_data);
@@ -103,9 +100,6 @@ int adm_get_pp_params(int port_id, int copp_idx, uint32_t client_id,
int adm_send_params_v5(int port_id, int copp_idx, char *params,
			      uint32_t params_length);

int adm_dolby_dap_send_params(int port_id, int copp_idx, char *params,
			      uint32_t params_length);

int adm_set_pp_params(int port_id, int copp_idx,
		      struct mem_mapping_hdr *mem_hdr, u8 *param_data,
		      u32 params_size);