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

Commit c0e1cac7 authored by Aditya Bavanari's avatar Aditya Bavanari
Browse files

ASoC: msm: qdsp6v2: 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: Ic2722cf5d686a7b10c682ca7866f7900da9d0cdb
Signed-off-by: default avatarSiena Richard <sienar@codeaurora.org>
Signed-off-by: default avatarAditya Bavanari <abavanar@codeaurora.org>
parent 2ee870a5
Loading
Loading
Loading
Loading
+268 −257

File changed.

Preview size limit exceeded, changes collapsed.

+30 −2
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2014, 2016-2017, 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.
@@ -32,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\
@@ -62,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 −39
Original line number Diff line number Diff line
@@ -710,15 +710,6 @@ set_stereo_to_custom_stereo_return:
	return rc;
}

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.
@@ -849,28 +840,6 @@ done:
}
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 = {0};

	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.
@@ -989,14 +958,6 @@ done:
}
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)