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

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

Merge fa03eae6 on remote branch

Change-Id: I9473edbe13f26f250784aa399eb009a94a7d9721
parents c098c049 fa03eae6
Loading
Loading
Loading
Loading
+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)) {
+2 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2016, 2018-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/clk.h>
@@ -1470,7 +1471,7 @@ static int wsa881x_i2c_probe(struct i2c_client *client,
					pdata->regmap[WSA881X_DIGITAL_SLAVE],
					WSA881X_DIGITAL_SLAVE);
		}
		pdata->wsa881x_id == wsa881x_i2c_read_device(pdata,
		pdata->wsa881x_id = wsa881x_i2c_read_device(pdata,
					WSA881X_OTP_REG_0);
		if (pdata->wsa881x_id & 0x01) {
			pdata->wsa881x_id = WSA8815;
+7 −6
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */


@@ -2907,18 +2908,18 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
	spin_lock_irqsave(&prtd->lock, flags);
	tstamp.sampling_rate = prtd->sample_rate;
	tstamp.byte_offset = prtd->byte_offset;
	if (cstream->direction == SND_COMPRESS_PLAYBACK)
	if (cstream->direction == SND_COMPRESS_PLAYBACK) {
		runtime->total_bytes_transferred = prtd->copied_total;
		tstamp.copied_total = prtd->copied_total;
	else if (cstream->direction == SND_COMPRESS_CAPTURE)
	}
	else if (cstream->direction == SND_COMPRESS_CAPTURE) {
		runtime->total_bytes_available = prtd->received_total;
		tstamp.copied_total = prtd->received_total;
	}
	first_buffer = prtd->first_buffer;
	if (atomic_read(&prtd->error)) {
		pr_err_ratelimited("%s Got RESET EVENTS notification, return error\n",
				   __func__);
		if (cstream->direction == SND_COMPRESS_PLAYBACK)
			runtime->total_bytes_transferred = tstamp.copied_total;
		else
			runtime->total_bytes_available = tstamp.copied_total;
		tstamp.pcm_io_frames = 0;
		memcpy(arg, &tstamp, sizeof(struct snd_compr_tstamp));
		spin_unlock_irqrestore(&prtd->lock, flags);
+9 −0
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) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */


@@ -1007,6 +1008,14 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
			xfer = size;
		offset = prtd->in_frame_info[idx].offset;
		pr_debug("Offset value = %d\n", offset);

		if (offset >= size) {
			pr_err("%s: Invalid dsp buf offset\n", __func__);
			ret = -EFAULT;
			q6asm_cpu_buf_release(OUT, prtd->audio_client);
			goto fail;
		}

		if (size == 0 || size < prtd->pcm_count) {
			memset(bufptr + offset + size, 0, prtd->pcm_count - size);
			if (fbytes > prtd->pcm_count)
+5 −0
Original line number Diff line number Diff line
@@ -21836,6 +21836,10 @@ static const struct snd_kcontrol_new wsa_cdc_dma_rx_0_port_mixer_controls[] = {
	MSM_BACKEND_DAI_WSA_CDC_DMA_RX_0,
	MSM_BACKEND_DAI_SLIMBUS_8_TX, 1, 0, msm_routing_get_port_mixer,
	msm_routing_put_port_mixer),
	SOC_DOUBLE_EXT("SLIM_7_TX", SND_SOC_NOPM,
	MSM_BACKEND_DAI_WSA_CDC_DMA_RX_0,
	MSM_BACKEND_DAI_SLIMBUS_7_TX, 1, 0, msm_routing_get_port_mixer,
	msm_routing_put_port_mixer),
	SOC_DOUBLE_EXT("TERT_MI2S_TX", SND_SOC_NOPM,
	MSM_BACKEND_DAI_WSA_CDC_DMA_RX_0,
	MSM_BACKEND_DAI_TERTIARY_MI2S_TX, 1, 0, msm_routing_get_port_mixer,
@@ -27295,6 +27299,7 @@ static const struct snd_soc_dapm_route intercon[] = {
	{"WSA_CDC_DMA_RX_0 Port Mixer", "VA_CDC_DMA_TX_0", "VA_CDC_DMA_TX_0"},
	{"WSA_CDC_DMA_RX_0 Port Mixer", "TX_CDC_DMA_TX_3", "TX_CDC_DMA_TX_3"},
	{"WSA_CDC_DMA_RX_0 Port Mixer", "SLIM_8_TX", "SLIMBUS_8_TX"},
	{"WSA_CDC_DMA_RX_0 Port Mixer", "SLIM_7_TX", "SLIMBUS_7_TX"},
	{"WSA_CDC_DMA_RX_0", NULL, "WSA_CDC_DMA_RX_0 Port Mixer"},
	{"RX_CDC_DMA_RX_0 Port Mixer", "TX_CDC_DMA_TX_3", "TX_CDC_DMA_TX_3"},
Loading