ASoC: atmel: tse850: rely on the ssc to register as a cpu dai by itself
This breaks devicetree compatibility, but in this case that is ok. All affected units are either on my desk, or running an even older version of the driver that is not compatible with the upstreamed version anyway (and when these other units are eventually updated, they will get a fresh dtb as well, so that is not a significant problem either). All of that is of course assuming that noone else has managed to build something that can use this driver, but that seems extremely improbable. Signed-off-by: Peter Rosin <peda@axentia.se> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
e8314d7d53
commit
ca8c7f233f
|
@ -2,8 +2,7 @@ Devicetree bindings for the Axentia TSE-850 audio complex
|
||||||
|
|
||||||
Required properties:
|
Required properties:
|
||||||
- compatible: "axentia,tse850-pcm5142"
|
- compatible: "axentia,tse850-pcm5142"
|
||||||
- axentia,ssc-controller: The phandle of the atmel SSC controller used as
|
- axentia,cpu-dai: The phandle of the cpu dai.
|
||||||
cpu dai.
|
|
||||||
- axentia,audio-codec: The phandle of the PCM5142 codec.
|
- axentia,audio-codec: The phandle of the PCM5142 codec.
|
||||||
- axentia,add-gpios: gpio specifier that controls the mixer.
|
- axentia,add-gpios: gpio specifier that controls the mixer.
|
||||||
- axentia,loop1-gpios: gpio specifier that controls loop relays on channel 1.
|
- axentia,loop1-gpios: gpio specifier that controls loop relays on channel 1.
|
||||||
|
@ -43,6 +42,12 @@ the PCM5142 codec.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
&ssc0 {
|
||||||
|
#sound-dai-cells = <0>;
|
||||||
|
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
&i2c {
|
&i2c {
|
||||||
codec: pcm5142@4c {
|
codec: pcm5142@4c {
|
||||||
compatible = "ti,pcm5142";
|
compatible = "ti,pcm5142";
|
||||||
|
@ -77,7 +82,7 @@ Example:
|
||||||
sound {
|
sound {
|
||||||
compatible = "axentia,tse850-pcm5142";
|
compatible = "axentia,tse850-pcm5142";
|
||||||
|
|
||||||
axentia,ssc-controller = <&ssc0>;
|
axentia,cpu-dai = <&ssc0>;
|
||||||
axentia,audio-codec = <&codec>;
|
axentia,audio-codec = <&codec>;
|
||||||
|
|
||||||
axentia,add-gpios = <&pioA 8 GPIO_ACTIVE_LOW>;
|
axentia,add-gpios = <&pioA 8 GPIO_ACTIVE_LOW>;
|
||||||
|
|
|
@ -51,11 +51,7 @@
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
|
|
||||||
#include "atmel_ssc_dai.h"
|
|
||||||
|
|
||||||
struct tse850_priv {
|
struct tse850_priv {
|
||||||
int ssc_id;
|
|
||||||
|
|
||||||
struct gpio_desc *add;
|
struct gpio_desc *add;
|
||||||
struct gpio_desc *loop1;
|
struct gpio_desc *loop1;
|
||||||
struct gpio_desc *loop2;
|
struct gpio_desc *loop2;
|
||||||
|
@ -329,23 +325,20 @@ static int tse850_dt_init(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct device_node *codec_np, *cpu_np;
|
struct device_node *codec_np, *cpu_np;
|
||||||
struct snd_soc_card *card = &tse850_card;
|
|
||||||
struct snd_soc_dai_link *dailink = &tse850_dailink;
|
struct snd_soc_dai_link *dailink = &tse850_dailink;
|
||||||
struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
|
|
||||||
|
|
||||||
if (!np) {
|
if (!np) {
|
||||||
dev_err(&pdev->dev, "only device tree supported\n");
|
dev_err(&pdev->dev, "only device tree supported\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu_np = of_parse_phandle(np, "axentia,ssc-controller", 0);
|
cpu_np = of_parse_phandle(np, "axentia,cpu-dai", 0);
|
||||||
if (!cpu_np) {
|
if (!cpu_np) {
|
||||||
dev_err(&pdev->dev, "failed to get dai and pcm info\n");
|
dev_err(&pdev->dev, "failed to get cpu dai\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
dailink->cpu_of_node = cpu_np;
|
dailink->cpu_of_node = cpu_np;
|
||||||
dailink->platform_of_node = cpu_np;
|
dailink->platform_of_node = cpu_np;
|
||||||
tse850->ssc_id = of_alias_get_id(cpu_np, "ssc");
|
|
||||||
of_node_put(cpu_np);
|
of_node_put(cpu_np);
|
||||||
|
|
||||||
codec_np = of_parse_phandle(np, "axentia,audio-codec", 0);
|
codec_np = of_parse_phandle(np, "axentia,audio-codec", 0);
|
||||||
|
@ -415,23 +408,14 @@ static int tse850_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = atmel_ssc_set_audio(tse850->ssc_id);
|
|
||||||
if (ret != 0) {
|
|
||||||
dev_err(dev,
|
|
||||||
"failed to set SSC %d for audio\n", tse850->ssc_id);
|
|
||||||
goto err_disable_ana;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = snd_soc_register_card(card);
|
ret = snd_soc_register_card(card);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "snd_soc_register_card failed\n");
|
dev_err(dev, "snd_soc_register_card failed\n");
|
||||||
goto err_put_audio;
|
goto err_disable_ana;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_put_audio:
|
|
||||||
atmel_ssc_put_audio(tse850->ssc_id);
|
|
||||||
err_disable_ana:
|
err_disable_ana:
|
||||||
regulator_disable(tse850->ana);
|
regulator_disable(tse850->ana);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -443,7 +427,6 @@ static int tse850_remove(struct platform_device *pdev)
|
||||||
struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
|
struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
snd_soc_unregister_card(card);
|
snd_soc_unregister_card(card);
|
||||||
atmel_ssc_put_audio(tse850->ssc_id);
|
|
||||||
regulator_disable(tse850->ana);
|
regulator_disable(tse850->ana);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue