Commit c912fa91 authored by Eric Millbrandt's avatar Eric Millbrandt Committed by Mark Brown

ASoC: fsl: register the wm9712-codec

The mpc5200-psc-ac97 driver does not enumerate attached ac97 devices, so
register the device here.
Signed-off-by: default avatarEric Millbrandt <emillbrandt@dekaresearch.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 08401161
...@@ -22,6 +22,11 @@ ...@@ -22,6 +22,11 @@
#define DRV_NAME "pcm030-audio-fabric" #define DRV_NAME "pcm030-audio-fabric"
struct pcm030_audio_data {
struct snd_soc_card *card;
struct platform_device *codec_device;
};
static struct snd_soc_dai_link pcm030_fabric_dai[] = { static struct snd_soc_dai_link pcm030_fabric_dai[] = {
{ {
.name = "AC97", .name = "AC97",
...@@ -51,14 +56,22 @@ static int __init pcm030_fabric_probe(struct platform_device *op) ...@@ -51,14 +56,22 @@ static int __init pcm030_fabric_probe(struct platform_device *op)
struct device_node *np = op->dev.of_node; struct device_node *np = op->dev.of_node;
struct device_node *platform_np; struct device_node *platform_np;
struct snd_soc_card *card = &pcm030_card; struct snd_soc_card *card = &pcm030_card;
struct pcm030_audio_data *pdata;
int ret; int ret;
int i; int i;
if (!of_machine_is_compatible("phytec,pcm030")) if (!of_machine_is_compatible("phytec,pcm030"))
return -ENODEV; return -ENODEV;
pdata = devm_kzalloc(&op->dev, sizeof(struct pcm030_audio_data),
GFP_KERNEL);
if (!pdata)
return -ENOMEM;
card->dev = &op->dev; card->dev = &op->dev;
platform_set_drvdata(op, card); platform_set_drvdata(op, pdata);
pdata->card = card;
platform_np = of_parse_phandle(np, "asoc-platform", 0); platform_np = of_parse_phandle(np, "asoc-platform", 0);
if (!platform_np) { if (!platform_np) {
...@@ -69,6 +82,18 @@ static int __init pcm030_fabric_probe(struct platform_device *op) ...@@ -69,6 +82,18 @@ static int __init pcm030_fabric_probe(struct platform_device *op)
for (i = 0; i < card->num_links; i++) for (i = 0; i < card->num_links; i++)
card->dai_link[i].platform_of_node = platform_np; card->dai_link[i].platform_of_node = platform_np;
ret = request_module("snd-soc-wm9712");
if (ret)
dev_err(&op->dev, "request_module returned: %d\n", ret);
pdata->codec_device = platform_device_alloc("wm9712-codec", -1);
if (!pdata->codec_device)
dev_err(&op->dev, "platform_device_alloc() failed\n");
ret = platform_device_add(pdata->codec_device);
if (ret)
dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
if (ret) if (ret)
dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret); dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
...@@ -78,10 +103,11 @@ static int __init pcm030_fabric_probe(struct platform_device *op) ...@@ -78,10 +103,11 @@ static int __init pcm030_fabric_probe(struct platform_device *op)
static int __devexit pcm030_fabric_remove(struct platform_device *op) static int __devexit pcm030_fabric_remove(struct platform_device *op)
{ {
struct snd_soc_card *card = platform_get_drvdata(op); struct pcm030_audio_data *pdata = platform_get_drvdata(op);
int ret; int ret;
ret = snd_soc_unregister_card(card); ret = snd_soc_unregister_card(pdata->card);
platform_device_unregister(pdata->codec_device);
return ret; return ret;
} }
......
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