Merge "asoc: use ASoC API to set driver component name prefix" into audio-kernel.lnx.5.15
This commit is contained in:

committato da
Gerrit - the friendly Code Review server

commit
af2e431272
@@ -599,9 +599,7 @@ static int swr_dmic_probe(struct swr_device *pdev)
|
||||
int i = 0;
|
||||
u8 swr_devnum = 0;
|
||||
int dev_index = -1;
|
||||
char* prefix_name = NULL;
|
||||
struct swr_dmic_priv *swr_dmic = NULL;
|
||||
const char *swr_dmic_name_prefix_of = NULL;
|
||||
const char *swr_dmic_codec_name_of = NULL;
|
||||
struct snd_soc_component *component = NULL;
|
||||
int num_retry = NUM_ATTEMPTS;
|
||||
@@ -645,15 +643,6 @@ static int swr_dmic_probe(struct swr_device *pdev)
|
||||
|
||||
swr_dmic->swr_slave = pdev;
|
||||
|
||||
ret = of_property_read_string(pdev->dev.of_node, "qcom,swr-dmic-prefix",
|
||||
&swr_dmic_name_prefix_of);
|
||||
if (ret) {
|
||||
dev_dbg(&pdev->dev, "%s: Looking up %s property in node %s failed\n",
|
||||
__func__, "qcom,swr-dmic-prefix",
|
||||
pdev->dev.of_node->full_name);
|
||||
goto dev_err;
|
||||
}
|
||||
|
||||
ret = of_property_read_string(pdev->dev.of_node, "qcom,codec-name",
|
||||
&swr_dmic_codec_name_of);
|
||||
if (ret) {
|
||||
@@ -755,16 +744,6 @@ static int swr_dmic_probe(struct swr_device *pdev)
|
||||
goto dev_err;
|
||||
}
|
||||
swr_dmic->component = component;
|
||||
prefix_name = devm_kzalloc(&pdev->dev,
|
||||
strlen(swr_dmic_name_prefix_of) + 1,
|
||||
GFP_KERNEL);
|
||||
if (!prefix_name) {
|
||||
ret = -ENOMEM;
|
||||
goto dev_err;
|
||||
}
|
||||
strlcpy(prefix_name, swr_dmic_name_prefix_of,
|
||||
strlen(prefix_name) + 1);
|
||||
component->name_prefix = prefix_name;
|
||||
|
||||
return 0;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef WSA883X_INTERNAL_H
|
||||
@@ -123,7 +123,6 @@ struct wsa883x_priv {
|
||||
int num_supplies;
|
||||
struct regulator_bulk_data *supplies;
|
||||
unsigned long status_mask;
|
||||
char *wsa883x_name_prefix;
|
||||
struct snd_soc_dai_driver *dai_driver;
|
||||
struct snd_soc_component_driver *driver;
|
||||
};
|
||||
|
@@ -1643,7 +1643,6 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
|
||||
bool pin_state_current = false;
|
||||
struct wsa_ctrl_platform_data *plat_data = NULL;
|
||||
struct snd_soc_component *component;
|
||||
const char *wsa883x_name_prefix_of = NULL;
|
||||
char buffer[MAX_NAME_LEN];
|
||||
int dev_index = 0;
|
||||
|
||||
@@ -1763,16 +1762,6 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
|
||||
|
||||
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PA_ON_ERR);
|
||||
|
||||
ret = of_property_read_string(pdev->dev.of_node, "qcom,wsa-prefix",
|
||||
&wsa883x_name_prefix_of);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,
|
||||
"%s: Looking up %s property in node %s failed\n",
|
||||
__func__, "qcom,wsa-prefix",
|
||||
pdev->dev.of_node->full_name);
|
||||
goto err_irq;
|
||||
}
|
||||
|
||||
wsa883x->driver = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct snd_soc_component_driver), GFP_KERNEL);
|
||||
if (!wsa883x->driver) {
|
||||
@@ -1813,15 +1802,12 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
|
||||
ret = snd_soc_register_component(&pdev->dev,
|
||||
wsa883x->driver, wsa883x->dai_driver, 1);
|
||||
|
||||
wsa883x->wsa883x_name_prefix = kstrndup(wsa883x_name_prefix_of,
|
||||
strlen(wsa883x_name_prefix_of), GFP_KERNEL);
|
||||
component = snd_soc_lookup_component(&pdev->dev, wsa883x->driver->name);
|
||||
if (!component) {
|
||||
dev_err(&pdev->dev, "%s: component is NULL \n", __func__);
|
||||
ret = -EINVAL;
|
||||
goto err_mem;
|
||||
}
|
||||
component->name_prefix = wsa883x->wsa883x_name_prefix;
|
||||
|
||||
wsa883x->parent_np = of_parse_phandle(pdev->dev.of_node,
|
||||
"qcom,bolero-handle", 0);
|
||||
@@ -1891,7 +1877,6 @@ static int wsa883x_swr_probe(struct swr_device *pdev)
|
||||
return 0;
|
||||
|
||||
err_mem:
|
||||
kfree(wsa883x->wsa883x_name_prefix);
|
||||
if (wsa883x->dai_driver) {
|
||||
kfree(wsa883x->dai_driver->name);
|
||||
kfree(wsa883x->dai_driver->playback.stream_name);
|
||||
@@ -1956,7 +1941,6 @@ static int wsa883x_swr_remove(struct swr_device *pdev)
|
||||
#endif
|
||||
mutex_destroy(&wsa883x->res_lock);
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
kfree(wsa883x->wsa883x_name_prefix);
|
||||
if (wsa883x->dai_driver) {
|
||||
kfree(wsa883x->dai_driver->name);
|
||||
kfree(wsa883x->dai_driver->playback.stream_name);
|
||||
|
@@ -165,7 +165,6 @@ struct wsa884x_priv {
|
||||
int num_supplies;
|
||||
struct regulator_bulk_data *supplies;
|
||||
unsigned long status_mask;
|
||||
char *wsa884x_name_prefix;
|
||||
struct snd_soc_dai_driver *dai_driver;
|
||||
struct snd_soc_component_driver *driver;
|
||||
};
|
||||
|
@@ -1869,7 +1869,6 @@ static int wsa884x_swr_probe(struct swr_device *pdev)
|
||||
bool pin_state_current = false;
|
||||
struct wsa_ctrl_platform_data *plat_data = NULL;
|
||||
struct snd_soc_component *component;
|
||||
const char *wsa884x_name_prefix_of = NULL;
|
||||
char buffer[MAX_NAME_LEN];
|
||||
int dev_index = 0;
|
||||
|
||||
@@ -1991,16 +1990,6 @@ static int wsa884x_swr_probe(struct swr_device *pdev)
|
||||
|
||||
wcd_disable_irq(&wsa884x->irq_info, WSA884X_IRQ_INT_PA_ON_ERR);
|
||||
|
||||
ret = of_property_read_string(pdev->dev.of_node, "qcom,wsa-prefix",
|
||||
&wsa884x_name_prefix_of);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,
|
||||
"%s: Looking up %s property in node %s failed\n",
|
||||
__func__, "qcom,wsa-prefix",
|
||||
pdev->dev.of_node->full_name);
|
||||
goto err_irq;
|
||||
}
|
||||
|
||||
wsa884x->driver = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct snd_soc_component_driver), GFP_KERNEL);
|
||||
if (!wsa884x->driver) {
|
||||
@@ -2042,15 +2031,12 @@ static int wsa884x_swr_probe(struct swr_device *pdev)
|
||||
ret = snd_soc_register_component(&pdev->dev,
|
||||
wsa884x->driver, wsa884x->dai_driver, 1);
|
||||
|
||||
wsa884x->wsa884x_name_prefix = kstrndup(wsa884x_name_prefix_of,
|
||||
strlen(wsa884x_name_prefix_of), GFP_KERNEL);
|
||||
component = snd_soc_lookup_component(&pdev->dev, wsa884x->driver->name);
|
||||
if (!component) {
|
||||
dev_err(&pdev->dev, "%s: component is NULL\n", __func__);
|
||||
ret = -EINVAL;
|
||||
goto err_mem;
|
||||
}
|
||||
component->name_prefix = wsa884x->wsa884x_name_prefix;
|
||||
|
||||
wsa884x->parent_np = of_parse_phandle(pdev->dev.of_node,
|
||||
"qcom,bolero-handle", 0);
|
||||
@@ -2120,7 +2106,6 @@ static int wsa884x_swr_probe(struct swr_device *pdev)
|
||||
return 0;
|
||||
|
||||
err_mem:
|
||||
kfree(wsa884x->wsa884x_name_prefix);
|
||||
if (wsa884x->dai_driver) {
|
||||
kfree(wsa884x->dai_driver->name);
|
||||
kfree(wsa884x->dai_driver->playback.stream_name);
|
||||
@@ -2185,7 +2170,6 @@ static int wsa884x_swr_remove(struct swr_device *pdev)
|
||||
#endif
|
||||
mutex_destroy(&wsa884x->res_lock);
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
kfree(wsa884x->wsa884x_name_prefix);
|
||||
if (wsa884x->dai_driver) {
|
||||
kfree(wsa884x->dai_driver->name);
|
||||
kfree(wsa884x->dai_driver->playback.stream_name);
|
||||
|
Fai riferimento in un nuovo problema
Block a user