Commit 2f8eae39 authored by Mark Brown's avatar Mark Brown

Merge branch 'for-5.7' of...

Merge branch 'for-5.7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.8
parents 2d744ecf 1fecbb71
...@@ -101,5 +101,5 @@ Example: ...@@ -101,5 +101,5 @@ Example:
nuvoton,crosstalk-enable; nuvoton,crosstalk-enable;
clock-names = "mclk"; clock-names = "mclk";
clocks = <&tegra_car TEGRA210_CLK_CLK_OUT_2>; clocks = <&tegra_pmc TEGRA_PMC_CLK_OUT_2>;
}; };
...@@ -860,8 +860,7 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream, ...@@ -860,8 +860,7 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
wm8960->is_stream_in_use[tx] = true; wm8960->is_stream_in_use[tx] = true;
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON && if (!wm8960->is_stream_in_use[!tx])
!wm8960->is_stream_in_use[!tx])
return wm8960_configure_clocking(component); return wm8960_configure_clocking(component);
return 0; return 0;
......
...@@ -118,7 +118,7 @@ static const struct reg_default wm8962_reg[] = { ...@@ -118,7 +118,7 @@ static const struct reg_default wm8962_reg[] = {
{ 5, 0x0018 }, /* R5 - ADC & DAC Control 1 */ { 5, 0x0018 }, /* R5 - ADC & DAC Control 1 */
{ 6, 0x2008 }, /* R6 - ADC & DAC Control 2 */ { 6, 0x2008 }, /* R6 - ADC & DAC Control 2 */
{ 7, 0x000A }, /* R7 - Audio Interface 0 */ { 7, 0x000A }, /* R7 - Audio Interface 0 */
{ 8, 0x01E4 }, /* R8 - Clocking2 */
{ 9, 0x0300 }, /* R9 - Audio Interface 1 */ { 9, 0x0300 }, /* R9 - Audio Interface 1 */
{ 10, 0x00C0 }, /* R10 - Left DAC volume */ { 10, 0x00C0 }, /* R10 - Left DAC volume */
{ 11, 0x00C0 }, /* R11 - Right DAC volume */ { 11, 0x00C0 }, /* R11 - Right DAC volume */
...@@ -788,7 +788,6 @@ static bool wm8962_volatile_register(struct device *dev, unsigned int reg) ...@@ -788,7 +788,6 @@ static bool wm8962_volatile_register(struct device *dev, unsigned int reg)
{ {
switch (reg) { switch (reg) {
case WM8962_CLOCKING1: case WM8962_CLOCKING1:
case WM8962_CLOCKING2:
case WM8962_SOFTWARE_RESET: case WM8962_SOFTWARE_RESET:
case WM8962_THERMAL_SHUTDOWN_STATUS: case WM8962_THERMAL_SHUTDOWN_STATUS:
case WM8962_ADDITIONAL_CONTROL_4: case WM8962_ADDITIONAL_CONTROL_4:
......
...@@ -87,6 +87,10 @@ static irqreturn_t esai_isr(int irq, void *devid) ...@@ -87,6 +87,10 @@ static irqreturn_t esai_isr(int irq, void *devid)
if ((saisr & (ESAI_SAISR_TUE | ESAI_SAISR_ROE)) && if ((saisr & (ESAI_SAISR_TUE | ESAI_SAISR_ROE)) &&
esai_priv->reset_at_xrun) { esai_priv->reset_at_xrun) {
dev_dbg(&pdev->dev, "reset module for xrun\n"); dev_dbg(&pdev->dev, "reset module for xrun\n");
regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR,
ESAI_xCR_xEIE_MASK, 0);
regmap_update_bits(esai_priv->regmap, REG_ESAI_RCR,
ESAI_xCR_xEIE_MASK, 0);
tasklet_schedule(&esai_priv->task); tasklet_schedule(&esai_priv->task);
} }
......
...@@ -205,13 +205,11 @@ static int tegra_alc5632_probe(struct platform_device *pdev) ...@@ -205,13 +205,11 @@ static int tegra_alc5632_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; goto err_put_cpu_of_node;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&alc5632->util_data);
err_put_cpu_of_node: err_put_cpu_of_node:
of_node_put(tegra_alc5632_dai.cpus->of_node); of_node_put(tegra_alc5632_dai.cpus->of_node);
tegra_alc5632_dai.cpus->of_node = NULL; tegra_alc5632_dai.cpus->of_node = NULL;
...@@ -226,12 +224,9 @@ static int tegra_alc5632_probe(struct platform_device *pdev) ...@@ -226,12 +224,9 @@ static int tegra_alc5632_probe(struct platform_device *pdev)
static int tegra_alc5632_remove(struct platform_device *pdev) static int tegra_alc5632_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
of_node_put(tegra_alc5632_dai.cpus->of_node); of_node_put(tegra_alc5632_dai.cpus->of_node);
tegra_alc5632_dai.cpus->of_node = NULL; tegra_alc5632_dai.cpus->of_node = NULL;
tegra_alc5632_dai.platforms->of_node = NULL; tegra_alc5632_dai.platforms->of_node = NULL;
......
...@@ -60,8 +60,6 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate, ...@@ -60,8 +60,6 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
data->set_mclk = 0; data->set_mclk = 0;
clk_disable_unprepare(data->clk_cdev1); clk_disable_unprepare(data->clk_cdev1);
clk_disable_unprepare(data->clk_pll_a_out0);
clk_disable_unprepare(data->clk_pll_a);
err = clk_set_rate(data->clk_pll_a, new_baseclock); err = clk_set_rate(data->clk_pll_a, new_baseclock);
if (err) { if (err) {
...@@ -77,18 +75,6 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate, ...@@ -77,18 +75,6 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
/* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */ /* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */
err = clk_prepare_enable(data->clk_pll_a);
if (err) {
dev_err(data->dev, "Can't enable pll_a: %d\n", err);
return err;
}
err = clk_prepare_enable(data->clk_pll_a_out0);
if (err) {
dev_err(data->dev, "Can't enable pll_a_out0: %d\n", err);
return err;
}
err = clk_prepare_enable(data->clk_cdev1); err = clk_prepare_enable(data->clk_cdev1);
if (err) { if (err) {
dev_err(data->dev, "Can't enable cdev1: %d\n", err); dev_err(data->dev, "Can't enable cdev1: %d\n", err);
...@@ -109,8 +95,6 @@ int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data) ...@@ -109,8 +95,6 @@ int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data)
int err; int err;
clk_disable_unprepare(data->clk_cdev1); clk_disable_unprepare(data->clk_cdev1);
clk_disable_unprepare(data->clk_pll_a_out0);
clk_disable_unprepare(data->clk_pll_a);
/* /*
* AC97 rate is fixed at 24.576MHz and is used for both the host * AC97 rate is fixed at 24.576MHz and is used for both the host
...@@ -130,18 +114,6 @@ int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data) ...@@ -130,18 +114,6 @@ int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data)
/* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */ /* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */
err = clk_prepare_enable(data->clk_pll_a);
if (err) {
dev_err(data->dev, "Can't enable pll_a: %d\n", err);
return err;
}
err = clk_prepare_enable(data->clk_pll_a_out0);
if (err) {
dev_err(data->dev, "Can't enable pll_a_out0: %d\n", err);
return err;
}
err = clk_prepare_enable(data->clk_cdev1); err = clk_prepare_enable(data->clk_cdev1);
if (err) { if (err) {
dev_err(data->dev, "Can't enable cdev1: %d\n", err); dev_err(data->dev, "Can't enable cdev1: %d\n", err);
...@@ -158,6 +130,7 @@ EXPORT_SYMBOL_GPL(tegra_asoc_utils_set_ac97_rate); ...@@ -158,6 +130,7 @@ EXPORT_SYMBOL_GPL(tegra_asoc_utils_set_ac97_rate);
int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
struct device *dev) struct device *dev)
{ {
struct clk *clk_out_1, *clk_extern1;
int ret; int ret;
data->dev = dev; data->dev = dev;
...@@ -175,52 +148,78 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, ...@@ -175,52 +148,78 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
return -EINVAL; return -EINVAL;
} }
data->clk_pll_a = clk_get(dev, "pll_a"); data->clk_pll_a = devm_clk_get(dev, "pll_a");
if (IS_ERR(data->clk_pll_a)) { if (IS_ERR(data->clk_pll_a)) {
dev_err(data->dev, "Can't retrieve clk pll_a\n"); dev_err(data->dev, "Can't retrieve clk pll_a\n");
ret = PTR_ERR(data->clk_pll_a); return PTR_ERR(data->clk_pll_a);
goto err;
} }
data->clk_pll_a_out0 = clk_get(dev, "pll_a_out0"); data->clk_pll_a_out0 = devm_clk_get(dev, "pll_a_out0");
if (IS_ERR(data->clk_pll_a_out0)) { if (IS_ERR(data->clk_pll_a_out0)) {
dev_err(data->dev, "Can't retrieve clk pll_a_out0\n"); dev_err(data->dev, "Can't retrieve clk pll_a_out0\n");
ret = PTR_ERR(data->clk_pll_a_out0); return PTR_ERR(data->clk_pll_a_out0);
goto err_put_pll_a;
} }
data->clk_cdev1 = clk_get(dev, "mclk"); data->clk_cdev1 = devm_clk_get(dev, "mclk");
if (IS_ERR(data->clk_cdev1)) { if (IS_ERR(data->clk_cdev1)) {
dev_err(data->dev, "Can't retrieve clk cdev1\n"); dev_err(data->dev, "Can't retrieve clk cdev1\n");
ret = PTR_ERR(data->clk_cdev1); return PTR_ERR(data->clk_cdev1);
goto err_put_pll_a_out0;
} }
ret = tegra_asoc_utils_set_rate(data, 44100, 256 * 44100); /*
if (ret) * If clock parents are not set in DT, configure here to use clk_out_1
goto err_put_cdev1; * as mclk and extern1 as parent for Tegra30 and higher.
*/
if (!of_find_property(dev->of_node, "assigned-clock-parents", NULL) &&
data->soc > TEGRA_ASOC_UTILS_SOC_TEGRA20) {
dev_warn(data->dev,
"Configuring clocks for a legacy device-tree\n");
dev_warn(data->dev,
"Please update DT to use assigned-clock-parents\n");
clk_extern1 = devm_clk_get(dev, "extern1");
if (IS_ERR(clk_extern1)) {
dev_err(data->dev, "Can't retrieve clk extern1\n");
return PTR_ERR(clk_extern1);
}
ret = clk_set_parent(clk_extern1, data->clk_pll_a_out0);
if (ret < 0) {
dev_err(data->dev,
"Set parent failed for clk extern1\n");
return ret;
}
clk_out_1 = devm_clk_get(dev, "pmc_clk_out_1");
if (IS_ERR(clk_out_1)) {
dev_err(data->dev, "Can't retrieve pmc_clk_out_1\n");
return PTR_ERR(clk_out_1);
}
ret = clk_set_parent(clk_out_1, clk_extern1);
if (ret < 0) {
dev_err(data->dev,
"Set parent failed for pmc_clk_out_1\n");
return ret;
}
data->clk_cdev1 = clk_out_1;
}
return 0; /*
* FIXME: There is some unknown dependency between audio mclk disable
* and suspend-resume functionality on Tegra30, although audio mclk is
* only needed for audio.
*/
ret = clk_prepare_enable(data->clk_cdev1);
if (ret) {
dev_err(data->dev, "Can't enable cdev1: %d\n", ret);
return ret;
}
err_put_cdev1: return 0;
clk_put(data->clk_cdev1);
err_put_pll_a_out0:
clk_put(data->clk_pll_a_out0);
err_put_pll_a:
clk_put(data->clk_pll_a);
err:
return ret;
} }
EXPORT_SYMBOL_GPL(tegra_asoc_utils_init); EXPORT_SYMBOL_GPL(tegra_asoc_utils_init);
void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data)
{
clk_put(data->clk_cdev1);
clk_put(data->clk_pll_a_out0);
clk_put(data->clk_pll_a);
}
EXPORT_SYMBOL_GPL(tegra_asoc_utils_fini);
MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
MODULE_DESCRIPTION("Tegra ASoC utility code"); MODULE_DESCRIPTION("Tegra ASoC utility code");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -34,6 +34,5 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate, ...@@ -34,6 +34,5 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data); int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data);
int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data, int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
struct device *dev); struct device *dev);
void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data);
#endif #endif
...@@ -218,19 +218,18 @@ static int tegra_max98090_probe(struct platform_device *pdev) ...@@ -218,19 +218,18 @@ static int tegra_max98090_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_card_name(card, "nvidia,model"); ret = snd_soc_of_parse_card_name(card, "nvidia,model");
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing");
if (ret) if (ret)
goto err; return ret;
tegra_max98090_dai.codecs->of_node = of_parse_phandle(np, tegra_max98090_dai.codecs->of_node = of_parse_phandle(np,
"nvidia,audio-codec", 0); "nvidia,audio-codec", 0);
if (!tegra_max98090_dai.codecs->of_node) { if (!tegra_max98090_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_max98090_dai.cpus->of_node = of_parse_phandle(np, tegra_max98090_dai.cpus->of_node = of_parse_phandle(np,
...@@ -238,40 +237,31 @@ static int tegra_max98090_probe(struct platform_device *pdev) ...@@ -238,40 +237,31 @@ static int tegra_max98090_probe(struct platform_device *pdev)
if (!tegra_max98090_dai.cpus->of_node) { if (!tegra_max98090_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_max98090_dai.platforms->of_node = tegra_max98090_dai.cpus->of_node; tegra_max98090_dai.platforms->of_node = tegra_max98090_dai.cpus->of_node;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err:
return ret;
} }
static int tegra_max98090_remove(struct platform_device *pdev) static int tegra_max98090_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_max98090 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
return 0; return 0;
} }
......
...@@ -164,19 +164,18 @@ static int tegra_rt5640_probe(struct platform_device *pdev) ...@@ -164,19 +164,18 @@ static int tegra_rt5640_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_card_name(card, "nvidia,model"); ret = snd_soc_of_parse_card_name(card, "nvidia,model");
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing");
if (ret) if (ret)
goto err; return ret;
tegra_rt5640_dai.codecs->of_node = of_parse_phandle(np, tegra_rt5640_dai.codecs->of_node = of_parse_phandle(np,
"nvidia,audio-codec", 0); "nvidia,audio-codec", 0);
if (!tegra_rt5640_dai.codecs->of_node) { if (!tegra_rt5640_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_rt5640_dai.cpus->of_node = of_parse_phandle(np, tegra_rt5640_dai.cpus->of_node = of_parse_phandle(np,
...@@ -184,40 +183,31 @@ static int tegra_rt5640_probe(struct platform_device *pdev) ...@@ -184,40 +183,31 @@ static int tegra_rt5640_probe(struct platform_device *pdev)
if (!tegra_rt5640_dai.cpus->of_node) { if (!tegra_rt5640_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_rt5640_dai.platforms->of_node = tegra_rt5640_dai.cpus->of_node; tegra_rt5640_dai.platforms->of_node = tegra_rt5640_dai.cpus->of_node;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err:
return ret;
} }
static int tegra_rt5640_remove(struct platform_device *pdev) static int tegra_rt5640_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
return 0; return 0;
} }
......
...@@ -270,13 +270,11 @@ static int tegra_rt5677_probe(struct platform_device *pdev) ...@@ -270,13 +270,11 @@ static int tegra_rt5677_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; goto err_put_cpu_of_node;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err_put_cpu_of_node: err_put_cpu_of_node:
of_node_put(tegra_rt5677_dai.cpus->of_node); of_node_put(tegra_rt5677_dai.cpus->of_node);
tegra_rt5677_dai.cpus->of_node = NULL; tegra_rt5677_dai.cpus->of_node = NULL;
...@@ -291,12 +289,9 @@ static int tegra_rt5677_probe(struct platform_device *pdev) ...@@ -291,12 +289,9 @@ static int tegra_rt5677_probe(struct platform_device *pdev)
static int tegra_rt5677_remove(struct platform_device *pdev) static int tegra_rt5677_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_rt5677 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
tegra_rt5677_dai.platforms->of_node = NULL; tegra_rt5677_dai.platforms->of_node = NULL;
of_node_put(tegra_rt5677_dai.codecs->of_node); of_node_put(tegra_rt5677_dai.codecs->of_node);
tegra_rt5677_dai.codecs->of_node = NULL; tegra_rt5677_dai.codecs->of_node = NULL;
......
...@@ -156,13 +156,11 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev) ...@@ -156,13 +156,11 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; goto err_put_cpu_of_node;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err_put_cpu_of_node: err_put_cpu_of_node:
of_node_put(tegra_sgtl5000_dai.cpus->of_node); of_node_put(tegra_sgtl5000_dai.cpus->of_node);
tegra_sgtl5000_dai.cpus->of_node = NULL; tegra_sgtl5000_dai.cpus->of_node = NULL;
...@@ -177,13 +175,10 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev) ...@@ -177,13 +175,10 @@ static int tegra_sgtl5000_driver_probe(struct platform_device *pdev)
static int tegra_sgtl5000_driver_remove(struct platform_device *pdev) static int tegra_sgtl5000_driver_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_sgtl5000 *machine = snd_soc_card_get_drvdata(card);
int ret; int ret;
ret = snd_soc_unregister_card(card); ret = snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
of_node_put(tegra_sgtl5000_dai.cpus->of_node); of_node_put(tegra_sgtl5000_dai.cpus->of_node);
tegra_sgtl5000_dai.cpus->of_node = NULL; tegra_sgtl5000_dai.cpus->of_node = NULL;
tegra_sgtl5000_dai.platforms->of_node = NULL; tegra_sgtl5000_dai.platforms->of_node = NULL;
......
...@@ -127,19 +127,18 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev) ...@@ -127,19 +127,18 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_card_name(card, "nvidia,model"); ret = snd_soc_of_parse_card_name(card, "nvidia,model");
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing");
if (ret) if (ret)
goto err; return ret;
tegra_wm8753_dai.codecs->of_node = of_parse_phandle(np, tegra_wm8753_dai.codecs->of_node = of_parse_phandle(np,
"nvidia,audio-codec", 0); "nvidia,audio-codec", 0);
if (!tegra_wm8753_dai.codecs->of_node) { if (!tegra_wm8753_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_wm8753_dai.cpus->of_node = of_parse_phandle(np, tegra_wm8753_dai.cpus->of_node = of_parse_phandle(np,
...@@ -147,40 +146,31 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev) ...@@ -147,40 +146,31 @@ static int tegra_wm8753_driver_probe(struct platform_device *pdev)
if (!tegra_wm8753_dai.cpus->of_node) { if (!tegra_wm8753_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_wm8753_dai.platforms->of_node = tegra_wm8753_dai.cpus->of_node; tegra_wm8753_dai.platforms->of_node = tegra_wm8753_dai.cpus->of_node;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err:
return ret;
} }
static int tegra_wm8753_driver_remove(struct platform_device *pdev) static int tegra_wm8753_driver_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_wm8753 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
return 0; return 0;
} }
......
...@@ -323,19 +323,18 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev) ...@@ -323,19 +323,18 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_card_name(card, "nvidia,model"); ret = snd_soc_of_parse_card_name(card, "nvidia,model");
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing");
if (ret) if (ret)
goto err; return ret;
tegra_wm8903_dai.codecs->of_node = of_parse_phandle(np, tegra_wm8903_dai.codecs->of_node = of_parse_phandle(np,
"nvidia,audio-codec", 0); "nvidia,audio-codec", 0);
if (!tegra_wm8903_dai.codecs->of_node) { if (!tegra_wm8903_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_wm8903_dai.cpus->of_node = of_parse_phandle(np, tegra_wm8903_dai.cpus->of_node = of_parse_phandle(np,
...@@ -343,40 +342,31 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev) ...@@ -343,40 +342,31 @@ static int tegra_wm8903_driver_probe(struct platform_device *pdev)
if (!tegra_wm8903_dai.cpus->of_node) { if (!tegra_wm8903_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
tegra_wm8903_dai.platforms->of_node = tegra_wm8903_dai.cpus->of_node; tegra_wm8903_dai.platforms->of_node = tegra_wm8903_dai.cpus->of_node;
ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&machine->util_data);
err:
return ret;
} }
static int tegra_wm8903_driver_remove(struct platform_device *pdev) static int tegra_wm8903_driver_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
return 0; return 0;
} }
......
...@@ -113,19 +113,17 @@ static int tegra_wm9712_driver_probe(struct platform_device *pdev) ...@@ -113,19 +113,17 @@ static int tegra_wm9712_driver_probe(struct platform_device *pdev)
ret = tegra_asoc_utils_set_ac97_rate(&machine->util_data); ret = tegra_asoc_utils_set_ac97_rate(&machine->util_data);
if (ret) if (ret)
goto asoc_utils_fini; goto codec_unregister;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto asoc_utils_fini; goto codec_unregister;
} }
return 0; return 0;
asoc_utils_fini:
tegra_asoc_utils_fini(&machine->util_data);
codec_unregister: codec_unregister:
platform_device_del(machine->codec); platform_device_del(machine->codec);
codec_put: codec_put:
...@@ -140,8 +138,6 @@ static int tegra_wm9712_driver_remove(struct platform_device *pdev) ...@@ -140,8 +138,6 @@ static int tegra_wm9712_driver_remove(struct platform_device *pdev)
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&machine->util_data);
platform_device_unregister(machine->codec); platform_device_unregister(machine->codec);
return 0; return 0;
......
...@@ -125,8 +125,7 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev) ...@@ -125,8 +125,7 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev)
if (!trimslice_tlv320aic23_dai.codecs->of_node) { if (!trimslice_tlv320aic23_dai.codecs->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,audio-codec' missing or invalid\n"); "Property 'nvidia,audio-codec' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
trimslice_tlv320aic23_dai.cpus->of_node = of_parse_phandle(np, trimslice_tlv320aic23_dai.cpus->of_node = of_parse_phandle(np,
...@@ -134,8 +133,7 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev) ...@@ -134,8 +133,7 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev)
if (!trimslice_tlv320aic23_dai.cpus->of_node) { if (!trimslice_tlv320aic23_dai.cpus->of_node) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n"); "Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL; return -EINVAL;
goto err;
} }
trimslice_tlv320aic23_dai.platforms->of_node = trimslice_tlv320aic23_dai.platforms->of_node =
...@@ -143,32 +141,24 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev) ...@@ -143,32 +141,24 @@ static int tegra_snd_trimslice_probe(struct platform_device *pdev)
ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev); ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev);
if (ret) if (ret)
goto err; return ret;
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) { if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret); ret);
goto err_fini_utils; return ret;
} }
return 0; return 0;
err_fini_utils:
tegra_asoc_utils_fini(&trimslice->util_data);
err:
return ret;
} }
static int tegra_snd_trimslice_remove(struct platform_device *pdev) static int tegra_snd_trimslice_remove(struct platform_device *pdev)
{ {
struct snd_soc_card *card = platform_get_drvdata(pdev); struct snd_soc_card *card = platform_get_drvdata(pdev);
struct tegra_trimslice *trimslice = snd_soc_card_get_drvdata(card);
snd_soc_unregister_card(card); snd_soc_unregister_card(card);
tegra_asoc_utils_fini(&trimslice->util_data);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment