ASoC: omap-mcbsp: Add support for Left Justified format
PATCH 1/1 ASoC: omap-mcbsp: Add support for Left Justified format
Basic support for Left Justified coding for OMAP McBSP.
--- sound/soc/omap/omap-mcbsp.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
sound/soc/omap/omap-mcbsp.c +9 -1
@@ -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 );
Signature · 1 line
1.7.0.2
Quoted 7 lines · On Fri, 19 Mar 2010 11:11:19 +0200 Peter Ujfalusi <[email protected]>…
Basic support for Left Justified coding for OMAP McBSP.
Signed-off-by Peter Ujfalusi <[email protected]>--- 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.
Signature · 1 line
Jarkko
Quoted 8 lines · On Friday 19 March 2010 11:28:54 ext Jarkko Nikula wrote:
On Fri, 19 Mar 2010 11:11:19 +0200
Quoted 5 lines · Peter Ujfalusi
Basic support for Left Justified coding for OMAP McBSP.
Signed-off-by Peter Ujfalusi <[email protected]>---
Quoted 6 lines
Quoted 2 lines
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
Signature · 1 line
Péter
Quoted 6 lines · On Fri, 19 Mar 2010 12:00:03 +0200 Peter Ujfalusi <[email protected]>…
Now with:
/* Left justified */
fmt =SND_SOC_DAIFMT_LEFT_J|
SND_SOC_DAIFMT_NB_IF|
SND_SOC_DAIFMT_CBM_CFM;
Quoted 9 lines
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 :-)
Signature · 1 line
Jarkko
Quoted 14 lines · On Friday 19 March 2010 12:13:08 ext Jarkko Nikula wrote:
On Fri, 19 Mar 2010 12:00:03 +0200
Quoted 11 lines · Peter Ujfalusi
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.
Quoted 8 lines
Quoted 5 lines
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_IFso try again withNB_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
Signature · 1 line
Péter