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

Commit f22c602a authored by Kunlei Zhang's avatar Kunlei Zhang
Browse files

asoc: Parse wcd-datalane-mismatch property to update rx frame config for khaje



Due to datalane mismatch, update rx frame config to use DATA_LANE0 for
khaje qrd.

Change-Id: I0f5720ab1d7b7c585f7df986481c28568385f09d
Signed-off-by: default avatarKunlei Zhang <kunleiz@codeaurora.org>
parent ffe853a8
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
 */

#ifndef _BENGAL_PORT_CONFIG
@@ -38,6 +38,14 @@ static struct port_params rx_frame_params_dsd[SWR_MSTR_PORT_LEN] = {
	{3,  1,  0,  0xFF, 0xFF, 0xFF, 0xFF, 3,    0},
};

static struct port_params rx_frame_params_khaje[SWR_MSTR_PORT_LEN] = {
	{3,  1,  0,  0xFF, 0xFF, 1,    0xFF, 0xFF, 0},
	{31, 0,  0,  3,    6,    7,    0,    0xFF, 0},
	{31, 11, 11, 0xFF, 0xFF, 4,    1,    0xFF, 0},
	{7,  1,  0,  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
	{0,  0,  0,  0xFF, 0xFF, 0xFF, 0xFF, 0,    0},
};

/* TX UC1: TX1: 1ch, TX2: 2chs, TX3: 1ch(MBHC) */
static struct port_params tx_frame_params_default[SWR_MSTR_PORT_LEN] = {
	{3,  1,  0,  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},  /* TX1 */
@@ -56,4 +64,10 @@ static struct swr_mstr_port_map sm_port_map_rouleur[] = {
	{RX_MACRO, SWR_UC0, rx_frame_params_rouleur},
	{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
};

static struct swr_mstr_port_map sm_port_map_khaje[] = {
	{VA_MACRO, SWR_UC0, tx_frame_params_default},
	{RX_MACRO, SWR_UC0, rx_frame_params_khaje},
	{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
};
#endif /* _BENGAL_PORT_CONFIG */
+11 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/clk.h>
@@ -555,6 +555,7 @@ static struct snd_soc_codec_conf *msm_codec_conf;
static struct snd_soc_card snd_soc_card_bengal_msm;
static int dmic_0_1_gpio_cnt;
static int dmic_2_3_gpio_cnt;
static u32 wcd_datalane_mismatch;

static void *def_wcd_mbhc_cal(void);
static void *def_rouleur_mbhc_cal(void);
@@ -4330,7 +4331,11 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
				data = (char*) of_device_get_match_data(
								&pdev->dev);
			if (data != NULL) {
				if (!strncmp(data, "wcd937x",
				if (wcd_datalane_mismatch) {
					bolero_set_port_map(component,
						ARRAY_SIZE(sm_port_map_khaje),
						sm_port_map_khaje);
				} else if (!strncmp(data, "wcd937x",
						sizeof("wcd937x"))) {
					bolero_set_port_map(component,
						ARRAY_SIZE(sm_port_map),
@@ -6735,6 +6740,10 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
	if (ret)
		goto err;

	ret = of_property_read_u32(pdev->dev.of_node,
			"qcom,wcd-datalane-mismatch",
			&wcd_datalane_mismatch);

	ret = devm_snd_soc_register_card(&pdev->dev, card);
	if (ret == -EPROBE_DEFER) {
		if (codec_reg_done)