ASoC: tegra-alt: override adsp fe-name

Change provide options to update fe-names.
This can be controlled via dt property
fe-info.

Jira EMA-421

Change-Id: Ie8c18e20f07d8a910e93f52720289a3ea70ee347
Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1514371
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
(cherry picked from commit ef7904abf93b0451761c304d19f2e6281672e2ab)
Reviewed-on: https://git-master.nvidia.com/r/1533083
GVS: Gerrit_Virtual_Submit
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
This commit is contained in:
Dipesh Gandhi
2017-07-06 12:27:24 +05:30
committed by Sameer Pujar
parent b271d423d8
commit d772f9ce82

View File

@@ -3860,7 +3860,11 @@ static void tegra210_adsp_wt_replace(struct device *dev, char **dest1,
strcpy(dest, src); strcpy(dest, src);
strcat(dest, " MUX"); strcat(dest, " MUX");
*dest1 = dest; *dest1 = dest;
} else { } else if (strstr(*dest1, " Transmit"))
;/* do nothing */
else if (strstr(*dest1, " Receive"))
;/* do nothing */
else {
strcpy(dest, src); strcpy(dest, src);
*dest1 = dest; *dest1 = dest;
} }
@@ -3869,35 +3873,85 @@ static void tegra210_adsp_wt_replace(struct device *dev, char **dest1,
static void tegra210_adsp_route_modify(struct device *dev, static void tegra210_adsp_route_modify(struct device *dev,
const char *wt_default, const char *wt_from_dt) const char *wt_default, const char *wt_from_dt)
{ {
int i; int i, len, ret;
if (!wt_default || !wt_from_dt) if (!wt_default || !wt_from_dt)
return; return;
ret = device_property_read_string_array(dev, "fe-info",
NULL, 0);
len = strlen(wt_default);
/* Modify dapm routing table */ /* Modify dapm routing table */
for (i = TEGRA210_ADSP_ROUTE_BASE; for (i = ((ret > 0) ? 0 : TEGRA210_ADSP_ROUTE_BASE);
i < ARRAY_SIZE(tegra210_adsp_routes); i++) { i < ARRAY_SIZE(tegra210_adsp_routes); i++) {
/* replace sink name */ /* replace sink name */
if (tegra210_adsp_routes[i].sink) if (tegra210_adsp_routes[i].sink)
if (strstr(tegra210_adsp_routes[i].sink, wt_default)) if (strstr(tegra210_adsp_routes[i].sink, wt_default) &&
(tegra210_adsp_routes[i].sink[len] == ' ' ||
tegra210_adsp_routes[i].sink[len] == 0))
tegra210_adsp_wt_replace(dev, tegra210_adsp_wt_replace(dev,
(char **)&tegra210_adsp_routes[i].sink, (char **)&tegra210_adsp_routes[i].sink,
wt_from_dt); wt_from_dt);
/* replace control name */ /* replace control name */
if (tegra210_adsp_routes[i].control) if (tegra210_adsp_routes[i].control)
if (strstr(tegra210_adsp_routes[i].control, wt_default)) if (strstr(tegra210_adsp_routes[i].control, wt_default)
&& (tegra210_adsp_routes[i].control[len] == ' '
|| tegra210_adsp_routes[i].control[len] == 0))
tegra210_adsp_wt_replace(dev, tegra210_adsp_wt_replace(dev,
(char **)&tegra210_adsp_routes[i].control, (char **)&tegra210_adsp_routes[i].control,
wt_from_dt); wt_from_dt);
/* replace source name */ /* replace source name */
if (tegra210_adsp_routes[i].source) if (tegra210_adsp_routes[i].source)
if (strstr(tegra210_adsp_routes[i].source, wt_default)) if (strstr(tegra210_adsp_routes[i].source, wt_default)
&& (tegra210_adsp_routes[i].source[len] == ' '
|| tegra210_adsp_routes[i].source[len] == 0))
tegra210_adsp_wt_replace(dev, tegra210_adsp_wt_replace(dev,
(char **)&tegra210_adsp_routes[i].source, (char **)&tegra210_adsp_routes[i].source,
wt_from_dt); wt_from_dt);
} }
} }
static void adsp_fe_name_override(struct device *dev, int count)
{
int ret = 0, i;
const char **fe_names;
char *name;
fe_names = devm_kcalloc(dev, count, sizeof(*fe_names),
GFP_KERNEL);
if (!fe_names)
return;
ret = device_property_read_string_array(dev, "fe-info",
fe_names, count);
ret = ret > ADSP_FE_END ? ADSP_FE_END : ret;
for (i = 0 ; i < ret; i++) {
tegra210_adsp_route_modify(dev,
tegra210_adsp_mux_texts[1+i],
fe_names[i]);
name = devm_kzalloc(dev, strlen(fe_names[i]) + 3,
GFP_KERNEL);
strcpy((char *)name, fe_names[i]);
strcat((char *)name, " TX");
tegra210_adsp_widgets[(3*i)+1].name = name;
name = devm_kzalloc(dev, strlen(fe_names[i]) + 4,
GFP_KERNEL);
strcpy((char *)name, fe_names[i]);
strcat((char *)name, " MUX");
tegra210_adsp_widgets[(3*i)+2].name = name;
name = devm_kzalloc(dev, strlen(fe_names[i]) + 3,
GFP_KERNEL);
strcpy((char *)name, fe_names[i]);
strcat((char *)name, " RX");
tegra210_adsp_widgets[(3*i)].name = name;
tegra210_adsp_mux_texts[1+i] = fe_names[i];
}
}
static int tegra210_adsp_param_info(struct snd_kcontrol *kcontrol, static int tegra210_adsp_param_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
@@ -4767,7 +4821,6 @@ static int tegra210_adsp_audio_platform_probe(struct platform_device *pdev)
uint32_t adma_ch_start = TEGRA210_ADSP_ADMA_CHANNEL_START_HV; uint32_t adma_ch_start = TEGRA210_ADSP_ADMA_CHANNEL_START_HV;
uint32_t adma_ch_cnt = TEGRA210_ADSP_ADMA_CHANNEL_COUNT; uint32_t adma_ch_cnt = TEGRA210_ADSP_ADMA_CHANNEL_COUNT;
char plugin_info[20]; char plugin_info[20];
const char **fe_names;
#ifdef CONFIG_SND_SOC_TEGRA_VIRT_IVC_COMM #ifdef CONFIG_SND_SOC_TEGRA_VIRT_IVC_COMM
char switch_info[20]; char switch_info[20];
uint32_t adsp_switch_count; uint32_t adsp_switch_count;
@@ -4836,6 +4889,11 @@ static int tegra210_adsp_audio_platform_probe(struct platform_device *pdev)
adsp->apps[i].input_mode = NVFX_APM_INPUT_MODE_PUSH; adsp->apps[i].input_mode = NVFX_APM_INPUT_MODE_PUSH;
} }
ret = device_property_read_string_array(&pdev->dev, "fe-info",
NULL, 0);
if (ret > 0)
adsp_fe_name_override(&pdev->dev, ret);
/* get the plugin count */ /* get the plugin count */
if (of_property_read_u32(pdev->dev.of_node, if (of_property_read_u32(pdev->dev.of_node,
"num-plugin", "num-plugin",
@@ -4926,6 +4984,7 @@ static int tegra210_adsp_audio_platform_probe(struct platform_device *pdev)
} }
} }
/* copy basic apps needed */ /* copy basic apps needed */
memcpy(&adsp_app_desc[adsp_app_count], memcpy(&adsp_app_desc[adsp_app_count],
&adsp_app_minimal[0], sizeof(adsp_app_minimal)); &adsp_app_minimal[0], sizeof(adsp_app_minimal));
@@ -4998,21 +5057,6 @@ static int tegra210_adsp_audio_platform_probe(struct platform_device *pdev)
goto err_unregister_platform; goto err_unregister_platform;
} }
ret = device_property_read_string_array(&pdev->dev, "fe-info",
NULL, 0);
if (ret > 0) {
fe_names = kcalloc(ret, sizeof(*fe_names), GFP_KERNEL);
if (!fe_names)
goto exit;
ret = device_property_read_string_array(&pdev->dev, "fe-info",
fe_names, ret);
ret = ret > ADSP_FE_END ? ADSP_FE_END : ret;
for (i = 0 ; i < ret; i++)
strcpy((char *)tegra210_adsp_mux_texts[1+i],
fe_names[i]);
kfree(fe_names);
}
exit:
#ifdef CONFIG_SND_SOC_TEGRA_VIRT_IVC_COMM #ifdef CONFIG_SND_SOC_TEGRA_VIRT_IVC_COMM
spin_lock_init(&adsp->switch_lock); spin_lock_init(&adsp->switch_lock);
/* get switch count */ /* get switch count */