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

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

Merge 342f8ec2 on remote branch

Change-Id: I4c91728ccb0aa5e9a5cf6232f300318e411b4479
parents 66b9d283 342f8ec2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
		-DPTT_SOCK_SVC_ENABLE \
		-Wall\
		-Werror\
		-Wno-enum-conversion \
		-D__linux__

KBUILD_CPPFLAGS += $(CDEFINES)
+18 −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>
@@ -626,6 +627,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),
@@ -656,6 +663,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);
@@ -683,6 +695,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);

+14 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */
#include <linux/init.h>
@@ -5566,6 +5566,14 @@ static int get_ec_ref_port_id(int value, int *index)
		*index = 40;
		port_id = AFE_PORT_ID_QUINARY_TDM_TX;
		break;
	case 41:
		*index = 41;
		port_id = AFE_PORT_ID_PRIMARY_TDM_RX;
		break;
	case 42:
		*index = 42;
		port_id = AFE_PORT_ID_PRIMARY_TDM_TX;
		break;
	default:
		*index = 0; /* NONE */
		pr_err("%s: Invalid value %d\n", __func__, value);
@@ -5624,6 +5632,7 @@ static const char *const ec_ref_rx[] = { "None", "SLIM_RX", "I2S_RX",
	"SLIM_7_RX", "RX_CDC_DMA_RX_0", "RX_CDC_DMA_RX_1", "RX_CDC_DMA_RX_2",
	"RX_CDC_DMA_RX_3", "TX_CDC_DMA_TX_0", "TERT_TDM_RX_2", "SEC_TDM_TX_0",
	"DISPLAY_PORT1", "SEN_MI2S_RX", "SENARY_MI2S_TX", "QUIN_TDM_TX_0",
	"PRI_TDM_RX_0", "PRI_TDM_TX_0",
};
static const struct soc_enum msm_route_ec_ref_rx_enum[] = {
@@ -29688,6 +29697,8 @@ static const struct snd_soc_dapm_route intercon_tdm[] = {
	{"AUDIO_REF_EC_UL1 MUX", "TERT_TDM_RX_2", "TERT_TDM_RX_2"},
	{"AUDIO_REF_EC_UL1 MUX", "SEC_TDM_TX_0", "SEC_TDM_TX_0"},
	{"AUDIO_REF_EC_UL1 MUX", "QUIN_TDM_TX_0", "QUIN_TDM_TX_0"},
	{"AUDIO_REF_EC_UL1 MUX", "PRI_TDM_RX_0", "PRI_TDM_RX_0"},
	{"AUDIO_REF_EC_UL1 MUX", "PRI_TDM_TX_0", "PRI_TDM_TX_0"},
	{"AUDIO_REF_EC_UL10 MUX", "QUAT_TDM_TX_1", "QUAT_TDM_TX_1"},
	{"AUDIO_REF_EC_UL10 MUX", "QUAT_TDM_RX_0", "QUAT_TDM_RX_0"},
@@ -29696,6 +29707,8 @@ static const struct snd_soc_dapm_route intercon_tdm[] = {
	{"AUDIO_REF_EC_UL10 MUX", "TERT_TDM_TX_0", "TERT_TDM_TX_0"},
	{"AUDIO_REF_EC_UL10 MUX", "TERT_TDM_RX_2", "TERT_TDM_RX_2"},
	{"AUDIO_REF_EC_UL10 MUX", "SEC_TDM_TX_0", "SEC_TDM_TX_0"},
	{"AUDIO_REF_EC_UL10 MUX", "PRI_TDM_RX_0", "PRI_TDM_RX_0"},
	{"AUDIO_REF_EC_UL10 MUX", "PRI_TDM_TX_0", "PRI_TDM_TX_0"},
	{"LSM1 Mixer", "QUIN_TDM_TX_0", "QUIN_TDM_TX_0"},
	{"LSM1 Mixer", "TERT_TDM_TX_0", "TERT_TDM_TX_0"},
+29 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/init.h>
@@ -365,6 +366,13 @@ static void voip_process_ul_pkt(uint8_t *voc_pkt,
		switch (prtd->mode) {
		case MODE_AMR_WB:
		case MODE_AMR: {
			if (pkt_len <= DSP_FRAME_HDR_LEN) {
				pr_err("%s: pkt_len %d is < required len\n",
						__func__, pkt_len);
				spin_unlock_irqrestore(&prtd->dsp_ul_lock,
							dsp_flags);
				return;
			}
			/* Remove the DSP frame info header. Header format:
			 * Bits 0-3: Frame rate
			 * Bits 4-7: Frame type
@@ -385,6 +393,13 @@ static void voip_process_ul_pkt(uint8_t *voc_pkt,
		case MODE_4GV_NB:
		case MODE_4GV_WB:
		case MODE_4GV_NW: {
			if (pkt_len <= DSP_FRAME_HDR_LEN) {
				pr_err("%s: pkt_len %d is < required len\n",
						__func__, pkt_len);
				spin_unlock_irqrestore(&prtd->dsp_ul_lock,
							dsp_flags);
				return;
			}
			/* Remove the DSP frame info header.
			 * Header format:
			 * Bits 0-3: frame rate
@@ -422,6 +437,13 @@ static void voip_process_ul_pkt(uint8_t *voc_pkt,
			buf_node->frame.frm_hdr.timestamp = timestamp;
			voc_pkt = voc_pkt + DSP_FRAME_HDR_LEN;

			if (pkt_len <= 2 * DSP_FRAME_HDR_LEN) {
				pr_err("%s: pkt_len %d is < required len\n",
						__func__, pkt_len);
				spin_unlock_irqrestore(&prtd->dsp_ul_lock,
							dsp_flags);
				return;
			}
			/* There are two frames in the buffer. Length of the
			 * first frame:
			 */
@@ -457,6 +479,13 @@ static void voip_process_ul_pkt(uint8_t *voc_pkt,
				buf_node->frame.frm_hdr.timestamp = timestamp;
				voc_pkt = voc_pkt + DSP_FRAME_HDR_LEN;

				if (pkt_len <= 2 * DSP_FRAME_HDR_LEN) {
					pr_err("%s: pkt_len %d is < required len\n",
							__func__, pkt_len);
					spin_unlock_irqrestore(&prtd->dsp_ul_lock,
								dsp_flags);
					return;
				}
				/* There are two frames in the buffer. Length
				 * of the second frame:
				 */
+16 −8
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
 *
 * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/init.h>
@@ -63,6 +65,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)
{
@@ -151,7 +154,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)) {

@@ -175,7 +177,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,
@@ -230,6 +231,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;
@@ -278,7 +280,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) {
@@ -286,7 +287,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,
@@ -309,7 +309,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;
@@ -331,7 +332,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;
	}

@@ -390,7 +393,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;
@@ -490,7 +493,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;
@@ -516,6 +519,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;
@@ -525,11 +529,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;
}
Loading