Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 326882
b: refs/heads/master
c: 0af541c
h: refs/heads/master
v: v3
  • Loading branch information
Lee Jones committed Sep 20, 2012
1 parent 1294271 commit eab8b7c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5ca032ee21cdabd08fb368ce3f02fa8906b0ef5f
refs/heads/master: 0af541ce47ee4e80393dda12109a1efaf757fdcd
40 changes: 40 additions & 0 deletions trunk/sound/soc/ux500/mop500.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/module.h>
#include <linux/io.h>
#include <linux/spi/spi.h>
#include <linux/of.h>

#include <sound/soc.h>
#include <sound/initval.h>
Expand Down Expand Up @@ -56,8 +57,35 @@ static struct snd_soc_card mop500_card = {
.num_links = ARRAY_SIZE(mop500_dai_links),
};

static int __devinit mop500_of_probe(struct platform_device *pdev,
struct device_node *np)
{
struct device_node *codec_np, *msp_np[2];
int i;

msp_np[0] = of_parse_phandle(np, "stericsson,cpu-dai", 0);
msp_np[1] = of_parse_phandle(np, "stericsson,cpu-dai", 1);
codec_np = of_parse_phandle(np, "stericsson,audio-codec", 0);

if (!(msp_np[0] && msp_np[1] && codec_np)) {
dev_err(&pdev->dev, "Phandle missing or invalid\n");
return -EINVAL;
}

for (i = 0; i < 2; i++) {
mop500_dai_links[i].cpu_of_node = msp_np[i];
mop500_dai_links[i].cpu_dai_name = NULL;
mop500_dai_links[i].codec_of_node = codec_np;
mop500_dai_links[i].codec_name = NULL;
}

snd_soc_of_parse_card_name(&mop500_card, "stericsson,card-name");

return 0;
}
static int __devinit mop500_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
int ret;

pr_debug("%s: Enter.\n", __func__);
Expand All @@ -66,6 +94,12 @@ static int __devinit mop500_probe(struct platform_device *pdev)

mop500_card.dev = &pdev->dev;

if (np) {
ret = mop500_of_probe(pdev, np);
if (ret)
return ret;
}

dev_dbg(&pdev->dev, "%s: Card %s: Set platform drvdata.\n",
__func__, mop500_card.name);
platform_set_drvdata(pdev, &mop500_card);
Expand Down Expand Up @@ -101,10 +135,16 @@ static int __devexit mop500_remove(struct platform_device *pdev)
return 0;
}

static const struct of_device_id snd_soc_mop500_match[] = {
{ .compatible = "stericsson,snd-soc-mop500", },
{},
};

static struct platform_driver snd_soc_mop500_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "snd-soc-mop500",
.of_match_table = snd_soc_mop500_match,
},
.probe = mop500_probe,
.remove = __devexit_p(mop500_remove),
Expand Down

0 comments on commit eab8b7c

Please sign in to comment.