alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Daniel Mack <zonque@gmail.com>
Cc: Mike Looijmans <mike.looijmans@topic.nl>,
	alsa-devel@alsa-project.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH v2] ALSA: ASoC: McASP: add support for 24 bit samples
Date: Tue, 09 Oct 2012 14:21:48 +0200	[thread overview]
Message-ID: <507416DC.6030207@ladisch.de> (raw)
In-Reply-To: <507403DB.5050003@gmail.com>

Daniel Mack wrote:
> On 09.10.2012 12:24, Mark Brown wrote:
>>> On 09.10.2012 11:41, Mike Looijmans wrote:
>>>> Sorry for the lack of quoting, but I onle get the digest.
>>
>>>> These are wrong:
>>
>>>> +       case SNDRV_PCM_FORMAT_U24_LE:
>>>> +       case SNDRV_PCM_FORMAT_S24_LE:
>>
>>>> These pack a 24-bit sample value in a 32-bit word. The codec will
>>>> send 32 bits to the McASP, and you should transfer 32 bits to the
>>>> user, not just 24. Hence, SNDRV_PCM_FORMAT_S24_LE must be treated
>>>> just like SNDRV_PCM_FORMAT_S32_LE.
>>
>> The above explanation isn't quite right.  For 24 bit the CODEC should be
>> working with 24 bits on the wire (though obviously extra BCLKs are
>> allowed) and the AP should be working with 32 bit words in memory.  The
>> issue here is probably that you're working with real 24 bit data in RAM
>> too.
>
> Hmm, I don't understand. I thought S24_3LE exists to denote a 3-byte
> representation

Yes.

The three possibilities to store little-endian signed 24-bit samples in
memory are (where L=LSB, M=MSB):

  0padding LLLLLLLL MMMMMMMM HHHHHHHH  S32_LE
  LLLLLLLL MMMMMMMM HHHHHHHH 0padding  S24_LE
  LLLLLLLL MMMMMMMM HHHHHHHH           S24_3LE

The first two require the DMA controller to transfer four bytes, the
last one, three bytes.

All three use (at least) 24 bits on the wire.

Mark is right, unless your DMA controller actually happens to support
three-byte samples, with all the alignment problems that entails.
S24_3LE was introduced for USB controllers that are too dumb to
differentiate between memory and on-the-wire formats; nobody else
should want to use it.  (But if the hardware supports it, you might
as well allow it, if you implement it correctly.)

> Hence Mike would be right that S24_LE has to use a 4-byte dma transfer
> size, no?

Yes.


Regards,
Clemens

  reply	other threads:[~2012-10-09 12:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09  9:41 [PATCH v2] ALSA: ASoC: McASP: add support for 24 bit samples Mike Looijmans
2012-10-09  9:47 ` Daniel Mack
2012-10-09  9:49   ` Mike Looijmans
2012-10-09 10:24   ` Mark Brown
2012-10-09 11:00     ` Daniel Mack
2012-10-09 12:21       ` Clemens Ladisch [this message]
2012-10-09 12:32         ` Mark Brown
2012-10-09 13:06         ` Mike Looijmans
  -- strict thread matches above, loose matches on Subject: below --
2012-10-09  7:35 Daniel Mack
2012-10-09  9:26 ` 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=507416DC.6030207@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=mike.looijmans@topic.nl \
    --cc=zonque@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).