Skip to contentSkip to conversation

S3C24XX/S3C64XX updates

PATCH In review Ben Dooks 3 participants 24 messages Mar 4, 2009 – Mar 11, 2009

Subsystems (6)
lore
Share & tools
lore
author
#2 lore raw

PATCH 2/9 JIVE: Add ASoC audio support

In reply to Ben Dooks

From: Ben Dooks <[email protected]>

Add support for the Jive's WM8750 codec attached via the S3C2412 IIS.

sound/soc/s3c24xx/Kconfig +9 -0
Index: linux.git/sound/soc/s3c24xx/Kconfig
===================================================================
@@ -26,6 +26,15 @@ config SND_S3C24XX_SOC_NEO1973_WM8753
 	  Say Y if you want to add support for SoC audio on smdk2440
 	  with the WM8753.
 
+config SND_S3C24XX_SOC_JIVE_WM8750
+	tristate "SoC I2S Audio support for Jive"
+	depends on SND_S3C24XX_SOC && MACH_JIVE
+	select SND_SOC_WM8750
+	select SND_SOC_WM8750_SPI
+	select SND_S3C2412_SOC_I2S
+	help
+	  Sat Y if you want to add support for SoC audio on the Jive.
+
 config SND_S3C24XX_SOC_SMDK2443_WM9710
 	tristate "SoC AC97 Audio support for SMDK2443 - WM9710"
 	depends on SND_S3C24XX_SOC && MACH_SMDK2443
sound/soc/s3c24xx/Makefile +2 -0
Index: linux.git/sound/soc/s3c24xx/Makefile
===================================================================
@@ -10,11 +10,13 @@ obj-$(CONFIG_SND_S3C2443_SOC_AC97) += sn
 obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
 
 # S3C24XX Machine Support
+snd-soc-jive-wm8750-objs := jive_wm8750.o
 snd-soc-neo1973-wm8753-objs := neo1973_wm8753.o
 snd-soc-smdk2443-wm9710-objs := smdk2443_wm9710.o
 snd-soc-ln2440sbc-alc650-objs := ln2440sbc_alc650.o
 snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o
 
+obj-$(CONFIG_SND_S3C24XX_SOC_JIVE_WM8750) += snd-soc-jive-wm8750.o
 obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
 obj-$(CONFIG_SND_S3C24XX_SOC_SMDK2443_WM9710) += snd-soc-smdk2443-wm9710.o
 obj-$(CONFIG_SND_S3C24XX_SOC_LN2440SBC_ALC650) += snd-soc-ln2440sbc-alc650.o
sound/soc/s3c24xx/jive_wm8750.c new file +216 -0

216 lines not on this page · raw message

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#4 lore raw

PATCH 3/9 S3C: Move <mach/audio.h> to <plat/audio.h>

In reply to Ben Dooks

From: Ben Dooks <[email protected]>

The <mach/audio.h> file needs to be common to both ARCH_S3C2410 and ARCH_S3C64XX as they share common driver code, so move it to <plat/audio.h>.

Index: linux.git/arch/arm/mach-s3c2410/include/mach/audio.h
===================================================================

arch/arm/mach-s3c2410/include/mach/audio.h deleted +0 -45
Index: linux.git/arch/arm/mach-s3c2410/include/mach/audio.h
===================================================================
@@ -1,45 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/audio.h
- *
- * Copyright (c) 2004-2005 Simtec Electronics
- *	http://www.simtec.co.uk/products/SWLINUX/
- *	Ben Dooks <[email protected]>
- *
- * S3C24XX - Audio platfrom_device info
- *
- * 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 __ASM_ARCH_AUDIO_H
-#define __ASM_ARCH_AUDIO_H __FILE__
-
-/* struct s3c24xx_iis_ops
- *
- * called from the s3c24xx audio core to deal with the architecture
- * or the codec's setup and control.
- *
- * the pointer to itself is passed through in case the caller wants to
- * embed this in an larger structure for easy reference to it's context.
-*/
-
-struct s3c24xx_iis_ops {
-	struct module *owner;
-
-	int	(*startup)(struct s3c24xx_iis_ops *me);
-	void	(*shutdown)(struct s3c24xx_iis_ops *me);
-	int	(*suspend)(struct s3c24xx_iis_ops *me);
-	int	(*resume)(struct s3c24xx_iis_ops *me);
-
-	int	(*open)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
-	int	(*close)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
-	int	(*prepare)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm, struct snd_pcm_runtime *rt);
-};
-
-struct s3c24xx_platdata_iis {
-	const char		*codec_clk;
-	struct s3c24xx_iis_ops	*ops;
-	int			(*match_dev)(struct device *dev);
-};
-
-#endif /* __ASM_ARCH_AUDIO_H */
arch/arm/plat-s3c/include/plat/audio.h new file +45 -0

45 lines not on this page · raw message

sound/soc/s3c24xx/neo1973_wm8753.c +1 -1
Index: linux.git/sound/soc/s3c24xx/neo1973_wm8753.c
===================================================================
@@ -29,7 +29,7 @@
 #include <mach/regs-clock.h>
 #include <mach/regs-gpio.h>
 #include <mach/hardware.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 #include <linux/io.h>
 #include <mach/spi-gpio.h>
 
sound/soc/s3c24xx/s3c2412-i2s.c +1 -1
Index: linux.git/sound/soc/s3c24xx/s3c2412-i2s.c
===================================================================
@@ -34,7 +34,7 @@
 #include <plat/regs-s3c2412-iis.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 #include <mach/dma.h>
 
 #include "s3c24xx-pcm.h"
sound/soc/s3c24xx/s3c2443-ac97.c +1 -1
Index: linux.git/sound/soc/s3c24xx/s3c2443-ac97.c
===================================================================
@@ -31,7 +31,7 @@
 #include <plat/regs-ac97.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-clock.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 #include <asm/dma.h>
 #include <mach/dma.h>
 
sound/soc/s3c24xx/s3c24xx-i2s.c +1 -1
Index: linux.git/sound/soc/s3c24xx/s3c24xx-i2s.c
===================================================================
@@ -30,7 +30,7 @@
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-clock.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 #include <asm/dma.h>
 #include <mach/dma.h>
 
sound/soc/s3c24xx/s3c24xx-pcm.c +1 -1
Index: linux.git/sound/soc/s3c24xx/s3c24xx-pcm.c
===================================================================
@@ -29,7 +29,7 @@
 #include <asm/dma.h>
 #include <mach/hardware.h>
 #include <mach/dma.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 
 #include "s3c24xx-pcm.h"
 
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#5 lore raw

PATCH 4/9 S3C24XX ASoC: Fix copyright statements on Simtec files

In reply to Ben Dooks

From: Ben Dooks <[email protected]>

Fix the copyright statements in two of the S3C24XX ASoC files that have (c) when we require the full word.

sound/soc/s3c24xx/s3c24xx-i2s.c +1 -1
Index: linux.git/sound/soc/s3c24xx/s3c24xx-i2s.c
===================================================================
@@ -4,7 +4,7 @@
  * (c) 2006 Wolfson Microelectronics PLC.
  * Graeme Gregory [email protected] or [email protected]
  *
- * (c) 2004-2005 Simtec Electronics
+ * Copyright 2004-2005 Simtec Electronics
  *	http://armlinux.simtec.co.uk/
  *	Ben Dooks <[email protected]>
  *
sound/soc/s3c24xx/s3c24xx-pcm.c +1 -1
Index: linux.git/sound/soc/s3c24xx/s3c24xx-pcm.c
===================================================================
@@ -4,7 +4,7 @@
  * (c) 2006 Wolfson Microelectronics PLC.
  * Graeme Gregory [email protected] or [email protected]
  *
- * (c) 2004-2005 Simtec Electronics
+ * Copyright 2004-2005 Simtec Electronics
  *	http://armlinux.simtec.co.uk/
  *	Ben Dooks <[email protected]>
  *
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#7 lore raw

PATCH 5/9 S3C: Split s3c2412-i2s.c into core and SoC specific parts

In reply to Ben Dooks

From: Ben Dooks <[email protected]>

The S3C2412 I2S (IIS) interface is replicated on further Samsung SoC parts in a broadly compatible way, so split the common code out into a core called s3c-i2s-v2.[ch] so that the newer SoCs such as the S3C6410 can make use of it.

As such, all the original s3c2412 functions are currently being left with their original names, and will be renamed later in the series.

sound/soc/s3c24xx/s3c-i2s-v2.c new file +645 -0
Index: linux.git/sound/soc/s3c24xx/s3c-i2s-v2.c
===================================================================
@@ -0,0 +1,645 @@
+/* sound/soc/s3c24xx/s3c-i2c-v2.c
+ *
+ * ALSA Soc Audio Layer - I2S core for newer Samsung SoCs.
+ *
+ * Copyright (c) 2006 Wolfson Microelectronics PLC.
+ *	Graeme Gregory [email protected]
+ *	[email protected]
+ *
+ * Copyright (c) 2008, 2007, 2004-2005 Simtec Electronics
+ *	http://armlinux.simtec.co.uk/
+ *	Ben Dooks <[email protected]>
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/initval.h>
+#include <sound/soc.h>
+
+#include <plat/regs-s3c2412-iis.h>
+
+#include <plat/audio.h>
+#include <mach/dma.h>
+
+#include "s3c-i2s-v2.h"
+
+#define S3C2412_I2S_DEBUG_CON 0
+#define S3C2412_I2S_DEBUG 0
+
+#if S3C2412_I2S_DEBUG
+#define DBG(x...) printk(KERN_INFO x)
+#else
+#define DBG(x...) do { } while (0)
+#endif
+
+static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
+{
+	return cpu_dai->private_data;
+}
+
+#define bit_set(v, b) (((v) & (b)) ? 1 : 0)
+
+#if S3C2412_I2S_DEBUG_CON
+static void dbg_showcon(const char *fn, u32 con)
+{
+	printk(KERN_DEBUG "%s: LRI=%d, TXFEMPT=%d, RXFEMPT=%d, TXFFULL=%d, RXFFULL=%d\n", fn,
+	       bit_set(con, S3C2412_IISCON_LRINDEX),
+	       bit_set(con, S3C2412_IISCON_TXFIFO_EMPTY),
+	       bit_set(con, S3C2412_IISCON_RXFIFO_EMPTY),
+	       bit_set(con, S3C2412_IISCON_TXFIFO_FULL),
+	       bit_set(con, S3C2412_IISCON_RXFIFO_FULL));
+
+	printk(KERN_DEBUG "%s: PAUSE: TXDMA=%d, RXDMA=%d, TXCH=%d, RXCH=%d\n",
+	       fn,
+	       bit_set(con, S3C2412_IISCON_TXDMA_PAUSE),
+	       bit_set(con, S3C2412_IISCON_RXDMA_PAUSE),
+	       bit_set(con, S3C2412_IISCON_TXCH_PAUSE),
+	       bit_set(con, S3C2412_IISCON_RXCH_PAUSE));
+	printk(KERN_DEBUG "%s: ACTIVE: TXDMA=%d, RXDMA=%d, IIS=%d\n", fn,
+	       bit_set(con, S3C2412_IISCON_TXDMA_ACTIVE),
+	       bit_set(con, S3C2412_IISCON_RXDMA_ACTIVE),
+	       bit_set(con, S3C2412_IISCON_IIS_ACTIVE));
+}
+#else
+static inline void dbg_showcon(const char *fn, u32 con)
+{
+}
+#endif
+
+
+/* Turn on or off the transmission path. */
+void s3c2412_snd_txctrl(struct s3c_i2sv2_info *i2s, int on)
+{
+	void __iomem *regs = i2s->regs;
+	u32 fic, con, mod;
+
+	DBG("%s(%d)\n", __func__, on);
+
+	fic = readl(regs + S3C2412_IISFIC);
+	con = readl(regs + S3C2412_IISCON);
+	mod = readl(regs + S3C2412_IISMOD);
+
+	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
+
+	if (on) {
+		con |= S3C2412_IISCON_TXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
+		con &= ~S3C2412_IISCON_TXDMA_PAUSE;
+		con &= ~S3C2412_IISCON_TXCH_PAUSE;
+
+		switch (mod & S3C2412_IISMOD_MODE_MASK) {
+		case S3C2412_IISMOD_MODE_TXONLY:
+		case S3C2412_IISMOD_MODE_TXRX:
+			/* do nothing, we are in the right mode */
+			break;
+
+		case S3C2412_IISMOD_MODE_RXONLY:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			mod |= S3C2412_IISMOD_MODE_TXRX;
+			break;
+
+		default:
+			dev_err(i2s->dev, "TXEN: Invalid MODE in IISMOD\n");
+		}
+
+		writel(con, regs + S3C2412_IISCON);
+		writel(mod, regs + S3C2412_IISMOD);
+	} else {
+		/* Note, we do not have any indication that the FIFO problems
+		 * tha the S3C2410/2440 had apply here, so we should be able
+		 * to disable the DMA and TX without resetting the FIFOS.
+		 */
+
+		con |=  S3C2412_IISCON_TXDMA_PAUSE;
+		con |=  S3C2412_IISCON_TXCH_PAUSE;
+		con &= ~S3C2412_IISCON_TXDMA_ACTIVE;
+
+		switch (mod & S3C2412_IISMOD_MODE_MASK) {
+		case S3C2412_IISMOD_MODE_TXRX:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			mod |= S3C2412_IISMOD_MODE_RXONLY;
+			break;
+
+		case S3C2412_IISMOD_MODE_TXONLY:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			con &= ~S3C2412_IISCON_IIS_ACTIVE;
+			break;
+
+		default:
+			dev_err(i2s->dev, "TXDIS: Invalid MODE in IISMOD\n");
+		}
+
+		writel(mod, regs + S3C2412_IISMOD);
+		writel(con, regs + S3C2412_IISCON);
+	}
+
+	fic = readl(regs + S3C2412_IISFIC);
+	dbg_showcon(__func__, con);
+	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
+}
+EXPORT_SYMBOL_GPL(s3c2412_snd_txctrl);
+
+void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on)
+{
+	void __iomem *regs = i2s->regs;
+	u32 fic, con, mod;
+
+	DBG("%s(%d)\n", __func__, on);
+
+	fic = readl(regs + S3C2412_IISFIC);
+	con = readl(regs + S3C2412_IISCON);
+	mod = readl(regs + S3C2412_IISMOD);
+
+	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
+
+	if (on) {
+		con |= S3C2412_IISCON_RXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
+		con &= ~S3C2412_IISCON_RXDMA_PAUSE;
+		con &= ~S3C2412_IISCON_RXCH_PAUSE;
+
+		switch (mod & S3C2412_IISMOD_MODE_MASK) {
+		case S3C2412_IISMOD_MODE_TXRX:
+		case S3C2412_IISMOD_MODE_RXONLY:
+			/* do nothing, we are in the right mode */
+			break;
+
+		case S3C2412_IISMOD_MODE_TXONLY:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			mod |= S3C2412_IISMOD_MODE_TXRX;
+			break;
+
+		default:
+			dev_err(i2s->dev, "RXEN: Invalid MODE in IISMOD\n");
+		}
+
+		writel(mod, regs + S3C2412_IISMOD);
+		writel(con, regs + S3C2412_IISCON);
+	} else {
+		/* See txctrl notes on FIFOs. */
+
+		con &= ~S3C2412_IISCON_RXDMA_ACTIVE;
+		con |=  S3C2412_IISCON_RXDMA_PAUSE;
+		con |=  S3C2412_IISCON_RXCH_PAUSE;
+
+		switch (mod & S3C2412_IISMOD_MODE_MASK) {
+		case S3C2412_IISMOD_MODE_RXONLY:
+			con &= ~S3C2412_IISCON_IIS_ACTIVE;
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			break;
+
+		case S3C2412_IISMOD_MODE_TXRX:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			mod |= S3C2412_IISMOD_MODE_TXONLY;
+			break;
+
+		default:
+			dev_err(i2s->dev, "RXEN: Invalid MODE in IISMOD\n");
+		}
+
+		writel(con, regs + S3C2412_IISCON);
+		writel(mod, regs + S3C2412_IISMOD);
+	}
+
+	fic = readl(regs + S3C2412_IISFIC);
+	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
+}
+EXPORT_SYMBOL_GPL(s3c2412_snd_rxctrl);
+
+/*
+ * Wait for the LR signal to allow synchronisation to the L/R clock
+ * from the codec. May only be needed for slave mode.
+ */
+static int s3c2412_snd_lrsync(struct s3c_i2sv2_info *i2s)
+{
+	u32 iiscon;
+	unsigned long timeout = jiffies + msecs_to_jiffies(5);
+
+	DBG("Entered %s\n", __func__);
+
+	while (1) {
+		iiscon = readl(i2s->regs + S3C2412_IISCON);
+		if (iiscon & S3C2412_IISCON_LRINDEX)
+			break;
+
+		if (timeout < jiffies) {
+			printk(KERN_ERR "%s: timeout\n", __func__);
+			return -ETIMEDOUT;
+		}
+	}
+
+	return 0;
+}
+
+/*
+ * Set S3C2412 I2S DAI format
+ */
+static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
+			       unsigned int fmt)
+{
+	struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
+	u32 iismod;
+
+	DBG("Entered %s\n", __func__);
+
+	iismod = readl(i2s->regs + S3C2412_IISMOD);
+	DBG("hw_params r: IISMOD: %x \n", iismod);
+
+#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
+#define IISMOD_MASTER_MASK S3C2412_IISMOD_MASTER_MASK
+#define IISMOD_SLAVE S3C2412_IISMOD_SLAVE
+#define IISMOD_MASTER S3C2412_IISMOD_MASTER_INTERNAL
+#endif
+
+#if defined(CONFIG_PLAT_S3C64XX)
+/* From Rev1.1 datasheet, we have two master and two slave modes:
+ * IMS[11:10]:
+ *	00 = master mode, fed from PCLK
+ *	01 = master mode, fed from CLKAUDIO
+ *	10 = slave mode, using PCLK
+ *	11 = slave mode, using I2SCLK
+ */
+#define IISMOD_MASTER_MASK (1 << 11)
+#define IISMOD_SLAVE (1 << 11)
+#define IISMOD_MASTER (0x0)
+#endif
+
+	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+	case SND_SOC_DAIFMT_CBM_CFM:
+		i2s->master = 0;
+		iismod &= ~IISMOD_MASTER_MASK;
+		iismod |= IISMOD_SLAVE;
+		break;
+	case SND_SOC_DAIFMT_CBS_CFS:
+		i2s->master = 1;
+		iismod &= ~IISMOD_MASTER_MASK;
+		iismod |= IISMOD_MASTER;
+		break;
+	default:
+		DBG("unknwon master/slave format\n");
+		return -EINVAL;
+	}
+
+	iismod &= ~S3C2412_IISMOD_SDF_MASK;
+
+	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+	case SND_SOC_DAIFMT_RIGHT_J:
+		iismod |= S3C2412_IISMOD_SDF_MSB;
+		break;
+	case SND_SOC_DAIFMT_LEFT_J:
+		iismod |= S3C2412_IISMOD_SDF_LSB;
+		break;
+	case SND_SOC_DAIFMT_I2S:
+		iismod |= S3C2412_IISMOD_SDF_IIS;
+		break;
+	default:
+		DBG("Unknown data format\n");
+		return -EINVAL;
+	}
+
+	writel(iismod, i2s->regs + S3C2412_IISMOD);
+	DBG("hw_params w: IISMOD: %x \n", iismod);
+	return 0;
+}
+
+static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
+				 struct snd_pcm_hw_params *params,
+				 struct snd_soc_dai *socdai)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai_link *dai = rtd->dai;
+	struct s3c_i2sv2_info *i2s = to_info(dai->cpu_dai);
+	u32 iismod;
+
+	DBG("Entered %s\n", __func__);
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		dai->cpu_dai->dma_data = i2s->dma_playback;
+	else
+		dai->cpu_dai->dma_data = i2s->dma_capture;
+
+	/* Working copies of register */
+	iismod = readl(i2s->regs + S3C2412_IISMOD);
+	DBG("%s: r: IISMOD: %x\n", __func__, iismod);
+
+	switch (params_format(params)) {
+	case SNDRV_PCM_FORMAT_S8:
+		iismod |= S3C2412_IISMOD_8BIT;
+		break;
+	case SNDRV_PCM_FORMAT_S16_LE:
+		iismod &= ~S3C2412_IISMOD_8BIT;
+		break;
+	}
+
+	writel(iismod, i2s->regs + S3C2412_IISMOD);
+	DBG("%s: w: IISMOD: %x\n", __func__, iismod);
+	return 0;
+}
+
+static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
+			       struct snd_soc_dai *dai)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct s3c_i2sv2_info *i2s = to_info(rtd->dai->cpu_dai);
+	int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+	unsigned long irqs;
+	int ret = 0;
+
+	DBG("Entered %s\n", __func__);
+
+	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_START:
+		/* On start, ensure that the FIFOs are cleared and reset. */
+
+		writel(capture ? S3C2412_IISFIC_RXFLUSH : S3C2412_IISFIC_TXFLUSH,
+		       i2s->regs + S3C2412_IISFIC);
+
+		/* clear again, just in case */
+		writel(0x0, i2s->regs + S3C2412_IISFIC);
+
+	case SNDRV_PCM_TRIGGER_RESUME:
+	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+		if (!i2s->master) {
+			ret = s3c2412_snd_lrsync(i2s);
+			if (ret)
+				goto exit_err;
+		}
+
+		local_irq_save(irqs);
+
+		if (capture)
+			s3c2412_snd_rxctrl(i2s, 1);
+		else
+			s3c2412_snd_txctrl(i2s, 1);
+
+		local_irq_restore(irqs);
+		break;
+
+	case SNDRV_PCM_TRIGGER_STOP:
+	case SNDRV_PCM_TRIGGER_SUSPEND:
+	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+		local_irq_save(irqs);
+
+		if (capture)
+			s3c2412_snd_rxctrl(i2s, 0);
+		else
+			s3c2412_snd_txctrl(i2s, 0);
+
+		local_irq_restore(irqs);
+		break;
+	default:
+		ret = -EINVAL;
+		break;
+	}
+
+exit_err:
+	return ret;
+}
+
+/*
+ * Set S3C2412 Clock dividers
+ */
+static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
+				  int div_id, int div)
+{
+	struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
+	u32 reg;
+
+	DBG("%s(%p, %d, %d)\n", __func__, cpu_dai, div_id, div);
+
+	switch (div_id) {
+	case S3C_I2SV2_DIV_BCLK:
+		reg = readl(i2s->regs + S3C2412_IISMOD);
+		reg &= ~S3C2412_IISMOD_BCLK_MASK;
+		writel(reg | div, i2s->regs + S3C2412_IISMOD);
+
+		DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
+		break;
+
+	case S3C_I2SV2_DIV_RCLK:
+		if (div > 3) {
+			/* convert value to bit field */
+
+			switch (div) {
+			case 256:
+				div = S3C2412_IISMOD_RCLK_256FS;
+				break;
+
+			case 384:
+				div = S3C2412_IISMOD_RCLK_384FS;
+				break;
+
+			case 512:
+				div = S3C2412_IISMOD_RCLK_512FS;
+				break;
+
+			case 768:
+				div = S3C2412_IISMOD_RCLK_768FS;
+				break;
+
+			default:
+				return -EINVAL;
+			}
+		}
+
+		reg = readl(i2s->regs + S3C2412_IISMOD);
+		reg &= ~S3C2412_IISMOD_RCLK_MASK;
+		writel(reg | div, i2s->regs + S3C2412_IISMOD);
+		DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
+		break;
+
+	case S3C_I2SV2_DIV_PRESCALER:
+		if (div >= 0) {
+			writel((div << 8) | S3C2412_IISPSR_PSREN,
+			       i2s->regs + S3C2412_IISPSR);
+		} else {
+			writel(0x0, i2s->regs + S3C2412_IISPSR);
+		}
+		DBG("%s: PSR=%08x\n", __func__, readl(i2s->regs + S3C2412_IISPSR));
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+/* default table of all avaialable root fs divisors */
+static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 };
+
+int s3c2412_iis_calc_rate(struct s3c_i2sv2_rate_calc *info,
+			  unsigned int *fstab,
+			  unsigned int rate, struct clk *clk)
+{
+	unsigned long clkrate = clk_get_rate(clk);
+	unsigned int div;
+	unsigned int fsclk;
+	unsigned int actual;
+	unsigned int fs;
+	unsigned int fsdiv;
+	signed int deviation = 0;
+	unsigned int best_fs = 0;
+	unsigned int best_div = 0;
+	unsigned int best_rate = 0;
+	unsigned int best_deviation = INT_MAX;
+
+	if (fstab == NULL)
+		fstab = iis_fs_tab;
+
+	for (fs = 0; fs < ARRAY_SIZE(iis_fs_tab); fs++) {
+		fsdiv = iis_fs_tab[fs];
+
+		fsclk = clkrate / fsdiv;
+		div = fsclk / rate;
+
+		if ((fsclk % rate) > (rate / 2))
+			div++;
+
+		if (div <= 1)
+			continue;
+
+		actual = clkrate / (fsdiv * div);
+		deviation = actual - rate;
+
+		printk(KERN_DEBUG "%dfs: div %d => result %d, deviation %d\n",
+		       fsdiv, div, actual, deviation);
+
+		deviation = abs(deviation);
+
+		if (deviation < best_deviation) {
+			best_fs = fsdiv;
+			best_div = div;
+			best_rate = actual;
+			best_deviation = deviation;
+		}
+
+		if (deviation == 0)
+			break;
+	}
+
+	printk(KERN_DEBUG "best: fs=%d, div=%d, rate=%d\n",
+	       best_fs, best_div, best_rate);
+
+	info->fs_div = best_fs;
+	info->clk_div = best_div;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(s3c2412_iis_calc_rate);
+
+int s3c_i2sv2_probe(struct platform_device *pdev,
+		    struct snd_soc_dai *dai,
+		    struct s3c_i2sv2_info *i2s,
+		    unsigned long base)
+{
+	struct device *dev = &pdev->dev;
+
+	i2s->dev = dev;
+
+	/* record our i2s structure for later use in the callbacks */
+	dai->private_data = i2s;
+
+	i2s->regs = ioremap(base, 0x100);
+	if (i2s->regs == NULL) {
+		dev_err(dev, "cannot ioremap registers\n");
+		return -ENXIO;
+	}
+
+	i2s->iis_pclk = clk_get(dev, "iis");
+	if (i2s->iis_pclk == NULL) {
+		DBG("failed to get iis_clock\n");
+		iounmap(i2s->regs);
+		return -ENOENT;
+	}
+
+	clk_enable(i2s->iis_pclk);
+
+	s3c2412_snd_txctrl(i2s, 0);
+	s3c2412_snd_rxctrl(i2s, 0);
+
+	return 0;
+}
+
+EXPORT_SYMBOL_GPL(s3c_i2sv2_probe);
+
+#ifdef CONFIG_PM
+static int s3c2412_i2s_suspend(struct snd_soc_dai *dai)
+{
+	struct s3c_i2sv2_info *i2s = to_info(dai);
+	u32 iismod;
+
+	if (dai->active) {
+		i2s->suspend_iismod = readl(i2s->regs + S3C2412_IISMOD);
+		i2s->suspend_iiscon = readl(i2s->regs + S3C2412_IISCON);
+		i2s->suspend_iispsr = readl(i2s->regs + S3C2412_IISPSR);
+
+		/* some basic suspend checks */
+
+		iismod = readl(i2s->regs + S3C2412_IISMOD);
+
+		if (iismod & S3C2412_IISCON_RXDMA_ACTIVE)
+			pr_warning("%s: RXDMA active?\n", __func__);
+
+		if (iismod & S3C2412_IISCON_TXDMA_ACTIVE)
+			pr_warning("%s: TXDMA active?\n", __func__);
+
+		if (iismod & S3C2412_IISCON_IIS_ACTIVE)
+			pr_warning("%s: IIS active\n", __func__);
+	}
+
+	return 0;
+}
+
+static int s3c2412_i2s_resume(struct snd_soc_dai *dai)
+{
+	struct s3c_i2sv2_info *i2s = to_info(dai);
+
+	pr_info("dai_active %d, IISMOD %08x, IISCON %08x\n",
+		dai->active, i2s->suspend_iismod, i2s->suspend_iiscon);
+
+	if (dai->active) {
+		writel(i2s->suspend_iiscon, i2s->regs + S3C2412_IISCON);
+		writel(i2s->suspend_iismod, i2s->regs + S3C2412_IISMOD);
+		writel(i2s->suspend_iispsr, i2s->regs + S3C2412_IISPSR);
+
+		writel(S3C2412_IISFIC_RXFLUSH | S3C2412_IISFIC_TXFLUSH,
+		       i2s->regs + S3C2412_IISFIC);
+
+		ndelay(250);
+		writel(0x0, i2s->regs + S3C2412_IISFIC);
+	}
+
+	return 0;
+}
+#else
+#define s3c2412_i2s_suspend NULL
+#define s3c2412_i2s_resume  NULL
+#endif
+
+int s3c_i2sv2_register_dai(struct snd_soc_dai *dai)
+{
+	dai->ops.trigger = s3c2412_i2s_trigger;
+	dai->ops.hw_params = s3c2412_i2s_hw_params;
+	dai->ops.set_fmt = s3c2412_i2s_set_fmt;
+	dai->ops.set_clkdiv = s3c2412_i2s_set_clkdiv;
+
+	dai->suspend = s3c2412_i2s_suspend;
+	dai->resume = s3c2412_i2s_resume;
+
+	return snd_soc_register_dai(dai);
+}
+
+EXPORT_SYMBOL_GPL(s3c_i2sv2_register_dai);
sound/soc/s3c24xx/s3c-i2s-v2.h new file +90 -0

90 lines not on this page · raw message

sound/soc/s3c24xx/s3c2412-i2s.c +18 -578

681 lines not on this page · raw message

sound/soc/s3c24xx/jive_wm8750.c +3 -3
Index: linux.git/sound/soc/s3c24xx/jive_wm8750.c
===================================================================
@@ -65,7 +65,7 @@ static int jive_hw_params(struct snd_pcm
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
 	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
-	struct s3c2412_rate_calc div;
+	struct s3c_i2sv2_rate_calc div;
 	unsigned int clk = 0;
 	int ret = 0;
 
@@ -83,8 +83,8 @@ static int jive_hw_params(struct snd_pcm
 		break;
 	}
 
-	s3c2412_iis_calc_rate(&div, NULL, params_rate(params),
-			      s3c2412_get_iisclk());
+	s3c_i2sv2_calc_rate(&div, NULL, params_rate(params),
+			    s3c2412_get_iisclk());
 
 	/* set codec DAI configuration */
 	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
sound/soc/s3c24xx/s3c2412-i2s.h +5 -12
Index: linux.git/sound/soc/s3c24xx/s3c2412-i2s.h
===================================================================
@@ -15,9 +15,11 @@
 #ifndef __SND_SOC_S3C24XX_S3C2412_I2S_H
 #define __SND_SOC_S3C24XX_S3C2412_I2S_H __FILE__
 
-#define S3C2412_DIV_BCLK	(1)
-#define S3C2412_DIV_RCLK	(2)
-#define S3C2412_DIV_PRESCALER	(3)
+#include "s3c-i2s-v2.h"
+
+#define S3C2412_DIV_BCLK	S3C_I2SV2_DIV_BCLK
+#define S3C2412_DIV_RCLK	S3C_I2SV2_DIV_RCLK
+#define S3C2412_DIV_PRESCALER	S3C_I2SV2_DIV_PRESCALER
 
 #define S3C2412_CLKSRC_PCLK	(0)
 #define S3C2412_CLKSRC_I2SCLK	(1)
@@ -26,13 +28,4 @@ extern struct clk *s3c2412_get_iisclk(vo
 
 extern struct snd_soc_dai s3c2412_i2s_dai;
 
-struct s3c2412_rate_calc {
-	unsigned int	clk_div;	/* for prescaler */
-	unsigned int	fs_div;		/* for root frame clock */
-};
-
-extern int s3c2412_iis_calc_rate(struct s3c2412_rate_calc *info,
-				 unsigned int *fstab,
-				 unsigned int rate, struct clk *clk);
-
 #endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */
sound/soc/s3c24xx/Kconfig +4 -0
Index: linux.git/sound/soc/s3c24xx/Kconfig
===================================================================
@@ -9,8 +9,12 @@ config SND_S3C24XX_SOC
 config SND_S3C24XX_SOC_I2S
 	tristate
 
+config SND_S3C_I2SV2_SOC
+	tristate
+
 config SND_S3C2412_SOC_I2S
 	tristate
+	select SND_S3C_I2SV2_SOC
 
 config SND_S3C2443_SOC_AC97
 	tristate
sound/soc/s3c24xx/Makefile +2 -0
Index: linux.git/sound/soc/s3c24xx/Makefile
===================================================================
@@ -3,11 +3,13 @@ snd-soc-s3c24xx-objs := s3c24xx-pcm.o
 snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o
 snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o
 snd-soc-s3c2443-ac97-objs := s3c2443-ac97.o
+snd-soc-s3c-i2s-v2-objs := s3c-i2s-v2.o
 
 obj-$(CONFIG_SND_S3C24XX_SOC) += snd-soc-s3c24xx.o
 obj-$(CONFIG_SND_S3C24XX_SOC_I2S) += snd-soc-s3c24xx-i2s.o
 obj-$(CONFIG_SND_S3C2443_SOC_AC97) += snd-soc-s3c2443-ac97.o
 obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
+obj-$(CONFIG_SND_S3C_I2SV2_SOC) += snd-soc-s3c-i2s-v2.o
 
 # S3C24XX Machine Support
 snd-soc-jive-wm8750-objs := jive_wm8750.o
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#9 lore raw

PATCH 6/9 S3C64XX: Add s3c64xx-i2s support

In reply to Ben Dooks

From: Ben Dooks <[email protected]>

Add the initial code to support the S3C64XX I2S hardware using the s3c-i2s-v2 core code.

sound/soc/s3c24xx/Makefile +2 -0
Index: linux.git/sound/soc/s3c24xx/Makefile
===================================================================
@@ -2,6 +2,7 @@
 snd-soc-s3c24xx-objs := s3c24xx-pcm.o
 snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o
 snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o
+snd-soc-s3c64xx-i2s-objs := s3c64xx-i2s.o
 snd-soc-s3c2443-ac97-objs := s3c2443-ac97.o
 snd-soc-s3c-i2s-v2-objs := s3c-i2s-v2.o
 
@@ -9,6 +10,7 @@ obj-$(CONFIG_SND_S3C24XX_SOC) += snd-soc
 obj-$(CONFIG_SND_S3C24XX_SOC_I2S) += snd-soc-s3c24xx-i2s.o
 obj-$(CONFIG_SND_S3C2443_SOC_AC97) += snd-soc-s3c2443-ac97.o
 obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
+obj-$(CONFIG_SND_S3C64XX_SOC_I2S) += snd-soc-s3c64xx-i2s.o
 obj-$(CONFIG_SND_S3C_I2SV2_SOC) += snd-soc-s3c-i2s-v2.o
 
 # S3C24XX Machine Support
sound/soc/s3c24xx/s3c64xx-i2s.c new file +220 -0

220 lines not on this page · raw message

sound/soc/s3c24xx/s3c64xx-i2s.h new file +31 -0
Index: linux.git/sound/soc/s3c24xx/s3c64xx-i2s.h
===================================================================
@@ -0,0 +1,31 @@
+/* sound/soc/s3c24xx/s3c64xx-i2s.h
+ *
+ * ALSA SoC Audio Layer - S3C64XX I2S driver
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <[email protected]>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * 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 __SND_SOC_S3C24XX_S3C64XX_I2S_H
+#define __SND_SOC_S3C24XX_S3C64XX_I2S_H __FILE__
+
+#include "s3c-i2s-v2.h"
+
+#define S3C64XX_DIV_BCLK	S3C_I2SV2_DIV_BCLK
+#define S3C64XX_DIV_RCLK	S3C_I2SV2_DIV_RCLK
+#define S3C64XX_DIV_PRESCALER	S3C_I2SV2_DIV_PRESCALER
+
+#define S3C64XX_CLKSRC_PCLK	(0)
+#define S3C64XX_CLKSRC_MUX	(1)
+
+extern struct snd_soc_dai s3c64xx_i2s_dai;
+
+extern unsigned long s3c64xx_i2s_get_clockrate(struct snd_soc_dai *cpu_dai);
+
+#endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */
sound/soc/s3c24xx/Kconfig +5 -1
Index: linux.git/sound/soc/s3c24xx/Kconfig
===================================================================
@@ -1,6 +1,6 @@
 config SND_S3C24XX_SOC
 	tristate "SoC Audio for the Samsung S3C24XX chips"
-	depends on ARCH_S3C2410
+	depends on ARCH_S3C2410 || ARCH_S3C64XX
 	help
 	  Say Y or M if you want to add support for codecs attached to
 	  the S3C24XX AC97, I2S or SSP interface. You will also need
@@ -16,6 +16,10 @@ config SND_S3C2412_SOC_I2S
 	tristate
 	select SND_S3C_I2SV2_SOC
 
+config SND_S3C64XX_SOC_I2S
+	tristate
+	select SND_S3C_I2SV2_SOC
+
 config SND_S3C2443_SOC_AC97
 	tristate
 	select AC97_BUS
arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h +3 -0
Index: linux.git/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h
===================================================================
@@ -33,6 +33,9 @@
 #define S3C2412_IISCON_RXDMA_ACTIVE	(1 << 1)
 #define S3C2412_IISCON_IIS_ACTIVE	(1 << 0)
 
+#define S3C64XX_IISMOD_IMS_PCLK		(0 << 10)
+#define S3C64XX_IISMOD_IMS_SYSMUX	(1 << 10)
+
 #define S3C2412_IISMOD_MASTER_INTERNAL	(0 << 10)
 #define S3C2412_IISMOD_MASTER_EXTERNAL	(1 << 10)
 #define S3C2412_IISMOD_SLAVE		(2 << 10)
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#12 lore raw

PATCH 7/9 ASoC: Ensure codec check hw_write error at probe

In reply to Ben Dooks

Add checks to see if wmXXXX_reset() failed and notify the user of the problem. This is generally due to a problem on the i2c bus such as an un-powered or non-connected codec.

sound/soc/codecs/wm8731.c +5 -1
Index: linux-2.6.29-rc6-quilt1/sound/soc/codecs/wm8731.c
===================================================================
@@ -521,7 +521,11 @@ static int wm8731_init(struct snd_soc_de
 	if (codec->reg_cache == NULL)
 		return -ENOMEM;
 
-	wm8731_reset(codec);
+	ret = wm8731_reset(codec);
+	if (ret < 0) {
+		printk(KERN_ERR "wm8731: failed to send reset\n");
+		return -EIO;
+	}
 
 	/* register pcms */
 	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
sound/soc/codecs/wm8753.c +5 -1
Index: linux-2.6.29-rc6-quilt1/sound/soc/codecs/wm8753.c
===================================================================
@@ -1573,7 +1573,11 @@ static int wm8753_init(struct snd_soc_de
 
 	wm8753_set_dai_mode(codec, 0);
 
-	wm8753_reset(codec);
+	ret = wm8753_reset(codec);
+	if (ret < 0) {
+		printk(KERN_ERR "wm8753: failed reset, not present?\n");
+		return -EIO;
+	}
 
 	/* register pcms */
 	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#14 lore raw

PATCH 8/9 SMDK6410: Add support for WM8731 on an add-on board

In reply to Ben Dooks

Add support for an WM8731 connected to an SMDK6410 instead of the onboard codec.

sound/soc/s3c24xx/Makefile +2 -0
Index: linux.git/sound/soc/s3c24xx/Makefile
===================================================================
@@ -19,9 +19,11 @@ snd-soc-neo1973-wm8753-objs := neo1973_w
 snd-soc-smdk2443-wm9710-objs := smdk2443_wm9710.o
 snd-soc-ln2440sbc-alc650-objs := ln2440sbc_alc650.o
 snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o
+snd-soc-smdk6410-wm8731-objs := smdk6410-wm8731.o
 
 obj-$(CONFIG_SND_S3C24XX_SOC_JIVE_WM8750) += snd-soc-jive-wm8750.o
 obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
 obj-$(CONFIG_SND_S3C24XX_SOC_SMDK2443_WM9710) += snd-soc-smdk2443-wm9710.o
 obj-$(CONFIG_SND_S3C24XX_SOC_LN2440SBC_ALC650) += snd-soc-ln2440sbc-alc650.o
 obj-$(CONFIG_SND_S3C24XX_SOC_S3C24XX_UDA134X) += snd-soc-s3c24xx-uda134x.o
+obj-$(CONFIG_SND_S3C64XX_SOC_SMDK6410_WM8731) += snd-soc-smdk6410-wm8731.o
sound/soc/s3c24xx/smdk6410-wm8731.c new file +227 -0

227 lines not on this page · raw message

sound/soc/s3c24xx/Kconfig +8 -0
Index: linux.git/sound/soc/s3c24xx/Kconfig
===================================================================
@@ -66,3 +66,11 @@ config SND_S3C24XX_SOC_S3C24XX_UDA134X
        	depends on SND_S3C24XX_SOC
        	select SND_S3C24XX_SOC_I2S
        	select SND_SOC_UDA134X
+
+config SND_S3C64XX_SOC_SMDK6410_WM8731
+	tristate "SoC I2S Audio support for WM8731 added to an SMDK6410"
+	depends on SND_S3C24XX_SOC
+	select SND_S3C64XX_SOC_I2S
+	select SND_SOC_WM8731
+	help
+	  Support for an WM8731 add-on board on I2S channel 0 on an SMDK6410
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#16 lore raw

PATCH 9/9 AUDIO: Select DMA if I2S is configured

In reply to Ben Dooks

Select the relevant DMA implementation when the
sound driver is selected.

sound/soc/s3c24xx/Kconfig +4 -0
Index: linux.agit/sound/soc/s3c24xx/Kconfig
===================================================================
@@ -8,6 +8,7 @@ config SND_S3C24XX_SOC
 
 config SND_S3C24XX_SOC_I2S
 	tristate
+	select S3C2410_DMA
 
 config SND_S3C_I2SV2_SOC
 	tristate
@@ -15,13 +16,16 @@ config SND_S3C_I2SV2_SOC
 config SND_S3C2412_SOC_I2S
 	tristate
 	select SND_S3C_I2SV2_SOC
+	select S3C2410_DMA
 
 config SND_S3C64XX_SOC_I2S
 	tristate
 	select SND_S3C_I2SV2_SOC
+	select S3C64XX_DMA
 
 config SND_S3C2443_SOC_AC97
 	tristate
+	select S3C2410_DMA
 	select AC97_BUS
 	select SND_SOC_AC97_BUS
 	
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'

Ben Dooks

author
#0 lore raw

cover S3C24XX/S3C64XX updates

This is a set of patches for 2.6.30 to add more s3c24xx machine support and support for the S3C64XX series of SoC.

It would be very useful to get the header moves merged as soon as possible, to help clear out the old ARM include directories (and make it easier for the merges from other s3c branches that need to take place in the merge window). As such, they're only moves and should not affect the actual build.

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#1 lore raw

PATCH 1/9 S3C24XX: Move and update IIS headers

From: Ben Dooks <[email protected]>

Move the IIS headers to their correct place.

arch/arm/mach-s3c2410/dma.c +1 -1
index 552b4c7..440c014 100644
@@ -28,7 +28,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 static struct s3c24xx_dma_map __initdata s3c2410_dma_mappings[] = {
arch/arm/mach-s3c2410/include/mach/hardware.h +0 -3
index 74d5a1a..db72beb 100644
@@ -131,7 +131,4 @@ extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state);
 
 /* machine specific hardware definitions should go after this */
 
-/* currently here until moved into config (todo) */
-#define CONFIG_NO_MULTIWORD_IO
-
 #endif /* __ASM_ARCH_HARDWARE_H */
arch/arm/mach-s3c2410/include/mach/io.h +1 -1
index 9813dbf..c477771 100644
@@ -9,7 +9,7 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#include <mach/hardware.h>
+#include <mach/map.h>
 
 #define IO_SPACE_LIMIT 0xffffffff
 
arch/arm/mach-s3c2412/dma.c +2 -2
index 919856c..9e34785 100644
@@ -29,8 +29,8 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-s3c2412-iis.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-s3c2412-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 #define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID }
arch/arm/mach-s3c2440/dma.c +1 -1
index 5b5ee0b..69b6cf3 100644
@@ -28,7 +28,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 static struct s3c24xx_dma_map __initdata s3c2440_dma_mappings[] = {
arch/arm/mach-s3c2443/dma.c +1 -1
index 2a58a4d..8430e58 100644
@@ -29,7 +29,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 #define MAP(x) { \
arch/arm/mach-shark/include/mach/io.h +1 -1
index c5cee82..8ca7d7f 100644
@@ -14,7 +14,7 @@
 #define PCIO_BASE	0xe0000000
 #define IO_SPACE_LIMIT	0xffffffff
 
-#define __io(a)		((void __iomem *)(PCIO_BASE + (a)))
+#define __io(a)		__typesafe_io(PCIO_BASE + (a))
 #define __mem_pci(addr)	(addr)
 
 #endif
arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h new file +72 -0

72 lines not on this page · raw message

arch/arm/plat-s3c24xx/clock-dclk.c +1 -0
index 5b75a79..35219dc 100644
@@ -18,6 +18,7 @@
 
 #include <mach/regs-clock.h>
 #include <mach/regs-gpio.h>
+#include <mach/hardware.h>
 
 #include <plat/clock.h>
 #include <plat/cpu.h>
arch/arm/plat-s3c24xx/include/plat/regs-iis.h new file +77 -0

77 lines not on this page · raw message

include/asm-arm/plat-s3c24xx/regs-iis.h deleted +0 -77

77 lines not on this page · raw message

include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h deleted +0 -72

72 lines not on this page · raw message

sound/soc/s3c24xx/neo1973_wm8753.c +1 -1
index 45bb12e..286ff44 100644
@@ -33,7 +33,7 @@
 #include <linux/io.h>
 #include <mach/spi-gpio.h>
 
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 
 #include "../codecs/wm8753.h"
 #include "lm4857.h"
sound/soc/s3c24xx/s3c2412-i2s.c +2 -4
index f3fc0ab..36b927d 100644
@@ -22,6 +22,7 @@
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/kernel.h>
+#include <linux/io.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -30,10 +31,7 @@
 #include <sound/soc.h>
 #include <mach/hardware.h>
 
-#include <linux/io.h>
-#include <asm/dma.h>
-
-#include <asm/plat-s3c24xx/regs-s3c2412-iis.h>
+#include <plat/regs-s3c2412-iis.h>
 
 #include <mach/regs-gpio.h>
 #include <mach/audio.h>
sound/soc/s3c24xx/s3c24xx-i2s.c +1 -1
index 6f4d439..2569b91 100644
@@ -34,7 +34,7 @@
 #include <asm/dma.h>
 #include <mach/dma.h>
 
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 
 #include "s3c24xx-pcm.h"
 #include "s3c24xx-i2s.h"
sound/soc/s3c24xx/s3c24xx_uda134x.c +1 -1
index a0a4d18..8e79a41 100644
@@ -22,7 +22,7 @@
 #include <sound/s3c24xx_uda134x.h>
 #include <sound/uda134x.h>
 
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 
 #include "s3c24xx-pcm.h"
 #include "s3c24xx-i2s.h"
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
author
#10 lore raw

Re: [patch 6/9] S3C64XX: Add s3c64xx-i2s support

In reply to Ben Dooks
Quoted 35 lines · Ben Dooks

From: Ben Dooks <[email protected]>

Add the initial code to support the S3C64XX I2S hardware using the s3c-i2s-v2 core code.

Index: linux.git/sound/soc/s3c24xx/Makefile
===================================================================

sound/soc/s3c24xx/Makefile +2 -0
@@ -2,6 +2,7 @@
 snd-soc-s3c24xx-objs := s3c24xx-pcm.o
 snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o
 snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o
+snd-soc-s3c64xx-i2s-objs := s3c64xx-i2s.o
 snd-soc-s3c2443-ac97-objs := s3c2443-ac97.o
 snd-soc-s3c-i2s-v2-objs := s3c-i2s-v2.o
 
@@ -9,6 +10,7 @@ obj-$(CONFIG_SND_S3C24XX_SOC) += snd-soc
 obj-$(CONFIG_SND_S3C24XX_SOC_I2S) += snd-soc-s3c24xx-i2s.o
 obj-$(CONFIG_SND_S3C2443_SOC_AC97) += snd-soc-s3c2443-ac97.o
 obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
+obj-$(CONFIG_SND_S3C64XX_SOC_I2S) += snd-soc-s3c64xx-i2s.o
 obj-$(CONFIG_SND_S3C_I2SV2_SOC) += snd-soc-s3c-i2s-v2.o
 
 # S3C24XX Machine Support

Index: linux.git/sound/soc/s3c24xx/s3c64xx-i2s.c
===================================================================

sound/soc/s3c24xx/s3c64xx-i2s.c new file +3 -0
@@ -0,0 +1,220 @@
+/* sound/soc/s3c24xx/s3c64xx-i2s.c
+ *
+ * ALSA SoC Audio Layer - S3C64XX I2S driver

sound/soc/s3c24xx/s3c64xx-i2s.c line 13

Quoted 10 lines
sound/soc/s3c24xx/s3c64xx-i2s.c new file +10 -0
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <[email protected]>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * 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.
+ */

sorry, forgot to update copyright before sending

Quoted 288 lines
sound/soc/s3c24xx/s3c64xx-i2s.c new file +206 -0
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/io.h>
+
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/initval.h>
+#include <sound/soc.h>
+
+#include <plat/regs-s3c2412-iis.h>
+#include <plat/gpio-bank-d.h>
+#include <plat/gpio-bank-e.h>
+#include <plat/gpio-cfg.h>
+#include <plat/audio.h>
+
+#include <mach/map.h>
+#include <mach/dma.h>
+
+#include "s3c24xx-pcm.h"
+#include "s3c64xx-i2s.h"
+
+static struct s3c2410_dma_client s3c64xx_dma_client_out = {
+	.name		= "I2S PCM Stereo out"
+};
+
+static struct s3c2410_dma_client s3c64xx_dma_client_in = {
+	.name		= "I2S PCM Stereo in"
+};
+
+static struct s3c24xx_pcm_dma_params s3c64xx_i2s_pcm_stereo_out[2] = {
+	[0] = {
+		.channel	= DMACH_I2S0_OUT,
+		.client		= &s3c64xx_dma_client_out,
+		.dma_addr	= S3C64XX_PA_IIS0 + S3C2412_IISTXD,
+		.dma_size	= 4,
+	},
+	[1] = {
+		.channel	= DMACH_I2S1_OUT,
+		.client		= &s3c64xx_dma_client_out,
+		.dma_addr	= S3C64XX_PA_IIS1 + S3C2412_IISTXD,
+		.dma_size	= 4,
+	},
+};
+
+static struct s3c24xx_pcm_dma_params s3c64xx_i2s_pcm_stereo_in[2] = {
+	[0] = {
+		.channel	= DMACH_I2S0_IN,
+		.client		= &s3c64xx_dma_client_in,
+		.dma_addr	= S3C64XX_PA_IIS0 + S3C2412_IISRXD,
+		.dma_size	= 4,
+	},
+	[1] = {
+		.channel	= DMACH_I2S1_IN,
+		.client		= &s3c64xx_dma_client_in,
+		.dma_addr	= S3C64XX_PA_IIS1 + S3C2412_IISRXD,
+		.dma_size	= 4,
+	},
+};
+
+static struct s3c_i2sv2_info s3c64xx_i2s[2];
+
+static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
+{
+	return cpu_dai->private_data;
+}
+
+static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
+				  int clk_id, unsigned int freq, int dir)
+{
+	struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
+	u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
+
+	switch (clk_id) {
+	case S3C64XX_CLKSRC_PCLK:
+		iismod &= ~S3C64XX_IISMOD_IMS_SYSMUX;
+		break;
+
+	case S3C64XX_CLKSRC_MUX:
+		iismod |= S3C64XX_IISMOD_IMS_SYSMUX;
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	writel(iismod, i2s->regs + S3C2412_IISMOD);
+
+	return 0;
+}
+
+
+unsigned long s3c64xx_i2s_get_clockrate(struct snd_soc_dai *dai)
+{
+	struct s3c_i2sv2_info *i2s = to_info(dai);
+
+	return clk_get_rate(i2s->iis_cclk);
+}
+EXPORT_SYMBOL_GPL(s3c64xx_i2s_get_clockrate);
+
+static int s3c64xx_i2s_probe(struct platform_device *pdev,
+			     struct snd_soc_dai *dai)
+{
+	struct device *dev = &pdev->dev;
+	struct s3c_i2sv2_info *i2s;
+	int ret;
+
+	dev_dbg(dev, "%s: probing dai %d\n", __func__, pdev->id);
+
+	if (pdev->id < 0 || pdev->id > ARRAY_SIZE(s3c64xx_i2s)) {
+		dev_err(dev, "id %d out of range\n", pdev->id);
+		return -EINVAL;
+	}
+
+	i2s = &s3c64xx_i2s[pdev->id];
+
+	ret = s3c_i2sv2_probe(pdev, dai, i2s,
+			      pdev->id ? S3C64XX_PA_IIS1 : S3C64XX_PA_IIS0);
+	if (ret)
+		return ret;
+
+	i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id];
+	i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id];
+
+	i2s->iis_cclk = clk_get(dev, "audio-bus");
+	if (IS_ERR(i2s->iis_cclk)) {
+		dev_err(dev, "failed to get audio-bus");
+		iounmap(i2s->regs);
+		return -ENODEV;
+	}
+
+	/* configure GPIO for i2s port */
+	switch (pdev->id) {
+	case 0:
+		s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_I2S0_CLK);
+		s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_I2S0_CDCLK);
+		s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_I2S0_LRCLK);
+		s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_I2S0_DI);
+		s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_I2S0_D0);
+		break;
+	case 1:
+		s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_I2S1_CLK);
+		s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_I2S1_CDCLK);
+		s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_I2S1_LRCLK);
+		s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_I2S1_DI);
+		s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_I2S1_D0);
+	}
+
+	return 0;
+}
+
+
+#define S3C64XX_I2S_RATES \
+	(SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
+	SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
+	SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
+
+#define S3C64XX_I2S_FMTS \
+	(SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE)
+
+struct snd_soc_dai s3c64xx_i2s_dai = {
+	.name		= "s3c64xx-i2s",
+	.id		= 0,
+	.probe		= s3c64xx_i2s_probe,
+	.playback = {
+		.channels_min	= 2,
+		.channels_max	= 2,
+		.rates		= S3C64XX_I2S_RATES,
+		.formats	= S3C64XX_I2S_FMTS,
+	},
+	.capture = {
+		.channels_min	= 2,
+		.channels_max	= 2,
+		.rates		= S3C64XX_I2S_RATES,
+		.formats	= S3C64XX_I2S_FMTS,
+	},
+	.ops = {
+		.set_sysclk	= s3c64xx_i2s_set_sysclk,
+	},
+};
+EXPORT_SYMBOL_GPL(s3c64xx_i2s_dai);
+
+static int __init s3c64xx_i2s_init(void)
+{
+	return  s3c_i2sv2_register_dai(&s3c64xx_i2s_dai);
+}
+module_init(s3c64xx_i2s_init);
+
+static void __exit s3c64xx_i2s_exit(void)
+{
+	snd_soc_unregister_dai(&s3c64xx_i2s_dai);
+}
+module_exit(s3c64xx_i2s_exit);
+
+/* Module information */
+MODULE_AUTHOR("Ben Dooks, <[email protected]>");
+MODULE_DESCRIPTION("S3C64XX I2S SoC Interface");
+MODULE_LICENSE("GPL");
+
+
+

Index: linux.git/sound/soc/s3c24xx/s3c64xx-i2s.h
===================================================================

sound/soc/s3c24xx/s3c64xx-i2s.h new file +31 -0
@@ -0,0 +1,31 @@
+/* sound/soc/s3c24xx/s3c64xx-i2s.h
+ *
+ * ALSA SoC Audio Layer - S3C64XX I2S driver
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <[email protected]>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * 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 __SND_SOC_S3C24XX_S3C64XX_I2S_H
+#define __SND_SOC_S3C24XX_S3C64XX_I2S_H __FILE__
+
+#include "s3c-i2s-v2.h"
+
+#define S3C64XX_DIV_BCLK	S3C_I2SV2_DIV_BCLK
+#define S3C64XX_DIV_RCLK	S3C_I2SV2_DIV_RCLK
+#define S3C64XX_DIV_PRESCALER	S3C_I2SV2_DIV_PRESCALER
+
+#define S3C64XX_CLKSRC_PCLK	(0)
+#define S3C64XX_CLKSRC_MUX	(1)
+
+extern struct snd_soc_dai s3c64xx_i2s_dai;
+
+extern unsigned long s3c64xx_i2s_get_clockrate(struct snd_soc_dai *cpu_dai);
+
+#endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */

Index: linux.git/sound/soc/s3c24xx/Kconfig
===================================================================

sound/soc/s3c24xx/Kconfig +5 -1
@@ -1,6 +1,6 @@
 config SND_S3C24XX_SOC
 	tristate "SoC Audio for the Samsung S3C24XX chips"
-	depends on ARCH_S3C2410
+	depends on ARCH_S3C2410 || ARCH_S3C64XX
 	help
 	  Say Y or M if you want to add support for codecs attached to
 	  the S3C24XX AC97, I2S or SSP interface. You will also need
@@ -16,6 +16,10 @@ config SND_S3C2412_SOC_I2S
 	tristate
 	select SND_S3C_I2SV2_SOC
 
+config SND_S3C64XX_SOC_I2S
+	tristate
+	select SND_S3C_I2SV2_SOC
+
 config SND_S3C2443_SOC_AC97
 	tristate
 	select AC97_BUS

Index: linux.git/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h
===================================================================

arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h +3 -0
@@ -33,6 +33,9 @@
 #define S3C2412_IISCON_RXDMA_ACTIVE	(1 << 1)
 #define S3C2412_IISCON_IIS_ACTIVE	(1 << 0)
 
+#define S3C64XX_IISMOD_IMS_PCLK		(0 << 10)
+#define S3C64XX_IISMOD_IMS_SYSMUX	(1 << 10)
+
 #define S3C2412_IISMOD_MASTER_INTERNAL	(0 << 10)
 #define S3C2412_IISMOD_MASTER_EXTERNAL	(1 << 10)
 #define S3C2412_IISMOD_SLAVE		(2 << 10)
Signature · 8 lines
-- 
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Signature · 5 lines
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#3 lore raw

Re: [patch 2/9] JIVE: Add ASoC audio support

In reply to Ben Dooks

sound/soc/s3c24xx/jive_wm8750.c line 60

Quoted 13 lines · Ben Dooks
sound/soc/s3c24xx/jive_wm8750.c new file +13 -0
+static int jive_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_codec *codec = rtd->socdev->codec;
+
+	snd_soc_dapm_enable_pin(codec, "Headphone Jack");
+	snd_soc_dapm_enable_pin(codec, "Internal Speaker");
+	snd_soc_dapm_enable_pin(codec, "Line In");
+
+	snd_soc_dapm_sync(codec);
+
+	return 0;
+}

As previously mentioned this function should be removed: the default state of pins is that they're enabled and you never disable these pins so there will be no effect.

sound/soc/s3c24xx/jive_wm8750.c line 136

Quoted 7 lines
sound/soc/s3c24xx/jive_wm8750.c new file +7 -0
+	/* These endpoints are not being used. */
+	snd_soc_dapm_disable_pin(codec, "LINPUT2");
+	snd_soc_dapm_disable_pin(codec, "RINPUT2");
+	snd_soc_dapm_disable_pin(codec, "LINPUT3");
+	snd_soc_dapm_disable_pin(codec, "RINPUT3");
+	snd_soc_dapm_disable_pin(codec, "OUT3");
+	snd_soc_dapm_disable_pin(codec, "MONO");

Should be snd_soc_dapm_nc_pin().

sound/soc/s3c24xx/jive_wm8750.c line 190

Quoted 1 line
sound/soc/s3c24xx/jive_wm8750.c new file +1 -0
+	printk("JIVE WM8750 Audio support\n");

Should have KERN_INFO or use pr_info().

#8 lore raw

Re: [patch 5/9] S3C: Split s3c2412-i2s.c into core and SoC specific parts

In reply to Ben Dooks

On Wed, Mar 04, 2009 at 12:49:30AM +0000, Ben Dooks wrote:

I'll apply this, just a few comments in passing (I'll probably fix these up myself).

Quoted 7 lines

The S3C2412 I2S (IIS) interface is replicated on further Samsung SoC parts in a broadly compatible way, so split the common code out into a core called s3c-i2s-v2.[ch] so that the newer SoCs such as the S3C6410 can make use of it.

As such, all the original s3c2412 functions are currently being left with their original names, and will be renamed later in the series.

This does a bit more than the patch description says - it also adds bits of code for S3C64xx.

sound/soc/s3c24xx/s3c-i2s-v2.c line 47

Quoted 5 lines
sound/soc/s3c24xx/s3c-i2s-v2.c new file +5 -0
+#if S3C2412_I2S_DEBUG
+#define DBG(x...) printk(KERN_INFO x)
+#else
+#define DBG(x...) do { } while (0)
+#endif

This should be pr_dbg() (the original file had that fixed).

Quoted 1 line

+#define bit_set(v, b) (((v) & (b)) ? 1 : 0)

This feels like it should be in some standard header but it isn't. Ho hum.

sound/soc/s3c24xx/s3c-i2s-v2.c line 293

Quoted 4 lines
sound/soc/s3c24xx/s3c-i2s-v2.c new file +4 -0
+	default:
+		DBG("unknwon master/slave format\n");
+		return -EINVAL;
+	}

Should be an unconditional error message.

sound/soc/s3c24xx/s3c-i2s-v2.c line 310

Quoted 4 lines
sound/soc/s3c24xx/s3c-i2s-v2.c new file +4 -0
+	default:
+		DBG("Unknown data format\n");
+		return -EINVAL;
+	}

Ditto.

#11 lore raw

Re: [patch 6/9] S3C64XX: Add s3c64xx-i2s support

In reply to Ben Dooks
Quoted 6 lines · Ben Dooks

From: Ben Dooks <[email protected]>

Add the initial code to support the S3C64XX I2S hardware using the s3c-i2s-v2 core code.

I'll apply this, just one little comment for future reference:

sound/soc/s3c24xx/s3c64xx-i2s.c line 175

Quoted 4 lines
sound/soc/s3c24xx/s3c64xx-i2s.c new file +4 -0
+#define S3C64XX_I2S_RATES \
+	(SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
+	SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
+	SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)

Could do SNDDRV_PCM_RATE_8000_96000 here.

#13 lore raw

Re: [patch 7/9] ASoC: Ensure codec check hw_write error at probe

In reply to Ben Dooks
Quoted 4 lines · Ben Dooks

Add checks to see if wmXXXX_reset() failed and notify the user of the problem. This is generally due to a problem on the i2c bus such as an un-powered or non-connected codec.

This doesn't apply against the current branch (and similar changes have already been merged anyway).

#15 lore raw

Re: [patch 8/9] SMDK6410: Add support for WM8731 on an add-on board

In reply to Ben Dooks
Quoted 4 lines · Ben Dooks

Add support for an WM8731 connected to an SMDK6410 instead of the onboard codec.

Is there any plan to make this board generally available? IIRC it was a flying wire board rather than a plugin for the baseband connector on the SMDK6410. I'd prefer not to start merging flying wire systems since the numbers tend to multiply (I do rather a lot myself!).

sound/soc/s3c24xx/smdk6410-wm8731.c line 29

Quoted 4 lines
sound/soc/s3c24xx/smdk6410-wm8731.c new file +4 -0
+static void wm_shutdown(struct snd_pcm_substream *substream)
+{
+	printk(KERN_INFO "%s: substream %p\n", __func__, substream);
+}

This and several of the other printks in the driver are a bit chatty... pr_dbg()?

sound/soc/s3c24xx/smdk6410-wm8731.c line 43

Quoted 1 line
sound/soc/s3c24xx/smdk6410-wm8731.c new file +1 -0
+	//fmt = SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;

C++ comment.

sound/soc/s3c24xx/smdk6410-wm8731.c line 182

Quoted 4 lines
sound/soc/s3c24xx/smdk6410-wm8731.c new file +4 -0
+struct wm8731_setup_data wm_setup = {
+	.i2c_bus	= 0,
+	.i2c_address	= 0x1a,
+};

This won't build with current git - the WM8731 has been refactored to probe using the standard I2C registration stuff. See the driver in atmel/sam9g20_wm8731.c for an example, essentially all that needs doing is to remove the struct here.

#17 lore raw
In reply to Ben Dooks
Quoted 3 lines · Ben Dooks

This is a set of patches for 2.6.30 to add more s3c24xx machine support and support for the S3C64XX series of SoC.

I've merged everything I didn't specifically comment on, plus some of the rest. I also added JIVE and fixed the review issues myself. Thanks a lot for doing this!

As previously discussed I'll update my IISv4 driver from the Samsung BSP for mainline and take care of AC97 and the on board audio for the SMDK6410 too.

Quoted 6 lines

It would be very useful to get the header moves merged as soon as possible, to help clear out the old ARM include directories (and make it easier for the merges from other s3c branches that need to take place in the merge window). As such, they're only moves and should not affect the actual build.

Takashi, what do you think about this? Should I send a 2.6.29 update (it's very late in the game...) or would it be better to deal with this by trying to merge ALSA early in the merge window? Either way works for me.

#18 lore raw

At Wed, 4 Mar 2009 20:29:54 +0000,

Quoted 8 lines · Mark Brown
Quoted 7 lines

It would be very useful to get the header moves merged as soon as possible, to help clear out the old ARM include directories (and make it easier for the merges from other s3c branches that need to take place in the merge window). As such, they're only moves and should not affect the actual build.

Quoted 4 lines

Takashi, what do you think about this? Should I send a 2.6.29 update (it's very late in the game...) or would it be better to deal with this by trying to merge ALSA early in the merge window? Either way works for me.

Me too :) I wouldn't take this for 2.6.29 as long as it builds now, but this particular change should go through ARM tree, so it's rather Russell's call. Could you forward this one?

The others are applied fine to sound tree as 2.6.30 changes.

thanks,

Takashi

#19 lore raw
Quoted 5 lines · Takashi Iwai

Me too :) I wouldn't take this for 2.6.29 as long as it builds now, but this particular change should go through ARM tree, so it's rather Russell's call. Could you forward this one?

The others are applied fine to sound tree as 2.6.30 changes.

Ordinarily it should go through the ARM tree but due to the addition of the S3C64xx support it would create merge issues to separate it out - most of the other patches in the series depend on this in one way or another. Ben is the maintainer for the general Samsung processor support and this header move is part of a general reorgansation of ARM headers from include/asm-arm into arch/arm so it was expected and should be entirely uncontrovesial.

I could separate it out and push a separate branch via Russell as well but that'd make more work for him and he's been having some very bad network problems in addition to all the stuff he normally has to do so I'm not sure he'd welcome more work right now.

#20 lore raw

At Thu, 5 Mar 2009 10:31:12 +0000,

Quoted 9 lines · Mark Brown
Quoted 5 lines · Takashi Iwai

Me too :) I wouldn't take this for 2.6.29 as long as it builds now, but this particular change should go through ARM tree, so it's rather Russell's call. Could you forward this one?

The others are applied fine to sound tree as 2.6.30 changes.

Quoted 7 lines

Ordinarily it should go through the ARM tree but due to the addition of the S3C64xx support it would create merge issues to separate it out - most of the other patches in the series depend on this in one way or another. Ben is the maintainer for the general Samsung processor support and this header move is part of a general reorgansation of ARM headers from include/asm-arm into arch/arm so it was expected and should be entirely uncontrovesial.

Fair enough.

Quoted 4 lines

I could separate it out and push a separate branch via Russell as well but that'd make more work for him and he's been having some very bad network problems in addition to all the stuff he normally has to do so I'm not sure he'd welcome more work right now.

Then it must be OK to keep the changes in our tree. Though, it'd be nice to have Russell's ack beforehand.
Maybe we can separate the header-move patch to another branch so that he can pull it in easily if needed.

thanks,

Takashi

#21 lore raw
Quoted 11 lines · Takashi Iwai
Quoted 4 lines · Mark Brown

I could separate it out and push a separate branch via Russell as well but that'd make more work for him and he's been having some very bad network problems in addition to all the stuff he normally has to do so I'm not sure he'd welcome more work right now.

Then it must be OK to keep the changes in our tree. Though, it'd be nice to have Russell's ack beforehand.
Maybe we can separate the header-move patch to another branch so that he can pull it in easily if needed.

OK, I'll create the separate branch and merge it into the branch I push to you - Ben, I guess it'll be best to merge that one into whatever you push to Russell?

author
#22 lore raw
Quoted 8 lines · Mark Brown
Quoted 6 lines · Takashi Iwai
Quoted 4 lines · Mark Brown

I could separate it out and push a separate branch via Russell as well but that'd make more work for him and he's been having some very bad network problems in addition to all the stuff he normally has to do so I'm not sure he'd welcome more work right now.

Quoted 8 lines
Quoted 4 lines

Then it must be OK to keep the changes in our tree. Though, it'd be nice to have Russell's ack beforehand.
Maybe we can separate the header-move patch to another branch so that he can pull it in easily if needed.

OK, I'll create the separate branch and merge it into the branch I push to you - Ben, I guess it'll be best to merge that one into whatever you push to Russell?

At the moment this is still in your for-2.6.30 branch, do I need to look at doing anything about it?

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#23 lore raw
Quoted 2 lines · Ben Dooks

At the moment this is still in your for-2.6.30 branch, do I need to look at doing anything about it?

I've pushed a revert of the two hunks I mentioned to Takashi already. If you could comment on the other two hunks I identified and provide a revert patch for them as well if they're not required that would be helpful - if they're not essential for this change they should be submitted separately via the ARM tree.