Merge "asoc: update tx frame config for soundwire port"

This commit is contained in:
qctecmdr
2020-05-05 23:55:57 -07:00
committed by Gerrit - the friendly Code Review server
3 changed files with 64 additions and 12 deletions

View File

@@ -4027,7 +4027,7 @@ static void wcd938x_unbind(struct device *dev)
} }
static const struct of_device_id wcd938x_dt_match[] = { static const struct of_device_id wcd938x_dt_match[] = {
{ .compatible = "qcom,wcd938x-codec" }, { .compatible = "qcom,wcd938x-codec", .data = "wcd938x"},
{} {}
}; };

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* /*
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
*/ */
#ifndef _KONA_PORT_CONFIG #ifndef _KONA_PORT_CONFIG
@@ -59,6 +59,14 @@ static struct port_params tx_frame_params_v2[SWR_MSTR_PORT_LEN] = {
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 2}, /* TX4 */ {3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 2}, /* TX4 */
}; };
static struct port_params tx_frame_params_wcd937x[SWR_MSTR_PORT_LEN] = {
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
{3, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
};
static struct swr_mstr_port_map sm_port_map[] = { static struct swr_mstr_port_map sm_port_map[] = {
{TX_MACRO, SWR_UC0, tx_frame_params_default}, {TX_MACRO, SWR_UC0, tx_frame_params_default},
{RX_MACRO, SWR_UC0, rx_frame_params_default}, {RX_MACRO, SWR_UC0, rx_frame_params_default},
@@ -73,4 +81,11 @@ static struct swr_mstr_port_map sm_port_map_v2[] = {
{WSA_MACRO, SWR_UC0, wsa_frame_params_default}, {WSA_MACRO, SWR_UC0, wsa_frame_params_default},
}; };
static struct swr_mstr_port_map sm_port_map_wcd937x[] = {
{TX_MACRO, SWR_UC0, tx_frame_params_wcd937x},
{RX_MACRO, SWR_UC0, rx_frame_params_default},
{RX_MACRO, SWR_UC1, rx_frame_params_dsd},
{WSA_MACRO, SWR_UC0, wsa_frame_params_default},
};
#endif /* _KONA_PORT_CONFIG */ #endif /* _KONA_PORT_CONFIG */

View File

@@ -5440,6 +5440,9 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
struct snd_card *card; struct snd_card *card;
struct snd_info_entry *entry; struct snd_info_entry *entry;
struct snd_soc_component *aux_comp; struct snd_soc_component *aux_comp;
struct platform_device *pdev = NULL;
int i = 0;
char *data = NULL;
struct msm_asoc_mach_data *pdata = struct msm_asoc_mach_data *pdata =
snd_soc_card_get_drvdata(rtd->card); snd_soc_card_get_drvdata(rtd->card);
@@ -5516,18 +5519,52 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
WSA_MACRO_GAIN_OFFSET_M1P5_DB); WSA_MACRO_GAIN_OFFSET_M1P5_DB);
} }
} }
if (pdata->lito_v2_enabled) { }
/*
* Enable tx data line3 for saipan version v2 amd for (i = 0; i < rtd->card->num_aux_devs; i++)
* write corresponding lpi register. {
*/ if (msm_aux_dev[i].name != NULL ) {
bolero_set_port_map(component, ARRAY_SIZE(sm_port_map_v2), if (strstr(msm_aux_dev[i].name, "wsa"))
sm_port_map_v2); continue;
} else { }
bolero_set_port_map(component, ARRAY_SIZE(sm_port_map),
sm_port_map); if (msm_aux_dev[i].codec_of_node) {
pdev = of_find_device_by_node(
msm_aux_dev[i].codec_of_node);
if (pdev)
data = (char*) of_device_get_match_data(
&pdev->dev);
if (data != NULL) {
if (!strncmp(data, "wcd937x",
sizeof("wcd937x"))) {
bolero_set_port_map(component,
ARRAY_SIZE(sm_port_map_wcd937x),
sm_port_map_wcd937x);
break;
} else if (!strncmp( data, "wcd938x",
sizeof("wcd938x"))) {
if (pdata->lito_v2_enabled) {
/*
* Enable tx data line3 for
* saipan version v2 and
* write corresponding
* lpi register.
*/
bolero_set_port_map(component,
ARRAY_SIZE(sm_port_map_v2),
sm_port_map_v2);
} else {
bolero_set_port_map(component,
ARRAY_SIZE(sm_port_map),
sm_port_map);
}
break;
}
}
} }
} }
card = rtd->card->snd_card; card = rtd->card->snd_card;
if (!pdata->codec_root) { if (!pdata->codec_root) {
entry = msm_snd_info_create_subdir(card->module, "codecs", entry = msm_snd_info_create_subdir(card->module, "codecs",