Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316201
b: refs/heads/master
c: bc92657
h: refs/heads/master
i:
  316199: 6425c1c
v: v3
  • Loading branch information
Stephen Warren authored and Mark Brown committed Jun 3, 2012
1 parent 8b9945e commit 421cb32
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 210cb67cb5b9f9a23b7ce91de50bab357440ba9d
refs/heads/master: bc92657a11c0982783979bbb84ceaf58ba222124
33 changes: 28 additions & 5 deletions trunk/include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -785,13 +785,36 @@ struct snd_soc_dai_link {
/* config - must be set by machine driver */
const char *name; /* Codec name */
const char *stream_name; /* Stream name */
const char *codec_name; /* for multi-codec */
const struct device_node *codec_of_node;
const char *platform_name; /* for multi-platform */
const struct device_node *platform_of_node;
/*
* You MAY specify the link's CPU-side device, either by device name,
* or by DT/OF node, but not both. If this information is omitted,
* the CPU-side DAI is matched using .cpu_dai_name only, which hence
* must be globally unique. These fields are currently typically used
* only for codec to codec links, or systems using device tree.
*/
const char *cpu_name;
const struct device_node *cpu_of_node;
/*
* You MAY specify the DAI name of the CPU DAI. If this information is
* omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node
* only, which only works well when that device exposes a single DAI.
*/
const char *cpu_dai_name;
const struct device_node *cpu_dai_of_node;
/*
* You MUST specify the link's codec, either by device name, or by
* DT/OF node, but not both.
*/
const char *codec_name;
const struct device_node *codec_of_node;
/* You MUST specify the DAI name within the codec */
const char *codec_dai_name;
/*
* You MAY specify the link's platform/PCM/DMA driver, either by
* device name, or by DT/OF node, but not both. Some forms of link
* do not need a platform.
*/
const char *platform_name;
const struct device_node *platform_of_node;
int be_id; /* optional ID for machine driver BE identification */

const struct snd_soc_pcm_stream *params;
Expand Down
2 changes: 1 addition & 1 deletion trunk/sound/soc/mxs/mxs-sgtl5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static int __devinit mxs_sgtl5000_probe_dt(struct platform_device *pdev)
mxs_sgtl5000_dai[i].codec_name = NULL;
mxs_sgtl5000_dai[i].codec_of_node = codec_np;
mxs_sgtl5000_dai[i].cpu_dai_name = NULL;
mxs_sgtl5000_dai[i].cpu_dai_of_node = saif_np[i];
mxs_sgtl5000_dai[i].cpu_of_node = saif_np[i];
mxs_sgtl5000_dai[i].platform_name = NULL;
mxs_sgtl5000_dai[i].platform_of_node = saif_np[i];
}
Expand Down
42 changes: 31 additions & 11 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,13 +812,15 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)

/* Find CPU DAI from registered DAIs*/
list_for_each_entry(cpu_dai, &dai_list, list) {
if (dai_link->cpu_dai_of_node) {
if (cpu_dai->dev->of_node != dai_link->cpu_dai_of_node)
continue;
} else {
if (strcmp(cpu_dai->name, dai_link->cpu_dai_name))
continue;
}
if (dai_link->cpu_of_node &&
(cpu_dai->dev->of_node != dai_link->cpu_of_node))
continue;
if (dai_link->cpu_name &&
strcmp(dev_name(cpu_dai->dev), dai_link->cpu_name))
continue;
if (dai_link->cpu_dai_name &&
strcmp(cpu_dai->name, dai_link->cpu_dai_name))
continue;

rtd->cpu_dai = cpu_dai;
}
Expand Down Expand Up @@ -3346,6 +3348,12 @@ int snd_soc_register_card(struct snd_soc_card *card)
link->name);
return -EINVAL;
}
/* Codec DAI name must be specified */
if (!link->codec_dai_name) {
dev_err(card->dev, "codec_dai_name not set for %s\n",
link->name);
return -EINVAL;
}

/*
* Platform may be specified by either name or OF node, but
Expand All @@ -3358,12 +3366,24 @@ int snd_soc_register_card(struct snd_soc_card *card)
}

/*
* CPU DAI must be specified by 1 of name or OF node,
* not both or neither.
* CPU device may be specified by either name or OF node, but
* can be left unspecified, and will be matched based on DAI
* name alone..
*/
if (link->cpu_name && link->cpu_of_node) {
dev_err(card->dev,
"Neither/both cpu name/of_node are set for %s\n",
link->name);
return -EINVAL;
}
/*
* At least one of CPU DAI name or CPU device name/node must be
* specified
*/
if (!!link->cpu_dai_name == !!link->cpu_dai_of_node) {
if (!link->cpu_dai_name &&
!(link->cpu_name || link->cpu_of_node)) {
dev_err(card->dev,
"Neither/both cpu_dai name/of_node are set for %s\n",
"Neither cpu_dai_name nor cpu_name/of_node are set for %s\n",
link->name);
return -EINVAL;
}
Expand Down
6 changes: 3 additions & 3 deletions trunk/sound/soc/tegra/tegra_alc5632.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,16 @@ static __devinit int tegra_alc5632_probe(struct platform_device *pdev)
goto err;
}

tegra_alc5632_dai.cpu_dai_of_node = of_parse_phandle(
tegra_alc5632_dai.cpu_of_node = of_parse_phandle(
pdev->dev.of_node, "nvidia,i2s-controller", 0);
if (!tegra_alc5632_dai.cpu_dai_of_node) {
if (!tegra_alc5632_dai.cpu_of_node) {
dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL;
goto err;
}

tegra_alc5632_dai.platform_of_node = tegra_alc5632_dai.cpu_dai_of_node;
tegra_alc5632_dai.platform_of_node = tegra_alc5632_dai.cpu_of_node;

ret = tegra_asoc_utils_init(&alc5632->util_data, &pdev->dev);
if (ret)
Expand Down
6 changes: 3 additions & 3 deletions trunk/sound/soc/tegra/tegra_wm8753.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,17 @@ static __devinit int tegra_wm8753_driver_probe(struct platform_device *pdev)
goto err;
}

tegra_wm8753_dai.cpu_dai_of_node = of_parse_phandle(
tegra_wm8753_dai.cpu_of_node = of_parse_phandle(
pdev->dev.of_node, "nvidia,i2s-controller", 0);
if (!tegra_wm8753_dai.cpu_dai_of_node) {
if (!tegra_wm8753_dai.cpu_of_node) {
dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL;
goto err;
}

tegra_wm8753_dai.platform_of_node =
tegra_wm8753_dai.cpu_dai_of_node;
tegra_wm8753_dai.cpu_of_node;

ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
if (ret)
Expand Down
6 changes: 3 additions & 3 deletions trunk/sound/soc/tegra/tegra_wm8903.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev)
}

tegra_wm8903_dai.cpu_dai_name = NULL;
tegra_wm8903_dai.cpu_dai_of_node = of_parse_phandle(np,
tegra_wm8903_dai.cpu_of_node = of_parse_phandle(np,
"nvidia,i2s-controller", 0);
if (!tegra_wm8903_dai.cpu_dai_of_node) {
if (!tegra_wm8903_dai.cpu_of_node) {
dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL;
Expand All @@ -342,7 +342,7 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev)

tegra_wm8903_dai.platform_name = NULL;
tegra_wm8903_dai.platform_of_node =
tegra_wm8903_dai.cpu_dai_of_node;
tegra_wm8903_dai.cpu_of_node;
} else {
card->dapm_routes = harmony_audio_map;
card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map);
Expand Down
6 changes: 3 additions & 3 deletions trunk/sound/soc/tegra/trimslice.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev)
}

trimslice_tlv320aic23_dai.cpu_dai_name = NULL;
trimslice_tlv320aic23_dai.cpu_dai_of_node = of_parse_phandle(
trimslice_tlv320aic23_dai.cpu_of_node = of_parse_phandle(
pdev->dev.of_node, "nvidia,i2s-controller", 0);
if (!trimslice_tlv320aic23_dai.cpu_dai_of_node) {
if (!trimslice_tlv320aic23_dai.cpu_of_node) {
dev_err(&pdev->dev,
"Property 'nvidia,i2s-controller' missing or invalid\n");
ret = -EINVAL;
Expand All @@ -173,7 +173,7 @@ static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev)

trimslice_tlv320aic23_dai.platform_name = NULL;
trimslice_tlv320aic23_dai.platform_of_node =
trimslice_tlv320aic23_dai.cpu_dai_of_node;
trimslice_tlv320aic23_dai.cpu_of_node;
}

ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev);
Expand Down

0 comments on commit 421cb32

Please sign in to comment.