From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
To: alsa-devel@alsa-project.org
Cc: "Nikula Jarkko (Nokia-D/Helsinki)" <jarkko.nikula@nokia.com>,
ext Mark Brown <broonie@sirena.org.uk>
Subject: Re: [PATCH 1/2] ASoC: omap-mcbsp: Correct the DSP_B mode
Date: Tue, 14 Apr 2009 13:34:33 +0300 [thread overview]
Message-ID: <200904141334.33497.peter.ujfalusi@nokia.com> (raw)
In-Reply-To: <20090414093133.GB12678@sirena.org.uk>
On Tuesday 14 April 2009 12:31:33 ext Mark Brown wrote:
> On Tue, Apr 14, 2009 at 12:02:21PM +0300, Jarkko Nikula wrote:
> > The pairs must mach. It's clearly a bug if another end is have to set
> > different polarity than another. Those polarity defines are with
> > respect to the mode, not e.g. what's the McBSP default.
>
> Indeed. However, the osk5912 board file that Peter pointed at as not
> needing any modifications for DSP_B already uses inverted frame clock
> for both CODEC and CPU. In that case either both are wrong or it's just
> that the driver is limited in what it supports which is not a problem.
Well, I think the mcbsp module is quite - maybe too - flexible...
To have the DSP_B mode correctly (for the tvl320aic32 codec used in osk5912
board) the FS polarity has to be handled by the mcbsp as it has been inverted.
If we don't do this, there is no way to have the MSB at the correct place (it
has to be available when the FS is high).
The DSP_A mode can use the FS polarity 'correctly' - as it is. Or we can also
consider to require to invert the FS polarity, than add 1 bit delay for DSP_A
mode.
So:
a) The proposal in the series
DSP_B mode (the MSB is transmitted when the FS is high, the length for the
pulse is 1):
case SND_SOC_DAIFMT_DSP_B:
regs->srgr2 |= FPER(wlen * channels - 1);
regs->srgr1 |= FWID(0);
break;
case SND_SOC_DAIFMT_DSP_B:
/* 0-bit data delay */
regs->rcr2 |= RDATDLY(0);
regs->xcr2 |= XDATDLY(0);
break;
case SND_SOC_DAIFMT_NB_IF:
regs->pcr0 |= CLKXP | CLKRP;
break;
DSP_A mode (the MSB is transmitted when the FS went low, the length for the
pulse is still 1, but the FS stays low for (wlen * channels - 1) cycles):
case SND_SOC_DAIFMT_DSP_A:
regs->srgr2 |= FPER(wlen * channels - 1);
regs->srgr1 |= FWID(wlen * channels - 2);
break;
case SND_SOC_DAIFMT_DSP_A:
/* 0-bit data delay */
regs->rcr2 |= RDATDLY(0);
regs->xcr2 |= XDATDLY(0);
break;
case SND_SOC_DAIFMT_IB_IF:
break;
b) twist in DSP_A mode.
The DSP_B mode is the same as it is in a)
DSP_A mode (the MSB is transmitted when the FS went low, the length for the
pulse is still 1, but the FS stays low for (wlen * channels - 1) cycles):
case SND_SOC_DAIFMT_DSP_A:
regs->srgr2 |= FPER(wlen * channels - 1);
regs->srgr1 |= FWID(0);
break;
case SND_SOC_DAIFMT_DSP_A:
/* 0-bit data delay */
regs->rcr2 |= RDATDLY(1);
regs->xcr2 |= XDATDLY(1);
break;
case SND_SOC_DAIFMT_NB_IF:
regs->pcr0 |= CLKXP | CLKRP;
break;
Both a) and b) would be OK for the DSP_A mode...
c)
Remove the SND_SOC_DAIFMT_* (DSP_A, DSP_B, I2S and NB_NF, NB_IF, IB_NF, IB_IF)
configuration from the omap_mcbsp_dai_set_dai_fmt, move it to the
omap_mcbsp_dai_hw_params function and have something like these there:
switch (mcbsp_data->fmt &
(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK)) {
case SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF:
...
break;
case SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF:
...
break;
case SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_IF:
...
break;
case SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF:
...
break;
case SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_IF:
...
break;
case SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF:
...
break;
...
}
and so on. I'm not sure if all of the combinations are valid, but it can be
done like this also. It is another thing how actually the mcbsp would be
configured for these modes - for DSP_B the FS polarity has to be inverted to
get the MSB in a correct place, but it would be correct from the
snd_soc_dai_set_fmt point of view, or something........
--
Péter
next prev parent reply other threads:[~2009-04-14 10:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-14 7:45 [PATCH 0/2] ASoC: DSP mode corrections for omap-mcbsp Peter Ujfalusi
2009-04-14 7:45 ` [PATCH 1/2] ASoC: omap-mcbsp: Correct the DSP_B mode Peter Ujfalusi
2009-04-14 7:45 ` [PATCH 2/2] ASoC: omap-mcbsp: Add DSP_A support Peter Ujfalusi
2009-04-14 8:20 ` [PATCH 1/2] ASoC: omap-mcbsp: Correct the DSP_B mode Jarkko Nikula
2009-04-14 8:40 ` Peter Ujfalusi
2009-04-14 9:02 ` Jarkko Nikula
2009-04-14 9:31 ` Mark Brown
2009-04-14 10:34 ` Peter Ujfalusi [this message]
2009-04-14 10:47 ` [PATCH 1/2] ASoC: omap-mcbsp: Correct the?DSP_B mode Mark Brown
2009-04-14 11:20 ` [PATCH 1/2] ASoC: omap-mcbsp: Correct the DSP_B mode Jarkko Nikula
2009-04-14 11:32 ` Arun KS
2009-04-14 12:58 ` Jarkko Nikula
2009-04-14 11:56 ` Peter Ujfalusi
2009-04-14 12:01 ` Mark Brown
2009-04-14 12:32 ` Peter Ujfalusi
2009-04-14 12:49 ` Jarkko Nikula
2009-04-14 13:00 ` Peter Ujfalusi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200904141334.33497.peter.ujfalusi@nokia.com \
--to=peter.ujfalusi@nokia.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@sirena.org.uk \
--cc=jarkko.nikula@nokia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.