All of lore.kernel.org
 help / color / mirror / Atom feed
* ASoC: pxa2xx-ssp
@ 2008-10-24  0:54 Daniel Ribeiro
  2008-10-24 15:54 ` Liam Girdwood
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Ribeiro @ 2008-10-24  0:54 UTC (permalink / raw)
  To: alsa-devel

Hi!

What is needed for [0] to be accepted on mainline linux?

[0]http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-asoc.git;a=blob;f=sound/soc/pxa/pxa2xx-ssp.c;h=6b1baeece184e990c4254e2f43495013d4562c95;hb=e4d89cdd854b4a40c963adf434d261070c67b6bb

-- 
Daniel Ribeiro

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ASoC: pxa2xx-ssp
  2008-10-24  0:54 ASoC: pxa2xx-ssp Daniel Ribeiro
@ 2008-10-24 15:54 ` Liam Girdwood
  2008-10-24 18:14   ` Mark Brown
  2008-10-25  5:32   ` Daniel Ribeiro
  0 siblings, 2 replies; 10+ messages in thread
From: Liam Girdwood @ 2008-10-24 15:54 UTC (permalink / raw)
  To: Daniel Ribeiro; +Cc: alsa-devel, Mark Brown

On Thu, 2008-10-23 at 22:54 -0200, Daniel Ribeiro wrote:
> Hi!
> 
> What is needed for [0] to be accepted on mainline linux?
> 
> [0]http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-asoc.git;a=blob;f=sound/soc/pxa/pxa2xx-ssp.c;h=6b1baeece184e990c4254e2f43495013d4562c95;hb=e4d89cdd854b4a40c963adf434d261070c67b6bb
> 

When I last worked on this it was in need of updates for SSP register
IO, clk API and more testing. It has the IO and clk stuff now.

Does this code work well on your platform/board ?

If so, I guess we could scratch off the more testing part and consider
it for the next merge window. Iirc it was also waiting on some pxa
dependencies going upstream, so it may wait a little longer.

I'm sure it's on Mark's long todo list....

Liam 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ASoC: pxa2xx-ssp
  2008-10-24 15:54 ` Liam Girdwood
@ 2008-10-24 18:14   ` Mark Brown
  2008-10-25  5:32   ` Daniel Ribeiro
  1 sibling, 0 replies; 10+ messages in thread
From: Mark Brown @ 2008-10-24 18:14 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, Daniel Ribeiro

On Fri, Oct 24, 2008 at 04:54:38PM +0100, Liam Girdwood wrote:

> If so, I guess we could scratch off the more testing part and consider
> it for the next merge window. Iirc it was also waiting on some pxa
> dependencies going upstream, so it may wait a little longer.

Yes, the only reason it's not been submitted yet is the cross tree
merging with ARM.  The last of that stuff should have gone in in the
current merge window - it should have gone in for .27 but rmk bumped out
a bunch of things at the last minute.

I'm not too worried about the testing since it's not currently in
mainline so there won't be any regressions from it, though obviously any
testing is good.

> I'm sure it's on Mark's long todo list....

Yeah, I was going to look at it sometime next week hopefully since -rc1
is out now.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ASoC: pxa2xx-ssp
  2008-10-24 15:54 ` Liam Girdwood
  2008-10-24 18:14   ` Mark Brown
@ 2008-10-25  5:32   ` Daniel Ribeiro
  2008-10-27 12:47     ` Mark Brown
  1 sibling, 1 reply; 10+ messages in thread
From: Daniel Ribeiro @ 2008-10-25  5:32 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, Mark Brown

[-- Attachment #1: Type: text/plain, Size: 1642 bytes --]

Em Sex, 2008-10-24 às 16:54 +0100, Liam Girdwood escreveu:
> On Thu, 2008-10-23 at 22:54 -0200, Daniel Ribeiro wrote:
> > Hi!
> > 
> > What is needed for [0] to be accepted on mainline linux?
> > 
> > [0]http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-asoc.git;a=blob;f=sound/soc/pxa/pxa2xx-ssp.c;h=6b1baeece184e990c4254e2f43495013d4562c95;hb=e4d89cdd854b4a40c963adf434d261070c67b6bb
> > 
> 
> When I last worked on this it was in need of updates for SSP register
> IO, clk API and more testing. It has the IO and clk stuff now.
> 
> Does this code work well on your platform/board ?

	Not as it is.

	My sound codec needs 32bit ssp frames, even considering that it only
supports 16bit mono/stereo audio. I guess that it works with I2S
emulation mode, which pxa2xx-ssp.c dont support yet.

	After some time trying to understand the very poorly documented I2S/SSP
emulation on the pxa manual, i ended up with [1]. It works perfectly on
my board, with SND_SOC_DAIFMT_MSB.

	To ease your reading, attached is a diff against [0]. It is updated to
build on the latest linus tree and handles DAIFMT_I2S and DAIFMT_MSB
differently.

> 
> If so, I guess we could scratch off the more testing part and consider
> it for the next merge window. Iirc it was also waiting on some pxa
> dependencies going upstream, so it may wait a little longer.
> 
> I'm sure it's on Mark's long todo list....
> 
> Liam 
> 

[1]http://git.openezx.org/?p=openezx.git;a=blob;f=sound/soc/pxa/pxa2xx-ssp.c;h=cdbc15e243094fd232119b342c39be26c8ac4c7d;hb=cacec205c17b9924db3ca625347a33d0ddd2b694

-- 
Daniel Ribeiro

[-- Attachment #2: pxa2xx-ssp-i2s-ezx.patch --]
[-- Type: text/x-patch, Size: 11008 bytes --]

--- /tmp/pxa2xx-ssp.c	2008-10-25 03:22:44.000000000 -0200
+++ pxa2xx-ssp.c	2008-10-24 20:19:29.000000000 -0200
@@ -28,12 +28,13 @@
 #include <sound/initval.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
+#include <sound/pxa2xx-lib.h>
 
-#include <asm/hardware.h>
-#include <asm/arch/pxa-regs.h>
-#include <asm/arch/regs-ssp.h>
-#include <asm/arch/audio.h>
-#include <asm/arch/ssp.h>
+#include <mach/hardware.h>
+#include <mach/pxa-regs.h>
+#include <mach/regs-ssp.h>
+#include <mach/audio.h>
+#include <mach/ssp.h>
 
 #include "pxa2xx-pcm.h"
 #include "pxa2xx-ssp.h"
@@ -58,7 +59,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp1_pcm_mono_out = {
 	.name			= "SSP1 PCM Mono out",
 	.dev_addr		= PXA2xx_SSP1_BASE + SSDR,
-	.drcmr			= &DRCMRTXSSDR,
+	.drcmr			= &DRCMR(14),
 	.dcmd			= DCMD_INCSRCADDR | DCMD_FLOWTRG |
 				  DCMD_BURST16 | DCMD_WIDTH2,
 };
@@ -66,7 +67,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp1_pcm_mono_in = {
 	.name			= "SSP1 PCM Mono in",
 	.dev_addr		= PXA2xx_SSP1_BASE + SSDR,
-	.drcmr			= &DRCMRRXSSDR,
+	.drcmr			= &DRCMR(13),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST16 | DCMD_WIDTH2,
 };
@@ -74,7 +75,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp1_pcm_stereo_out = {
 	.name			= "SSP1 PCM Stereo out",
 	.dev_addr		= PXA2xx_SSP1_BASE + SSDR,
-	.drcmr			= &DRCMRTXSSDR,
+	.drcmr			= &DRCMR(14),
 	.dcmd			= DCMD_INCSRCADDR | DCMD_FLOWTRG |
 				  DCMD_BURST16 | DCMD_WIDTH4,
 };
@@ -82,7 +83,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp1_pcm_stereo_in = {
 	.name			= "SSP1 PCM Stereo in",
 	.dev_addr		= PXA2xx_SSP1_BASE + SSDR,
-	.drcmr			= &DRCMRRXSSDR,
+	.drcmr			= &DRCMR(13),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST16 | DCMD_WIDTH4,
 };
@@ -90,7 +91,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp2_pcm_mono_out = {
 	.name			= "SSP2 PCM Mono out",
 	.dev_addr		= PXA27x_SSP2_BASE + SSDR,
-	.drcmr			= &DRCMRTXSS2DR,
+	.drcmr			= &DRCMR(16),
 	.dcmd			= DCMD_INCSRCADDR | DCMD_FLOWTRG |
 				  DCMD_BURST16 | DCMD_WIDTH2,
 };
@@ -98,7 +99,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp2_pcm_mono_in = {
 	.name			= "SSP2 PCM Mono in",
 	.dev_addr		= PXA27x_SSP2_BASE + SSDR,
-	.drcmr			= &DRCMRRXSS2DR,
+	.drcmr			= &DRCMR(15),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST16 | DCMD_WIDTH2,
 };
@@ -106,7 +107,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp2_pcm_stereo_out = {
 	.name			= "SSP2 PCM Stereo out",
 	.dev_addr		= PXA27x_SSP2_BASE + SSDR,
-	.drcmr			= &DRCMRTXSS2DR,
+	.drcmr			= &DRCMR(16),
 	.dcmd			= DCMD_INCSRCADDR | DCMD_FLOWTRG |
 				  DCMD_BURST16 | DCMD_WIDTH4,
 };
@@ -114,7 +115,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp2_pcm_stereo_in = {
 	.name			= "SSP2 PCM Stereo in",
 	.dev_addr		= PXA27x_SSP2_BASE + SSDR,
-	.drcmr			= &DRCMRRXSS2DR,
+	.drcmr			= &DRCMR(15),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST16 | DCMD_WIDTH4,
 };
@@ -122,7 +123,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp3_pcm_mono_out = {
 	.name			= "SSP3 PCM Mono out",
 	.dev_addr		= PXA27x_SSP3_BASE + SSDR,
-	.drcmr			= &DRCMRTXSS3DR,
+	.drcmr			= &DRCMR(67),
 	.dcmd			= DCMD_INCSRCADDR | DCMD_FLOWTRG |
 				  DCMD_BURST16 | DCMD_WIDTH2,
 };
@@ -130,7 +131,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp3_pcm_mono_in = {
 	.name			= "SSP3 PCM Mono in",
 	.dev_addr		= PXA27x_SSP3_BASE + SSDR,
-	.drcmr			= &DRCMRRXSS3DR,
+	.drcmr			= &DRCMR(66),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST16 | DCMD_WIDTH2,
 };
@@ -138,7 +139,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp3_pcm_stereo_out = {
 	.name			= "SSP3 PCM Stereo out",
 	.dev_addr		= PXA27x_SSP3_BASE + SSDR,
-	.drcmr			= &DRCMRTXSS3DR,
+	.drcmr			= &DRCMR(67),
 	.dcmd			= DCMD_INCSRCADDR | DCMD_FLOWTRG |
 				  DCMD_BURST16 | DCMD_WIDTH4,
 };
@@ -146,7 +147,7 @@
 static struct pxa2xx_pcm_dma_params pxa2xx_ssp3_pcm_stereo_in = {
 	.name			= "SSP3 PCM Stereo in",
 	.dev_addr		= PXA27x_SSP3_BASE + SSDR,
-	.drcmr			= &DRCMRRXSS3DR,
+	.drcmr			= &DRCMR(66),
 	.dcmd			= DCMD_INCTRGADDR | DCMD_FLOWSRC |
 				  DCMD_BURST16 | DCMD_WIDTH4,
 };
@@ -163,7 +164,7 @@
 static int pxa2xx_ssp_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
+	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
 	int ret = 0;
 
 	if (!rtd->dai->cpu_dai->active) {
@@ -179,7 +180,7 @@
 static void pxa2xx_ssp_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
+	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
 
 	if (!cpu_dai->active) {
 		ssp_disable(&ssp[cpu_dai->id]);
@@ -190,7 +191,7 @@
 #ifdef CONFIG_PM
 
 static int pxa2xx_ssp_suspend(struct platform_device *pdev,
-	struct snd_soc_cpu_dai *dai)
+	struct snd_soc_dai *dai)
 {
 	if (!dai->active)
 		return 0;
@@ -201,7 +202,7 @@
 }
 
 static int pxa2xx_ssp_resume(struct platform_device *pdev,
-	struct snd_soc_cpu_dai *dai)
+	struct snd_soc_dai *dai)
 {
 	if (!dai->active)
 		return 0;
@@ -233,7 +234,7 @@
 /*
  * Set the SSP ports SYSCLK.
  */
-static int pxa2xx_ssp_set_dai_sysclk(struct snd_soc_cpu_dai *cpu_dai,
+static int pxa2xx_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 	int clk_id, unsigned int freq, int dir)
 {
 	void __iomem *mmio_base = ssp[cpu_dai->id].ssp->mmio_base;
@@ -283,7 +284,7 @@
 /*
  * Set the SSP clock dividers.
  */
-static int pxa2xx_ssp_set_dai_clkdiv(struct snd_soc_cpu_dai *cpu_dai,
+static int pxa2xx_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
 	int div_id, int div)
 {
 	void __iomem *mmio_base = ssp[cpu_dai->id].ssp->mmio_base;
@@ -313,7 +314,7 @@
 /*
  * Configure the PLL frequency pxa27x and (afaik - pxa320 only)
  */
-static int pxa2xx_ssp_set_dai_pll(struct snd_soc_cpu_dai *cpu_dai,
+static int pxa2xx_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai,
 	int pll_id, unsigned int freq_in, unsigned int freq_out)
 {
 	void __iomem *mmio_base = ssp[cpu_dai->id].ssp->mmio_base;
@@ -346,7 +347,7 @@
 /*
  * Set the active slots in TDM/Network mode
  */
-static int pxa2xx_ssp_set_dai_tdm_slot(struct snd_soc_cpu_dai *cpu_dai,
+static int pxa2xx_ssp_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
 	unsigned int mask, int slots)
 {
 	void __iomem *mmio_base = ssp[cpu_dai->id].ssp->mmio_base;
@@ -367,7 +368,7 @@
 /*
  * Tristate the SSP DAI lines
  */
-static int pxa2xx_ssp_set_dai_tristate(struct snd_soc_cpu_dai *cpu_dai,
+static int pxa2xx_ssp_set_dai_tristate(struct snd_soc_dai *cpu_dai,
 	int tristate)
 {
 	void __iomem *mmio_base = ssp[cpu_dai->id].ssp->mmio_base;
@@ -388,53 +389,23 @@
  * The SSP Port must be inactive before calling this function as the
  * physical interface format is changed.
  */
-static int pxa2xx_ssp_set_dai_fmt(struct snd_soc_cpu_dai *cpu_dai,
+static int pxa2xx_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		unsigned int fmt)
 {
 	void __iomem *mmio_base = ssp[cpu_dai->id].ssp->mmio_base;
-	int val;
+	int val, tmp;
 
 	/* reset port settings */
 	__raw_writel(0, mmio_base + SSCR0);
 	__raw_writel(0, mmio_base + SSCR1);
 	__raw_writel(0, mmio_base + SSPSP);
 
-	/* NOTE: I2S emulation is still very much work in progress here */
-
-	/* FIXME: this is what wince uses for msb */
-	if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_MSB) {
-		__raw_writel(SSCR0_EDSS | SSCR0_TISSP | SSCR0_DataSize(16),
-				mmio_base + SSCR0);
-		goto master;
-	}
-
-	/* check for I2S emulation mode - handle it separately  */
-	if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_I2S) {
-		/* 8.4.11 */
-
-		/* Only SSCR0[NCS] or SSCR0[ECS] bit fields settings are optional */
-		__raw_writel(SSCR0_EDSS | SSCR0_PSP | SSCR0_DataSize(16),
-				mmio_base + SSCR0);
-
-		/* set FIFO thresholds */
-		__raw_writel(SSCR1_RxTresh(14) | SSCR1_TxTresh(1),
-				mmio_base + SSCR1);
-
-		/* normal: */
-		/* all bit fields must be cleared except: FSRT = 1 and
-		 * SFRMWDTH = 16, DMYSTART=0,1) */
-		__raw_writel(SSPSP_FSRT | SSPSP_SFRMWDTH(16) | SSPSP_DMYSTRT(0),
-				mmio_base + SSPSP);
-		goto master;
-	}
-
 	val = __raw_readl(mmio_base + SSCR0) | SSCR0_PSP;
 	__raw_writel(val, mmio_base + SSCR0);
 	__raw_writel(SSCR1_RxTresh(14) | SSCR1_TxTresh(1) |
 			SSCR1_TRAIL | SSCR1_RWOT,
 			mmio_base + SSCR1);
 
-master:
 	val = __raw_readl(mmio_base + SSCR1);
 	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
 	case SND_SOC_DAIFMT_CBM_CFM:
@@ -465,15 +436,20 @@
 	}
 
 	val = __raw_readl(mmio_base + SSPSP);
+	val |= SSPSP_SCMODE(2);
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_DSP_A:
 		val |= SSPSP_DMYSTRT(1);
 	case SND_SOC_DAIFMT_DSP_B:
-		val |= SSPSP_SCMODE(2);
 		break;
 	case SND_SOC_DAIFMT_I2S:
+		val |= SSPSP_FSRT;
 	case SND_SOC_DAIFMT_MSB:
-		/* handled above */
+		val |= SSPSP_SFRMWDTH(16);
+
+		tmp = __raw_readl(mmio_base + SSCR0) | SSCR0_EDSS |
+			SSCR0_DataSize(16);
+		__raw_writel(tmp, mmio_base + SSCR0);
 		break;
 	default:
 		return -EINVAL;
@@ -491,7 +467,7 @@
 				struct snd_pcm_hw_params *params)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
+	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
 	int dma = 0, chn = params_channels(params);
 	void __iomem *mmio_base = ssp[cpu_dai->id].ssp->mmio_base;
 	u32 sscr0;
@@ -505,12 +481,20 @@
 
 	pr_debug("pxa2xx_ssp_hw_params: dma %d", dma);
 
+	sscr0 = __raw_readl(mmio_base + SSCR0);
+
 	/* we can only change the settings if the port is not in use */
-	if (__raw_readl(mmio_base + SSCR0) & SSCR0_SSE)
-		return 0;
+	if (sscr0 & SSCR0_SSE)
+		goto ret;
+
+	/* check if we are running on I2S mode */
+	/* FIXME: Is there a better way to check this? */
+	if ((sscr0 & (SSCR0_EDSS | SSCR0_DataSize(16) | SSCR0_PSP)) ==
+			(SSCR0_EDSS | SSCR0_DataSize(16) | SSCR0_PSP))
+		goto ret;
 
 	/* clear selected SSP bits */
-	sscr0 = __raw_readl(mmio_base + SSCR0) & ~(SSCR0_DSS | SSCR0_EDSS);
+	sscr0 &= ~(SSCR0_DSS | SSCR0_EDSS);
 	__raw_writel(sscr0, mmio_base + SSCR0);
 
 	/* bit size */
@@ -530,6 +514,7 @@
 	}
 	__raw_writel(sscr0, mmio_base + SSCR0);
 
+ret:
 	pr_debug("SSCR0 0x%08x SSCR1 0x%08x SSTO 0x%08x SSPSP 0x%08x SSSR 0x%08x SSACD 0x%08x",
 		__raw_readl(mmio_base + SSCR0), __raw_readl(mmio_base + SSCR1),
 		__raw_readl(mmio_base + SSTO), __raw_readl(mmio_base + SSPSP),
@@ -541,7 +526,7 @@
 static int pxa2xx_ssp_trigger(struct snd_pcm_substream *substream, int cmd)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
+	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
 	int ret = 0;
 	void __iomem *mmio_base = ssp[cpu_dai->id].ssp->mmio_base;
 	int val;
@@ -609,7 +594,7 @@
 #define PXA2XX_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
 	SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
 
-struct snd_soc_cpu_dai pxa_ssp_dai[] = {
+struct snd_soc_dai pxa_ssp_dai[] = {
 	{	.name = "pxa2xx-ssp1",
 		.id = 0,
 		.type = SND_SOC_DAI_PCM,

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ASoC: pxa2xx-ssp
  2008-10-25  5:32   ` Daniel Ribeiro
@ 2008-10-27 12:47     ` Mark Brown
  2008-10-27 13:19       ` Daniel Ribeiro
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2008-10-27 12:47 UTC (permalink / raw)
  To: Daniel Ribeiro; +Cc: alsa-devel, Liam Girdwood

On Sat, Oct 25, 2008 at 03:32:47AM -0200, Daniel Ribeiro wrote:

> 	To ease your reading, attached is a diff against [0]. It is updated to
> build on the latest linus tree and handles DAIFMT_I2S and DAIFMT_MSB
> differently.

Please work against the pxa-ssp driver, not the pxa2xx-ssp driver.
There are no plans to merge the pxa2xx-ssp driver - the pxa-ssp should
be able to cover everything, perhaps with a couple of functions selected
per-CPU, but it's not been tested on pxa2xx yet.  It should hopefully be
making its way upstream today or tomorrow.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ASoC: pxa2xx-ssp
  2008-10-27 12:47     ` Mark Brown
@ 2008-10-27 13:19       ` Daniel Ribeiro
  2008-10-27 13:44         ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Ribeiro @ 2008-10-27 13:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood

Em Seg, 2008-10-27 às 12:47 +0000, Mark Brown escreveu:
> On Sat, Oct 25, 2008 at 03:32:47AM -0200, Daniel Ribeiro wrote:
> 
> > 	To ease your reading, attached is a diff against [0]. It is updated to
> > build on the latest linus tree and handles DAIFMT_I2S and DAIFMT_MSB
> > differently.
> 
> Please work against the pxa-ssp driver, not the pxa2xx-ssp driver.
> There are no plans to merge the pxa2xx-ssp driver - the pxa-ssp should
> be able to cover everything, perhaps with a couple of functions selected
> per-CPU, but it's not been tested on pxa2xx yet.  It should hopefully be
> making its way upstream today or tomorrow.

	Ok, i will rebase my work on pxa-ssp.c. But a first look shows that
pxa_ssp_hw_params sets the ssp frame size depending on the audio stream
format even for I2S mode. I think it will not work, as I2S needs to
stick to 32bit frame size.
	Is there anybody using SND_SOC_DAIFMT_I2S with this driver?
	I will send you a patch later today. Thanks for the reply! :)

-- 
Daniel Ribeiro

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ASoC: pxa2xx-ssp
  2008-10-27 13:19       ` Daniel Ribeiro
@ 2008-10-27 13:44         ` Mark Brown
  2008-10-30 11:40           ` Daniel Ribeiro
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2008-10-27 13:44 UTC (permalink / raw)
  To: Daniel Ribeiro; +Cc: alsa-devel, Liam Girdwood

On Mon, Oct 27, 2008 at 11:19:34AM -0200, Daniel Ribeiro wrote:

> 	Ok, i will rebase my work on pxa-ssp.c. But a first look shows that
> pxa_ssp_hw_params sets the ssp frame size depending on the audio stream
> format even for I2S mode. I think it will not work, as I2S needs to
> stick to 32bit frame size.

That's not a general requirement of I2S - many devices are OK with
scaling the number of bit clocks with the data.

> 	Is there anybody using SND_SOC_DAIFMT_I2S with this driver?

I'd go so far as to say that most of the testing has been in I2S mode.
Other modes have been tested but most of the usage is with I2S.

I suspect that what you need to do here to interoperate well with your
codec is to set things up to use TDM so that the extra clocks are
generated by what the CPU believes are idle TDM slots.

> 	I will send you a patch later today. Thanks for the reply! :)

When submitting patches please do try to submit separate patches for
separate logical changes - for example, your previous patch mixed in
changes for recent PXA APIs with changes in the behaviour of the code.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ASoC: pxa2xx-ssp
  2008-10-27 13:44         ` Mark Brown
@ 2008-10-30 11:40           ` Daniel Ribeiro
  2008-10-30 12:06             ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Ribeiro @ 2008-10-30 11:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood

Em Seg, 2008-10-27 às 13:44 +0000, Mark Brown escreveu:
> On Mon, Oct 27, 2008 at 11:19:34AM -0200, Daniel Ribeiro wrote:
> 
> > 	Ok, i will rebase my work on pxa-ssp.c. But a first look shows that
> > pxa_ssp_hw_params sets the ssp frame size depending on the audio stream
> > format even for I2S mode. I think it will not work, as I2S needs to
> > stick to 32bit frame size.
> 
> That's not a general requirement of I2S - many devices are OK with
> scaling the number of bit clocks with the data.
> 
> > 	Is there anybody using SND_SOC_DAIFMT_I2S with this driver?
> 
> I'd go so far as to say that most of the testing has been in I2S mode.
> Other modes have been tested but most of the usage is with I2S.
> 
> I suspect that what you need to do here to interoperate well with your
> codec is to set things up to use TDM so that the extra clocks are
> generated by what the CPU believes are idle TDM slots.

	Im trying to setup as you said.

	I get correct audio if use one tdm_slot and mono audio, but i couldnt
get stereo audio working correctly without changing the ssp frame size.

	Here are my test results for stereo S16_LE audio:

	set_tdm_slot(cpu_dai, 1, 2), SSCR0_Datasize(16):
	Only left channel works.

	set_tdm_slot(cpu_dai, 2, 2), SSCR0_Datasize(16):
	No I/O.

	set_tdm_slot(cpu_dai, 3, 2), SSCR0_Datasize(16):
	Only left channel works.

	set_tdm_slot(cpu_dai, 1, 1), SSCR0_Datasize(16) | SSCR0_EDSS:
	Both channels work.

	What could be wrong? Can you suggest me how to setup the tdm slots so i
can get both channels?
	On my board CLK and FRM are driven by the codec, pxa is slave. I have
no specs for the codec, only a 2.4 kernel driver that works with
(SSCR0_Datasize(16) | SSCR0_EDSS | SSCR0_SlotsPerFrm(1)).

> 
> > 	I will send you a patch later today. Thanks for the reply! :)
> 
> When submitting patches please do try to submit separate patches for
> separate logical changes - for example, your previous patch mixed in
> changes for recent PXA APIs with changes in the behaviour of the code.

	That was not a patch submission. :)

-- 
Daniel Ribeiro

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ASoC: pxa2xx-ssp
  2008-10-30 11:40           ` Daniel Ribeiro
@ 2008-10-30 12:06             ` Mark Brown
  2008-10-30 12:24               ` Daniel Ribeiro
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2008-10-30 12:06 UTC (permalink / raw)
  To: Daniel Ribeiro; +Cc: alsa-devel, Liam Girdwood

On Thu, Oct 30, 2008 at 09:40:17AM -0200, Daniel Ribeiro wrote:

> 	Here are my test results for stereo S16_LE audio:

> 	set_tdm_slot(cpu_dai, 1, 2), SSCR0_Datasize(16):
> 	Only left channel works.

> 	set_tdm_slot(cpu_dai, 2, 2), SSCR0_Datasize(16):
> 	No I/O.

Could you expand on what you mean by "No I/O" here - do you get silent
output or does DMA not work either?

> 	set_tdm_slot(cpu_dai, 3, 2), SSCR0_Datasize(16):
> 	Only left channel works.

> 	set_tdm_slot(cpu_dai, 1, 1), SSCR0_Datasize(16) | SSCR0_EDSS:
> 	Both channels work.

Just a thought, but you should also be able to get things working by
adding a constraint on the format in your machine driver to force use of
32 bit - see things like the WM8903 driver for examples of how to this.
Ideally that shouldn't be required, though.

> 	On my board CLK and FRM are driven by the codec, pxa is slave. I have
> no specs for the codec, only a 2.4 kernel driver that works with
> (SSCR0_Datasize(16) | SSCR0_EDSS | SSCR0_SlotsPerFrm(1)).

Which codec is this?  Could you post the driver?

BTW, your mail client is doing some really strange indentation here
and indenting the first line of each paragraph by a tab which looks like
how some other clients do quotation.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: ASoC: pxa2xx-ssp
  2008-10-30 12:06             ` Mark Brown
@ 2008-10-30 12:24               ` Daniel Ribeiro
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Ribeiro @ 2008-10-30 12:24 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood

Em Qui, 2008-10-30 às 12:06 +0000, Mark Brown escreveu:
> On Thu, Oct 30, 2008 at 09:40:17AM -0200, Daniel Ribeiro wrote:
> 
> > 	Here are my test results for stereo S16_LE audio:
> 
> > 	set_tdm_slot(cpu_dai, 1, 2), SSCR0_Datasize(16):
> > 	Only left channel works.

+ Silent output on right channel.

> 
> > 	set_tdm_slot(cpu_dai, 2, 2), SSCR0_Datasize(16):
> > 	No I/O.
> 
> Could you expand on what you mean by "No I/O" here - do you get silent
> output or does DMA not work either?

DMA dont work.

> 
> > 	set_tdm_slot(cpu_dai, 3, 2), SSCR0_Datasize(16):
> > 	Only left channel works.

+ Silent output on right channel.

> 
> > 	set_tdm_slot(cpu_dai, 1, 1), SSCR0_Datasize(16) | SSCR0_EDSS:
> > 	Both channels work.
> 
> Just a thought, but you should also be able to get things working by
> adding a constraint on the format in your machine driver to force use of
> 32 bit - see things like the WM8903 driver for examples of how to this.
> Ideally that shouldn't be required, though.

I havent tried this yet, but if I set the codec driver to S32_LE
shouldnt it change the audio data format? According to the information I
have on this codec it only works with 16 bits audio format.

> 
> > 	On my board CLK and FRM are driven by the codec, pxa is slave. I have
> > no specs for the codec, only a 2.4 kernel driver that works with
> > (SSCR0_Datasize(16) | SSCR0_EDSS | SSCR0_SlotsPerFrm(1)).
> 
> Which codec is this?  Could you post the driver?

Its a motorola ASIC called PCAP2, it does a lot more than sound, and is
used on almost all Motorola phones (including WinCE and P2K phones) from
2004~2007.

http://git.openezx.org/?p=openezx.git;a=blob;f=sound/soc/codecs/pcap2.c;h=d5cf7d2e34a8565ed0e91094ee63f40236bb0b75;hb=18aeb9d03c0969b68fada1913b4d72ca8f47a912

> 
> BTW, your mail client is doing some really strange indentation here
> and indenting the first line of each paragraph by a tab which looks like
> how some other clients do quotation.

Sorry, im used to indent each paragraph with a tab, its not my mail
client, its me. :)

-- 
Daniel Ribeiro

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-10-30 12:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-24  0:54 ASoC: pxa2xx-ssp Daniel Ribeiro
2008-10-24 15:54 ` Liam Girdwood
2008-10-24 18:14   ` Mark Brown
2008-10-25  5:32   ` Daniel Ribeiro
2008-10-27 12:47     ` Mark Brown
2008-10-27 13:19       ` Daniel Ribeiro
2008-10-27 13:44         ` Mark Brown
2008-10-30 11:40           ` Daniel Ribeiro
2008-10-30 12:06             ` Mark Brown
2008-10-30 12:24               ` Daniel Ribeiro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.