Hi,
On Wed, Jul 13, 2011 at 10:25 AM, Sangbeom Kim sbkim73@samsung.com wrote:
I2S in Exynos4 and S5PC110(S5PV210) has a internal dma. It can be used low power audio mode and 2nd channel transfer. This patch can support idma.
Signed-off-by: Sangbeom Kim sbkim73@samsung.com
V2: change idma_new by new pcm_new api add handling different idma address as jassi comments, Modify the idma driver
V3: merge idma_reg_int and idma_addr_init
V4: move idma setting in i2s.c to idma_hw_params in idma.c move idma_reg_addr_init calling modify idma address handling error modify module information delete useless dev_dbg
V5: delete redundant error print and check routine modify irq handler as jassi comment fix the indent error
sound/soc/samsung/Makefile | 2 + sound/soc/samsung/idma.c | 453 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/samsung/idma.h | 26 +++ 3 files changed, 481 insertions(+), 0 deletions(-) create mode 100644 sound/soc/samsung/idma.c create mode 100644 sound/soc/samsung/idma.h
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 00ba557..41becdd 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -1,5 +1,6 @@ # S3c24XX Platform Support snd-soc-s3c24xx-objs := dma.o +snd-soc-idma-objs := idma.o snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o snd-soc-ac97-objs := ac97.o @@ -16,6 +17,7 @@ obj-$(CONFIG_SND_S3C_I2SV2_SOC) += snd-soc-s3c-i2s-v2.o obj-$(CONFIG_SND_SAMSUNG_SPDIF) += snd-soc-samsung-spdif.o obj-$(CONFIG_SND_SAMSUNG_PCM) += snd-soc-pcm.o obj-$(CONFIG_SND_SAMSUNG_I2S) += snd-soc-i2s.o +obj-$(CONFIG_SND_SAMSUNG_I2S) += snd-soc-idma.o
# S3C24XX Machine Support snd-soc-jive-wm8750-objs := jive_wm8750.o diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c new file mode 100644 index 0000000..ebde074 --- /dev/null +++ b/sound/soc/samsung/idma.c @@ -0,0 +1,453 @@ +/*
- sound/soc/samsung/idma.c
- Copyright (c) 2011 Samsung Electronics Co., Ltd.
- I2S0's Internal DMA driver
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2 of the License, or (at your
- option) any later version.
- */
+#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/dma-mapping.h> +#include <linux/slab.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/soc.h>
+#include "i2s.h" +#include "idma.h" +#include "dma.h" +#include "i2s-regs.h"
+#define ST_RUNNING (1<<0) +#define ST_OPENED (1<<1)
+static const struct snd_pcm_hardware idma_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,
- .formats = SNDRV_PCM_FMTBIT_S16_LE |
- SNDRV_PCM_FMTBIT_U16_LE |
- SNDRV_PCM_FMTBIT_S24_LE |
- SNDRV_PCM_FMTBIT_U24_LE |
- SNDRV_PCM_FMTBIT_U8 |
- SNDRV_PCM_FMTBIT_S8,
- .channels_min = 2,
- .channels_max = 2,
- .buffer_bytes_max = MAX_IDMA_BUFFER,
- .period_bytes_min = 128,
- .period_bytes_max = MAX_IDMA_PERIOD,
In this case, MAX_IDMA_BUFFER is 160k and MAX_IDMA_PERIOD is 128k, buffer is not twice of period. If you set like this, many of general ALSA applications return error on initial buffers. If this setting is for best efficient of IDMA, how about set this half of buffer size as a default and make another interface to modify this value or write a note which point to be modified to MAX_IDMA_PERIOD for maximum efficient.
claude