Skip to contentSkip to conversation

ASoC: Pay attention to driver supplied DAI IDs

PATCH In review Mark Brown 3 participants 6 messages Oct 12, 2010 – Oct 13, 2010

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/2 ASoC: Pay attention to driver supplied DAI IDs

The driver can specify a DAI ID number so use that.

---
 sound/soc/soc-core.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
sound/soc/soc-core.c +4 -1
index 4f6ea8c..c20cf7f 100644
@@ -3015,7 +3015,10 @@ int snd_soc_register_dais(struct device *dev,
 		}
 
 		dai->dev = dev;
-		dai->id = i;
+		if (dai->driver->id)
+			dai->id = dai->driver->id;
+		else
+			dai->id = i;
 		dai->driver = &dai_drv[i];
 		if (!dai->driver->ops)
 			dai->driver->ops = &null_dai_ops;
Signature · 1 line
1.7.1
author
#1 lore raw

PATCH 2/2 ASoC: Restore DAI ID specification for WM8994

WM8994 relies on the DAIs having IDs that match the AIF numbers.

---
 sound/soc/codecs/wm8994.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
sound/soc/codecs/wm8994.c +3 -0
index cb9338e..9ccda44 100644
@@ -3850,6 +3850,7 @@ static struct snd_soc_dai_ops wm8994_aif3_dai_ops = {
 static struct snd_soc_dai_driver wm8994_dai[] = {
 	{
 		.name = "wm8994-aif1",
+		.id = 1,
 		.playback = {
 			.stream_name = "AIF1 Playback",
 			.channels_min = 2,
@@ -3868,6 +3869,7 @@ static struct snd_soc_dai_driver wm8994_dai[] = {
 	},
 	{
 		.name = "wm8994-aif2",
+		.id = 2,
 		.playback = {
 			.stream_name = "AIF2 Playback",
 			.channels_min = 2,
@@ -3886,6 +3888,7 @@ static struct snd_soc_dai_driver wm8994_dai[] = {
 	},
 	{
 		.name = "wm8994-aif3",
+		.id = 3,
 		.playback = {
 			.stream_name = "AIF3 Playback",
 			.channels_min = 2,
Signature · 1 line
1.7.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] ASoC: Restore DAI ID specification for WM8994

Quoted 28 lines · Mark Brown

WM8994 relies on the DAIs having IDs that match the AIF numbers.

---
 sound/soc/codecs/wm8994.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
sound/soc/codecs/wm8994.c +2 -0
index cb9338e..9ccda44 100644
@@ -3850,6 +3850,7 @@ static struct snd_soc_dai_ops wm8994_aif3_dai_ops = {
 static struct snd_soc_dai_driver wm8994_dai[] = {
 	{
 		.name = "wm8994-aif1",
+		.id = 1,
 		.playback = {
 			.stream_name = "AIF1 Playback",
 			.channels_min = 2,
@@ -3868,6 +3869,7 @@ static struct snd_soc_dai_driver wm8994_dai[] = {
 	},
 	{
 		.name = "wm8994-aif2",
+		.id = 2,
 		.playback = {
 			.stream_name = "AIF2 Playback",
 			.channels_min = 2,

sound/soc/codecs/wm8994.c static struct snd_soc_dai_driver wm8994_dai[] = { · line 3894

Quoted 7 lines
sound/soc/codecs/wm8994.c +1 -0
@@ -3886,6 +3888,7 @@ static struct snd_soc_dai_driver wm8994_dai[] = {
 	},
 	{
 		.name = "wm8994-aif3",
+		.id = 3,
 		.playback = {
 			.stream_name = "AIF3 Playback",
 			.channels_min = 2,
Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
author
#3 lore raw
In reply to Mark Brown

sound/soc/soc-core.c int snd_soc_register_dais(struct device *dev, · line 3022

Quoted 7 lines · Mark Brown
sound/soc/soc-core.c +4 -1
 		dai->dev = dev;
-		dai->id = i;
+		if (dai->driver->id)
+			dai->id = dai->driver->id;
+		else
+			dai->id = i;
 		dai->driver = &dai_drv[i];

Sorry, sent the wrong version of this - obviously the new check should go after the assignment.

#4 lore raw
In reply to Mark Brown
Quoted 12 lines · Mark Brown

The driver can specify a DAI ID number so use that.

---
 sound/soc/soc-core.c |    5 ++++-

 1 files changed, 4 insertions(+), 1 deletions(-)
sound/soc/soc-core.c +0 -0
index 4f6ea8c..c20cf7f 100644

sound/soc/soc-core.c int snd_soc_register_dais(struct device *dev, · line 3021

Quoted 8 lines
sound/soc/soc-core.c +4 -1
@@ -3015,7 +3015,10 @@ int snd_soc_register_dais(struct device *dev,
                }
 
                dai->dev = dev;
-               dai->id = i;
+               if (dai->driver->id)
+                       dai->id = dai->driver->id;
+               else
+                       dai->id = i;

I haven't looked at the code, but doesn't this assume that a DAI ID of 0 is invalid?

I have a suspicion I need to retest my driver to make sure it still works.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
author
#5 lore raw
Quoted 8 lines · Timur Tabi

On Tue, Oct 12, 2010 at 9:57 AM, Mark Brown

Quoted 5 lines

-               dai->id = i;
+               if (dai->driver->id)
+                       dai->id = dai->driver->id;
+               else
+                       dai->id = i;

Quoted 4 lines

I haven't looked at the code, but doesn't this assume that a DAI ID of 0 is invalid?

I have a suspicion I need to retest my driver to make sure it still works.

This makes no change to the behaviour when the DAI ID is zero. Previously it would be overwritten with i, with the new code it is still overwritten with i. You can specify a DAI ID of zero, but only for the first DAI. This is a limitation but avoids having to manually set the DAI ID in the simple case where they're all numbered sequentially from zero.