* [PATCH] ASoC: omap-mcbsp: Add support for Left Justified format
@ 2010-03-19 9:11 Peter Ujfalusi
2010-03-19 9:28 ` Jarkko Nikula
0 siblings, 1 reply; 5+ messages in thread
From: Peter Ujfalusi @ 2010-03-19 9:11 UTC (permalink / raw)
To: alsa-devel; +Cc: broonie, lrg
Basic support for Left Justified coding for OMAP McBSP.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
sound/soc/omap/omap-mcbsp.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 2952fb0..d315cc4 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -331,7 +331,8 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
format = mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK;
wpf = channels = params_channels(params);
- if (channels == 2 && format == SND_SOC_DAIFMT_I2S) {
+ if (channels == 2 && (format == SND_SOC_DAIFMT_I2S ||
+ format == SND_SOC_DAIFMT_LEFT_J)) {
/* Use dual-phase frames */
regs->rcr2 |= RPHASE;
regs->xcr2 |= XPHASE;
@@ -376,6 +377,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
/* Set FS period and length in terms of bit clock periods */
switch (format) {
case SND_SOC_DAIFMT_I2S:
+ case SND_SOC_DAIFMT_LEFT_J:
regs->srgr2 |= FPER(framesize - 1);
regs->srgr1 |= FWID((framesize >> 1) - 1);
break;
@@ -427,6 +429,12 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
regs->rcr2 |= RDATDLY(1);
regs->xcr2 |= XDATDLY(1);
break;
+ case SND_SOC_DAIFMT_LEFT_J:
+ /* 0-bit data delay */
+ regs->rcr2 |= RDATDLY(0);
+ regs->xcr2 |= XDATDLY(0);
+ regs->spcr1 |= RJUST(2);
+ break;
case SND_SOC_DAIFMT_DSP_A:
/* 1-bit data delay */
regs->rcr2 |= RDATDLY(1);
--
1.7.0.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] ASoC: omap-mcbsp: Add support for Left Justified format
2010-03-19 9:11 [PATCH] ASoC: omap-mcbsp: Add support for Left Justified format Peter Ujfalusi
@ 2010-03-19 9:28 ` Jarkko Nikula
2010-03-19 10:00 ` Peter Ujfalusi
0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Nikula @ 2010-03-19 9:28 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, broonie, lrg
On Fri, 19 Mar 2010 11:11:19 +0200
Peter Ujfalusi <peter.ujfalusi@nokia.com> wrote:
> Basic support for Left Justified coding for OMAP McBSP.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
> ---
> sound/soc/omap/omap-mcbsp.c | 10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletions(-)
>
I don't point it out immediately but is the FS polarity correct?
According to WM8772 spec, the left/right justified modes has inverted
FS polarity from I2S.
--
Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: omap-mcbsp: Add support for Left Justified format
2010-03-19 9:28 ` Jarkko Nikula
@ 2010-03-19 10:00 ` Peter Ujfalusi
2010-03-19 10:13 ` Jarkko Nikula
0 siblings, 1 reply; 5+ messages in thread
From: Peter Ujfalusi @ 2010-03-19 10:00 UTC (permalink / raw)
To: ext Jarkko Nikula
Cc: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com,
lrg@slimlogic.co.uk
On Friday 19 March 2010 11:28:54 ext Jarkko Nikula wrote:
> On Fri, 19 Mar 2010 11:11:19 +0200
>
> Peter Ujfalusi <peter.ujfalusi@nokia.com> wrote:
> > Basic support for Left Justified coding for OMAP McBSP.
> >
> > Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
> > ---
> >
> > sound/soc/omap/omap-mcbsp.c | 10 +++++++++-
> > 1 files changed, 9 insertions(+), 1 deletions(-)
>
> I don't point it out immediately but is the FS polarity correct?
> According to WM8772 spec, the left/right justified modes has inverted
> FS polarity from I2S.
Yes, that is correct, and I'm aware of that.
However, I have done some testing:
I have a sample prepared, which only has data on the left channel, than I did
tried I2S and LEFT_J...
With:
/* I2S mode */
fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM;
The data line has data when the FS is low (when FS is high, that data line has
0). So this is correct I2S.
Now with:
/* Left justified */
fmt = SND_SOC_DAIFMT_LEFT_J |
SND_SOC_DAIFMT_NB_IF |
SND_SOC_DAIFMT_CBM_CFM;
The data line has data when the FS is high (when FS is low, that data line has
0). So this is correct Left Justified.
At least it seams that McBSP is actually shifting out the data at the correct
place, when it is slave..
Oh, and I can not explain why this is working, but I do trust on my scope, and
it shows me that it is correct :o
--
Péter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: omap-mcbsp: Add support for Left Justified format
2010-03-19 10:00 ` Peter Ujfalusi
@ 2010-03-19 10:13 ` Jarkko Nikula
2010-03-19 10:17 ` Peter Ujfalusi
0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Nikula @ 2010-03-19 10:13 UTC (permalink / raw)
To: Peter Ujfalusi
Cc: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com,
lrg@slimlogic.co.uk
On Fri, 19 Mar 2010 12:00:03 +0200
Peter Ujfalusi <peter.ujfalusi@nokia.com> wrote:
> Now with:
> /* Left justified */
> fmt = SND_SOC_DAIFMT_LEFT_J |
> SND_SOC_DAIFMT_NB_IF |
> SND_SOC_DAIFMT_CBM_CFM;
>
> The data line has data when the FS is high (when FS is low, that data line has
> 0). So this is correct Left Justified.
>
> At least it seams that McBSP is actually shifting out the data at the correct
> place, when it is slave..
>
> Oh, and I can not explain why this is working, but I do trust on my scope, and
> it shows me that it is correct :o
>
For me it looks it's working because of NB_IF so try again with
NB_NF :-)
--
Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: omap-mcbsp: Add support for Left Justified format
2010-03-19 10:13 ` Jarkko Nikula
@ 2010-03-19 10:17 ` Peter Ujfalusi
0 siblings, 0 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2010-03-19 10:17 UTC (permalink / raw)
To: ext Jarkko Nikula
Cc: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com,
lrg@slimlogic.co.uk
On Friday 19 March 2010 12:13:08 ext Jarkko Nikula wrote:
> On Fri, 19 Mar 2010 12:00:03 +0200
>
> Peter Ujfalusi <peter.ujfalusi@nokia.com> wrote:
> > Now with:
> > /* Left justified */
> > fmt = SND_SOC_DAIFMT_LEFT_J |
> >
> > SND_SOC_DAIFMT_NB_IF |
> >
> > SND_SOC_DAIFMT_CBM_CFM;
> >
> > The data line has data when the FS is high (when FS is low, that data
> > line has 0). So this is correct Left Justified.
> >
> > At least it seams that McBSP is actually shifting out the data at the
> > correct place, when it is slave..
> >
> > Oh, and I can not explain why this is working, but I do trust on my
> > scope, and it shows me that it is correct :o
>
> For me it looks it's working because of NB_IF so try again with
> NB_NF :-)
Oh yes :D
You know, I was looking at the diff between the I2S and LEFT_J polarities, but
did not noticed NF vs IF...
Yes, you are right, I need to invert the FS in a similar fashion as we do with
the DSP modes.
Thanks for spotting it, I'll send the fixed patch with inverting the FS in case
of LEFT_J
--
Péter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-03-19 10:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-19 9:11 [PATCH] ASoC: omap-mcbsp: Add support for Left Justified format Peter Ujfalusi
2010-03-19 9:28 ` Jarkko Nikula
2010-03-19 10:00 ` Peter Ujfalusi
2010-03-19 10:13 ` Jarkko Nikula
2010-03-19 10:17 ` Peter Ujfalusi
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.