From 19363f7321489c2b8c52109442fa5e32a45fd303 Mon Sep 17 00:00:00 2001 From: Aditya Bavanari Date: Sat, 18 Apr 2020 11:21:43 +0530 Subject: [PATCH] asoc: Add Rx swr master port config for scuba target Add port config for Rx swr master in order to support the rouleur codec in scuba target. Change-Id: Ic278d02f222686afc6ff976c4b1c3bb499ed903f Signed-off-by: Aditya Bavanari --- asoc/bengal-port-config.h | 16 +++++++++++++++- asoc/bengal.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/asoc/bengal-port-config.h b/asoc/bengal-port-config.h index a20a6d54487e..37d4f740aac6 100644 --- a/asoc/bengal-port-config.h +++ b/asoc/bengal-port-config.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef _BENGAL_PORT_CONFIG @@ -21,6 +21,15 @@ static struct port_params rx_frame_params_default[SWR_MSTR_PORT_LEN] = { {0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0}, }; +static struct port_params rx_frame_params_rouleur[SWR_MSTR_PORT_LEN] = { + {3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1}, + {31, 0, 0, 3, 6, 7, 0, 0xFF, 0}, + {31, 1, 0, 0xFF, 0xFF, 4, 1, 0xFF, 0}, + {7, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0}, + {0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0}, +}; + + static struct port_params rx_frame_params_dsd[SWR_MSTR_PORT_LEN] = { {3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1}, {31, 0, 0, 3, 6, 7, 0, 0xFF, 0}, @@ -42,4 +51,9 @@ static struct swr_mstr_port_map sm_port_map[] = { {RX_MACRO, SWR_UC1, rx_frame_params_dsd}, }; +static struct swr_mstr_port_map sm_port_map_rouleur[] = { + {VA_MACRO, SWR_UC0, tx_frame_params_default}, + {RX_MACRO, SWR_UC0, rx_frame_params_rouleur}, + {RX_MACRO, SWR_UC1, rx_frame_params_dsd}, +}; #endif /* _BENGAL_PORT_CONFIG */ diff --git a/asoc/bengal.c b/asoc/bengal.c index 22677cb258f8..8123152b4365 100644 --- a/asoc/bengal.c +++ b/asoc/bengal.c @@ -4259,6 +4259,9 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dapm_context *dapm; struct snd_card *card; struct snd_info_entry *entry; + struct platform_device *pdev = NULL; + int i = 0; + char *data = NULL; struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(rtd->card); @@ -4305,8 +4308,38 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd) snd_soc_dapm_sync(dapm); - bolero_set_port_map(component, ARRAY_SIZE(sm_port_map), - sm_port_map); + for (i = 0; i < rtd->card->num_aux_devs; i++) + { + if (msm_aux_dev[i].name != NULL ) { + if (strstr(msm_aux_dev[i].name, "wsa")) + continue; + } + + 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), + sm_port_map); + break; + } else if (!strncmp( data, "rouleur", + sizeof("rouleur"))) { + bolero_set_port_map(component, + ARRAY_SIZE(sm_port_map_rouleur), + sm_port_map_rouleur); + break; + } + } + } + } + card = rtd->card->snd_card; if (!pdata->codec_root) { entry = snd_info_create_subdir(card->module, "codecs",