All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: samsung: Deferred probing support fixes
@ 2016-07-21 18:03 Sylwester Nawrocki
  2016-07-21 18:03 ` [PATCH 1/2] ASoC: samsung: Fix error paths in the I2S driver's probe() Sylwester Nawrocki
  2016-07-21 18:03 ` [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config Sylwester Nawrocki
  0 siblings, 2 replies; 9+ messages in thread
From: Sylwester Nawrocki @ 2016-07-21 18:03 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, k.kozlowski, b.zolnierkie, linux-samsung-soc,
	Sylwester Nawrocki

This patch series is an attempt to fix sound card initialization isssues
observed in Odroid XU3 board after conversion of the AUDSS clock controller
driver to proper loadable module.  Related patch can be found here:
https://patchwork.kernel.org/patch/9221051, it's also already in -next.

It would be good to have these two patches merged in 4.8-rc cycle so as
to avoid regressions on on boards using ADMA. The sound breakage happens
only when ADMA is used, as ADMA gets apb_pclk clock from the AUDSS clock
controller.  Previously the clock controller was initialized early in
core_initcall which ensured the ADMA PL330 driver initialization before
the I2S probe.

Probably as a followup the SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME could
be dropped and it's usage replaced with struct snd_dmaengine_pcm_config
::dma_names, I didn't want to make too invasive changes for a bug fix patch
and don't have the older s3c non-dt boards for testing.

Sylwester Nawrocki (2):
  ASoC: samsung: Fix error paths in the I2S driver's probe()
  ASoC: samsung: Specify DMA channels through struct
    snd_dmaengine_pcm_config

 sound/soc/samsung/ac97.c        |  3 ++-
 sound/soc/samsung/dma.h         |  9 ++++++---
 sound/soc/samsung/dmaengine.c   | 31 ++++++++++++++++++++-----------
 sound/soc/samsung/i2s.c         | 28 ++++++++++++++++++++++------
 sound/soc/samsung/pcm.c         |  3 ++-
 sound/soc/samsung/s3c2412-i2s.c |  3 ++-
 sound/soc/samsung/s3c24xx-i2s.c |  3 ++-
 sound/soc/samsung/spdif.c       |  3 ++-
 8 files changed, 58 insertions(+), 25 deletions(-)

--
1.9.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] ASoC: samsung: Fix error paths in the I2S driver's probe()
  2016-07-21 18:03 [PATCH 0/2] ASoC: samsung: Deferred probing support fixes Sylwester Nawrocki
@ 2016-07-21 18:03 ` Sylwester Nawrocki
  2016-07-21 18:31   ` Applied "ASoC: samsung: Fix error paths in the I2S driver's probe()" to the asoc tree Mark Brown
  2016-07-21 18:03 ` [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config Sylwester Nawrocki
  1 sibling, 1 reply; 9+ messages in thread
From: Sylwester Nawrocki @ 2016-07-21 18:03 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, k.kozlowski, b.zolnierkie, linux-samsung-soc,
	Sylwester Nawrocki

Ensure they secondary DAI device is freed properly when asoc_dma_platform
registration fails.  This change is needed for proper deferred probe support
and will help preventing situations when the CPU DAI's initialization
completes without required DMA resources.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 sound/soc/samsung/i2s.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 27ca116..2bb3550 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1107,6 +1107,11 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
 	return i2s;
 }
 
+static void i2s_free_sec_dai(struct i2s_dai *i2s)
+{
+	platform_device_del(i2s->pdev);
+}
+
 #ifdef CONFIG_PM
 static int i2s_runtime_suspend(struct device *dev)
 {
@@ -1340,17 +1345,27 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	devm_snd_soc_register_component(&pri_dai->pdev->dev,
+	ret = devm_snd_soc_register_component(&pri_dai->pdev->dev,
 					&samsung_i2s_component,
 					&pri_dai->i2s_dai_drv, 1);
+	if (ret < 0)
+		goto err_free_dai;
+
+	ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter);
+	if (ret < 0)
+		goto err_free_dai;
 
 	pm_runtime_enable(&pdev->dev);
 
-	ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter);
-	if (ret != 0)
-		return ret;
+	ret = i2s_register_clock_provider(pdev);
+	if (!ret)
+		return 0;
 
-	return i2s_register_clock_provider(pdev);
+	pm_runtime_disable(&pdev->dev);
+err_free_dai:
+	if (sec_dai)
+		i2s_free_sec_dai(sec_dai);
+	return ret;
 }
 
 static int samsung_i2s_remove(struct platform_device *pdev)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config
  2016-07-21 18:03 [PATCH 0/2] ASoC: samsung: Deferred probing support fixes Sylwester Nawrocki
  2016-07-21 18:03 ` [PATCH 1/2] ASoC: samsung: Fix error paths in the I2S driver's probe() Sylwester Nawrocki
@ 2016-07-21 18:03 ` Sylwester Nawrocki
  2016-07-21 18:31   ` Applied "ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config" to the asoc tree Mark Brown
  2016-07-21 18:32   ` [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config Krzysztof Kozlowski
  1 sibling, 2 replies; 9+ messages in thread
From: Sylwester Nawrocki @ 2016-07-21 18:03 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, k.kozlowski, b.zolnierkie, linux-samsung-soc,
	Sylwester Nawrocki

The DMA channel names are specified through struct snd_dmaengine_pcm_config
rather than using SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag when
booting with devicetree in order to properly support deferred probing.
Without this change the sound machine driver initialization can complete
successfully with unavailable DMA resources.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 sound/soc/samsung/ac97.c        |  3 ++-
 sound/soc/samsung/dma.h         |  9 ++++++---
 sound/soc/samsung/dmaengine.c   | 31 ++++++++++++++++++++-----------
 sound/soc/samsung/i2s.c         |  5 +++--
 sound/soc/samsung/pcm.c         |  3 ++-
 sound/soc/samsung/s3c2412-i2s.c |  3 ++-
 sound/soc/samsung/s3c24xx-i2s.c |  3 ++-
 sound/soc/samsung/spdif.c       |  3 ++-
 8 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index 4a7a503..547d310 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -389,7 +389,8 @@ static int s3c_ac97_probe(struct platform_device *pdev)
 		goto err5;
 
 	ret = samsung_asoc_dma_platform_register(&pdev->dev,
-						 ac97_pdata->dma_filter);
+						 ac97_pdata->dma_filter,
+						 NULL, NULL);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
 		goto err5;
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
index a7616cc..3830f29 100644
--- a/sound/soc/samsung/dma.h
+++ b/sound/soc/samsung/dma.h
@@ -26,7 +26,10 @@ struct s3c_dma_params {
 void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
 				struct s3c_dma_params *playback,
 				struct s3c_dma_params *capture);
-int samsung_asoc_dma_platform_register(struct device *dev,
-				       dma_filter_fn fn);
-
+/*
+ * @tx, @rx arguments can be NULL if the DMA channel names are "tx", "rx",
+ * otherwise actual DMA channel names must be passed to this function.
+ */
+int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter,
+				       const char *tx, const char *rx);
 #endif
diff --git a/sound/soc/samsung/dmaengine.c b/sound/soc/samsung/dmaengine.c
index 0631259..2c87f38 100644
--- a/sound/soc/samsung/dmaengine.c
+++ b/sound/soc/samsung/dmaengine.c
@@ -28,10 +28,6 @@
 
 #include "dma.h"
 
-static struct snd_dmaengine_pcm_config samsung_dmaengine_pcm_config = {
-	.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
-};
-
 void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
 				struct s3c_dma_params *playback,
 				struct s3c_dma_params *capture)
@@ -58,15 +54,28 @@ void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
 }
 EXPORT_SYMBOL_GPL(samsung_asoc_init_dma_data);
 
-int samsung_asoc_dma_platform_register(struct device *dev,
-				       dma_filter_fn filter)
+int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter,
+				       const char *tx, const char *rx)
 {
-	samsung_dmaengine_pcm_config.compat_filter_fn = filter;
+	unsigned int flags = SND_DMAENGINE_PCM_FLAG_COMPAT;
+
+	struct snd_dmaengine_pcm_config *pcm_conf;
+
+	pcm_conf = devm_kzalloc(dev, sizeof(*pcm_conf), GFP_KERNEL);
+	if (!pcm_conf)
+		return -ENOMEM;
+
+	pcm_conf->prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
+	pcm_conf->compat_filter_fn = filter;
+
+	if (dev->of_node) {
+		pcm_conf->chan_names[SNDRV_PCM_STREAM_PLAYBACK] = tx;
+		pcm_conf->chan_names[SNDRV_PCM_STREAM_CAPTURE] = rx;
+	} else {
+		flags |= SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME;
+	}
 
-	return devm_snd_dmaengine_pcm_register(dev,
-			&samsung_dmaengine_pcm_config,
-			SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME |
-			SND_DMAENGINE_PCM_FLAG_COMPAT);
+	return devm_snd_dmaengine_pcm_register(dev, pcm_conf, flags);
 }
 EXPORT_SYMBOL_GPL(samsung_asoc_dma_platform_register);
 
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 2bb3550..50635ee 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1244,7 +1244,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 			return ret;
 
 		return samsung_asoc_dma_platform_register(&pdev->dev,
-							  sec_dai->filter);
+					sec_dai->filter, "tx-sec", NULL);
 	}
 
 	pri_dai = i2s_alloc_dai(pdev, false);
@@ -1351,7 +1351,8 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto err_free_dai;
 
-	ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter);
+	ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter,
+						 NULL, NULL);
 	if (ret < 0)
 		goto err_free_dai;
 
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
index 498f563..490c1a8 100644
--- a/sound/soc/samsung/pcm.c
+++ b/sound/soc/samsung/pcm.c
@@ -576,7 +576,8 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
 		goto err5;
 	}
 
-	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter);
+	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter,
+						 NULL, NULL);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
 		goto err5;
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index 204029d..d45dffb 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -177,7 +177,8 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev)
 	}
 
 	ret = samsung_asoc_dma_platform_register(&pdev->dev,
-						 pdata->dma_filter);
+						 pdata->dma_filter,
+						 NULL, NULL);
 	if (ret)
 		pr_err("failed to register the DMA: %d\n", ret);
 
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
index b3a475d..3e76f2a 100644
--- a/sound/soc/samsung/s3c24xx-i2s.c
+++ b/sound/soc/samsung/s3c24xx-i2s.c
@@ -482,7 +482,8 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
 	}
 
 	ret = samsung_asoc_dma_platform_register(&pdev->dev,
-						 pdata->dma_filter);
+						 pdata->dma_filter,
+						 NULL, NULL);
 	if (ret)
 		pr_err("failed to register the dma: %d\n", ret);
 
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
index 4687f52..0cb9c85 100644
--- a/sound/soc/samsung/spdif.c
+++ b/sound/soc/samsung/spdif.c
@@ -435,7 +435,8 @@ static int spdif_probe(struct platform_device *pdev)
 
 	spdif->dma_playback = &spdif_stereo_out;
 
-	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter);
+	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter,
+						 NULL, NULL);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register DMA: %d\n", ret);
 		goto err4;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Applied "ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config" to the asoc tree
  2016-07-21 18:03 ` [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config Sylwester Nawrocki
@ 2016-07-21 18:31   ` Mark Brown
  2016-07-21 18:32   ` [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config Krzysztof Kozlowski
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Brown @ 2016-07-21 18:31 UTC (permalink / raw)
  To: Sylwester Nawrocki; +Cc: Mark Brown

The patch

   ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 42a74e77471ea42e6ab44e5be16723ede72b9901 Mon Sep 17 00:00:00 2001
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
Date: Thu, 21 Jul 2016 20:03:50 +0200
Subject: [PATCH] ASoC: samsung: Specify DMA channels through struct
 snd_dmaengine_pcm_config

The DMA channel names are specified through struct snd_dmaengine_pcm_config
rather than using SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag when
booting with devicetree in order to properly support deferred probing.
Without this change the sound machine driver initialization can complete
successfully with unavailable DMA resources.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/samsung/ac97.c        |  3 ++-
 sound/soc/samsung/dma.h         |  9 ++++++---
 sound/soc/samsung/dmaengine.c   | 31 ++++++++++++++++++++-----------
 sound/soc/samsung/i2s.c         |  5 +++--
 sound/soc/samsung/pcm.c         |  3 ++-
 sound/soc/samsung/s3c2412-i2s.c |  3 ++-
 sound/soc/samsung/s3c24xx-i2s.c |  3 ++-
 sound/soc/samsung/spdif.c       |  3 ++-
 8 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index 4a7a503fe13c..547d31032088 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -389,7 +389,8 @@ static int s3c_ac97_probe(struct platform_device *pdev)
 		goto err5;
 
 	ret = samsung_asoc_dma_platform_register(&pdev->dev,
-						 ac97_pdata->dma_filter);
+						 ac97_pdata->dma_filter,
+						 NULL, NULL);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
 		goto err5;
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
index a7616cc9b39e..3830f297e0b6 100644
--- a/sound/soc/samsung/dma.h
+++ b/sound/soc/samsung/dma.h
@@ -26,7 +26,10 @@ struct s3c_dma_params {
 void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
 				struct s3c_dma_params *playback,
 				struct s3c_dma_params *capture);
-int samsung_asoc_dma_platform_register(struct device *dev,
-				       dma_filter_fn fn);
-
+/*
+ * @tx, @rx arguments can be NULL if the DMA channel names are "tx", "rx",
+ * otherwise actual DMA channel names must be passed to this function.
+ */
+int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter,
+				       const char *tx, const char *rx);
 #endif
diff --git a/sound/soc/samsung/dmaengine.c b/sound/soc/samsung/dmaengine.c
index 063125937311..2c87f380bfc4 100644
--- a/sound/soc/samsung/dmaengine.c
+++ b/sound/soc/samsung/dmaengine.c
@@ -28,10 +28,6 @@
 
 #include "dma.h"
 
-static struct snd_dmaengine_pcm_config samsung_dmaengine_pcm_config = {
-	.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
-};
-
 void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
 				struct s3c_dma_params *playback,
 				struct s3c_dma_params *capture)
@@ -58,15 +54,28 @@ void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
 }
 EXPORT_SYMBOL_GPL(samsung_asoc_init_dma_data);
 
-int samsung_asoc_dma_platform_register(struct device *dev,
-				       dma_filter_fn filter)
+int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter,
+				       const char *tx, const char *rx)
 {
-	samsung_dmaengine_pcm_config.compat_filter_fn = filter;
+	unsigned int flags = SND_DMAENGINE_PCM_FLAG_COMPAT;
+
+	struct snd_dmaengine_pcm_config *pcm_conf;
+
+	pcm_conf = devm_kzalloc(dev, sizeof(*pcm_conf), GFP_KERNEL);
+	if (!pcm_conf)
+		return -ENOMEM;
+
+	pcm_conf->prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
+	pcm_conf->compat_filter_fn = filter;
+
+	if (dev->of_node) {
+		pcm_conf->chan_names[SNDRV_PCM_STREAM_PLAYBACK] = tx;
+		pcm_conf->chan_names[SNDRV_PCM_STREAM_CAPTURE] = rx;
+	} else {
+		flags |= SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME;
+	}
 
-	return devm_snd_dmaengine_pcm_register(dev,
-			&samsung_dmaengine_pcm_config,
-			SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME |
-			SND_DMAENGINE_PCM_FLAG_COMPAT);
+	return devm_snd_dmaengine_pcm_register(dev, pcm_conf, flags);
 }
 EXPORT_SYMBOL_GPL(samsung_asoc_dma_platform_register);
 
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 2bb35502b070..50635ee8ff20 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1244,7 +1244,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 			return ret;
 
 		return samsung_asoc_dma_platform_register(&pdev->dev,
-							  sec_dai->filter);
+					sec_dai->filter, "tx-sec", NULL);
 	}
 
 	pri_dai = i2s_alloc_dai(pdev, false);
@@ -1351,7 +1351,8 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto err_free_dai;
 
-	ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter);
+	ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter,
+						 NULL, NULL);
 	if (ret < 0)
 		goto err_free_dai;
 
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
index 498f563a4c9c..490c1a87fd66 100644
--- a/sound/soc/samsung/pcm.c
+++ b/sound/soc/samsung/pcm.c
@@ -576,7 +576,8 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)
 		goto err5;
 	}
 
-	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter);
+	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter,
+						 NULL, NULL);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
 		goto err5;
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index 204029d12f5b..d45dffb297d8 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -177,7 +177,8 @@ static int s3c2412_iis_dev_probe(struct platform_device *pdev)
 	}
 
 	ret = samsung_asoc_dma_platform_register(&pdev->dev,
-						 pdata->dma_filter);
+						 pdata->dma_filter,
+						 NULL, NULL);
 	if (ret)
 		pr_err("failed to register the DMA: %d\n", ret);
 
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
index b3a475d73ba7..3e76f2a75a24 100644
--- a/sound/soc/samsung/s3c24xx-i2s.c
+++ b/sound/soc/samsung/s3c24xx-i2s.c
@@ -482,7 +482,8 @@ static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
 	}
 
 	ret = samsung_asoc_dma_platform_register(&pdev->dev,
-						 pdata->dma_filter);
+						 pdata->dma_filter,
+						 NULL, NULL);
 	if (ret)
 		pr_err("failed to register the dma: %d\n", ret);
 
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
index 4687f521197c..0cb9c8567546 100644
--- a/sound/soc/samsung/spdif.c
+++ b/sound/soc/samsung/spdif.c
@@ -435,7 +435,8 @@ static int spdif_probe(struct platform_device *pdev)
 
 	spdif->dma_playback = &spdif_stereo_out;
 
-	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter);
+	ret = samsung_asoc_dma_platform_register(&pdev->dev, filter,
+						 NULL, NULL);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register DMA: %d\n", ret);
 		goto err4;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Applied "ASoC: samsung: Fix error paths in the I2S driver's probe()" to the asoc tree
  2016-07-21 18:03 ` [PATCH 1/2] ASoC: samsung: Fix error paths in the I2S driver's probe() Sylwester Nawrocki
@ 2016-07-21 18:31   ` Mark Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2016-07-21 18:31 UTC (permalink / raw)
  To: Sylwester Nawrocki; +Cc: Mark Brown

The patch

   ASoC: samsung: Fix error paths in the I2S driver's probe()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 2b960386cb75bd332a132c44c9ec69bd1f3122d8 Mon Sep 17 00:00:00 2001
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
Date: Thu, 21 Jul 2016 20:03:49 +0200
Subject: [PATCH] ASoC: samsung: Fix error paths in the I2S driver's probe()

Ensure they secondary DAI device is freed properly when asoc_dma_platform
registration fails.  This change is needed for proper deferred probe support
and will help preventing situations when the CPU DAI's initialization
completes without required DMA resources.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/samsung/i2s.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 27ca116ef31f..2bb35502b070 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1107,6 +1107,11 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
 	return i2s;
 }
 
+static void i2s_free_sec_dai(struct i2s_dai *i2s)
+{
+	platform_device_del(i2s->pdev);
+}
+
 #ifdef CONFIG_PM
 static int i2s_runtime_suspend(struct device *dev)
 {
@@ -1340,17 +1345,27 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	devm_snd_soc_register_component(&pri_dai->pdev->dev,
+	ret = devm_snd_soc_register_component(&pri_dai->pdev->dev,
 					&samsung_i2s_component,
 					&pri_dai->i2s_dai_drv, 1);
+	if (ret < 0)
+		goto err_free_dai;
+
+	ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter);
+	if (ret < 0)
+		goto err_free_dai;
 
 	pm_runtime_enable(&pdev->dev);
 
-	ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter);
-	if (ret != 0)
-		return ret;
+	ret = i2s_register_clock_provider(pdev);
+	if (!ret)
+		return 0;
 
-	return i2s_register_clock_provider(pdev);
+	pm_runtime_disable(&pdev->dev);
+err_free_dai:
+	if (sec_dai)
+		i2s_free_sec_dai(sec_dai);
+	return ret;
 }
 
 static int samsung_i2s_remove(struct platform_device *pdev)
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config
  2016-07-21 18:03 ` [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config Sylwester Nawrocki
  2016-07-21 18:31   ` Applied "ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config" to the asoc tree Mark Brown
@ 2016-07-21 18:32   ` Krzysztof Kozlowski
  2016-07-21 20:03     ` Sylwester Nawrocki
  1 sibling, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-21 18:32 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: broonie, alsa-devel, Bartłomiej Żołnierkiewicz,
	linux-samsung-soc

On Thu, Jul 21, 2016 at 8:03 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> The DMA channel names are specified through struct snd_dmaengine_pcm_config
> rather than using SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag when
> booting with devicetree in order to properly support deferred probing.
> Without this change the sound machine driver initialization can complete
> successfully with unavailable DMA resources.
>

Is this the fix for the issue I reported recently
(http://www.spinics.net/lists/linux-clk/msg10805.html)? It looks like
it, so a credit? :)

BR,
Krzysztof

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config
  2016-07-21 18:32   ` [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config Krzysztof Kozlowski
@ 2016-07-21 20:03     ` Sylwester Nawrocki
  2016-07-21 20:13       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 9+ messages in thread
From: Sylwester Nawrocki @ 2016-07-21 20:03 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sylwester Nawrocki, broonie, alsa-devel,
	Bartłomiej Żołnierkiewicz, linux-samsung-soc

On 07/21/2016 08:32 PM, Krzysztof Kozlowski wrote:

> Is this the fix for the issue I reported recently
> (http://www.spinics.net/lists/linux-clk/msg10805.html)? It looks like
> it, so a credit? :)

My apologies Krzysztof for this unfortunate omission, it's indeed a fix
for the issue you've reported.  You're doing a great job by continuously
testing -next on multiple platforms and I just have miserably forgotten
to give due credits.  This can't be undone now but there must be something
I can do in recompense. I could buy you an orange juice or whatever juice 
you like next time we meet.
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config
  2016-07-21 20:03     ` Sylwester Nawrocki
@ 2016-07-21 20:13       ` Krzysztof Kozlowski
  2016-07-21 20:19         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-21 20:13 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: Sylwester Nawrocki, broonie, alsa-devel,
	Bartłomiej Żołnierkiewicz, linux-samsung-soc

On Thu, Jul 21, 2016 at 10:03 PM, Sylwester Nawrocki
<sylvester.nawrocki@gmail.com> wrote:
> On 07/21/2016 08:32 PM, Krzysztof Kozlowski wrote:
>
>> Is this the fix for the issue I reported recently
>> (http://www.spinics.net/lists/linux-clk/msg10805.html)? It looks like
>> it, so a credit? :)
>
> My apologies Krzysztof for this unfortunate omission, it's indeed a fix
> for the issue you've reported.  You're doing a great job by continuously
> testing -next on multiple platforms and I just have miserably forgotten
> to give due credits.  This can't be undone now but there must be something
> I can do in recompense. I could buy you an orange juice or whatever juice
> you like next time we meet.

My preferred juice is a fermented and distilled juice from malt so the
only suitable compensation would be a barrel of 12 yo single malt
whisky. It could be older than 12 years of course! :)

BTW, I can provide you a tested by when I am back to the office - on Monday.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config
  2016-07-21 20:13       ` Krzysztof Kozlowski
@ 2016-07-21 20:19         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-21 20:19 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: Sylwester Nawrocki, broonie, alsa-devel,
	Bartłomiej Żołnierkiewicz, linux-samsung-soc

On Thu, Jul 21, 2016 at 10:13 PM, Krzysztof Kozlowski
<k.kozlowski@samsung.com> wrote:
> On Thu, Jul 21, 2016 at 10:03 PM, Sylwester Nawrocki
> <sylvester.nawrocki@gmail.com> wrote:
>> On 07/21/2016 08:32 PM, Krzysztof Kozlowski wrote:
>>
>>> Is this the fix for the issue I reported recently
>>> (http://www.spinics.net/lists/linux-clk/msg10805.html)? It looks like
>>> it, so a credit? :)
>>
>> My apologies Krzysztof for this unfortunate omission, it's indeed a fix
>> for the issue you've reported.  You're doing a great job by continuously
>> testing -next on multiple platforms and I just have miserably forgotten
>> to give due credits.  This can't be undone now but there must be something
>> I can do in recompense. I could buy you an orange juice or whatever juice
>> you like next time we meet.
>
> My preferred juice is a fermented and distilled juice from malt so the
> only suitable compensation would be a barrel of 12 yo single malt
> whisky. It could be older than 12 years of course! :)
>
> BTW, I can provide you a tested by when I am back to the office - on Monday.

Oh, it is already applied... so no testing needed from my side...
Damn, I am going sailing. Have a nice weekend folks!

BR,
Krzysztof

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-07-21 20:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 18:03 [PATCH 0/2] ASoC: samsung: Deferred probing support fixes Sylwester Nawrocki
2016-07-21 18:03 ` [PATCH 1/2] ASoC: samsung: Fix error paths in the I2S driver's probe() Sylwester Nawrocki
2016-07-21 18:31   ` Applied "ASoC: samsung: Fix error paths in the I2S driver's probe()" to the asoc tree Mark Brown
2016-07-21 18:03 ` [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config Sylwester Nawrocki
2016-07-21 18:31   ` Applied "ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config" to the asoc tree Mark Brown
2016-07-21 18:32   ` [PATCH 2/2] ASoC: samsung: Specify DMA channels through struct snd_dmaengine_pcm_config Krzysztof Kozlowski
2016-07-21 20:03     ` Sylwester Nawrocki
2016-07-21 20:13       ` Krzysztof Kozlowski
2016-07-21 20:19         ` Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.