Skip to contentSkip to conversation

ASoC: Blackfin: drop "-codec" from codec names

PATCH Applied Mike Frysinger 3 participants 8 messages Mar 28, 2011 – Apr 7, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ASoC: Blackfin: drop "-codec" from codec names

The recent multi-component patch incorrectly added "-codec" suffixes to parts which are not MFD. Drop the suffix from the machine drivers too.

---
 sound/soc/blackfin/bf5xx-ad1836.c  |    2 +-
 sound/soc/blackfin/bf5xx-ad193x.c  |    2 +-
 sound/soc/blackfin/bf5xx-ad1980.c  |    2 +-
 sound/soc/blackfin/bf5xx-ad73311.c |    2 +-
 sound/soc/blackfin/bf5xx-ssm2602.c |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
sound/soc/blackfin/bf5xx-ad1836.c +1 -1
index 83012da..826bae6 100644
@@ -85,7 +85,7 @@ static struct snd_soc_dai_link bf5xx_ad1836_dai = {
 	.cpu_dai_name = "bf5xx-tdm",
 	.codec_dai_name = "ad1836-hifi",
 	.platform_name = "bf5xx-tdm-pcm-audio",
-	.codec_name = "ad1836-codec.0",
+	.codec_name = "ad1836.0",
 	.ops = &bf5xx_ad1836_ops,
 };
 
sound/soc/blackfin/bf5xx-ad193x.c +1 -1
index 3367882..5794d09 100644
@@ -113,7 +113,7 @@ static struct snd_soc_dai_link bf5xx_ad193x_dai = {
 	.cpu_dai_name = "bf5xx-tdm",
 	.codec_dai_name ="ad193x-hifi",
 	.platform_name = "bf5xx-tdm-pcm-audio",
-	.codec_name = "ad193x-codec.5",
+	.codec_name = "ad193x.5",
 	.ops = &bf5xx_ad193x_ops,
 };
 
sound/soc/blackfin/bf5xx-ad1980.c +1 -1
index d57c9c9..c147130 100644
@@ -73,7 +73,7 @@ static struct snd_soc_dai_link bf5xx_board_dai = {
 	.cpu_dai_name = "bfin-ac97",
 	.codec_dai_name = "ad1980-hifi",
 	.platform_name = "bfin-pcm-audio",
-	.codec_name = "ad1980-codec",
+	.codec_name = "ad1980",
 	.ops = &bf5xx_board_ops,
 };
 
sound/soc/blackfin/bf5xx-ad73311.c +1 -1
index 732fb8b..1655f95 100644
@@ -186,7 +186,7 @@ static struct snd_soc_dai_link bf5xx_ad73311_dai = {
 	.cpu_dai_name = "bf5xx-i2s",
 	.codec_dai_name = "ad73311-hifi",
 	.platform_name = "bfin-pcm-audio",
-	.codec_name = "ad73311-codec",
+	.codec_name = "ad73311",
 	.ops = &bf5xx_ad73311_ops,
 };
 
sound/soc/blackfin/bf5xx-ssm2602.c +1 -1
index ad28663..732a02f 100644
@@ -119,7 +119,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai = {
 	.cpu_dai_name = "bf5xx-i2s",
 	.codec_dai_name = "ssm2602-hifi",
 	.platform_name = "bf5xx-pcm-audio",
-	.codec_name = "ssm2602-codec.0-001b",
+	.codec_name = "ssm2602.0-001b",
 	.ops = &bf5xx_ssm2602_ops,
 };
 
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 2/3 ASoC: Blackfin: standardize machine driver names

Some machine drivers were using "bf5xx-", others were using "bf5xx_", while others were using "bfin-". Further, some were using the same name in the transport layer which makes it hard to use different codecs at the same time. So standardize all of them to "bfin-" and make sure they are name spaced according to their driver name.

---
 sound/soc/blackfin/bf5xx-ac97-pcm.c |    2 +-
 sound/soc/blackfin/bf5xx-ad1836.c   |    6 +++---
 sound/soc/blackfin/bf5xx-ad193x.c   |    6 +++---
 sound/soc/blackfin/bf5xx-ad1980.c   |    4 ++--
 sound/soc/blackfin/bf5xx-ad73311.c  |    6 +++---
 sound/soc/blackfin/bf5xx-i2s-pcm.c  |    2 +-
 sound/soc/blackfin/bf5xx-i2s.c      |    2 +-
 sound/soc/blackfin/bf5xx-ssm2602.c  |    6 +++---
 sound/soc/blackfin/bf5xx-tdm-pcm.c  |    2 +-
 9 files changed, 18 insertions(+), 18 deletions(-)
sound/soc/blackfin/bf5xx-ac97-pcm.c +1 -1
index 5a2fd8a..e940d26 100644
@@ -458,7 +458,7 @@ static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev)
 
 static struct platform_driver bf5xx_pcm_driver = {
 	.driver = {
-			.name = "bf5xx-pcm-audio",
+			.name = "bfin-ac97-pcm-audio",
 			.owner = THIS_MODULE,
 	},
 
sound/soc/blackfin/bf5xx-ad1836.c +3 -3
index 826bae6..5d9d9e2 100644
@@ -82,15 +82,15 @@ static struct snd_soc_ops bf5xx_ad1836_ops = {
 static struct snd_soc_dai_link bf5xx_ad1836_dai = {
 	.name = "ad1836",
 	.stream_name = "AD1836",
-	.cpu_dai_name = "bf5xx-tdm",
+	.cpu_dai_name = "bfin-tdm",
 	.codec_dai_name = "ad1836-hifi",
-	.platform_name = "bf5xx-tdm-pcm-audio",
+	.platform_name = "bfin-tdm-pcm-audio",
 	.codec_name = "ad1836.0",
 	.ops = &bf5xx_ad1836_ops,
 };
 
 static struct snd_soc_card bf5xx_ad1836 = {
-	.name = "bf5xx_ad1836",
+	.name = "bfin-ad1836",
 	.dai_link = &bf5xx_ad1836_dai,
 	.num_links = 1,
 };
sound/soc/blackfin/bf5xx-ad193x.c +3 -3
index 5794d09..355094f 100644
@@ -110,15 +110,15 @@ static struct snd_soc_ops bf5xx_ad193x_ops = {
 static struct snd_soc_dai_link bf5xx_ad193x_dai = {
 	.name = "ad193x",
 	.stream_name = "AD193X",
-	.cpu_dai_name = "bf5xx-tdm",
+	.cpu_dai_name = "bfin-tdm",
 	.codec_dai_name ="ad193x-hifi",
-	.platform_name = "bf5xx-tdm-pcm-audio",
+	.platform_name = "bfin-tdm-pcm-audio",
 	.codec_name = "ad193x.5",
 	.ops = &bf5xx_ad193x_ops,
 };
 
 static struct snd_soc_card bf5xx_ad193x = {
-	.name = "bf5xx_ad193x",
+	.name = "bfin-ad193x",
 	.dai_link = &bf5xx_ad193x_dai,
 	.num_links = 1,
 };
sound/soc/blackfin/bf5xx-ad1980.c +2 -2
index c147130..a381240 100644
@@ -72,13 +72,13 @@ static struct snd_soc_dai_link bf5xx_board_dai = {
 	.stream_name = "AC97 HiFi",
 	.cpu_dai_name = "bfin-ac97",
 	.codec_dai_name = "ad1980-hifi",
-	.platform_name = "bfin-pcm-audio",
+	.platform_name = "bfin-ac97-pcm-audio",
 	.codec_name = "ad1980",
 	.ops = &bf5xx_board_ops,
 };
 
 static struct snd_soc_card bf5xx_board = {
-	.name = "bf5xx-board",
+	.name = "bfin-ad1980",
 	.dai_link = &bf5xx_board_dai,
 	.num_links = 1,
 };
sound/soc/blackfin/bf5xx-ad73311.c +3 -3
index 1655f95..9f0d4f3 100644
@@ -183,15 +183,15 @@ static struct snd_soc_ops bf5xx_ad73311_ops = {
 static struct snd_soc_dai_link bf5xx_ad73311_dai = {
 	.name = "ad73311",
 	.stream_name = "AD73311",
-	.cpu_dai_name = "bf5xx-i2s",
+	.cpu_dai_name = "bfin-i2s",
 	.codec_dai_name = "ad73311-hifi",
-	.platform_name = "bfin-pcm-audio",
+	.platform_name = "bfin-i2s-pcm-audio",
 	.codec_name = "ad73311",
 	.ops = &bf5xx_ad73311_ops,
 };
 
 static struct snd_soc_card bf5xx_ad73311 = {
-	.name = "bf5xx_ad73311",
+	.name = "bfin-ad73311",
 	.probe = bf5xx_probe,
 	.dai_link = &bf5xx_ad73311_dai,
 	.num_links = 1,
sound/soc/blackfin/bf5xx-i2s-pcm.c +1 -1
index 890a0dc..50b1df8 100644
@@ -292,7 +292,7 @@ static int __devexit bfin_i2s_soc_platform_remove(struct platform_device *pdev)
 
 static struct platform_driver bfin_i2s_pcm_driver = {
 	.driver = {
-			.name = "bfin-pcm-audio",
+			.name = "bfin-i2s-pcm-audio",
 			.owner = THIS_MODULE,
 	},
 
sound/soc/blackfin/bf5xx-i2s.c +1 -1
index 37d9d3c..dacd86c 100644
@@ -316,7 +316,7 @@ static struct platform_driver bfin_i2s_driver = {
 	.remove = __devexit_p(bfin_i2s_drv_remove),
 
 	.driver = {
-		.name = "bf5xx-i2s",
+		.name = "bfin-i2s",
 		.owner = THIS_MODULE,
 	},
 };
sound/soc/blackfin/bf5xx-ssm2602.c +3 -3
index 732a02f..8a7b589 100644
@@ -116,15 +116,15 @@ static struct snd_soc_ops bf5xx_ssm2602_ops = {
 static struct snd_soc_dai_link bf5xx_ssm2602_dai = {
 	.name = "ssm2602",
 	.stream_name = "SSM2602",
-	.cpu_dai_name = "bf5xx-i2s",
+	.cpu_dai_name = "bfin-i2s",
 	.codec_dai_name = "ssm2602-hifi",
-	.platform_name = "bf5xx-pcm-audio",
+	.platform_name = "bfin-i2s-pcm-audio",
 	.codec_name = "ssm2602.0-001b",
 	.ops = &bf5xx_ssm2602_ops,
 };
 
 static struct snd_soc_card bf5xx_ssm2602 = {
-	.name = "bf5xx_ssm2602",
+	.name = "bfin-ssm2602",
 	.dai_link = &bf5xx_ssm2602_dai,
 	.num_links = 1,
 };
sound/soc/blackfin/bf5xx-tdm-pcm.c +1 -1
index 74cf759..d1bd745 100644
@@ -326,7 +326,7 @@ static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev)
 
 static struct platform_driver bfin_tdm_driver = {
 	.driver = {
-			.name = "bf5xx-tdm-pcm-audio",
+			.name = "bfin-tdm-pcm-audio",
 			.owner = THIS_MODULE,
 	},
 
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 3/3 ASoC: Blackfin: push down SPORT settings from global variables

In reply to Mike Frysinger

From: Barry Song <[email protected]>

Now that we have multi-component support, take the time to unify the SPORT implementations a bit and make the setup dynamic. This kills off the global sport_handle which was shared across all the Blackfin machine drivers. The pin management aspect is off loaded to platform resources, and now multiple SPORTs can be instantiated simultaneously.

---
 sound/soc/blackfin/bf5xx-ac97-pcm.c |   11 ++-
 sound/soc/blackfin/bf5xx-ac97.c     |  166 +++++++++++------------------------
 sound/soc/blackfin/bf5xx-ad1836.c   |   40 ++++----
 sound/soc/blackfin/bf5xx-ad193x.c   |   40 ++++----
 sound/soc/blackfin/bf5xx-ad1980.c   |   43 ++++-----
 sound/soc/blackfin/bf5xx-ad73311.c  |   40 ++++----
 sound/soc/blackfin/bf5xx-i2s-pcm.c  |   21 +++--
 sound/soc/blackfin/bf5xx-i2s.c      |  159 +++++++++++++--------------------
 sound/soc/blackfin/bf5xx-sport.c    |  159 +++++++++++++++++++++++++---------
 sound/soc/blackfin/bf5xx-sport.h    |   16 +++-
 sound/soc/blackfin/bf5xx-ssm2602.c  |   40 ++++----
 sound/soc/blackfin/bf5xx-tdm-pcm.c  |   21 +++--
 sound/soc/blackfin/bf5xx-tdm.c      |  110 ++++++++---------------
 13 files changed, 416 insertions(+), 450 deletions(-)
sound/soc/blackfin/bf5xx-ac97-pcm.c +9 -2
index e940d26..98b44b3 100644
@@ -243,6 +243,9 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream)
 
 static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
 {
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	int ret;
 
@@ -314,6 +317,9 @@ static struct snd_pcm_ops bf5xx_pcm_ac97_ops = {
 
 static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
 {
+	struct snd_soc_pcm_runtime *rtd = pcm->private_data;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
 	struct snd_pcm_substream *substream = pcm->streams[stream].substream;
 	struct snd_dma_buffer *buf = &substream->dma_buffer;
 	size_t size = bf5xx_pcm_hardware.buffer_bytes_max
@@ -377,6 +383,9 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
 	struct snd_dma_buffer *buf;
 	int stream;
 #if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT)
+	struct snd_soc_pcm_runtime *rtd = pcm->private_data;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
 	size_t size = bf5xx_pcm_hardware.buffer_bytes_max *
 		sizeof(struct ac97_frame) / 4;
 #endif
@@ -405,8 +414,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
 	}
 #endif
 	}
-	if (sport_handle)
-		sport_done(sport_handle);
 }
 
 static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
sound/soc/blackfin/bf5xx-ac97.c +53 -113

245 lines not on this page · raw message

sound/soc/blackfin/bf5xx-ad1836.c +20 -20
index 5d9d9e2..ea4951c 100644
@@ -29,22 +29,12 @@
 #include <asm/portmux.h>
 
 #include "../codecs/ad1836.h"
-#include "bf5xx-sport.h"
 
 #include "bf5xx-tdm-pcm.h"
 #include "bf5xx-tdm.h"
 
 static struct snd_soc_card bf5xx_ad1836;
 
-static int bf5xx_ad1836_startup(struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-
-	snd_soc_dai_set_drvdata(cpu_dai, sport_handle);
-	return 0;
-}
-
 static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream,
 	struct snd_pcm_hw_params *params)
 {
@@ -75,23 +65,33 @@ static int bf5xx_ad1836_hw_params(struct snd_pcm_substream *substream,
 }
 
 static struct snd_soc_ops bf5xx_ad1836_ops = {
-	.startup = bf5xx_ad1836_startup,
 	.hw_params = bf5xx_ad1836_hw_params,
 };
 
-static struct snd_soc_dai_link bf5xx_ad1836_dai = {
-	.name = "ad1836",
-	.stream_name = "AD1836",
-	.cpu_dai_name = "bfin-tdm",
-	.codec_dai_name = "ad1836-hifi",
-	.platform_name = "bfin-tdm-pcm-audio",
-	.codec_name = "ad1836.0",
-	.ops = &bf5xx_ad1836_ops,
+static struct snd_soc_dai_link bf5xx_ad1836_dai[] = {
+	{
+		.name = "ad1836",
+		.stream_name = "AD1836",
+		.cpu_dai_name = "bfin-tdm.0",
+		.codec_dai_name = "ad1836-hifi",
+		.platform_name = "bfin-tdm-pcm-audio",
+		.codec_name = "ad1836.0",
+		.ops = &bf5xx_ad1836_ops,
+	},
+	{
+		.name = "ad1836",
+		.stream_name = "AD1836",
+		.cpu_dai_name = "bfin-tdm.1",
+		.codec_dai_name = "ad1836-hifi",
+		.platform_name = "bfin-tdm-pcm-audio",
+		.codec_name = "ad1836.0",
+		.ops = &bf5xx_ad1836_ops,
+	},
 };
 
 static struct snd_soc_card bf5xx_ad1836 = {
 	.name = "bfin-ad1836",
-	.dai_link = &bf5xx_ad1836_dai,
+	.dai_link = &bf5xx_ad1836_dai[CONFIG_SND_BF5XX_SPORT_NUM],
 	.num_links = 1,
 };
 
sound/soc/blackfin/bf5xx-ad193x.c +20 -20
index 355094f..d6651c0 100644
@@ -38,22 +38,12 @@
 #include <asm/portmux.h>
 
 #include "../codecs/ad193x.h"
-#include "bf5xx-sport.h"
 
 #include "bf5xx-tdm-pcm.h"
 #include "bf5xx-tdm.h"
 
 static struct snd_soc_card bf5xx_ad193x;
 
-static int bf5xx_ad193x_startup(struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-
-	snd_soc_dai_set_drvdata(cpu_dai, sport_handle);
-	return 0;
-}
-
 static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
 	struct snd_pcm_hw_params *params)
 {
@@ -103,23 +93,33 @@ static int bf5xx_ad193x_hw_params(struct snd_pcm_substream *substream,
 }
 
 static struct snd_soc_ops bf5xx_ad193x_ops = {
-	.startup = bf5xx_ad193x_startup,
 	.hw_params = bf5xx_ad193x_hw_params,
 };
 
-static struct snd_soc_dai_link bf5xx_ad193x_dai = {
-	.name = "ad193x",
-	.stream_name = "AD193X",
-	.cpu_dai_name = "bfin-tdm",
-	.codec_dai_name ="ad193x-hifi",
-	.platform_name = "bfin-tdm-pcm-audio",
-	.codec_name = "ad193x.5",
-	.ops = &bf5xx_ad193x_ops,
+static struct snd_soc_dai_link bf5xx_ad193x_dai[] = {
+	{
+		.name = "ad193x",
+		.stream_name = "AD193X",
+		.cpu_dai_name = "bfin-tdm.0",
+		.codec_dai_name ="ad193x-hifi",
+		.platform_name = "bfin-tdm-pcm-audio",
+		.codec_name = "ad193x.5",
+		.ops = &bf5xx_ad193x_ops,
+	},
+	{
+		.name = "ad193x",
+		.stream_name = "AD193X",
+		.cpu_dai_name = "bfin-tdm.1",
+		.codec_dai_name ="ad193x-hifi",
+		.platform_name = "bfin-tdm-pcm-audio",
+		.codec_name = "ad193x.5",
+		.ops = &bf5xx_ad193x_ops,
+	},
 };
 
 static struct snd_soc_card bf5xx_ad193x = {
 	.name = "bfin-ad193x",
-	.dai_link = &bf5xx_ad193x_dai,
+	.dai_link = &bf5xx_ad193x_dai[CONFIG_SND_BF5XX_SPORT_NUM],
 	.num_links = 1,
 };
 
sound/soc/blackfin/bf5xx-ad1980.c +19 -24

58 lines not on this page · raw message

sound/soc/blackfin/bf5xx-ad73311.c +20 -20
index 9f0d4f3..732a247 100644
@@ -145,16 +145,6 @@ static int bf5xx_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int bf5xx_ad73311_startup(struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-
-	pr_debug("%s enter\n", __func__);
-	snd_soc_dai_set_drvdata(cpu_dai, sport_handle);
-	return 0;
-}
-
 static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream,
 	struct snd_pcm_hw_params *params)
 {
@@ -176,24 +166,34 @@ static int bf5xx_ad73311_hw_params(struct snd_pcm_substream *substream,
 
 
 static struct snd_soc_ops bf5xx_ad73311_ops = {
-	.startup = bf5xx_ad73311_startup,
 	.hw_params = bf5xx_ad73311_hw_params,
 };
 
-static struct snd_soc_dai_link bf5xx_ad73311_dai = {
-	.name = "ad73311",
-	.stream_name = "AD73311",
-	.cpu_dai_name = "bfin-i2s",
-	.codec_dai_name = "ad73311-hifi",
-	.platform_name = "bfin-i2s-pcm-audio",
-	.codec_name = "ad73311",
-	.ops = &bf5xx_ad73311_ops,
+static struct snd_soc_dai_link bf5xx_ad73311_dai[] = {
+	{
+		.name = "ad73311",
+		.stream_name = "AD73311",
+		.cpu_dai_name = "bfin-i2s.0",
+		.codec_dai_name = "ad73311-hifi",
+		.platform_name = "bfin-i2s-pcm-audio",
+		.codec_name = "ad73311",
+		.ops = &bf5xx_ad73311_ops,
+	},
+	{
+		.name = "ad73311",
+		.stream_name = "AD73311",
+		.cpu_dai_name = "bfin-i2s.1",
+		.codec_dai_name = "ad73311-hifi",
+		.platform_name = "bfin-i2s-pcm-audio",
+		.codec_name = "ad73311",
+		.ops = &bf5xx_ad73311_ops,
+	},
 };
 
 static struct snd_soc_card bf5xx_ad73311 = {
 	.name = "bfin-ad73311",
 	.probe = bf5xx_probe,
-	.dai_link = &bf5xx_ad73311_dai,
+	.dai_link = &bf5xx_ad73311_dai[CONFIG_SND_BF5XX_SPORT_NUM],
 	.num_links = 1,
 };
 
sound/soc/blackfin/bf5xx-i2s-pcm.c +12 -9
index 50b1df8..b5101ef 100644
@@ -148,10 +148,15 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream)
 
 static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
 {
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
 	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct snd_dma_buffer *buf = &substream->dma_buffer;
 	int ret;
 
 	pr_debug("%s enter\n", __func__);
+
 	snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware);
 
 	ret = snd_pcm_hw_constraint_integer(runtime, \
@@ -159,9 +164,14 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
 	if (ret < 0)
 		goto out;
 
-	if (sport_handle != NULL)
+	if (sport_handle != NULL) {
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+			sport_handle->tx_buf = buf->area;
+		else
+			sport_handle->rx_buf = buf->area;
+
 		runtime->private_data = sport_handle;
-	else {
+	} else {
 		pr_err("sport_handle is NULL\n");
 		return -1;
 	}
@@ -214,11 +224,6 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
 	pr_debug("%s, area:%p, size:0x%08lx\n", __func__,
 		buf->area, buf->bytes);
 
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK)
-		sport_handle->tx_buf = buf->area;
-	else
-		sport_handle->rx_buf = buf->area;
-
 	return 0;
 }
 
@@ -239,8 +244,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
 		dma_free_coherent(NULL, buf->bytes, buf->area, 0);
 		buf->area = NULL;
 	}
-	if (sport_handle)
-		sport_done(sport_handle);
 }
 
 static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
sound/soc/blackfin/bf5xx-i2s.c +63 -96

260 lines not on this page · raw message

sound/soc/blackfin/bf5xx-sport.c +119 -40

227 lines not on this page · raw message

sound/soc/blackfin/bf5xx-sport.h +11 -5
index a86e8cc..5ab60bd 100644
@@ -1,5 +1,5 @@
 /*
- * File:         bf5xx_ac97_sport.h
+ * File:         bf5xx_sport.h
  * Based on:
  * Author:       Roy Huang <[email protected]>
  *
@@ -33,15 +33,18 @@
 #include <linux/types.h>
 #include <linux/wait.h>
 #include <linux/workqueue.h>
+#include <linux/platform_device.h>
 #include <asm/dma.h>
 #include <asm/bfin_sport.h>
 
 #define DESC_ELEMENT_COUNT 9
 
 struct sport_device {
+	int num;
 	int dma_rx_chan;
 	int dma_tx_chan;
 	int err_irq;
+	const unsigned short *pin_req;
 	struct sport_register *regs;
 
 	unsigned char *rx_buf;
@@ -103,17 +106,20 @@ struct sport_device {
 	void *private_data;
 };
 
-extern struct sport_device *sport_handle;
-
 struct sport_param {
+	int num;
 	int dma_rx_chan;
 	int dma_tx_chan;
 	int err_irq;
+	const unsigned short *pin_req;
 	struct sport_register *regs;
+	unsigned int wdsize;
+	unsigned int dummy_count;
+	void *private_data;
 };
 
-struct sport_device *sport_init(struct sport_param *param, unsigned wdsize,
-		unsigned dummy_count, void *private_data);
+struct sport_device *sport_init(struct platform_device *pdev,
+	unsigned int wdsize, unsigned int dummy_count, size_t priv_size);
 
 void sport_done(struct sport_device *sport);
 
sound/soc/blackfin/bf5xx-ssm2602.c +20 -20
index 8a7b589..767e772 100644
@@ -44,16 +44,6 @@
 
 static struct snd_soc_card bf5xx_ssm2602;
 
-static int bf5xx_ssm2602_startup(struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-
-	pr_debug("%s enter\n", __func__);
-	snd_soc_dai_set_drvdata(cpu_dai, sport_handle);
-	return 0;
-}
-
 static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream,
 	struct snd_pcm_hw_params *params)
 {
@@ -109,23 +99,33 @@ static int bf5xx_ssm2602_hw_params(struct snd_pcm_substream *substream,
 }
 
 static struct snd_soc_ops bf5xx_ssm2602_ops = {
-	.startup = bf5xx_ssm2602_startup,
 	.hw_params = bf5xx_ssm2602_hw_params,
 };
 
-static struct snd_soc_dai_link bf5xx_ssm2602_dai = {
-	.name = "ssm2602",
-	.stream_name = "SSM2602",
-	.cpu_dai_name = "bfin-i2s",
-	.codec_dai_name = "ssm2602-hifi",
-	.platform_name = "bfin-i2s-pcm-audio",
-	.codec_name = "ssm2602.0-001b",
-	.ops = &bf5xx_ssm2602_ops,
+static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = {
+	{
+		.name = "ssm2602",
+		.stream_name = "SSM2602",
+		.cpu_dai_name = "bfin-i2s.0",
+		.codec_dai_name = "ssm2602-hifi",
+		.platform_name = "bfin-i2s-pcm-audio",
+		.codec_name = "ssm2602.0-001b",
+		.ops = &bf5xx_ssm2602_ops,
+	},
+	{
+		.name = "ssm2602",
+		.stream_name = "SSM2602",
+		.cpu_dai_name = "bfin-i2s.1",
+		.codec_dai_name = "ssm2602-hifi",
+		.platform_name = "bfin-i2s-pcm-audio",
+		.codec_name = "ssm2602.0-001b",
+		.ops = &bf5xx_ssm2602_ops,
+	},
 };
 
 static struct snd_soc_card bf5xx_ssm2602 = {
 	.name = "bfin-ssm2602",
-	.dai_link = &bf5xx_ssm2602_dai,
+	.dai_link = &bf5xx_ssm2602_dai[CONFIG_SND_BF5XX_SPORT_NUM],
 	.num_links = 1,
 };
 
sound/soc/blackfin/bf5xx-tdm-pcm.c +12 -9
index d1bd745..07cfc7a 100644
@@ -154,7 +154,12 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream)
 
 static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
 {
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
 	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct snd_dma_buffer *buf = &substream->dma_buffer;
+
 	int ret = 0;
 
 	snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware);
@@ -164,9 +169,14 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
 	if (ret < 0)
 		goto out;
 
-	if (sport_handle != NULL)
+	if (sport_handle != NULL) {
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+			sport_handle->tx_buf = buf->area;
+		else
+			sport_handle->rx_buf = buf->area;
+
 		runtime->private_data = sport_handle;
-	else {
+	} else {
 		pr_err("sport_handle is NULL\n");
 		ret = -ENODEV;
 	}
@@ -249,11 +259,6 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
 	}
 	buf->bytes = size;
 
-	if (stream == SNDRV_PCM_STREAM_PLAYBACK)
-		sport_handle->tx_buf = buf->area;
-	else
-		sport_handle->rx_buf = buf->area;
-
 	return 0;
 }
 
@@ -274,8 +279,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
 		dma_free_coherent(NULL, buf->bytes, buf->area, 0);
 		buf->area = NULL;
 	}
-	if (sport_handle)
-		sport_done(sport_handle);
 }
 
 static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
sound/soc/blackfin/bf5xx-tdm.c +38 -72

217 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#3 lore raw

Re: [uclinux-dist-devel] [PATCH 3/3] ASoC: Blackfin: push down SPORT settings from global variables

Quoted 1 line · Mike Frysinger

+       struct bfin_snd_platform_data *pdata = dev->platform_data;

hrm, i noticed that this struct is fairly generic and could be reused in other SPORT drivers, but i'd want to replace the "_snd_" in the struct name with "_sport_". i think you've already merged this patch and so you dont want to go squashing any changes into it ? so i should send a small follow up patch to change the name ? -mike
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw

Re: [uclinux-dist-devel] [PATCH 3/3] ASoC: Blackfin: push down SPORT settings from global variables

Quoted 3 lines · Mike Frysinger

struct name with "_sport_". i think you've already merged this patch and so you dont want to go squashing any changes into it ? so i should send a small follow up patch to change the name ?

Yes, followup please.

#5 lore raw
In reply to Mike Frysinger

btw, all the recent patches which havent garnered unresolved feedback can be found in my for-alsa branch. in case it makes things easier.
git://git.kernel.org/pub/scm/linux/kernel/git/vapier/blackfin.git
-mike

Applied
#7 lore raw
In reply to Mike Frysinger
Quoted 4 lines · Mike Frysinger

The recent multi-component patch incorrectly added "-codec" suffixes to parts which are not MFD. Drop the suffix from the machine drivers too.

Applied all, thanks - note these should've also included the updates to the machine drivers for bisection.