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

Commit d9538087 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge 315c6f41 on remote branch

Change-Id: Iefe94c23ce226619c74550c29c8bd0409b568ed1
parents 2826aae1 315c6f41
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/init.h>
@@ -654,6 +655,11 @@ static void hpcm_copy_playback_data_from_queue(struct dai_data *dai_data,
				struct hpcm_buf_node, list);
		list_del(&buf_node->list);
		*len = buf_node->frame.len;
		if (*len > HPCM_MAX_VOC_PKT_SIZE) {
			pr_err("%s: Playback data len %d overflow\n",
					__func__, *len);
			return;
		}
		memcpy((u8 *)dai_data->vocpcm_ion_buffer.kvaddr,
		       &buf_node->frame.voc_pkt[0],
		       buf_node->frame.len);
@@ -681,6 +687,12 @@ static void hpcm_copy_capture_data_to_queue(struct dai_data *dai_data,
	if (dai_data->substream == NULL)
		return;

	if (len > HPCM_MAX_VOC_PKT_SIZE) {
		pr_err("%s: Copy capture data len %d overflow\n",
				__func__, len);
		return;
	}

	/* Copy out buffer packet into free_queue */
	spin_lock_irqsave(&dai_data->dsp_lock, dsp_flags);

+8 −9
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2013-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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/init.h>
@@ -632,6 +625,12 @@ static int hpcm_start_vocpcm(char *pcm_id, struct hpcm_drv *prtd,
		}
	}

	if (*no_of_tp != no_of_tp_req && *no_of_tp > 2) {
		pr_err("%s:: Invalid hpcm start request\n", __func__);
		memset(&prtd->start_cmd, 0, sizeof(struct start_cmd));
		return -EINVAL;
	}

	if ((prtd->mixer_conf.tx.enable || prtd->mixer_conf.rx.enable) &&
	    *no_of_tp == no_of_tp_req) {
		voc_send_cvp_start_vocpcm(voc_get_session_id(sess_name),
+5 −0
Original line number Diff line number Diff line
@@ -2126,6 +2126,11 @@ static void msm_pcm_routing_process_voice(u16 reg, u16 val, int set)
	pr_debug("%s: FE DAI 0x%x session_id 0x%x\n",
		__func__, val, session_id);
	if (!session_id) {
		pr_err("%s: Invalid session_id %x\n", __func__, session_id);
		return;
	}
	mutex_lock(&routing_lock);
	if (set)
+16 −8
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
 *
 * Copyright (c) 2023, Qualcomm Innovation Center, Inc. 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.
@@ -78,6 +80,7 @@ static void msm_audio_ion_add_allocation(
	mutex_unlock(&(msm_audio_ion_data->list_mutex));
}

/* This function is called with ion_data list mutex lock */
static int msm_audio_dma_buf_map(struct dma_buf *dma_buf,
				 dma_addr_t *addr, size_t *len)
{
@@ -166,7 +169,6 @@ static int msm_audio_dma_buf_unmap(struct dma_buf *dma_buf)
	 * should be explicitly acquired to avoid race condition
	 * on adding elements to the list.
	 */
	mutex_lock(&(msm_audio_ion_data.list_mutex));
	list_for_each_safe(ptr, next,
			    &(msm_audio_ion_data.alloc_list)) {

@@ -190,7 +192,6 @@ static int msm_audio_dma_buf_unmap(struct dma_buf *dma_buf)
			break;
		}
	}
	mutex_unlock(&(msm_audio_ion_data.list_mutex));

	if (!found) {
		dev_err(cb_dev,
@@ -245,6 +246,7 @@ int msm_audio_ion_get_smmu_info(struct device **cb_dev,
	return 0;
}

/* This function is called with ion_data list mutex lock */
static void *msm_audio_ion_map_kernel(struct dma_buf *dma_buf)
{
	int rc = 0;
@@ -293,7 +295,6 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf)
	 * TBD: remove the below section once new API
	 * for unmapping kernel virtual address is available.
	 */
	mutex_lock(&(msm_audio_ion_data.list_mutex));
	list_for_each_entry(alloc_data, &(msm_audio_ion_data.alloc_list),
			    list) {
		if (alloc_data->dma_buf == dma_buf) {
@@ -301,7 +302,6 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf)
			break;
		}
	}
	mutex_unlock(&(msm_audio_ion_data.list_mutex));

	if (!vaddr) {
		dev_err(cb_dev,
@@ -324,7 +324,8 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf)
	return rc;
}

static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
/* This function is called with ion_data list mutex lock */
static int msm_audio_ion_buf_map(struct dma_buf *dma_buf, dma_addr_t *paddr,
				 size_t *plen, void **vaddr)
{
	int rc = 0;
@@ -346,7 +347,9 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
	if (IS_ERR_OR_NULL(*vaddr)) {
		pr_err("%s: ION memory mapping for AUDIO failed\n", __func__);
		rc = -ENOMEM;
		mutex_lock(&(msm_audio_ion_data.list_mutex));
		msm_audio_dma_buf_unmap(dma_buf);
		mutex_unlock(&(msm_audio_ion_data.list_mutex));
		goto err;
	}

@@ -405,7 +408,7 @@ int msm_audio_ion_alloc(struct dma_buf **dma_buf, size_t bufsz,
		goto err;
	}

	rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, vaddr);
	rc = msm_audio_ion_buf_map(*dma_buf, paddr, plen, vaddr);
	if (rc) {
		pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
		goto err;
@@ -505,7 +508,7 @@ int msm_audio_ion_import(struct dma_buf **dma_buf, int fd,
		}
	}

	rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, vaddr);
	rc = msm_audio_ion_buf_map(*dma_buf, paddr, plen, vaddr);
	if (rc) {
		pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
		goto err;
@@ -531,6 +534,7 @@ EXPORT_SYMBOL(msm_audio_ion_import);
 *
 * Returns 0 on success or error on failure
 */
 /* This funtion is called with ion_data list mutex lock */
int msm_audio_ion_free(struct dma_buf *dma_buf)
{
	int ret = 0;
@@ -540,11 +544,15 @@ int msm_audio_ion_free(struct dma_buf *dma_buf)
		return -EINVAL;
	}

	mutex_lock(&(msm_audio_ion_data.list_mutex));
	ret = msm_audio_ion_unmap_kernel(dma_buf);
	if (ret)
	if (ret) {
		mutex_unlock(&(msm_audio_ion_data.list_mutex));
		return ret;
	}

	msm_audio_dma_buf_unmap(dma_buf);
	mutex_unlock(&(msm_audio_ion_data.list_mutex));

	return 0;
}
+11 −10
Original line number Diff line number Diff line
/* Copyright (c) 2012-2021, 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 * SPDX-License-Identifier: GPL-2.0-only
*/
#include <linux/slab.h>
#include <linux/debugfs.h>
@@ -6418,6 +6411,14 @@ static int afe_sidetone_iir(u16 tx_port_id)
		pr_debug("%s: adding 2 to size:%d\n", __func__, size);
		size = size + 2;
	}

	if (size > MAX_SIDETONE_IIR_DATA_SIZE) {
		pr_err("%s: iir_config size is out of bounds:%d\n", __func__, size);
		mutex_unlock(&this_afe.cal_data[cal_index]->lock);
		ret = -EINVAL;
		goto done;
	}

	memcpy(&filter_data.iir_config, &st_iir_cal_info->iir_config, size);
	mutex_unlock(&this_afe.cal_data[cal_index]->lock);

Loading