From f0fba2ad1b6b53d5360125c41953b7afcd6deff0 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 17 Mar 2010 20:15:21 +0000 Subject: ASoC: multi-component - ASoC Multi-Component Support This patch extends the ASoC API to allow sound cards to have more than one CODEC and more than one platform DMA controller. This is achieved by dividing some current ASoC structures that contain both driver data and device data into structures that only either contain device data or driver data. i.e. struct snd_soc_codec ---> struct snd_soc_codec (device data) +-> struct snd_soc_codec_driver (driver data) struct snd_soc_platform ---> struct snd_soc_platform (device data) +-> struct snd_soc_platform_driver (driver data) struct snd_soc_dai ---> struct snd_soc_dai (device data) +-> struct snd_soc_dai_driver (driver data) struct snd_soc_device ---> deleted This now allows ASoC to be more tightly aligned with the Linux driver model and also means that every ASoC codec, platform and (platform) DAI is a kernel device. ASoC component private data is now stored as device private data. The ASoC sound card struct snd_soc_card has also been updated to store lists of it's components rather than a pointer to a codec and platform. The PCM runtime struct soc_pcm_runtime now has pointers to all its components. This patch adds DAPM support for ASoC multi-component and removes struct snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec or runtime PCM level basis rather than using snd_soc_socdev. Other notable multi-component changes:- * Stream operations now de-reference less structures. * close_delayed work() now runs on a DAI basis rather than looping all DAIs in a card. * PM suspend()/resume() operations can now handle N CODECs and Platforms per sound card. * Added soc_bind_dai_link() to bind the component devices to the sound card. * Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove DAI link components. * sysfs entries can now be registered per component per card. * snd_soc_new_pcms() functionailty rolled into dai_link_probe(). * snd_soc_register_codec() now does all the codec list and mutex init. This patch changes the probe() and remove() of the CODEC drivers as follows:- o Make CODEC driver a platform driver o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core. o Removed all static codec pointers (drivers now support > 1 codec dev) o snd_soc_register_pcms() now done by core. o snd_soc_register_dai() folded into snd_soc_register_codec(). CS4270 portions: Acked-by: Timur Tabi Some TLV320aic23 and Cirrus platform fixes. Signed-off-by: Ryan Mallon TI CODEC and OMAP fixes Signed-off-by: Peter Ujfalusi Signed-off-by: Janusz Krzysztofik Signed-off-by: Jarkko Nikula Samsung platform and misc fixes :- Signed-off-by: Chanwoo Choi Signed-off-by: Joonyoung Shim Signed-off-by: Kyungmin Park Reviewed-by: Jassi Brar Signed-off-by: Seungwhan Youn MPC8610 and PPC fixes. Signed-off-by: Timur Tabi i.MX fixes and some core fixes. Signed-off-by: Sascha Hauer J4740 platform fixes:- Signed-off-by: Lars-Peter Clausen CC: Tony Lindgren CC: Nicolas Ferre CC: Kevin Hilman CC: Sascha Hauer CC: Atsushi Nemoto CC: Kuninori Morimoto CC: Daniel Gloeckner CC: Manuel Lauss CC: Mike Frysinger CC: Arnaud Patard CC: Wan ZongShun Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/s3c24xx/s3c-pcm.c | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'sound/soc/s3c24xx/s3c-pcm.c') diff --git a/sound/soc/s3c24xx/s3c-pcm.c b/sound/soc/s3c24xx/s3c-pcm.c index 326f0a9e7e3..653ffa27091 100644 --- a/sound/soc/s3c24xx/s3c-pcm.c +++ b/sound/soc/s3c24xx/s3c-pcm.c @@ -64,11 +64,6 @@ static struct s3c_dma_params s3c_pcm_stereo_in[] = { static struct s3c_pcm_info s3c_pcm[2]; -static inline struct s3c_pcm_info *to_info(struct snd_soc_dai *cpu_dai) -{ - return cpu_dai->private_data; -} - static void s3c_pcm_snd_txctrl(struct s3c_pcm_info *pcm, int on) { void __iomem *regs = pcm->regs; @@ -132,7 +127,7 @@ static int s3c_pcm_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct s3c_pcm_info *pcm = to_info(rtd->dai->cpu_dai); + struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(rtd->cpu_dai); unsigned long flags; dev_dbg(pcm->dev, "Entered %s\n", __func__); @@ -176,8 +171,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *socdai) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai_link *dai = rtd->dai; - struct s3c_pcm_info *pcm = to_info(dai->cpu_dai); + struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(rtd->cpu_dai); struct s3c_dma_params *dma_data; void __iomem *regs = pcm->regs; struct clk *clk; @@ -192,7 +186,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, else dma_data = pcm->dma_capture; - snd_soc_dai_set_dma_data(dai->cpu_dai, substream, dma_data); + snd_soc_dai_set_dma_data(rtd->cpu_dai, substream, dma_data); /* Strictly check for sample size */ switch (params_format(params)) { @@ -242,7 +236,7 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, static int s3c_pcm_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) { - struct s3c_pcm_info *pcm = to_info(cpu_dai); + struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(cpu_dai); void __iomem *regs = pcm->regs; unsigned long flags; int ret = 0; @@ -313,7 +307,7 @@ exit: static int s3c_pcm_set_clkdiv(struct snd_soc_dai *cpu_dai, int div_id, int div) { - struct s3c_pcm_info *pcm = to_info(cpu_dai); + struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(cpu_dai); switch (div_id) { case S3C_PCM_SCLK_PER_FS: @@ -330,7 +324,7 @@ static int s3c_pcm_set_clkdiv(struct snd_soc_dai *cpu_dai, static int s3c_pcm_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id, unsigned int freq, int dir) { - struct s3c_pcm_info *pcm = to_info(cpu_dai); + struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(cpu_dai); void __iomem *regs = pcm->regs; u32 clkctl = readl(regs + S3C_PCM_CLKCTL); @@ -366,10 +360,9 @@ static struct snd_soc_dai_ops s3c_pcm_dai_ops = { #define S3C_PCM_RATES SNDRV_PCM_RATE_8000_96000 -#define S3C_PCM_DECLARE(n) \ +#define S3C_PCM_DAI_DECLARE \ { \ - .name = "samsung-pcm", \ - .id = (n), \ + .name = "samsung-dai", \ .symmetric_rates = 1, \ .ops = &s3c_pcm_dai_ops, \ .playback = { \ @@ -386,16 +379,15 @@ static struct snd_soc_dai_ops s3c_pcm_dai_ops = { }, \ } -struct snd_soc_dai s3c_pcm_dai[] = { - S3C_PCM_DECLARE(0), - S3C_PCM_DECLARE(1), +struct snd_soc_dai_driver s3c_pcm_dai[] = { + S3C_PCM_DAI_DECLARE, + S3C_PCM_DAI_DECLARE, }; EXPORT_SYMBOL_GPL(s3c_pcm_dai); static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) { struct s3c_pcm_info *pcm; - struct snd_soc_dai *dai; struct resource *mem_res, *dmatx_res, *dmarx_res; struct s3c_audio_pdata *pcm_pdata; int ret; @@ -437,9 +429,6 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) spin_lock_init(&pcm->lock); - dai = &s3c_pcm_dai[pdev->id]; - dai->dev = &pdev->dev; - /* Default is 128fs */ pcm->sclk_per_fs = 128; @@ -452,7 +441,7 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) clk_enable(pcm->cclk); /* record our pcm structure for later use in the callbacks */ - dai->private_data = pcm; + dev_set_drvdata(&pdev->dev, pcm); if (!request_mem_region(mem_res->start, resource_size(mem_res), "samsung-pcm")) { @@ -476,7 +465,7 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) } clk_enable(pcm->pclk); - ret = snd_soc_register_dai(dai); + ret = snd_soc_register_dai(&pdev->dev, s3c_pcm_dai); if (ret != 0) { dev_err(&pdev->dev, "failed to get pcm_clock\n"); goto err5; @@ -514,6 +503,8 @@ static __devexit int s3c_pcm_dev_remove(struct platform_device *pdev) struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id]; struct resource *mem_res; + snd_soc_unregister_dai(&pdev->dev); + iounmap(pcm->regs); mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -531,7 +522,7 @@ static struct platform_driver s3c_pcm_driver = { .probe = s3c_pcm_dev_probe, .remove = s3c_pcm_dev_remove, .driver = { - .name = "samsung-pcm", + .name = "samsung-pcm-audio", .owner = THIS_MODULE, }, }; -- cgit v1.2.3-70-g09d2 From 960d0697919aef453273e3a0ccc87daf52d808ac Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 12 Aug 2010 11:02:19 +0100 Subject: ASoC: Add MODULE_ALIAS to Samsung DAI drivers Signed-off-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/s3c24xx/s3c-ac97.c | 1 + sound/soc/s3c24xx/s3c-dma.c | 1 + sound/soc/s3c24xx/s3c-pcm.c | 1 + sound/soc/s3c24xx/s3c2412-i2s.c | 1 + sound/soc/s3c24xx/s3c24xx-i2s.c | 1 + sound/soc/s3c24xx/s3c64xx-i2s-v4.c | 1 + sound/soc/s3c24xx/s3c64xx-i2s.c | 1 + 7 files changed, 7 insertions(+) (limited to 'sound/soc/s3c24xx/s3c-pcm.c') diff --git a/sound/soc/s3c24xx/s3c-ac97.c b/sound/soc/s3c24xx/s3c-ac97.c index 86f4a9b4a86..26f4ed90a0e 100644 --- a/sound/soc/s3c24xx/s3c-ac97.c +++ b/sound/soc/s3c24xx/s3c-ac97.c @@ -513,3 +513,4 @@ module_exit(s3c_ac97_exit); MODULE_AUTHOR("Jaswinder Singh, "); MODULE_DESCRIPTION("AC97 driver for the Samsung SoC"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:s3c-ac97"); diff --git a/sound/soc/s3c24xx/s3c-dma.c b/sound/soc/s3c24xx/s3c-dma.c index 9f91b2d5145..54bff83c98b 100644 --- a/sound/soc/s3c24xx/s3c-dma.c +++ b/sound/soc/s3c24xx/s3c-dma.c @@ -500,3 +500,4 @@ module_exit(snd_s3c24xx_pcm_exit); MODULE_AUTHOR("Ben Dooks, "); MODULE_DESCRIPTION("Samsung S3C Audio DMA module"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:s3c24xx-pcm-audio"); diff --git a/sound/soc/s3c24xx/s3c-pcm.c b/sound/soc/s3c24xx/s3c-pcm.c index 653ffa27091..6174e26e433 100644 --- a/sound/soc/s3c24xx/s3c-pcm.c +++ b/sound/soc/s3c24xx/s3c-pcm.c @@ -543,3 +543,4 @@ module_exit(s3c_pcm_exit); MODULE_AUTHOR("Jaswinder Singh, "); MODULE_DESCRIPTION("S3C PCM Controller Driver"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:samsung-pcm-audio"); diff --git a/sound/soc/s3c24xx/s3c2412-i2s.c b/sound/soc/s3c24xx/s3c2412-i2s.c index acd00962ac3..4a861cfa52c 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.c +++ b/sound/soc/s3c24xx/s3c2412-i2s.c @@ -209,3 +209,4 @@ module_exit(s3c2412_i2s_exit); MODULE_AUTHOR("Ben Dooks, "); MODULE_DESCRIPTION("S3C2412 I2S SoC Interface"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:s3c2412-iis"); diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c index 1d0bade10d3..e060daaa458 100644 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c @@ -516,3 +516,4 @@ module_exit(s3c24xx_i2s_exit); MODULE_AUTHOR("Ben Dooks, "); MODULE_DESCRIPTION("s3c24xx I2S SoC Interface"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:s3c24xx-iis"); diff --git a/sound/soc/s3c24xx/s3c64xx-i2s-v4.c b/sound/soc/s3c24xx/s3c64xx-i2s-v4.c index 7cab4fcf1f1..a13415a85a4 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s-v4.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s-v4.c @@ -216,3 +216,4 @@ module_exit(s3c64xx_i2sv4_exit); MODULE_AUTHOR("Jaswinder Singh, "); MODULE_DESCRIPTION("S3C64XX I2Sv4 SoC Interface"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:s3c64xx-iis-v4"); diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.c b/sound/soc/s3c24xx/s3c64xx-i2s.c index a1d0b256641..ae7acb6c4f1 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s.c @@ -239,3 +239,4 @@ module_exit(s3c64xx_i2s_exit); MODULE_AUTHOR("Ben Dooks, "); MODULE_DESCRIPTION("S3C64XX I2S SoC Interface"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:s3c64xx-iis"); -- cgit v1.2.3-70-g09d2 From 5fbdedf072500859601705fa6f07a9e895d5e3a8 Mon Sep 17 00:00:00 2001 From: Jassi Brar Date: Fri, 10 Sep 2010 16:41:17 +0900 Subject: ASoC: Samsung: Debug PCM platform device name The PCM controller platform devices are registered by the name 'samsung-pcm', so use the same in the CPU driver. Signed-off-by: Jassi Brar Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/s3c24xx/s3c-pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/soc/s3c24xx/s3c-pcm.c') diff --git a/sound/soc/s3c24xx/s3c-pcm.c b/sound/soc/s3c24xx/s3c-pcm.c index 6174e26e433..825645fbe4d 100644 --- a/sound/soc/s3c24xx/s3c-pcm.c +++ b/sound/soc/s3c24xx/s3c-pcm.c @@ -522,7 +522,7 @@ static struct platform_driver s3c_pcm_driver = { .probe = s3c_pcm_dev_probe, .remove = s3c_pcm_dev_remove, .driver = { - .name = "samsung-pcm-audio", + .name = "samsung-pcm", .owner = THIS_MODULE, }, }; @@ -543,4 +543,4 @@ module_exit(s3c_pcm_exit); MODULE_AUTHOR("Jaswinder Singh, "); MODULE_DESCRIPTION("S3C PCM Controller Driver"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:samsung-pcm-audio"); +MODULE_ALIAS("platform:samsung-pcm"); -- cgit v1.2.3-70-g09d2 From 0cca9012527b77df1491f1b8422c7aae16e17ae0 Mon Sep 17 00:00:00 2001 From: Seungwhan Youn Date: Fri, 10 Sep 2010 17:20:00 +0900 Subject: ASoC: S3C: Fix PCM RX FIFO settings When PCM capture, sound recorded abnormally because of RX FIFO threshold settings are missing. So, This patch modify PCM RX FIFO setting codes same as TX. And for DMA, if PCM RXFIFO_DIPSTICK is not '0', it doesn't effect to DMA request, because DMA refer RX_FIFO_EMPTY flag as the DMA request. Signed-off-by: Seungwhan Youn Acked-by: Jassi Brar Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/s3c24xx/s3c-pcm.c | 3 +++ sound/soc/s3c24xx/s3c-pcm.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'sound/soc/s3c24xx/s3c-pcm.c') diff --git a/sound/soc/s3c24xx/s3c-pcm.c b/sound/soc/s3c24xx/s3c-pcm.c index 825645fbe4d..eadd1bebfe8 100644 --- a/sound/soc/s3c24xx/s3c-pcm.c +++ b/sound/soc/s3c24xx/s3c-pcm.c @@ -102,11 +102,14 @@ static void s3c_pcm_snd_rxctrl(struct s3c_pcm_info *pcm, int on) ctl = readl(regs + S3C_PCM_CTL); clkctl = readl(regs + S3C_PCM_CLKCTL); + ctl &= ~(S3C_PCM_CTL_RXDIPSTICK_MASK + << S3C_PCM_CTL_RXDIPSTICK_SHIFT); if (on) { ctl |= S3C_PCM_CTL_RXDMA_EN; ctl |= S3C_PCM_CTL_RXFIFO_EN; ctl |= S3C_PCM_CTL_ENABLE; + ctl |= (0x20< Date: Fri, 10 Sep 2010 17:20:45 +0900 Subject: ASoC: S3C: Fix PCM TXFIFO_DIPSTICK value This patch modify FIFO_DIPSTICK value of PCM TX FIFO to be a optimal one. Privious value (0x20) did not support 'Almost_full' of PCM FIFO for the DMA request. Signed-off-by: Seungwhan Youn Acked-by: Jassi Brar Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/s3c24xx/s3c-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/soc/s3c24xx/s3c-pcm.c') diff --git a/sound/soc/s3c24xx/s3c-pcm.c b/sound/soc/s3c24xx/s3c-pcm.c index eadd1bebfe8..4f73275f4db 100644 --- a/sound/soc/s3c24xx/s3c-pcm.c +++ b/sound/soc/s3c24xx/s3c-pcm.c @@ -78,7 +78,7 @@ static void s3c_pcm_snd_txctrl(struct s3c_pcm_info *pcm, int on) ctl |= S3C_PCM_CTL_TXDMA_EN; ctl |= S3C_PCM_CTL_TXFIFO_EN; ctl |= S3C_PCM_CTL_ENABLE; - ctl |= (0x20< Date: Fri, 10 Sep 2010 16:41:05 +0900 Subject: ASoC: Samsung: Debug PCM snd_soc_dai_driver registration Each of the two PCM controllers need to be registered during probe with appropriate 'name' of the dai driver. Signed-off-by: Jassi Brar Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/s3c24xx/s3c-pcm.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'sound/soc/s3c24xx/s3c-pcm.c') diff --git a/sound/soc/s3c24xx/s3c-pcm.c b/sound/soc/s3c24xx/s3c-pcm.c index 4f73275f4db..2e020e1b4ea 100644 --- a/sound/soc/s3c24xx/s3c-pcm.c +++ b/sound/soc/s3c24xx/s3c-pcm.c @@ -364,8 +364,6 @@ static struct snd_soc_dai_ops s3c_pcm_dai_ops = { #define S3C_PCM_RATES SNDRV_PCM_RATE_8000_96000 #define S3C_PCM_DAI_DECLARE \ -{ \ - .name = "samsung-dai", \ .symmetric_rates = 1, \ .ops = &s3c_pcm_dai_ops, \ .playback = { \ @@ -379,12 +377,17 @@ static struct snd_soc_dai_ops s3c_pcm_dai_ops = { .channels_max = 2, \ .rates = S3C_PCM_RATES, \ .formats = SNDRV_PCM_FMTBIT_S16_LE, \ - }, \ -} + } struct snd_soc_dai_driver s3c_pcm_dai[] = { - S3C_PCM_DAI_DECLARE, - S3C_PCM_DAI_DECLARE, + [0] = { + .name = "samsung-pcm.0", + S3C_PCM_DAI_DECLARE, + }, + [1] = { + .name = "samsung-pcm.1", + S3C_PCM_DAI_DECLARE, + }, }; EXPORT_SYMBOL_GPL(s3c_pcm_dai); @@ -468,7 +471,7 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) } clk_enable(pcm->pclk); - ret = snd_soc_register_dai(&pdev->dev, s3c_pcm_dai); + ret = snd_soc_register_dai(&pdev->dev, &s3c_pcm_dai[pdev->id]); if (ret != 0) { dev_err(&pdev->dev, "failed to get pcm_clock\n"); goto err5; -- cgit v1.2.3-70-g09d2