All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Alexander <subaparts@yandex.ru>
Cc: alsa-devel@alsa-project.org, ryan@bluewatersys.com,
	linux-arm-kernel@lists.infradead.org, lrg@slimlogic.co.uk
Subject: Re: [PATCH 1/3] ASoC: EP93xx I2S and PCM fixes
Date: Thu, 9 Dec 2010 12:34:57 +0000	[thread overview]
Message-ID: <20101209123457.GD4469@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <1291897061.31916.149.camel@r60e>

On Thu, Dec 09, 2010 at 03:17:41PM +0300, Alexander wrote:
> On Thu, 2010-12-09 at 10:54 +0000, Mark Brown wrote:

> > pair of samples at a go, which works well enough.  Some of the hardware
> > configuration may be technically incorrect according to the spec but so
> > long as the externally observable behaviour is OK that's not an issue.

> I2S controller always takes 2 samples (2 ch) from DMA, DMA is always 32
> bit, so if you will feed it with 16 samples, you will get 2 times faster
> sound.

How exactly does it "take" the samples?  You're really not being clear
about what the hardware is doing here.  Please be specific about the
interaction between the I2S controller and the DMA controller - for
example, is there a FIFO on the edge of the I2S controller, is there any
mediation of the data words anywhere in the process?

I *think* what you're trying to say above is that the I2S controller
reads each sample as an individual word directly from the DMA controller
so the DMA word size must match exactly the I2S word size but you're
really not being clear.

> > It may be that there's limitations in the hardware that prevent such a
> > configuration but I'd like to see more analysis of what's going on here.

> If we take a look into I2S specification, we will figure that LRCLK MUST
> be equal to sample rate, if we are talking about stereo (in mono too,
> but it's not our case at all). So it doesnt seems strange to you,
> ep93xx-i2s.c produces LRCLK two times slower than it MUST be? It's a
> bug, making DMA bug less visible...

Right, but the DMA controller can (ignoring any restrictions in your
hardware) happily transfer data in any size and this needn't have
anything to do with what the I2S controller is emitting.  You need to
look at the configuration of the interaction between the I2S and DMA
controllers rather than the external interface when looking at this
stuff.

This is all broadly orthogonal to the external BCLK and LRCLK rates,
it's all about how the data gets between the I2S and DMA controllers.

> Always using 32 bit chunks is not a problem for I2S, the codec I use
> uses less bits too (24), it's permitted by I2S standard.

It's a problem because it means that the data needs to be laid out in
memory in 32 bit words which means that a lot of data is going to need
to be repacked from 16 bit to 32 bit samples which is wasteful.  If the
hardware can be persuaded to avoid this then that's much better.

WARNING: multiple messages have this Message-ID (diff)
From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ASoC: EP93xx I2S and PCM fixes
Date: Thu, 9 Dec 2010 12:34:57 +0000	[thread overview]
Message-ID: <20101209123457.GD4469@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <1291897061.31916.149.camel@r60e>

On Thu, Dec 09, 2010 at 03:17:41PM +0300, Alexander wrote:
> On Thu, 2010-12-09 at 10:54 +0000, Mark Brown wrote:

> > pair of samples at a go, which works well enough.  Some of the hardware
> > configuration may be technically incorrect according to the spec but so
> > long as the externally observable behaviour is OK that's not an issue.

> I2S controller always takes 2 samples (2 ch) from DMA, DMA is always 32
> bit, so if you will feed it with 16 samples, you will get 2 times faster
> sound.

How exactly does it "take" the samples?  You're really not being clear
about what the hardware is doing here.  Please be specific about the
interaction between the I2S controller and the DMA controller - for
example, is there a FIFO on the edge of the I2S controller, is there any
mediation of the data words anywhere in the process?

I *think* what you're trying to say above is that the I2S controller
reads each sample as an individual word directly from the DMA controller
so the DMA word size must match exactly the I2S word size but you're
really not being clear.

> > It may be that there's limitations in the hardware that prevent such a
> > configuration but I'd like to see more analysis of what's going on here.

> If we take a look into I2S specification, we will figure that LRCLK MUST
> be equal to sample rate, if we are talking about stereo (in mono too,
> but it's not our case at all). So it doesnt seems strange to you,
> ep93xx-i2s.c produces LRCLK two times slower than it MUST be? It's a
> bug, making DMA bug less visible...

Right, but the DMA controller can (ignoring any restrictions in your
hardware) happily transfer data in any size and this needn't have
anything to do with what the I2S controller is emitting.  You need to
look at the configuration of the interaction between the I2S and DMA
controllers rather than the external interface when looking at this
stuff.

This is all broadly orthogonal to the external BCLK and LRCLK rates,
it's all about how the data gets between the I2S and DMA controllers.

> Always using 32 bit chunks is not a problem for I2S, the codec I use
> uses less bits too (24), it's permitted by I2S standard.

It's a problem because it means that the data needs to be laid out in
memory in 32 bit words which means that a lot of data is going to need
to be repacked from 16 bit to 32 bit samples which is wasteful.  If the
hardware can be persuaded to avoid this then that's much better.

  reply	other threads:[~2010-12-09 12:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08 12:01 [PATCH 1/3] ASoC: EP93xx I2S and PCM fixes Alexander
2010-12-08 12:01 ` Alexander
2010-12-08 12:46 ` Mark Brown
2010-12-08 12:46   ` Mark Brown
2010-12-09  0:37   ` Alexander
2010-12-09  0:37     ` Alexander
2010-12-09 10:54     ` Mark Brown
2010-12-09 10:54       ` Mark Brown
2010-12-09 12:17       ` Alexander
2010-12-09 12:17         ` Alexander
2010-12-09 12:34         ` Mark Brown [this message]
2010-12-09 12:34           ` Mark Brown
2010-12-09 21:14           ` Alexander
2010-12-09 21:14             ` Alexander
2010-12-10 15:07             ` Mark Brown
2010-12-10 15:07               ` Mark Brown
2011-01-16 11:21               ` Alexander
2011-01-16 11:21                 ` Alexander
2011-01-16 11:27                 ` Mark Brown
2011-01-16 11:27                   ` Mark Brown
2010-12-09  0:43   ` [PATCH] ASoC: EP93xx: sampling rate range extended Alexander
2010-12-09  0:43     ` Alexander
2010-12-09 10:07     ` Liam Girdwood
2010-12-09 10:07       ` [alsa-devel] " Liam Girdwood
2010-12-09 11:10     ` Mark Brown
2010-12-09 11:10       ` Mark Brown
2010-12-09  0:59   ` [PATCH] ASoC: EP93xx: fixed LRCLK rate and DMA oper. in I2S code Alexander
2010-12-09  0:59     ` Alexander
2010-12-09 10:08     ` Liam Girdwood
2010-12-09 10:08       ` [alsa-devel] " Liam Girdwood
2011-01-16 12:48   ` Alexander
2011-01-16 12:48     ` Alexander
2011-01-17 14:05     ` Liam Girdwood
2011-01-17 14:05       ` [alsa-devel] " Liam Girdwood
2011-01-17 14:07     ` Mark Brown
2011-01-17 14:07       ` Mark Brown

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=20101209123457.GD4469@rakim.wolfsonmicro.main \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=ryan@bluewatersys.com \
    --cc=subaparts@yandex.ru \
    /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.