All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM DaVinci: Add Right-Justified mode and Codec clock master to davinci-i2s
@ 2008-11-08 18:26 hugo.villeneuve
  2008-11-10 11:42 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: hugo.villeneuve @ 2008-11-08 18:26 UTC (permalink / raw)
  To: alsa-devel; +Cc: davinci-linux-open-source, Hugo Villeneuve

From: Hugo Villeneuve <hugo.villeneuve@lyrtech.com>

ARM DaVinci: Add Right-Justified mode and Codec clock master to davinci-i2s

The TI DVEVM board uses the SND_SOC_DAIFMT_CBM_CFM & I2S formats, but the
Lyrtech SFFSDR board uses the SND_SOC_DAIFMT_CBM_CFS & RIGHT-JUSTIFIED formats.

Signed-off-by: Hugo Villeneuve <hugo.villeneuve@lyrtech.com>
---
 sound/soc/davinci/davinci-i2s.c |   40 ++++++++++++++++++++++++++++++++------
 1 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index abb5fed..d814ec8 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -59,6 +59,7 @@
 #define DAVINCI_MCBSP_PCR_CLKXP		(1 << 1)
 #define DAVINCI_MCBSP_PCR_FSRP		(1 << 2)
 #define DAVINCI_MCBSP_PCR_FSXP		(1 << 3)
+#define DAVINCI_MCBSP_PCR_SCLKME	(1 << 7)
 #define DAVINCI_MCBSP_PCR_CLKRM		(1 << 8)
 #define DAVINCI_MCBSP_PCR_CLKXM		(1 << 9)
 #define DAVINCI_MCBSP_PCR_FSRM		(1 << 10)
@@ -171,6 +172,16 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG,
 					DAVINCI_MCBSP_SRGR_FSGM);
 		break;
+	case SND_SOC_DAIFMT_CBM_CFS:
+		/* McBSP CLKR pin is the input for the Sample Rate Generator.
+		 * McBSP FSR and FSX are driven by the Sample Rate Generator. */
+		davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_PCR_REG,
+					DAVINCI_MCBSP_PCR_SCLKME |
+					DAVINCI_MCBSP_PCR_FSXM |
+					DAVINCI_MCBSP_PCR_FSRM);
+		davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG,
+					DAVINCI_MCBSP_SRGR_FSGM);
+		break;
 	case SND_SOC_DAIFMT_CBM_CFM:
 		davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_PCR_REG, 0);
 		break;
@@ -205,6 +216,28 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		return -EINVAL;
 	}
 
+	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+	case SND_SOC_DAIFMT_RIGHT_J:
+		davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG,
+					DAVINCI_MCBSP_RCR_RFRLEN1(1) |
+					DAVINCI_MCBSP_RCR_RDATDLY(0));
+		davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG,
+					DAVINCI_MCBSP_XCR_XFRLEN1(1) |
+					DAVINCI_MCBSP_XCR_XDATDLY(0) |
+					DAVINCI_MCBSP_XCR_XFIG);
+		break;
+	case SND_SOC_DAIFMT_I2S:
+	default:
+		davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG,
+					DAVINCI_MCBSP_RCR_RFRLEN1(1) |
+					DAVINCI_MCBSP_RCR_RDATDLY(1));
+		davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG,
+					DAVINCI_MCBSP_XCR_XFRLEN1(1) |
+					DAVINCI_MCBSP_XCR_XDATDLY(1) |
+					DAVINCI_MCBSP_XCR_XFIG);
+		break;
+	}
+
 	return 0;
 }
 
@@ -223,13 +256,6 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
 				DAVINCI_MCBSP_SPCR_RINTM(3) |
 				DAVINCI_MCBSP_SPCR_XINTM(3) |
 				DAVINCI_MCBSP_SPCR_FREE);
-	davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG,
-				DAVINCI_MCBSP_RCR_RFRLEN1(1) |
-				DAVINCI_MCBSP_RCR_RDATDLY(1));
-	davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG,
-				DAVINCI_MCBSP_XCR_XFRLEN1(1) |
-				DAVINCI_MCBSP_XCR_XDATDLY(1) |
-				DAVINCI_MCBSP_XCR_XFIG);
 
 	i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS);
 	w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SRGR_REG);

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

* Re: [PATCH] ARM DaVinci: Add Right-Justified mode and Codec clock master to davinci-i2s
  2008-11-08 18:26 [PATCH] ARM DaVinci: Add Right-Justified mode and Codec clock master to davinci-i2s hugo.villeneuve
@ 2008-11-10 11:42 ` Mark Brown
  2008-11-10 15:06   ` Hugo Villeneuve
       [not found]   ` <20081110114223.GB12804-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2008-11-10 11:42 UTC (permalink / raw)
  To: hugo.villeneuve; +Cc: alsa-devel, davinci-linux-open-source

On Sat, Nov 08, 2008 at 01:26:09PM -0500, hugo.villeneuve@lyrtech.com wrote:
> From: Hugo Villeneuve <hugo.villeneuve@lyrtech.com>

> ARM DaVinci: Add Right-Justified mode and Codec clock master to davinci-i2s

Not a big deal but you shouldn't repeat the subject line of your patch
in the body - it causes automated tools like git am to duplicate it in
the commit mesage.

> The TI DVEVM board uses the SND_SOC_DAIFMT_CBM_CFM & I2S formats, but the
> Lyrtech SFFSDR board uses the SND_SOC_DAIFMT_CBM_CFS & RIGHT-JUSTIFIED formats.

Is there any news on the progress of the new DaVinci DMA API to
mainline?

> Signed-off-by: Hugo Villeneuve <hugo.villeneuve@lyrtech.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Takashi, I'm assembling another patch queue for you - should send it out
later today.

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

* Re: [PATCH] ARM DaVinci: Add Right-Justified mode and Codec clock master to davinci-i2s
  2008-11-10 11:42 ` Mark Brown
@ 2008-11-10 15:06   ` Hugo Villeneuve
       [not found]   ` <20081110114223.GB12804-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Hugo Villeneuve @ 2008-11-10 15:06 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, davinci-linux-open-source

Mark Brown wrote:
> On Sat, Nov 08, 2008 at 01:26:09PM -0500, hugo.villeneuve@lyrtech.com
> wrote: 
>> From: Hugo Villeneuve <hugo.villeneuve@lyrtech.com>
> 
>> ARM DaVinci: Add Right-Justified mode and Codec clock master to
>> davinci-i2s 
> 
> Not a big deal but you shouldn't repeat the subject line of your patch
> in the body - it causes automated tools like git am to duplicate it in
> the commit mesage.

That´s right. Thanks for the tip!

>> The TI DVEVM board uses the SND_SOC_DAIFMT_CBM_CFM & I2S formats,
>> but the Lyrtech SFFSDR board uses the SND_SOC_DAIFMT_CBM_CFS &
>> RIGHT-JUSTIFIED formats. 
> 
> Is there any news on the progress of the new DaVinci DMA API to
> mainline?

I´m not familiar with that, maybe someone from the DaVinci list can answer.

Hugo V.

Hugo Villeneuve
Hardware developer | Concepteur matériel
Lyrtech
Phone/Tél. : (1) (418) 877-4644 #2395
Toll-free/Sans frais - Canada & USA : (1) (888) 922-4644 #2395
Fax/Téléc. : (1) (418) 877-7710
www.lyrtech.com
Infinite possibilities...TM

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

* Re: [alsa-devel] [PATCH] ARM DaVinci: Add Right-Justified mode and Codec clock master to davinci-i2s
       [not found]   ` <20081110114223.GB12804-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2008-11-13 14:56     ` Kevin Hilman
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2008-11-13 14:56 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/

Mark Brown <broonie-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> writes:

> On Sat, Nov 08, 2008 at 01:26:09PM -0500, hugo.villeneuve-alTlfEjb/c1BDgjK7y7TUQ@public.gmane.org wrote:
>> From: Hugo Villeneuve <hugo.villeneuve-alTlfEjb/c1BDgjK7y7TUQ@public.gmane.org>
>
>> ARM DaVinci: Add Right-Justified mode and Codec clock master to davinci-i2s
>
> Not a big deal but you shouldn't repeat the subject line of your patch
> in the body - it causes automated tools like git am to duplicate it in
> the commit mesage.
>
>> The TI DVEVM board uses the SND_SOC_DAIFMT_CBM_CFM & I2S formats, but the
>> Lyrtech SFFSDR board uses the SND_SOC_DAIFMT_CBM_CFS & RIGHT-JUSTIFIED formats.
>
> Is there any news on the progress of the new DaVinci DMA API to
> mainline?
>
>> Signed-off-by: Hugo Villeneuve <hugo.villeneuve-alTlfEjb/c1BDgjK7y7TUQ@public.gmane.org>
>
> Acked-by: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
>

OK, pulling into DaVinci git and will drop when resync with next ASoC.

Kevin

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

end of thread, other threads:[~2008-11-13 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-08 18:26 [PATCH] ARM DaVinci: Add Right-Justified mode and Codec clock master to davinci-i2s hugo.villeneuve
2008-11-10 11:42 ` Mark Brown
2008-11-10 15:06   ` Hugo Villeneuve
     [not found]   ` <20081110114223.GB12804-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2008-11-13 14:56     ` [alsa-devel] " Kevin Hilman

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.