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

Commit 2faa1b50 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: qdsp6v2: Fix DTS HPX Audio Effects Get Param"

parents 4ca97dd6 6762d3aa
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -16,6 +16,18 @@

#include <linux/qdsp6v2/apr.h>

/* size of header needed for passing data out of band */
#define APR_CMD_OB_HDR_SZ  12

/* size of header needed for getting data */
#define APR_CMD_GET_HDR_SZ 16

struct param_outband {
	size_t       size;
	void        *kvaddr;
	phys_addr_t  paddr;
};

#define ADSP_ADM_VERSION    0x00070000

#define ADM_CMD_SHARED_MEM_MAP_REGIONS    0x00010322
@@ -7112,18 +7124,6 @@ struct asm_dts_eagle_param_get {
	struct asm_stream_cmd_get_pp_params_v2 param;
} __packed;

struct param_outband {
	size_t       size;
	void        *kvaddr;
	phys_addr_t  paddr;
};

/* size of header needed for passing data out of band */
#define CMD_OB_HDR_SZ  12

/* size of header needed for getting data */
#define CMD_GET_HDR_SZ 16

/* LSM Specific */
#define VW_FEAT_DIM					(39)

+20 −9
Original line number Diff line number Diff line
@@ -81,6 +81,15 @@ const DECLARE_TLV_DB_LINEAR(msm_compr_vol_gain, 0,

#define MAX_NUMBER_OF_STREAMS 2

/*
 * Max size for getting DTS EAGLE Param through kcontrol
 * Safe for both 32 and 64 bit platforms
 * 64 = size of kcontrol value array on 64 bit platform
 * 4 = size of parameters Eagle expects before cast to 64 bits
 * 40 = size of dts_eagle_param_desc + module_id cast to 64 bits
 */
#define DTS_EAGLE_MAX_PARAM_SIZE_FOR_ALSA ((64 * 4) - 40)

struct msm_compr_gapless_state {
	bool set_next_stream_id;
	int32_t stream_opened[MAX_NUMBER_OF_STREAMS];
@@ -2164,11 +2173,18 @@ static int msm_compr_audio_effects_config_get(struct snd_kcontrol *kcontrol,
		values[2] = (long)audio_effects->query.size;
		values[3] = (long)audio_effects->query.offset;
		values[4] = (long)audio_effects->query.device;
		if (values[2] > DTS_EAGLE_MAX_PARAM_SIZE_FOR_ALSA) {
			pr_err("%s: DTS_EAGLE_MODULE parameter's requested size (%li) too large (max size is %i)\n",
				__func__, values[2],
				DTS_EAGLE_MAX_PARAM_SIZE_FOR_ALSA);
			return -EINVAL;
		}
		msm_dts_eagle_handle_asm(NULL, (void *)&values[1],
					 true, true, prtd->audio_client, NULL);
		break;
	default:
		break;
		pr_err("%s: Invalid effects config module\n", __func__);
		return -EINVAL;
	}
	return 0;
}
@@ -2185,7 +2201,6 @@ static int msm_compr_query_audio_effect_put(struct snd_kcontrol *kcontrol,
	struct msm_compr_audio *prtd = NULL;
	long *values = &(ucontrol->value.integer.value[0]);

	pr_debug("%s\n", __func__);
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
		pr_err("%s Received out of bounds fe_id %lu\n",
			__func__, fe_id);
@@ -2203,12 +2218,9 @@ static int msm_compr_query_audio_effect_put(struct snd_kcontrol *kcontrol,
		return -EINVAL;
	}
	if (prtd->compr_passthr != LEGACY_PCM) {
		pr_debug("%s: No effects for compr_type[%d]\n",
			__func__, prtd->compr_passthr);
		return 0;
	} else {
		pr_debug("%s: Effects supported for compr_type[%d]\n",
		pr_err("%s: No effects for compr_type[%d]\n",
			__func__, prtd->compr_passthr);
		return -EPERM;
	}
	audio_effects->query.mod_id = (u32)*values++;
	audio_effects->query.parm_id = (u32)*values++;
@@ -2230,7 +2242,6 @@ static int msm_compr_query_audio_effect_get(struct snd_kcontrol *kcontrol,
	struct msm_compr_audio *prtd = NULL;
	long *values = &(ucontrol->value.integer.value[0]);

	pr_debug("%s\n", __func__);
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
		pr_err("%s Received out of bounds fe_id %lu\n",
			__func__, fe_id);
@@ -2697,7 +2708,7 @@ static int msm_compr_add_query_audio_effect_control(
	snprintf(mixer_str, ctl_len, "%s %d", mixer_ctl_name, rtd->pcm->device);
	fe_query_audio_effect_control[0].name = mixer_str;
	fe_query_audio_effect_control[0].private_value = rtd->dai_link->be_id;
	pr_debug("Registering new mixer ctl %s\n", mixer_str);
	pr_debug("%s: registering new mixer ctl %s\n", __func__, mixer_str);
	snd_soc_add_platform_controls(rtd->platform,
				fe_query_audio_effect_control,
				ARRAY_SIZE(fe_query_audio_effect_control));
+25 −11
Original line number Diff line number Diff line
@@ -376,7 +376,8 @@ static void _reg_ion_mem(void)
	rc = msm_audio_ion_alloc("DTS_EAGLE", &_ion_client, &_ion_handle,
			    ION_MEM_SIZE, &_po.paddr, &_po.size, &_po.kvaddr);
	if (rc)
		eagle_drv_err("%s: msm audio ion alloc failed",	__func__);
		eagle_drv_err("%s: msm audio ion alloc failed with %i",
				__func__, rc);
}

static void _unreg_ion_mem(void)
@@ -384,7 +385,8 @@ static void _unreg_ion_mem(void)
	int rc;
	rc = msm_audio_ion_free(_ion_client, _ion_handle);
	if (rc)
		eagle_drv_err("%s: msm audio ion free failed", __func__);
		eagle_drv_err("%s: msm audio ion alloc failed with %i",
				__func__, rc);
}

static void _reg_ion_mem_NT(void)
@@ -822,12 +824,18 @@ int msm_dts_eagle_handle_asm(struct dts_eagle_param_desc *depd, char *buf,
			buf_ = (u32 *)&_depc[offset];
		}
		if (isALSA) {
			if (depd->size == 2)
				*(long *)buf++ = (long)*(__u16 *)buf_;
			else {
				u32 *pbuf = (u32 *)buf_;
				for (i = 0; i < (depd->size >> 2); i++)
					*(long *)buf++ = (long)*pbuf++;
			if (depd->size == 2) {
				*(long *)buf = (long)*(__u16 *)buf_;
				eagle_asm_dbg("%s: asm out 16 bit value %li",
						__func__, *(long *)buf);
			} else {
				s32 *pbuf = (s32 *)buf_;
				long *bufl = (long *)buf;
				for (i = 0; i < (depd->size >> 2); i++) {
					*bufl++ = (long)*pbuf++;
					eagle_asm_dbg("%s: asm out value %li",
							 __func__, *(bufl-1));
				}
			}
		} else {
			memcpy(buf, buf_, depd->size);
@@ -851,10 +859,16 @@ DTS_EAGLE_IOCTL_GET_PARAM_PRE_EXIT:
		if (isALSA) {
			if (depd->size == 2) {
				*(__u16 *)&_depc[offset] = (__u16)*(long *)buf;
				eagle_asm_dbg("%s: asm in 16 bit value %li",
						__func__, *(long *)buf);
			} else {
				u32 *pbuf = (u32 *)&_depc[offset];
				for (i = 0; i < (depd->size >> 2); i++)
					*pbuf++ = (u32)*(long *)buf++;
				s32 *pbuf = (s32 *)&_depc[offset];
				long *bufl = (long *)buf;
				for (i = 0; i < (depd->size >> 2); i++) {
					*pbuf++ = (s32)*bufl++;
					eagle_asm_dbg("%s: asm in value %i",
							__func__, *(pbuf-1));
				}
			}
		} else {
			memcpy(&_depc[offset], buf, depd->size);
+4 −4
Original line number Diff line number Diff line
@@ -250,10 +250,10 @@ int adm_dts_eagle_set(int port_id, int copp_idx, int param_id,
		ret = -EINVAL;
		goto fail_cmd;
	}
	if (size + CMD_OB_HDR_SZ > this_adm.outband_memmap.size) {
	if (size + APR_CMD_OB_HDR_SZ > this_adm.outband_memmap.size) {
		pr_err("DTS_EAGLE_ADM - %s: ion alloc of size %zu too small for size requested %i.\n",
			__func__, this_adm.outband_memmap.size,
			size + CMD_OB_HDR_SZ);
			size + APR_CMD_OB_HDR_SZ);
		ret = -EINVAL;
		goto fail_cmd;
	}
@@ -338,10 +338,10 @@ int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
		ret = -EINVAL;
		goto fail_cmd;
	}
	if (size + CMD_OB_HDR_SZ > this_adm.outband_memmap.size) {
	if (size + APR_CMD_OB_HDR_SZ > this_adm.outband_memmap.size) {
		pr_err("DTS_EAGLE_ADM - %s: ion alloc of size %zu too small for size requested %i.\n",
			__func__, this_adm.outband_memmap.size,
			size + CMD_OB_HDR_SZ);
			size + APR_CMD_OB_HDR_SZ);
		ret = -EINVAL;
		goto fail_cmd;
	}
+6 −6
Original line number Diff line number Diff line
@@ -4299,9 +4299,9 @@ int q6asm_dts_eagle_set(struct audio_client *ac, int param_id, int size,
			rc = -EINVAL;
			goto fail_cmd;
		}
		if (size + CMD_OB_HDR_SZ > po->size) {
		if (size + APR_CMD_OB_HDR_SZ > po->size) {
			pr_err("DTS_EAGLE_ASM - %s: ion alloc of size %zu too small for size requested %i.\n",
				__func__, po->size, size + CMD_OB_HDR_SZ);
				__func__, po->size, size + APR_CMD_OB_HDR_SZ);
			rc = -EINVAL;
			goto fail_cmd;
		}
@@ -4342,7 +4342,7 @@ int q6asm_dts_eagle_get(struct audio_client *ac, int param_id, int size,
{
	struct asm_dts_eagle_param_get *ad;
	int rc = 0, *ob_params = NULL;
	int sz = sizeof(struct asm_dts_eagle_param) + CMD_GET_HDR_SZ +
	int sz = sizeof(struct asm_dts_eagle_param) + APR_CMD_GET_HDR_SZ +
		 (po ? 0 : size);

	if (!ac || ac->apr == NULL || size <= 0 || !data) {
@@ -4365,7 +4365,7 @@ int q6asm_dts_eagle_get(struct audio_client *ac, int param_id, int size,
	ad->param.mem_map_handle = 0;
	ad->param.module_id = m_id;
	ad->param.param_id = param_id;
	ad->param.param_max_size = size + CMD_GET_HDR_SZ;
	ad->param.param_max_size = size + APR_CMD_GET_HDR_SZ;
	ad->param.reserved = 0;
	atomic_set(&ac->cmd_state, 1);

@@ -4398,9 +4398,9 @@ int q6asm_dts_eagle_get(struct audio_client *ac, int param_id, int size,
			rc = -EINVAL;
			goto fail_cmd;
		}
		if (size + CMD_OB_HDR_SZ > po->size) {
		if (size + APR_CMD_OB_HDR_SZ > po->size) {
			pr_err("DTS_EAGLE_ASM - %s: ion alloc of size %zu too small for size requested %i.\n",
				__func__, po->size, size + CMD_OB_HDR_SZ);
				__func__, po->size, size + APR_CMD_OB_HDR_SZ);
			rc = -EINVAL;
			goto fail_cmd;
		}