aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/samsung/Kconfig13
-rw-r--r--sound/soc/samsung/Makefile6
-rw-r--r--sound/soc/samsung/dma.h3
-rw-r--r--sound/soc/samsung/dmaengine.c84
-rw-r--r--sound/soc/samsung/i2s.c2
5 files changed, 104 insertions, 4 deletions
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index 37459dfd168d..27930fc432dc 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -1,13 +1,22 @@
1config SND_SOC_SAMSUNG 1config SND_SOC_SAMSUNG
2 tristate "ASoC support for Samsung" 2 tristate "ASoC support for Samsung"
3 depends on PLAT_SAMSUNG 3 depends on PLAT_SAMSUNG
4 select S3C64XX_DMA if ARCH_S3C64XX 4 select S3C2410_DMA if ARCH_S3C24XX
5 select S3C24XX_DMA if ARCH_S3C24XX 5 select S3C64XX_PL080 if ARCH_S3C64XX
6 select SND_S3C_DMA if !ARCH_S3C24XX
7 select SND_S3C_DMA_LEGACY if ARCH_S3C24XX
8 select SND_SOC_GENERIC_DMAENGINE_PCM if !ARCH_S3C24XX
6 help 9 help
7 Say Y or M if you want to add support for codecs attached to 10 Say Y or M if you want to add support for codecs attached to
8 the Samsung SoCs' Audio interfaces. You will also need to 11 the Samsung SoCs' Audio interfaces. You will also need to
9 select the audio interfaces to support below. 12 select the audio interfaces to support below.
10 13
14config SND_S3C_DMA
15 tristate
16
17config SND_S3C_DMA_LEGACY
18 tristate
19
11config SND_S3C24XX_I2S 20config SND_S3C24XX_I2S
12 tristate 21 tristate
13 select S3C2410_DMA 22 select S3C2410_DMA
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile
index 709f6059ad67..86715d8efee6 100644
--- a/sound/soc/samsung/Makefile
+++ b/sound/soc/samsung/Makefile
@@ -1,5 +1,6 @@
1# S3c24XX Platform Support 1# S3c24XX Platform Support
2snd-soc-s3c24xx-objs := dma.o 2snd-soc-s3c-dma-objs := dmaengine.o
3snd-soc-s3c-dma-legacy-objs := dma.o
3snd-soc-idma-objs := idma.o 4snd-soc-idma-objs := idma.o
4snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o 5snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o
5snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o 6snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o
@@ -9,7 +10,8 @@ snd-soc-samsung-spdif-objs := spdif.o
9snd-soc-pcm-objs := pcm.o 10snd-soc-pcm-objs := pcm.o
10snd-soc-i2s-objs := i2s.o 11snd-soc-i2s-objs := i2s.o
11 12
12obj-$(CONFIG_SND_SOC_SAMSUNG) += snd-soc-s3c24xx.o 13obj-$(CONFIG_SND_S3C_DMA) += snd-soc-s3c-dma.o
14obj-$(CONFIG_SND_S3C_DMA_LEGACY) += snd-soc-s3c-dma-legacy.o
13obj-$(CONFIG_SND_S3C24XX_I2S) += snd-soc-s3c24xx-i2s.o 15obj-$(CONFIG_SND_S3C24XX_I2S) += snd-soc-s3c24xx-i2s.o
14obj-$(CONFIG_SND_SAMSUNG_AC97) += snd-soc-ac97.o 16obj-$(CONFIG_SND_SAMSUNG_AC97) += snd-soc-ac97.o
15obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o 17obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
index fb09a1c5f75b..225e5378014e 100644
--- a/sound/soc/samsung/dma.h
+++ b/sound/soc/samsung/dma.h
@@ -12,6 +12,8 @@
12#ifndef _S3C_AUDIO_H 12#ifndef _S3C_AUDIO_H
13#define _S3C_AUDIO_H 13#define _S3C_AUDIO_H
14 14
15#include <sound/dmaengine_pcm.h>
16
15struct s3c_dma_params { 17struct s3c_dma_params {
16 struct s3c2410_dma_client *client; /* stream identifier */ 18 struct s3c2410_dma_client *client; /* stream identifier */
17 int channel; /* Channel ID */ 19 int channel; /* Channel ID */
@@ -20,6 +22,7 @@ struct s3c_dma_params {
20 unsigned ch; 22 unsigned ch;
21 struct samsung_dma_ops *ops; 23 struct samsung_dma_ops *ops;
22 char *ch_name; 24 char *ch_name;
25 struct snd_dmaengine_dai_dma_data dma_data;
23}; 26};
24 27
25void samsung_asoc_init_dma_data(struct snd_soc_dai *dai, 28void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
diff --git a/sound/soc/samsung/dmaengine.c b/sound/soc/samsung/dmaengine.c
new file mode 100644
index 000000000000..3be479d51b9b
--- /dev/null
+++ b/sound/soc/samsung/dmaengine.c
@@ -0,0 +1,84 @@
1/*
2 * dmaengine.c - Samsung dmaengine wrapper
3 *
4 * Author: Mark Brown <broonie@linaro.org>
5 * Copyright 2013 Linaro
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 */
17
18#include <linux/module.h>
19#include <linux/amba/pl08x.h>
20
21#include <sound/core.h>
22#include <sound/pcm.h>
23#include <sound/pcm_params.h>
24#include <sound/dmaengine_pcm.h>
25#include <sound/soc.h>
26#include <sound/soc-dai.h>
27
28#include "dma.h"
29
30#ifdef CONFIG_ARCH_S3C64XX
31#define filter_fn pl08x_filter_id
32#else
33#define filter_fn NULL
34#endif
35
36static const struct snd_dmaengine_pcm_config samsung_dmaengine_pcm_config = {
37 .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
38 .compat_filter_fn = filter_fn,
39};
40
41void samsung_asoc_init_dma_data(struct snd_soc_dai *dai,
42 struct s3c_dma_params *playback,
43 struct s3c_dma_params *capture)
44{
45 struct snd_dmaengine_dai_dma_data *playback_data = NULL;
46 struct snd_dmaengine_dai_dma_data *capture_data = NULL;
47
48 if (playback) {
49 playback_data = &playback->dma_data;
50 playback_data->filter_data = (void *)playback->channel;
51 playback_data->chan_name = playback->ch_name;
52 playback_data->addr = playback->dma_addr;
53 playback_data->addr_width = playback->dma_size;
54 }
55 if (capture) {
56 capture_data = &capture->dma_data;
57 capture_data->filter_data = (void *)capture->channel;
58 capture_data->chan_name = capture->ch_name;
59 capture_data->addr = capture->dma_addr;
60 capture_data->addr_width = capture->dma_size;
61 }
62
63 snd_soc_dai_init_dma_data(dai, playback_data, capture_data);
64}
65EXPORT_SYMBOL_GPL(samsung_asoc_init_dma_data);
66
67int samsung_asoc_dma_platform_register(struct device *dev)
68{
69 return snd_dmaengine_pcm_register(dev, &samsung_dmaengine_pcm_config,
70 SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME |
71 SND_DMAENGINE_PCM_FLAG_NO_RESIDUE |
72 SND_DMAENGINE_PCM_FLAG_COMPAT);
73}
74EXPORT_SYMBOL_GPL(samsung_asoc_dma_platform_register);
75
76void samsung_asoc_dma_platform_unregister(struct device *dev)
77{
78 return snd_dmaengine_pcm_unregister(dev);
79}
80EXPORT_SYMBOL_GPL(samsung_asoc_dma_platform_unregister);
81
82MODULE_AUTHOR("Mark Brown <broonie@linaro.org>");
83MODULE_DESCRIPTION("Samsung dmaengine ASoC driver");
84MODULE_LICENSE("GPL");
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index eab0050d4579..92f64363427d 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -702,6 +702,8 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
702 } 702 }
703 writel(mod, i2s->addr + I2SMOD); 703 writel(mod, i2s->addr + I2SMOD);
704 704
705 samsung_asoc_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture);
706
705 i2s->frmclk = params_rate(params); 707 i2s->frmclk = params_rate(params);
706 708
707 return 0; 709 return 0;