Skip to contentSkip to conversation

ASoC: spear_pcm: Update to new pcm_new() API

PATCH Applied Lars-Peter Clausen 3 participants 4 messages Mar 18, 2013 – Mar 20, 2013

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

PATCH 1/2 ASoC: spear_pcm: Update to new pcm_new() API

Commit 552d1ef6 ("ASoC: core - Optimise and refactor pcm_new() to pass only rtd") updated the pcm_new() callback to take the rtd as the only parameter. The spear PCM driver (which was merged much later) still uses the old API. This patch updates the driver to the new API.

---

Btw. where are the Kconfig and Makefile files for spear?

---
 sound/soc/spear/spear_pcm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/spear/spear_pcm.c +6 -6
index 9b76cc5..5e7aebe 100644
@@ -149,9 +149,9 @@ static void spear_pcm_free(struct snd_pcm *pcm)
 
 static u64 spear_pcm_dmamask = DMA_BIT_MASK(32);
 
-static int spear_pcm_new(struct snd_card *card,
-		struct snd_soc_dai *dai, struct snd_pcm *pcm)
+static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd)
 {
+	struct snd_card *card = rtd->card->snd_card;
 	int ret;
 
 	if (!card->dev->dma_mask)
@@ -159,16 +159,16 @@ static int spear_pcm_new(struct snd_card *card,
 	if (!card->dev->coherent_dma_mask)
 		card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
 
-	if (dai->driver->playback.channels_min) {
-		ret = spear_pcm_preallocate_dma_buffer(pcm,
+	if (rtd->cpu_dai->driver->playback.channels_min) {
+		ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
 				SNDRV_PCM_STREAM_PLAYBACK,
 				spear_pcm_hardware.buffer_bytes_max);
 		if (ret)
 			return ret;
 	}
 
-	if (dai->driver->capture.channels_min) {
-		ret = spear_pcm_preallocate_dma_buffer(pcm,
+	if (rtd->cpu_dai->driver->capture.channels_min) {
+		ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
 				SNDRV_PCM_STREAM_CAPTURE,
 				spear_pcm_hardware.buffer_bytes_max);
 		if (ret)
Signature · 1 line
1.8.0
#1 lore raw

PATCH 2/2 ASoC: spear_pcm: Staticize non-exported structs

---
 sound/soc/spear/spear_pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/spear/spear_pcm.c +2 -2
index 5e7aebe..dd71167 100644
@@ -25,7 +25,7 @@
 #include <sound/soc.h>
 #include <sound/spear_dma.h>
 
-struct snd_pcm_hardware spear_pcm_hardware = {
+static struct snd_pcm_hardware spear_pcm_hardware = {
 	.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
 		 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
 		 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
@@ -178,7 +178,7 @@ static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd)
 	return 0;
 }
 
-struct snd_soc_platform_driver spear_soc_platform = {
+static struct snd_soc_platform_driver spear_soc_platform = {
 	.ops		=	&spear_pcm_ops,
 	.pcm_new	=	spear_pcm_new,
 	.pcm_free	=	spear_pcm_free,
Signature · 1 line
1.8.0
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] ASoC: spear_pcm: Staticize non-exported structs

Quoted 19 lines · Lars-Peter Clausen
---
  sound/soc/spear/spear_pcm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/spear/spear_pcm.c +1 -1
index 5e7aebe..dd71167 100644
@@ -25,7 +25,7 @@
  #include<sound/soc.h>
  #include<sound/spear_dma.h>
 
-struct snd_pcm_hardware spear_pcm_hardware = {
+static struct snd_pcm_hardware spear_pcm_hardware = {
  	.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
  		 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
  		 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),

sound/soc/spear/spear_pcm.c static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd) · line 184

Quoted 8 lines
sound/soc/spear/spear_pcm.c +1 -1
@@ -178,7 +178,7 @@ static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd)
  	return 0;
  }
 
-struct snd_soc_platform_driver spear_soc_platform = {
+static struct snd_soc_platform_driver spear_soc_platform = {
  	.ops		=	&spear_pcm_ops,
  	.pcm_new	=	spear_pcm_new,
  	.pcm_free	=	spear_pcm_free,
Applied
#3 lore raw
In reply to Lars-Peter Clausen
Quoted 2 lines · Lars-Peter Clausen

Commit 552d1ef6 ("ASoC: core - Optimise and refactor pcm_new() to pass only rtd") updated the pcm_new() callback to take the rtd as the only parameter. The

Applied both, thanks.