Skip to contentSkip to conversation

Add Samsung internal dma driver support

PATCH Superseded Sangbeom Kim 4 participants 9 messages Jun 15, 2011 – Jul 21, 2011

Subsystems (6)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add Samsung internal dma driver support

I2S in samsung audio subsytem has a small internal dma(idma). IDMA can be used in low power audio mode and I2S0 secondary fifo data tranfer.
In this patchsets, idma driver is added.
Original code is made by jassi brar on SMDKV210
After idma driver merge, I will submit low power audio support with idma driver and samsung dsp driver.

Changes since v1:
1. Change idma_new by new pcm_new api
2. Add handling different idma address
3. As jassi comments, Modify the idma driver

This patchset contains followings

o To Jassi Brar, Mark Brown and Liam Girdwood,
[PATCH V2 1/4] ASoC: SAMSUNG: Modify I2S driver to support idma [PATCH V2 2/4] ASoC: SAMSUNG: Add I2S0 internal dma driver

o To Kukjin Kim
[PATCH V2 3/4] ARM: SAMSUNG: Add platform device for idma [PATCH V2 4/4] ARM: SAMSUNG: Add IRQ_I2S0 definition

Thanks
SB Kim

#1 lore raw

PATCH v2 1/4 ASoC: SAMSUNG: Modify I2S driver to support idma

Previously, I2S driver only can support system dma. In this patch, i2s driver can support internal dma too.

---
 sound/soc/samsung/i2s-regs.h |  141 ++++++++++++++++++++++++++++++++++++++++++
 sound/soc/samsung/i2s.c      |  124 ++++++-------------------------------
 2 files changed, 160 insertions(+), 105 deletions(-)
 create mode 100644 sound/soc/samsung/i2s-regs.h
sound/soc/samsung/i2s-regs.h new file +141 -0
new file mode 100644
index 0000000..aeb0590
@@ -0,0 +1,141 @@
+/*
+ * linux/sound/soc/samsung/i2s-regs.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * Samsung I2S driver's register header
+ *
+ * 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.
+ */
+
+#ifndef __SND_SOC_SAMSUNG_I2S_REGS_H
+#define __SND_SOC_SAMSUNG_I2S_REGS_H
+
+#define I2SCON			0x0
+#define I2SMOD			0x4
+#define I2SFIC			0x8
+#define I2SPSR			0xc
+#define I2STXD			0x10
+#define I2SRXD			0x14
+#define I2SFICS			0x18
+#define I2STXDS			0x1c
+#define I2SAHB			0x20
+#define I2SSTR0			0x24
+#define I2SSIZE			0x28
+#define I2STRNCNT		0x2c
+#define I2SLVL0ADDR		0x30
+#define I2SLVL1ADDR		0x34
+#define I2SLVL2ADDR		0x38
+#define I2SLVL3ADDR		0x3c
+
+#define CON_RSTCLR		(1 << 31)
+#define CON_FRXOFSTATUS		(1 << 26)
+#define CON_FRXORINTEN		(1 << 25)
+#define CON_FTXSURSTAT		(1 << 24)
+#define CON_FTXSURINTEN		(1 << 23)
+#define CON_TXSDMA_PAUSE	(1 << 20)
+#define CON_TXSDMA_ACTIVE	(1 << 18)
+
+#define CON_FTXURSTATUS		(1 << 17)
+#define CON_FTXURINTEN		(1 << 16)
+#define CON_TXFIFO2_EMPTY	(1 << 15)
+#define CON_TXFIFO1_EMPTY	(1 << 14)
+#define CON_TXFIFO2_FULL	(1 << 13)
+#define CON_TXFIFO1_FULL	(1 << 12)
+
+#define CON_LRINDEX		(1 << 11)
+#define CON_TXFIFO_EMPTY	(1 << 10)
+#define CON_RXFIFO_EMPTY	(1 << 9)
+#define CON_TXFIFO_FULL		(1 << 8)
+#define CON_RXFIFO_FULL		(1 << 7)
+#define CON_TXDMA_PAUSE		(1 << 6)
+#define CON_RXDMA_PAUSE		(1 << 5)
+#define CON_TXCH_PAUSE		(1 << 4)
+#define CON_RXCH_PAUSE		(1 << 3)
+#define CON_TXDMA_ACTIVE	(1 << 2)
+#define CON_RXDMA_ACTIVE	(1 << 1)
+#define CON_ACTIVE		(1 << 0)
+
+#define MOD_OPCLK_CDCLK_OUT	(0 << 30)
+#define MOD_OPCLK_CDCLK_IN	(1 << 30)
+#define MOD_OPCLK_BCLK_OUT	(2 << 30)
+#define MOD_OPCLK_PCLK		(3 << 30)
+#define MOD_OPCLK_MASK		(3 << 30)
+#define MOD_TXS_IDMA		(1 << 28)
+
+#define MOD_BLCS_SHIFT		26
+#define MOD_BLCS_16BIT		(0 << MOD_BLCS_SHIFT)
+#define MOD_BLCS_8BIT		(1 << MOD_BLCS_SHIFT)
+#define MOD_BLCS_24BIT		(2 << MOD_BLCS_SHIFT)
+#define MOD_BLCS_MASK		(3 << MOD_BLCS_SHIFT)
+#define MOD_BLCP_SHIFT		24
+#define MOD_BLCP_16BIT		(0 << MOD_BLCP_SHIFT)
+#define MOD_BLCP_8BIT		(1 << MOD_BLCP_SHIFT)
+#define MOD_BLCP_24BIT		(2 << MOD_BLCP_SHIFT)
+#define MOD_BLCP_MASK		(3 << MOD_BLCP_SHIFT)
+
+#define MOD_C2DD_HHALF		(1 << 21) /* Discard Higher-half */
+#define MOD_C2DD_LHALF		(1 << 20) /* Discard Lower-half */
+#define MOD_C1DD_HHALF		(1 << 19)
+#define MOD_C1DD_LHALF		(1 << 18)
+#define MOD_DC2_EN		(1 << 17)
+#define MOD_DC1_EN		(1 << 16)
+#define MOD_BLC_16BIT		(0 << 13)
+#define MOD_BLC_8BIT		(1 << 13)
+#define MOD_BLC_24BIT		(2 << 13)
+#define MOD_BLC_MASK		(3 << 13)
+
+#define MOD_IMS_SYSMUX		(1 << 10)
+#define MOD_SLAVE		(1 << 11)
+#define MOD_TXONLY		(0 << 8)
+#define MOD_RXONLY		(1 << 8)
+#define MOD_TXRX		(2 << 8)
+#define MOD_MASK		(3 << 8)
+#define MOD_LR_LLOW		(0 << 7)
+#define MOD_LR_RLOW		(1 << 7)
+#define MOD_SDF_IIS		(0 << 5)
+#define MOD_SDF_MSB		(1 << 5)
+#define MOD_SDF_LSB		(2 << 5)
+#define MOD_SDF_MASK		(3 << 5)
+#define MOD_RCLK_256FS		(0 << 3)
+#define MOD_RCLK_512FS		(1 << 3)
+#define MOD_RCLK_384FS		(2 << 3)
+#define MOD_RCLK_768FS		(3 << 3)
+#define MOD_RCLK_MASK		(3 << 3)
+#define MOD_BCLK_32FS		(0 << 1)
+#define MOD_BCLK_48FS		(1 << 1)
+#define MOD_BCLK_16FS		(2 << 1)
+#define MOD_BCLK_24FS		(3 << 1)
+#define MOD_BCLK_MASK		(3 << 1)
+#define MOD_8BIT		(1 << 0)
+
+#define MOD_CDCLKCON		(1 << 12)
+
+#define PSR_PSREN		(1 << 15)
+
+#define FIC_TX2COUNT(x)		(((x) >>  24) & 0xf)
+#define FIC_TX1COUNT(x)		(((x) >>  16) & 0xf)
+
+#define FIC_TXFLUSH		(1 << 15)
+#define FIC_RXFLUSH		(1 << 7)
+
+#define FIC_TXCOUNT(x)		(((x) >>  8) & 0x7f)
+#define FIC_RXCOUNT(x)		(((x) >>  0) & 0x7f)
+#define FICS_TXCOUNT(x)		(((x) >>  8) & 0x7f)
+
+#define AHB_INTENLVL0		(1 << 24)
+#define AHB_LVL0INT		(1 << 20)
+#define AHB_CLRLVL0INT		(1 << 16)
+#define AHB_DMARLD		(1 << 5)
+#define AHB_INTMASK		(1 << 3)
+#define AHB_DMAEN		(1 << 0)
+#define AHB_LVLINTMASK		(0xf << 20)
+
+#define I2SSIZE_TRNMSK		(0xffff)
+#define I2SSIZE_SHIFT		(16)
+
+#endif /* __SND_SOC_SAMSUNG_I2S_REGS_H */
sound/soc/samsung/i2s.c +19 -105

162 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH V2 1/4] ASoC: SAMSUNG: Modify I2S driver to support idma

sound/soc/samsung/i2s-regs.h line 139

Quoted 10 lines · Sangbeom Kim
sound/soc/samsung/i2s-regs.h new file +10 -0
+#define AHB_INTENLVL0          (1 << 24)
+#define AHB_LVL0INT            (1 << 20)
+#define AHB_CLRLVL0INT         (1 << 16)
+#define AHB_DMARLD             (1 << 5)
+#define AHB_INTMASK            (1 << 3)
+#define AHB_DMAEN              (1 << 0)
+#define AHB_LVLINTMASK         (0xf << 20)
+
+#define I2SSIZE_TRNMSK         (0xffff)
+#define I2SSIZE_SHIFT          (16)

Not serious but ....
a) Let us please get over our infatuation with such parentheses :)
b) Ideally these _new_ definitions should have been added separate to this moving.

sound/soc/samsung/i2s.c line 12

Quoted 10 lines
sound/soc/samsung/i2s.c +1 -1
index 992a732..2fc2428 100644
@@ -9,7 +9,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
+#define DEBUG

Usually we don't do it by default.

sound/soc/samsung/i2s.c line 31

Quoted 2 lines
sound/soc/samsung/i2s.c +2 -0
+#define ST_RUNNING             (1<<0)
+#define ST_OPENED              (1<<1)

why do we need these two defines ?

@@ -646,6 +548,7 @@ static int i2s_hw_params(struct snd_pcm_substream
*substream,

Quoted 4 lines
sound/soc/samsung/i2s.c +0 -0
  {

       struct i2s_dai *i2s = to_info(dai);
       u32 mod = readl(i2s->addr + I2SMOD);
+       u32 ahb = readl(i2s->addr + I2SAHB);

Please realize that this function is common for even s3c24xx, for which this is invalid AHB read
and all other subsequent ops.

sound/soc/samsung/i2s.c static int i2s_hw_params(struct snd_pcm_substream *substream, · line 614

Quoted 11 lines
sound/soc/samsung/i2s.c +7 -0
@@ -702,6 +605,13 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
                                params_format(params));
                return -EINVAL;
        }
+
+       if (is_secondary(i2s)) {
+               ahb |= (AHB_DMARLD | AHB_INTMASK);
+               mod |= MOD_TXS_IDMA;
+       }
+
+       writel(ahb, i2s->addr + I2SAHB);

... this too.

#3 lore raw

PATCH v2 2/4 ASoC: SAMSUNG: Add I2S0 internal dma driver

In reply to Sangbeom Kim

I2S in Exynos4 and S5PC110(S5PV210) has a internal dma. It can be used low power audio mode and 2nd channel transfer.

---
 sound/soc/samsung/Makefile |    2 +
 sound/soc/samsung/idma.c   |  495 ++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/samsung/idma.h   |   27 +++
 3 files changed, 524 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/samsung/idma.c
 create mode 100644 sound/soc/samsung/idma.h
sound/soc/samsung/Makefile +2 -0
index 683843a..2b9e251 100644
@@ -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
sound/soc/samsung/idma.c new file +495 -0

495 lines not on this page · raw message

sound/soc/samsung/idma.h new file +27 -0
new file mode 100644
index 0000000..511ad40
@@ -0,0 +1,27 @@
+/*
+ * linux/sound/soc/samsung/idma.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd
+ *		http://www.samsung.com
+ *
+ *  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.
+ *
+ */
+
+#ifndef __SND_SOC_SAMSUNG_IDMA_H_
+#define __SND_SOC_SAMSUNG_IDMA_H_
+
+extern void idma_reg_init(void *regs);
+extern void idma_addr_init(dma_addr_t addr);
+
+/* dma_state */
+#define LPAM_DMA_STOP	0
+#define LPAM_DMA_START	1
+
+#define MAX_IDMA_PERIOD (105 * 1024)
+#define MAX_IDMA_BUFFER (128 * 1024)
+
+#endif /* __SND_SOC_SAMSUNG_IDMA_H_ */
Signature · 1 line
1.7.1
#4 lore raw

Re: [PATCH V2 2/4] ASoC: SAMSUNG: Add I2S0 internal dma driver

Quoted 8 lines · Sangbeom Kim

+       .channels_min = 2,
+       .channels_max = 2,
+       .buffer_bytes_max = MAX_IDMA_BUFFER,
+       .period_bytes_min = 128,
+       .period_bytes_max = MAX_IDMA_PERIOD,
+       .periods_min = 1,
+       .periods_max = 2,
+};

The settings here don't ensure ring buffer is always MAX_IDMA_BUFFER. Whereas you assume that in 'iis_irq'.

sound/soc/samsung/idma.c line 86

Quoted 11 lines
sound/soc/samsung/idma.c new file +11 -0
+
+void i2sdma_getpos(dma_addr_t *src, struct snd_pcm_substream *substream)
+{
+       struct idma_ctrl *prtd = substream->runtime->private_data;
+
+       if (prtd && (prtd->state & ST_RUNNING))
+               *src = idma.lp_tx_addr +
+                       (readl(idma.regs + I2STRNCNT) & 0xffffff) * 4;
+       else
+               *src = idma.lp_tx_addr;
+}

Why do we need this function ?

Quoted 6 lines
sound/soc/samsung/idma.c new file +6 -0
+
+static int idma_hw_params(struct snd_pcm_substream *substream,
+                               struct snd_pcm_hw_params *params)
+{
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct idma_ctrl *prtd = substream->runtime->private_data;

sound/soc/samsung/idma.c line 176

Quoted 10 lines
sound/soc/samsung/idma.c new file +10 -0
+
+       dev_dbg(dev, "Entered %s\n", __func__);
+
+       snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
+       runtime->dma_bytes = params_buffer_bytes(params);
+
+       prtd->start = prtd->pos = runtime->dma_addr;
+       prtd->period = params_periods(params);
+       prtd->periodsz = params_period_bytes(params);
+       prtd->end = idma.lp_tx_addr + runtime->dma_bytes;
     prtd->end = runtime->dma_addr + runtime->dma_bytes;   makes better sense
Quoted 11 lines
sound/soc/samsung/idma.c new file +11 -0
+static snd_pcm_uframes_t
+       idma_pointer(struct snd_pcm_substream *substream)
+{
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct idma_ctrl *prtd = runtime->private_data;
+       dma_addr_t src;
+       unsigned long res;
+
+       dev_dbg(dev, "Entered %s\n", __func__);
+
+       spin_lock(&prtd->lock);

sound/soc/samsung/idma.c line 265

Quoted 10 lines
sound/soc/samsung/idma.c new file +10 -0
+
+       idma_getpos(&src);
+       res = src - prtd->start;
+
+       spin_unlock(&prtd->lock);
+
+       dev_dbg(dev, "Pointer %x \n", src);
+
+       if (res >= snd_pcm_lib_buffer_bytes(substream)) {
+               if (res == snd_pcm_lib_buffer_bytes(substream))

This second check is redundant.

+static irqreturn_t iis_irq(int irqno, void *dev_id) +{
+ struct idma_ctrl *prtd = (struct idma_ctrl *)dev_id;
+ u32 iiscon, iisahb, val, addr;
+

+       iisahb  = readl(idma.regs + I2SAHB);
+       iiscon  = readl(idma.regs + I2SCON);

+
+ val = (iisahb & AHB_LVL0INT) ? AHB_CLRLVL0INT : 0;
+
+ if (val) {
+ iisahb |= val;
+ writel(iisahb, idma.regs + I2SAHB);
+

+               addr = readl(idma.regs + I2SLVL0ADDR) - idma.lp_tx_addr;
+               addr += prtd->period;
+               addr %= MAX_IDMA_BUFFER;
+               addr += idma.lp_tx_addr;

+
+ writel(addr, idma.regs + I2SLVL0ADDR);
+
+ if (prtd->cb) {
+ if (iisahb & AHB_LVL0INT)
iisahb will always have the AHB_LVL0INT bit set at this point.

sound/soc/samsung/idma.c line 448

Quoted 6 lines
sound/soc/samsung/idma.c new file +6 -0
+void idma_reg_init(void *regs)
+{
+       spin_lock_init(&idma.lock);
+       idma.regs = regs;
+}
+

Why initialize lock twice, here ...

sound/soc/samsung/idma.c line 453

Quoted 5 lines
sound/soc/samsung/idma.c new file +5 -0
+void idma_addr_init(dma_addr_t addr)
+{
+       spin_lock_init(&idma.lock);
+       idma.lp_tx_addr = addr;
+}

... and here.
And we might have races here - there is no mechanism to ensure these functions are called before idma.lp_tx_addr and idma.regs are used. Also, please try to merge them into one function.

sound/soc/samsung/idma.c line 495

Quoted 2 lines
sound/soc/samsung/idma.c new file +2 -0
+MODULE_DESCRIPTION("Samsung ASoC IDMA Driver");
+MODULE_LICENSE("GPL");

The MODULE_AUTHOR field is missing here.

Thnx,
-j

#5 lore raw

PATCH v2 3/4 ARM: SAMSUNG: Add platform device for idma

In reply to Sangbeom Kim

Exynos4 and S5PC110(S5PV210) has Internal dma(idma) in AUDSS. To support idma, register idma platform device.
and Exynos4 and S5PC110 has different IDMA address. TO handle different IDMA address, register idma platform data

---
 arch/arm/mach-exynos4/dev-audio.c               |    2 ++
 arch/arm/mach-exynos4/include/mach/regs-audss.h |   18 ++++++++++++++++++
 arch/arm/mach-exynos4/mach-smdkv310.c           |    1 +
 arch/arm/mach-s5pv210/dev-audio.c               |    1 +
 arch/arm/mach-s5pv210/include/mach/regs-audss.h |   18 ++++++++++++++++++
 arch/arm/mach-s5pv210/mach-smdkv210.c           |    1 +
 arch/arm/plat-samsung/dev-asocdma.c             |   10 ++++++++++
 arch/arm/plat-samsung/include/plat/audio.h      |    1 +
 arch/arm/plat-samsung/include/plat/devs.h       |    1 +
 9 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/include/mach/regs-audss.h
 create mode 100644 arch/arm/mach-s5pv210/include/mach/regs-audss.h
arch/arm/mach-exynos4/dev-audio.c +2 -0
index 1eed5f9..215bfb5 100644
@@ -21,6 +21,7 @@
 #include <mach/map.h>
 #include <mach/dma.h>
 #include <mach/irqs.h>
+#include <mach/regs-audss.h>
 
 static const char *rclksrc[] = {
 	[0] = "busclk",
@@ -55,6 +56,7 @@ static struct s3c_audio_pdata i2sv5_pdata = {
 			.quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
 					 | QUIRK_NEED_RSTCLR,
 			.src_clk = rclksrc,
+			.idma_addr = EXYNOS4_AUDSS_INT_MEM,
 		},
 	},
 };
arch/arm/mach-exynos4/include/mach/regs-audss.h new file +18 -0
new file mode 100644
index 0000000..ca5a8b6
@@ -0,0 +1,18 @@
+/* arch/arm/mach-exynos4/include/mach/regs-audss.h
+ *
+ * Copyright (c) 2011 Samsung Electronics
+ *		http://www.samsung.com
+ *
+ * Exynos4 Audio SubSystem clock register definitions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __PLAT_REGS_AUDSS_H
+#define __PLAT_REGS_AUDSS_H __FILE__
+
+#define EXYNOS4_AUDSS_INT_MEM	(0x03000000)
+
+#endif /* _PLAT_REGS_AUDSS_H */
arch/arm/mach-exynos4/mach-smdkv310.c +1 -0
index 1526764..7c538c0 100644
@@ -187,6 +187,7 @@ static struct platform_device *smdkv310_devices[] __initdata = {
 	&exynos4_device_pd[PD_GPS],
 	&exynos4_device_sysmmu,
 	&samsung_asoc_dma,
+	&samsung_asoc_idma,
 	&smdkv310_smsc911x,
 };
 
arch/arm/mach-s5pv210/dev-audio.c +1 -0
index 8d58f19..0be95f1 100644
@@ -52,6 +52,7 @@ static struct s3c_audio_pdata i2sv5_pdata = {
 			.quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
 					 | QUIRK_NEED_RSTCLR,
 			.src_clk = rclksrc,
+			.idma_addr = S5PV210_AUDSS_INT_MEM,
 		},
 	},
 };
arch/arm/mach-s5pv210/include/mach/regs-audss.h new file +18 -0
new file mode 100644
index 0000000..eacc1f7
@@ -0,0 +1,18 @@
+/* arch/arm/mach-s5pv210/include/mach/regs-audss.h
+ *
+ * Copyright (c) 2011 Samsung Electronics
+ *		http://www.samsung.com
+ *
+ * S5PV210 Audio SubSystem clock register definitions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __PLAT_REGS_AUDSS_H
+#define __PLAT_REGS_AUDSS_H __FILE__
+
+#define S5PV210_AUDSS_INT_MEM	(0xC0000000)
+
+#endif /* _PLAT_REGS_AUDSS_H */
arch/arm/mach-s5pv210/mach-smdkv210.c +1 -0
index c6a9e86..c6900f8 100644
@@ -267,6 +267,7 @@ static struct platform_device *smdkv210_devices[] __initdata = {
 	&s5pv210_device_iis0,
 	&s5pv210_device_spdif,
 	&samsung_asoc_dma,
+	&samsung_asoc_idma,
 	&samsung_device_keypad,
 	&smdkv210_dm9000,
 	&smdkv210_lcd_lte480wv,
arch/arm/plat-samsung/dev-asocdma.c +10 -0
index a068c4f..832fa83 100644
@@ -23,3 +23,13 @@ struct platform_device samsung_asoc_dma = {
 	}
 };
 EXPORT_SYMBOL(samsung_asoc_dma);
+
+struct platform_device samsung_asoc_idma = {
+	.name		  = "samsung-idma",
+	.id		  = -1,
+	.dev              = {
+		.dma_mask = &audio_dmamask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	}
+};
+EXPORT_SYMBOL(samsung_asoc_idma);
arch/arm/plat-samsung/include/plat/audio.h +1 -0
index a0826ed..aa9875f 100644
@@ -44,6 +44,7 @@ struct samsung_i2s {
 	 * Also corresponds to clocks of I2SMOD[10]
 	 */
 	const char **src_clk;
+	dma_addr_t idma_addr;
 };
 
 /**
arch/arm/plat-samsung/include/plat/devs.h +1 -0
index b61b8ee..54d4cd6 100644
@@ -36,6 +36,7 @@ extern struct platform_device s3c64xx_device_spi0;
 extern struct platform_device s3c64xx_device_spi1;
 
 extern struct platform_device samsung_asoc_dma;
+extern struct platform_device samsung_asoc_idma;
 
 extern struct platform_device s3c64xx_device_pcm0;
 extern struct platform_device s3c64xx_device_pcm1;
Signature · 1 line
1.7.1
#6 lore raw

PATCH v2 4/4 ARM: SAMSUNG: Add IRQ_I2S0 definition

In reply to Sangbeom Kim

To handle i2s0 interrupt and To fix compilation error adds IRQ_I2S0 for exynos4, s3c64xx, s5p64x0

---
 arch/arm/mach-exynos4/include/mach/irqs.h |    2 ++
 arch/arm/mach-s3c64xx/include/mach/irqs.h |    1 +
 arch/arm/mach-s5p64x0/include/mach/irqs.h |    2 ++
 3 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mach-exynos4/include/mach/irqs.h +2 -0
index 5d03730..4c78dc0 100644
@@ -73,6 +73,8 @@
 #define IRQ_SYSMMU_MFC_M1_0	COMBINER_IRQ(5, 6)
 #define IRQ_SYSMMU_PCIE_0	COMBINER_IRQ(5, 7)
 
+#define IRQ_I2S0		COMBINER_IRQ(17, 0)
+
 #define IRQ_PDMA0		COMBINER_IRQ(21, 0)
 #define IRQ_PDMA1		COMBINER_IRQ(21, 1)
 
arch/arm/mach-s3c64xx/include/mach/irqs.h +1 -0
index 8e2df26..bf7cc82 100644
@@ -215,6 +215,7 @@
 /* Compatibility */
 
 #define IRQ_ONENAND	IRQ_ONENAND0
+#define IRQ_I2S0	IRQ_S3C6410_IIS
 
 #endif /* __ASM_MACH_S3C64XX_IRQS_H */
 
arch/arm/mach-s5p64x0/include/mach/irqs.h +2 -0
index 513abff..5837a36 100644
@@ -85,6 +85,8 @@
 #define IRQ_S3CUART_RX4		IRQ_S5P_UART_RX4
 #define IRQ_S3CUART_RX5		IRQ_S5P_UART_RX5
 
+#define IRQ_I2S0		IRQ_I2SV40
+
 /* S5P6450 EINT feature will be added */
 
 /*
Signature · 1 line
1.7.1
Acked-by on the v2 series
#7 lore raw
In reply to Sangbeom Kim
Quoted 13 lines · Sangbeom Kim

I2S in samsung audio subsytem has a small internal dma(idma). IDMA can be used in low power audio mode and I2S0 secondary fifo data tranfer.
In this patchsets, idma driver is added.
Original code is made by jassi brar on SMDKV210
After idma driver merge, I will submit low power audio support with idma driver and samsung dsp driver.

Changes since v1:
1. Change idma_new by new pcm_new api
2. Add handling different idma address
3. As jassi comments, Modify the idma driver

Quoted 5 lines

This patchset contains followings

o To Jassi Brar, Mark Brown and Liam Girdwood,
[PATCH V2 1/4] ASoC: SAMSUNG: Modify I2S driver to support idma [PATCH V2 2/4] ASoC: SAMSUNG: Add I2S0 internal dma driver

but you have left #define DEBUG enabled in 1/4.

This could be fixed incrementally if you don't have to do a V3 for any other reasons.

Liam

#8 lore raw
In reply to Sangbeom Kim
Quoted 16 lines · Sangbeom Kim

I2S in samsung audio subsytem has a small internal dma(idma). IDMA can be used in low power audio mode and I2S0 secondary fifo data tranfer.
In this patchsets, idma driver is added.
Original code is made by jassi brar on SMDKV210
After idma driver merge, I will submit low power audio support with idma driver and samsung dsp driver.

Changes since v1:
1. Change idma_new by new pcm_new api
2. Add handling different idma address
3. As jassi comments, Modify the idma driver

This patchset contains followings

Quoted 8 lines

o To Jassi Brar, Mark Brown and Liam Girdwood,
[PATCH V2 1/4] ASoC: SAMSUNG: Modify I2S driver to support idma [PATCH V2 2/4] ASoC: SAMSUNG: Add I2S0 internal dma driver

o To Kukjin Kim
[PATCH V2 3/4] ARM: SAMSUNG: Add platform device for idma [PATCH V2 4/4] ARM: SAMSUNG: Add IRQ_I2S0 definition

OK, applied 3rd and 4th.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.