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

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

Merge 342f8ec2 on remote branch

Change-Id: I86d30397ba8ad85411a8335b1cb4906a9326b219
parents d776211b 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)
+45 −29
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */
#include <linux/module.h>
#include <linux/init.h>
@@ -459,6 +460,10 @@ static void rouleur_mbhc_get_result_params(struct rouleur_priv *rouleur,
		__func__, *zdet);
	/* Start discharge */
	regmap_update_bits(rouleur->regmap, ROULEUR_ANA_MBHC_ZDET, 0x20, 0x00);
	/* Discharge operation takes time for the HPH PA to ramp down to 0V.
	 * Add finite amunt of delay to complete ramp down.
	 */
	usleep_range(40000, 40010);
}

static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,
@@ -473,9 +478,6 @@ static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,
	/* HPHL pull down switch to force OFF */
	regmap_update_bits(rouleur->regmap,
			  ROULEUR_ANA_HPHPA_CNP_CTL_2, 0x30, 0x00);
	/* Averaging enable for reliable results */
	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x80);
	/* ZDET left measurement enable */
	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET, 0x80, 0x80);
@@ -484,8 +486,6 @@ static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,

	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET, 0x80, 0x00);
	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x00);
	regmap_update_bits(rouleur->regmap,
			  ROULEUR_ANA_HPHPA_CNP_CTL_2, 0x30, 0x20);

@@ -497,9 +497,6 @@ static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,
	/* HPHR pull down switch to force OFF */
	regmap_update_bits(rouleur->regmap,
			  ROULEUR_ANA_HPHPA_CNP_CTL_2, 0x0C, 0x00);
	/* Averaging enable for reliable results */
	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x80);
	/* ZDET right measurement enable */
	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET, 0x40, 0x40);
@@ -509,8 +506,6 @@ static void rouleur_mbhc_zdet_start(struct snd_soc_component *component,

	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET, 0x40, 0x00);
	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x00);
	regmap_update_bits(rouleur->regmap,
			  ROULEUR_ANA_HPHPA_CNP_CTL_2, 0x0C, 0x08);

@@ -522,22 +517,39 @@ static void rouleur_mbhc_impedance_fn(struct snd_soc_component *component,
				      int32_t *zl, int32_t *zr)
{
	int i;
	bool is_zl_calculted = false;
	bool is_zr_calculted = false;

	/*
	 * Calculate impedance for multiple times until IMPED_NUM_RETRY
	 * stop calculating if the result is within the threshold
	 */
	for (i = 0; i < IMPED_NUM_RETRY; i++) {
		if (!is_zl_calculted) {
			/* Start of left ch impedance calculation */
			rouleur_mbhc_zdet_start(component, z1L, NULL);
			if ((*z1L == ROULEUR_ZDET_FLOATING_IMPEDANCE) ||
				(*z1L > ROULEUR_ZDET_VAL_100K))
				*zl = ROULEUR_ZDET_FLOATING_IMPEDANCE;
		else
			else {
				*zl = *z1L/1000;

				is_zl_calculted = true;
			}
		}
		if (!is_zr_calculted) {
			/* Start of right ch impedance calculation */
			rouleur_mbhc_zdet_start(component, NULL, z1R);
			if ((*z1R == ROULEUR_ZDET_FLOATING_IMPEDANCE) ||
				(*z1R > ROULEUR_ZDET_VAL_100K))
				*zr = ROULEUR_ZDET_FLOATING_IMPEDANCE;
		else
			else {
				*zr = *z1R/1000;
				is_zr_calculted = true;
			}
		}

		if (is_zl_calculted && is_zr_calculted)
			break;
	}

	dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n",
@@ -595,12 +607,16 @@ static void rouleur_wcd_mbhc_calc_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
	/* 1ms delay needed after disable surge protection */
	usleep_range(1000, 1010);

	/*
	 * Call impedance detection routine multiple times
	 * in order to avoid wrong impedance values.
	 */
	/* Averaging enable for reliable impedance results */
	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x80);

	rouleur_mbhc_impedance_fn(component, &z1L, &z1R, zl, zr);

	/* Disable averaging after impedance calculation */
	regmap_update_bits(rouleur->regmap,
			   ROULEUR_ANA_MBHC_ZDET_ANA_CTL, 0x80, 0x00);

	/* Mono/stereo detection */
	if ((*zl == ROULEUR_ZDET_FLOATING_IMPEDANCE) &&
		(*zr == ROULEUR_ZDET_FLOATING_IMPEDANCE)) {
+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:
				 */
Loading