Skip to contentSkip to conversation

Separate common pxa2xx-ac97 code

PATCH In review Dmitry Baryshkov 3 participants 13 messages Sep 10, 2008 – Sep 12, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 Separate common pxa2xx-ac97 code

ASoC and non-ASoC drivers for ACLINK on PXA share lot's of common code. Move all common code into separate module snd-pxa2xx-lib.

---
 include/sound/pxa2xx-lib.h  |   20 +++
 sound/arm/Kconfig           |    6 +-
 sound/arm/Makefile          |    3 +
 sound/arm/pxa2xx-ac97-lib.c |  323 +++++++++++++++++++++++++++++++++++++++++++
 sound/arm/pxa2xx-ac97.c     |  247 +++------------------------------
 sound/soc/pxa/Kconfig       |    2 +
 sound/soc/pxa/pxa2xx-ac97.c |  272 ++-----------------------------------
 7 files changed, 380 insertions(+), 493 deletions(-)
 create mode 100644 include/sound/pxa2xx-lib.h
 create mode 100644 sound/arm/pxa2xx-ac97-lib.c
include/sound/pxa2xx-lib.h new file +20 -0
new file mode 100644
index 0000000..d18dd2d
@@ -0,0 +1,20 @@
+#ifndef PXA2XX_LIB_H
+#define PXA2XX_LIB_H
+
+#include <linux/platform_device.h>
+#include <sound/ac97_codec.h>
+
+extern unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
+extern void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
+
+extern bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97);
+extern bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97);
+extern void pxa2xx_ac97_finish_reset(struct snd_ac97 *ac97);
+
+extern int pxa2xx_ac97_hw_suspend(void);
+extern int pxa2xx_ac97_hw_resume(void);
+
+extern int pxa2xx_ac97_hw_probe(struct platform_device *dev);
+extern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
+
+#endif
sound/arm/Kconfig +5 -1
index 351e19e..3fd2642 100644
@@ -32,11 +32,15 @@ config SND_PXA2XX_PCM
 	tristate
 	select SND_PCM
 
+config SND_PXA2XX_LIB
+	tristate
+	select SND_AC97_CODEC
+
 config SND_PXA2XX_AC97
 	tristate "AC97 driver for the Intel PXA2xx chip"
 	depends on ARCH_PXA
 	select SND_PXA2XX_PCM
-	select SND_AC97_CODEC
+	select SND_PXA2XX_LIB
 	help
 	  Say Y or M if you want to support any AC97 codec attached to
 	  the PXA2xx AC97 interface.
sound/arm/Makefile +3 -0
index 4ef6dd0..bb2ed88 100644
@@ -11,5 +11,8 @@ snd-aaci-objs			:= aaci.o devdma.o
 obj-$(CONFIG_SND_PXA2XX_PCM)	+= snd-pxa2xx-pcm.o
 snd-pxa2xx-pcm-objs		:= pxa2xx-pcm.o
 
+obj-$(CONFIG_SND_PXA2XX_LIB)	+= snd-pxa2xx-lib.o
+snd-pxa2xx-lib-objs		:= pxa2xx-ac97-lib.o
+
 obj-$(CONFIG_SND_PXA2XX_AC97)	+= snd-pxa2xx-ac97.o
 snd-pxa2xx-ac97-objs		:= pxa2xx-ac97.o
sound/arm/pxa2xx-ac97-lib.c new file +323 -0

323 lines not on this page · raw message

sound/arm/pxa2xx-ac97.c +18 -229

310 lines not on this page · raw message

sound/soc/pxa/Kconfig +2 -0
index 9212c37..d1ccbdc 100644
@@ -13,6 +13,8 @@ config SND_PXA2XX_AC97
 config SND_PXA2XX_SOC_AC97
 	tristate
 	select AC97_BUS
+	select SND_ARM
+	select SND_PXA2XX_LIB
 	select SND_SOC_AC97_BUS
 
 config SND_PXA2XX_SOC_I2S
sound/soc/pxa/pxa2xx-ac97.c +9 -263

319 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 2/4 pxa2xx-ac97-lib: support building for several CPUs

Support building of pxa2xx-ac97-lib for several CPUs by making code run-time selected, not only compile-time.

---
 sound/arm/pxa2xx-ac97-lib.c |  215 +++++++++++++++++++++++++++----------------
 1 files changed, 137 insertions(+), 78 deletions(-)
sound/arm/pxa2xx-ac97-lib.c +137 -78
index 61cf41f..61aee0b 100644
@@ -29,9 +29,7 @@ static DEFINE_MUTEX(car_mutex);
 static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
 static volatile long gsr_bits;
 static struct clk *ac97_clk;
-#ifdef CONFIG_PXA27x
 static struct clk *ac97conf_clk;
-#endif
 
 /*
  * Beware PXA27x bugs:
@@ -51,14 +49,10 @@ unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 	mutex_lock(&car_mutex);
 
 	/* set up primary or secondary codec space */
-#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
-	reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
-#else
-	if (reg == AC97_GPIO_STATUS)
+	if ((cpu_is_pxa21x() || cpu_is_pxa25x()) && reg == AC97_GPIO_STATUS)
 		reg_addr = ac97->num ? &SMC_REG_BASE : &PMC_REG_BASE;
 	else
 		reg_addr = ac97->num ? &SAC_REG_BASE : &PAC_REG_BASE;
-#endif
 	reg_addr += (reg >> 1);
 
 	/* start read access across the ac97 link */
@@ -94,14 +88,10 @@ void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short
 	mutex_lock(&car_mutex);
 
 	/* set up primary or secondary codec space */
-#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
-	reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE;
-#else
-	if (reg == AC97_GPIO_STATUS)
+	if ((cpu_is_pxa21x() || cpu_is_pxa25x()) && reg == AC97_GPIO_STATUS)
 		reg_addr = ac97->num ? &SMC_REG_BASE : &PMC_REG_BASE;
 	else
 		reg_addr = ac97->num ? &SAC_REG_BASE : &PAC_REG_BASE;
-#endif
 	reg_addr += (reg >> 1);
 
 	GSR = GSR_CDONE | GSR_SDONE;
@@ -116,14 +106,33 @@ void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short
 }
 EXPORT_SYMBOL_GPL(pxa2xx_ac97_write);
 
-bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97)
+#ifdef CONFIG_PXA25x
+static inline void pxa_ac97_warm_pxa25x(void)
 {
-#ifdef CONFIG_PXA3xx
-	int timeout = 100;
-#endif
 	gsr_bits = 0;
 
+	GCR |= GCR_WARM_RST | GCR_PRIRDY_IEN | GCR_SECRDY_IEN;
+	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
+}
+
+static inline void pxa_ac97_cold_pxa25x(void)
+{
+	GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
+	GCR &= ~GCR_COLD_RST;  /* then assert nCRST */
+
+	gsr_bits = 0;
+
+	GCR = GCR_COLD_RST;
+	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
+	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
+}
+#endif
+
 #ifdef CONFIG_PXA27x
+static inline void pxa_ac97_warm_pxa27x(void)
+{
+	gsr_bits = 0;
+
 	/* warm reset broken on Bulverde,
 	   so manually keep AC97 reset high */
 	pxa_gpio_mode(113 | GPIO_OUT | GPIO_DFLT_HIGH);
@@ -131,30 +140,39 @@ bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97)
 	GCR |= GCR_WARM_RST;
 	pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
 	udelay(500);
-#elif defined(CONFIG_PXA3xx)
-	/* Can't use interrupts */
-	GCR |= GCR_WARM_RST;
-	while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
-		mdelay(1);
-#else
-	GCR |= GCR_WARM_RST | GCR_PRIRDY_IEN | GCR_SECRDY_IEN;
-	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
+}
+
+static inline void pxa_ac97_cold_pxa27x(void)
+{
+	GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
+	GCR &= ~GCR_COLD_RST;  /* then assert nCRST */
+
+	gsr_bits = 0;
+
+	/* PXA27x Developers Manual section 13.5.2.2.1 */
+	clk_enable(ac97conf_clk);
+	udelay(5);
+	clk_disable(ac97conf_clk);
+	GCR = GCR_COLD_RST;
+	udelay(50);
+}
 #endif
 
-	if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) {
-		printk(KERN_INFO "%s: warm reset timeout (GSR=%#lx)\n",
-				 __func__, gsr_bits);
+#ifdef CONFIG_PXA3xx
+static inline void pxa_ac97_warm_pxa3xx(void)
+{
+	int timeout = 100;
 
-		return false;
-	}
+	gsr_bits = 0;
 
-	return true;
+	/* Can't use interrupts */
+	GCR |= GCR_WARM_RST;
+	while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
+		mdelay(1);
 }
-EXPORT_SYMBOL_GPL(pxa2xx_ac97_try_warm_reset);
 
-bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97)
+static inline void pxa_ac97_cold_pxa3xx(void)
 {
-#ifdef CONFIG_PXA3xx
 	int timeout = 1000;
 
 	/* Hold CLKBPB for 100us */
@@ -162,31 +180,69 @@ bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97)
 	GCR = GCR_CLKBPB;
 	udelay(100);
 	GCR = 0;
-#endif
 
 	GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
 	GCR &= ~GCR_COLD_RST;  /* then assert nCRST */
 
 	gsr_bits = 0;
-#ifdef CONFIG_PXA27x
-	/* PXA27x Developers Manual section 13.5.2.2.1 */
-	clk_enable(ac97conf_clk);
-	udelay(5);
-	clk_disable(ac97conf_clk);
-	GCR = GCR_COLD_RST;
-	udelay(50);
-#elif defined(CONFIG_PXA3xx)
+
 	/* Can't use interrupts on PXA3xx */
 	GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
 
 	GCR = GCR_WARM_RST | GCR_COLD_RST;
 	while (!(GSR & (GSR_PCR | GSR_SCR)) && timeout--)
 		mdelay(10);
-#else
-	GCR = GCR_COLD_RST;
-	GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
-	wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
+}
+#endif
+
+bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97)
+{
+#ifdef CONFIG_PXA25x
+	if (cpu_is_pxa21x() || cpu_is_pxa25x())
+		pxa_ac97_warm_pxa25x();
+	else
+#endif
+#ifdef CONFIG_PXA27x
+	if (cpu_is_pxa27x())
+		pxa_ac97_warm_pxa27x();
+	else
+#endif
+#ifdef CONFIG_PXA3XX
+	if (cpu_is_pxa3xx())
+		pxa_ac97_warm_pxa3xx();
+	else
+#endif
+		BUG();
+
+	if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) {
+		printk(KERN_INFO "%s: warm reset timeout (GSR=%#lx)\n",
+				 __func__, gsr_bits);
+
+		return false;
+	}
+
+	return true;
+}
+EXPORT_SYMBOL_GPL(pxa2xx_ac97_try_warm_reset);
+
+bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97)
+{
+#ifdef CONFIG_PXA25x
+	if (cpu_is_pxa21x() || cpu_is_pxa25x())
+		pxa_ac97_cold_pxa25x();
+	else
+#endif
+#ifdef CONFIG_PXA27x
+	if (cpu_is_pxa27x())
+		pxa_ac97_cold_pxa27x();
+	else
 #endif
+#ifdef CONFIG_PXA3XX
+	if (cpu_is_pxa3xx())
+		pxa_ac97_cold_pxa3xx();
+	else
+#endif
+		BUG();
 
 	if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) {
 		printk(KERN_INFO "%s: cold reset timeout (GSR=%#lx)\n",
@@ -217,14 +273,14 @@ static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id)
 		gsr_bits |= status;
 		wake_up(&gsr_wq);
 
-#ifdef CONFIG_PXA27x
 		/* Although we don't use those we still need to clear them
 		   since they tend to spuriously trigger when MMC is used
 		   (hardware bug? go figure)... */
-		MISR = MISR_EOC;
-		PISR = PISR_EOC;
-		MCSR = MCSR_EOC;
-#endif
+		if (cpu_is_pxa27x()) {
+			MISR = MISR_EOC;
+			PISR = PISR_EOC;
+			MCSR = MCSR_EOC;
+		}
 
 		return IRQ_HANDLED;
 	}
@@ -243,14 +299,16 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_suspend);
 
 int pxa2xx_ac97_hw_resume(void)
 {
-	pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
-	pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
-	pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
-	pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
-#ifdef CONFIG_PXA27x
-	/* Use GPIO 113 as AC97 Reset on Bulverde */
-	pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
-#endif
+	if (cpu_is_pxa21x() || cpu_is_pxa25x() || cpu_is_pxa27x()) {
+		pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
+		pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
+		pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
+		pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
+	}
+	if (cpu_is_pxa27x()) {
+		/* Use GPIO 113 as AC97 Reset on Bulverde */
+		pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
+	}
 	clk_enable(ac97_clk);
 	return 0;
 }
@@ -265,20 +323,23 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
 	if (ret < 0)
 		goto err;
 
-	pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
-	pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
-	pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
-	pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
-#ifdef CONFIG_PXA27x
-	/* Use GPIO 113 as AC97 Reset on Bulverde */
-	pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
-	ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
-	if (IS_ERR(ac97conf_clk)) {
-		ret = PTR_ERR(ac97conf_clk);
-		ac97conf_clk = NULL;
-		goto err_irq;
+	if (cpu_is_pxa21x() || cpu_is_pxa25x() || cpu_is_pxa27x()) {
+		pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
+		pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
+		pxa_gpio_mode(GPIO28_BITCLK_AC97_MD);
+		pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
+	}
+
+	if (cpu_is_pxa27x()) {
+		/* Use GPIO 113 as AC97 Reset on Bulverde */
+		pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
+		ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
+		if (IS_ERR(ac97conf_clk)) {
+			ret = PTR_ERR(ac97conf_clk);
+			ac97conf_clk = NULL;
+			goto err_irq;
+		}
 	}
-#endif
 
 	ac97_clk = clk_get(&dev->dev, "AC97CLK");
 	if (IS_ERR(ac97_clk)) {
@@ -291,12 +352,10 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
 
 err_irq:
 	GCR |= GCR_ACLINK_OFF;
-#ifdef CONFIG_PXA27x
 	if (ac97conf_clk) {
 		clk_put(ac97conf_clk);
 		ac97conf_clk = NULL;
 	}
-#endif
 	free_irq(IRQ_AC97, NULL);
 err:
 	return ret;
@@ -307,10 +366,10 @@ void pxa2xx_ac97_hw_remove(struct platform_device *dev)
 {
 	GCR |= GCR_ACLINK_OFF;
 	free_irq(IRQ_AC97, NULL);
-#ifdef CONFIG_PXA27x
-	clk_put(ac97conf_clk);
-	ac97conf_clk = NULL;
-#endif
+	if (ac97conf_clk) {
+		clk_put(ac97conf_clk);
+		ac97conf_clk = NULL;
+	}
 	clk_disable(ac97_clk);
 	clk_put(ac97_clk);
 	ac97_clk = NULL;
Signature · 1 line
1.5.6.5
#2 lore raw

PATCH 3/4 pxa2xx-i2s: support runtime selection of correct cpu.

---
 sound/soc/pxa/pxa2xx-i2s.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
sound/soc/pxa/pxa2xx-i2s.c +5 -5
index c796b18..21ca3fe 100644
@@ -65,11 +65,6 @@ static struct pxa2xx_gpio gpio_bus[] = {
 		.frm = GPIO31_SYNC_I2S_MD,
 	},
 	{ /* I2S SoC Master */
-#ifdef CONFIG_PXA27x
-		.sys = GPIO113_I2S_SYSCLK_MD,
-#else
-		.sys = GPIO32_SYSCLK_I2S_MD,
-#endif
 		.rx = GPIO29_SDATA_IN_I2S_MD,
 		.tx = GPIO30_SDATA_OUT_I2S_MD,
 		.clk = GPIO28_BITCLK_OUT_I2S_MD,
@@ -343,6 +338,11 @@ static struct platform_driver pxa2xx_i2s_driver = {
 
 static int __init pxa2xx_i2s_init(void)
 {
+	if (cpu_is_pxa27x())
+		gpio_bus[1].sys = GPIO113_I2S_SYSCLK_MD;
+	else
+		gpio_bus[1].sys = GPIO32_SYSCLK_I2S_MD;
+
 	clk_i2s = ERR_PTR(-ENOENT);
 	return platform_driver_register(&pxa2xx_i2s_driver);
 }
Signature · 1 line
1.5.6.5
#3 lore raw

PATCH 4/4 Separate common pxa2xx-pcm code

ASoC and non-ASoC drivers for PCM DMA on PXA share lot's of common code. Move it to pxa2xx-lib.

---
 include/sound/pxa2xx-lib.h                         |   25 ++
 sound/arm/Kconfig                                  |    7 +-
 sound/arm/Makefile                                 |    3 +-
 .../{soc/pxa/pxa2xx-pcm.c => arm/pxa2xx-pcm-lib.c} |  247 ++++++-------------
 sound/arm/pxa2xx-pcm.c                             |  252 +------------------
 sound/arm/pxa2xx-pcm.h                             |   13 +-
 sound/soc/pxa/Kconfig                              |    3 +-
 sound/soc/pxa/pxa2xx-i2s.c                         |   10 +
 sound/soc/pxa/pxa2xx-pcm.c                         |  261 +-------------------
 sound/soc/pxa/pxa2xx-pcm.h                         |   15 --
 10 files changed, 143 insertions(+), 693 deletions(-)
 copy sound/{soc/pxa/pxa2xx-pcm.c => arm/pxa2xx-pcm-lib.c} (52%)
include/sound/pxa2xx-lib.h +25 -0
index d18dd2d..2fd3d25 100644
@@ -4,6 +4,31 @@
 #include <linux/platform_device.h>
 #include <sound/ac97_codec.h>
 
+/* PCM */
+
+struct pxa2xx_pcm_dma_params {
+	char *name;			/* stream identifier */
+	u32 dcmd;			/* DMA descriptor dcmd field */
+	volatile u32 *drcmr;		/* the DMA request channel to use */
+	u32 dev_addr;			/* device physical address for DMA */
+};
+
+extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
+				struct snd_pcm_hw_params *params);
+extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream);
+extern int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
+extern snd_pcm_uframes_t pxa2xx_pcm_pointer(struct snd_pcm_substream *substream);
+extern int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream);
+extern void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id);
+extern int __pxa2xx_pcm_open(struct snd_pcm_substream *substream);
+extern int __pxa2xx_pcm_close(struct snd_pcm_substream *substream);
+extern int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream,
+	struct vm_area_struct *vma);
+extern int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream);
+extern void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm);
+
+/* AC97 */
+
 extern unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
 extern void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
 
sound/arm/Kconfig +5 -2
index 3fd2642..234708e 100644
@@ -34,13 +34,16 @@ config SND_PXA2XX_PCM
 
 config SND_PXA2XX_LIB
 	tristate
-	select SND_AC97_CODEC
+	select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97
+
+config SND_PXA2XX_LIB_AC97
+	bool
 
 config SND_PXA2XX_AC97
 	tristate "AC97 driver for the Intel PXA2xx chip"
 	depends on ARCH_PXA
 	select SND_PXA2XX_PCM
-	select SND_PXA2XX_LIB
+	select SND_PXA2XX_LIB_AC97
 	help
 	  Say Y or M if you want to support any AC97 codec attached to
 	  the PXA2xx AC97 interface.
sound/arm/Makefile +2 -1
index bb2ed88..2054de1 100644
@@ -12,7 +12,8 @@ obj-$(CONFIG_SND_PXA2XX_PCM)	+= snd-pxa2xx-pcm.o
 snd-pxa2xx-pcm-objs		:= pxa2xx-pcm.o
 
 obj-$(CONFIG_SND_PXA2XX_LIB)	+= snd-pxa2xx-lib.o
-snd-pxa2xx-lib-objs		:= pxa2xx-ac97-lib.o
+snd-pxa2xx-lib-y		:= pxa2xx-pcm-lib.o
+snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_AC97)	+= pxa2xx-ac97-lib.o
 
 obj-$(CONFIG_SND_PXA2XX_AC97)	+= snd-pxa2xx-ac97.o
 snd-pxa2xx-ac97-objs		:= pxa2xx-ac97.o
sound/arm/pxa2xx-pcm-lib.c renamed from sound/soc/pxa/pxa2xx-pcm.c +77 -170

375 lines not on this page · raw message

sound/arm/pxa2xx-pcm.c +8 -244

310 lines not on this page · raw message

sound/arm/pxa2xx-pcm.h +7 -6
index b79f1e8..5c4a4d3 100644
@@ -9,14 +9,15 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <asm/dma.h>
 
-struct pxa2xx_pcm_dma_params {
-	char *name;			/* stream identifier */
-	u32 dcmd;			/* DMA descriptor dcmd field */
-	volatile u32 *drcmr;		/* the DMA request channel to use */
-	u32 dev_addr;			/* device physical address for DMA */
+struct pxa2xx_runtime_data {
+	int dma_ch;
+	struct pxa2xx_pcm_dma_params *params;
+	pxa_dma_desc *dma_desc_array;
+	dma_addr_t dma_desc_array_phys;
 };
-	
+
 struct pxa2xx_pcm_client {
 	struct pxa2xx_pcm_dma_params *playback_params;
 	struct pxa2xx_pcm_dma_params *capture_params;
sound/soc/pxa/Kconfig +2 -1
index d1ccbdc..f8c1cdd 100644
@@ -1,6 +1,7 @@
 config SND_PXA2XX_SOC
 	tristate "SoC Audio for the Intel PXA2xx chip"
 	depends on ARCH_PXA
+	select SND_PXA2XX_LIB
 	help
 	  Say Y or M if you want to add support for codecs attached to
 	  the PXA2xx AC97, I2S or SSP interface. You will also need
@@ -14,7 +15,7 @@ config SND_PXA2XX_SOC_AC97
 	tristate
 	select AC97_BUS
 	select SND_ARM
-	select SND_PXA2XX_LIB
+	select SND_PXA2XX_LIB_AC97
 	select SND_SOC_AC97_BUS
 
 config SND_PXA2XX_SOC_I2S
sound/soc/pxa/pxa2xx-i2s.c +10 -0
index 21ca3fe..39d1921 100644
@@ -21,6 +21,7 @@
 #include <sound/pcm.h>
 #include <sound/initval.h>
 #include <sound/soc.h>
+#include <sound/pxa2xx-lib.h>
 
 #include <mach/hardware.h>
 #include <mach/pxa-regs.h>
@@ -30,6 +31,15 @@
 #include "pxa2xx-pcm.h"
 #include "pxa2xx-i2s.h"
 
+struct pxa2xx_gpio {
+	u32 sys;
+	u32	rx;
+	u32 tx;
+	u32 clk;
+	u32 frm;
+};
+
+
 struct pxa_i2s_port {
 	u32 sadiv;
 	u32 sacr0;
sound/soc/pxa/pxa2xx-pcm.c +7 -254

308 lines not on this page · raw message

sound/soc/pxa/pxa2xx-pcm.h +0 -15
index 54c9c75..60c3b20 100644
@@ -13,21 +13,6 @@
 #ifndef _PXA2XX_PCM_H
 #define _PXA2XX_PCM_H
 
-struct pxa2xx_pcm_dma_params {
-	char *name;			/* stream identifier */
-	u32 dcmd;			/* DMA descriptor dcmd field */
-	volatile u32 *drcmr;		/* the DMA request channel to use */
-	u32 dev_addr;			/* device physical address for DMA */
-};
-
-struct pxa2xx_gpio {
-	u32 sys;
-	u32	rx;
-	u32 tx;
-	u32 clk;
-	u32 frm;
-};
-
 /* platform data */
 extern struct snd_soc_platform pxa2xx_soc_platform;
 
Signature · 1 line
1.5.6.5
#4 lore raw

Re: [PATCH 4/4] Separate common pxa2xx-pcm code

Quoted 4 lines · Dmitry Baryshkov

config SND_PXA2XX_LIB

sound/arm/Kconfig +1 -1
 	tristate
-	select SND_AC97_CODEC
+	select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97

sound/arm/Kconfig config SND_PXA2XX_PCM · line 46

Quoted 10 lines
sound/arm/Kconfig +4 -1
+
+config SND_PXA2XX_LIB_AC97
+	bool
 
 config SND_PXA2XX_AC97
 	tristate "AC97 driver for the Intel PXA2xx chip"
 	depends on ARCH_PXA
 	select SND_PXA2XX_PCM
-	select SND_PXA2XX_LIB
+	select SND_PXA2XX_LIB_AC97

The select on SND_PXA2XX_LIB needs to stay since SND_PXA2XX_LIB_AC97 only does anything if SND_PXA2XX_LIB is selected. Again, I'll fix this up locally.

#5 lore raw

Re: [PATCH 2/4] pxa2xx-ac97-lib: support building for several CPUs

In reply to Dmitry Baryshkov

sound/arm/pxa2xx-ac97-lib.c bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97) · line 214

Quoted 6 lines · Dmitry Baryshkov
sound/arm/pxa2xx-ac97-lib.c +6 -0
+#endif
+#ifdef CONFIG_PXA3XX
+	if (cpu_is_pxa3xx())
+		pxa_ac97_warm_pxa3xx();
+	else
+#endif

Typo, should be CONFIG_PXA3xx (and also in cold reset). Again, I've fixed that up locally. However, PXA3xx support seems broken in some other way, it fails during init - I'll debug this and post updated patches.

#6 lore raw

Re: [PATCH 2/4] pxa2xx-ac97-lib: support building for several CPUs

Quoted 3 lines · Mark Brown

fixed that up locally. However, PXA3xx support seems broken in some other way, it fails during init - I'll debug this and post updated patches.

This was a false alarm, sorry - the machine I was using for testing required some unmerged MFP configuration for AC97 to work.

Signature · 1 line
"You grabbed my hand and we fell into it, like a daydream - or a fever."
#7 lore raw
In reply to Dmitry Baryshkov
Quoted 4 lines · Dmitry Baryshkov

ASoC and non-ASoC drivers for ACLINK on PXA share lot's of common code. Move all common code into separate module snd-pxa2xx-lib.

These look good from code review but I'd like to do some testing on the systems I have here before acking. Could you confirm which platforms you're able to test on?

#8 lore raw
Quoted 9 lines · Mark Brown
Quoted 4 lines · Dmitry Baryshkov

ASoC and non-ASoC drivers for ACLINK on PXA share lot's of common code. Move all common code into separate module snd-pxa2xx-lib.

These look good from code review but I'd like to do some testing on the systems I have here before acking. Could you confirm which platforms you're able to test on?

Slightly tested on pxa255 (tosa, kernel compiled with support for all pxa models) and pxa27x (spitz under qemu, same kernel).

Signature · 2 lines
With best wishes
Dmitry
#9 lore raw
Quoted 5 lines · Dmitry Baryshkov
Quoted 4 lines · Mark Brown
Quoted 3 lines · Dmitry Baryshkov

ASoC and non-ASoC drivers for ACLINK on PXA share lot's of common code. Move all common code into separate module snd-pxa2xx-lib.

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

These look good from code review but I'd like to do some testing on the systems I have here before acking. Could you confirm which platforms you're able to test on?

Slightly tested on pxa255 (tosa, kernel compiled with support for all pxa models) and pxa27x (spitz under qemu, same kernel).

I'd prefer some real hardware for pxa27x since it has some different AC97 silicon errata. However, since there are no pxa27x volunteers we should upstream and wait for any unlikely pxa27x issues in the 2.6.28-rc series.

Acked-by Liam Girdwood <[email protected]>

Liam

#10 lore raw
Quoted 4 lines · Liam Girdwood

I'd prefer some real hardware for pxa27x since it has some different AC97 silicon errata. However, since there are no pxa27x volunteers we should upstream and wait for any unlikely pxa27x issues in the 2.6.28-rc series.

I've got a PXA27x sitting here, I'll test then push to Takashi assuming I don't run into any problems.

#11 lore raw
In reply to Dmitry Baryshkov

sound/arm/Kconfig config SND_PXA2XX_PCM · line 44

Quoted 11 lines · Dmitry Baryshkov
sound/arm/Kconfig +5 -1
+config SND_PXA2XX_LIB
+	tristate
+	select SND_AC97_CODEC
+
 config SND_PXA2XX_AC97
 	tristate "AC97 driver for the Intel PXA2xx chip"
 	depends on ARCH_PXA
 	select SND_PXA2XX_PCM
-	select SND_AC97_CODEC
+	select SND_PXA2XX_LIB
 	help

Since select ignores dependency information in the selected thing the select for SND_AC97_CODEC needs to stay in SND_PXA2XX_AC97. I'll fix this up locally.

author
#12 lore raw

2008/9/11 Mark Brown <[email protected]>:

Quoted 18 lines · Dmitry Baryshkov

sound/arm/Kconfig config SND_PXA2XX_PCM · line 44

Quoted 12 lines
sound/arm/Kconfig +5 -1
+config SND_PXA2XX_LIB
+     tristate
+     select SND_AC97_CODEC
+
 config SND_PXA2XX_AC97
      tristate "AC97 driver for the Intel PXA2xx chip"
      depends on ARCH_PXA
      select SND_PXA2XX_PCM
-     select SND_AC97_CODEC
+     select SND_PXA2XX_LIB
      help

Since select ignores dependency information in the selected thing the select for SND_AC97_CODEC needs to stay in SND_PXA2XX_AC97. I'll fix this up locally.

Fine with me, thanks!

Signature · 2 lines
With best wishes
Dmitry