All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Reichl <hias@horus.com>
To: "Emmanuel Fusté" <emmanuel.fuste@laposte.net>
Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Lee Jones <lee@kernel.org>,
	phil@raspberrypi.org, Liam Girdwood <lgirdwood@gmail.com>,
	Matt Flax <flatmax@flatmax.org>, Eric Anholt <eric@anholt.net>,
	florian.kauer@koalo.de, Mark Brown <broonie@kernel.org>,
	Florian Meier <florian.meier@koalo.de>,
	linux-rpi-kernel@lists.infradead.org,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 0/3] ASoC: Enable a new IC master mode: bcm2835<=>IC<=>cs42xx8
Date: Tue, 21 Mar 2017 23:11:45 +0100	[thread overview]
Message-ID: <20170321221145.GA7258@camel2.lan> (raw)
In-Reply-To: <e0adcc6c-8bf4-adae-874b-c291e71e5712@laposte.net>

On Tue, Mar 21, 2017 at 10:21:04PM +0100, Emmanuel Fusté wrote:
> Le 16/03/2017 à 23:14, Matt Flax a écrit :
> >
> >
> >On 17/03/17 08:27, Lars-Peter Clausen wrote:
> >>On 03/16/2017 09:51 PM, Matt Flax wrote:
> >>>
> >>>On 16/03/17 06:01, Mark Brown wrote:
> >>>>On Tue, Feb 28, 2017 at 09:59:29AM +0000, Charles Keepax wrote:
> >>>>>On Mon, Feb 27, 2017 at 12:51:08PM +0100, Matthias Reichl wrote:
> >>>>>>>I have a bcm2835 (Pi 2 and 3) SoC here. It is producing
> >>>>>>>multichannel (8
> >>>>>>>out,
> >>>>>>>6 in) audio. In ALSA we call that DSP mode - right ?!
> >>>>>>No. DSP modes are protocol/timing specifications as I2S, PDP,
> >>>>>>S/PDIF, ...
> >>>>>>You can look these up in datasheets and if a chip implements such a
> >>>>>>protocol you can be sure that it adheres to that standard - i.e. it
> >>>>>>will sync the frames to the pulses on LRclk.
> >>>>>I agree with the thoughts in this thread really if the AP doesn't
> >>>>>actually support DSP A mode we shouldn't add DSP A mode.
> >>>>The trouble here is that this isn't 100% clear, the specifications of
> >>>>the DSP modes are such that only one edge in the LRCLK matters and so
> >>>>providing you're doing mono or have exact clocking they interoperate
> >>>>perfectly well.  We already frequently do similar things the other
> >>>>way,
> >>>>most of the programmable serial ports can't actually do I2S modes
> >>>>properly and rely on exact clocking to get things right when operating
> >>>>as I2S since they only sync on one edge (though they can generally
> >>>>generate the clocks correctly when operating as master, they just
> >>>>don't
> >>>>pay attention to the left/right switch edge).
> >>>>
> >>>>That said unless we're doing something with the data layout or similar
> >>>>configuration there's a fairly strong case for putting the mangling
> >>>>for
> >>>>this in the core, something like just falling back to I2S mode if we
> >>>>set
> >>>>DSP A and so on.  Which would be a lot nicer if we actually got
> >>>>round to
> >>>>putting mode capability information in the drivers.
> >>>I agree, the data layout is already configurable in the bcm2835_i2s.c
> >>>platform driver. We can already use the "snd_soc_dai_set_bclk_ratio"
> >>>function to manage word offsets in our machine drivers.
> >>>
> >>>There is nothing which says that the bcm2835 SoC is I2S restricted in
> >>>any
> >>>way. In fact, the reference document says quite the opposite.
> >>>
> >>>In the reference "BCM2835 ARM Peripherals" pdf, they call the audio
> >>>system
> >>>an "APB peripheral". They are saying that it is reconfigurable and
> >>>part of
> >>>the AMBA family of interconnect schemes.
> >>>
> >>>As far as the bcm2835_i2s platform driver goes, it has implemented an
> >>>AMBA
> >>>protocol, where audio words are counted from the LR clock onset - for
> >>>some
> >>>reason people are insisting this is an I2S bus. Really our
> >>>implementation is
> >>>not I2S at all, because word onsets are programmable and flexible in
> >>>the
> >>>bcm2835_i2s.c driver.
> >>AMBA/APB is the interface which connects the peripheral to the system
> >>memory
> >>bus. It is the interface over which the CPU does configuration register
> >>writes. This has nothing and absolutely nothing to do with the I2S
> >>interface
> >>that is also implemented by the peripheral that is used to stream audio
> >>to
> >>and from external components.
> >>
> >
> >Their (BCM reference) document [1] specifically states "It supports many
> >classic PCM formats including I2S".
> >
> >Do agree with Mark's statement "the specifications of the DSP modes are
> >such that only one edge in the LRCLK matters" ?
> >
> >If we look at the bcm2835 platform driver setup, it is concerned with bit
> >clock counting to specify the audio data for both of the AMBA/APB channels
> >from serial bitstream into memory. It has two channels into memory,
> >however "it supports many classic PCM formats" ... my vote for one classic
> >format is DSP mode !
> >
> >Do you see a problem with that ?
> >
> >thanks
> >Matt
> >[1] https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
> >_______________________________________________
> >
> Re-reading this document, the bcm2835 PCM IP block SHOULD support real DSP
> mode, with one BCLK pulsed LRCLK, zero BCLK delay etc...
> It just need to be properly setup.

I've re-read the document, too, last week and noticed the framesync
registers - sorry, I had completely forgotten about these. I guess it
should be possible to configure the bcm2835 to DSP mode but it'd still be
limited to 2 channel setups - the hardware only has 2 channel position
registers for each direction.

> According to the same document, you could program the bmc up to 16 32bits
> channels when in master mode, so I suspect that you could go up to this
> limit in slave mode.
> But as it is designed, it could only use up to two of any channels among the
> 16.

I'm not quite sure if I can follow you on this - how would you
configure 16 channels when there are only 2 channel position registers?

With bclk ratio eg set to 16*32=512 BCM2835 will only transmit 2*32
bits of data (at configurable bit positions), the remaining 448
bits will be zero.

so long,

Hias

WARNING: multiple messages have this Message-ID (diff)
From: hias@horus.com (Matthias Reichl)
To: linux-arm-kernel@lists.infradead.org
Subject: [alsa-devel] [PATCH 0/3] ASoC: Enable a new IC master mode: bcm2835<=>IC<=>cs42xx8
Date: Tue, 21 Mar 2017 23:11:45 +0100	[thread overview]
Message-ID: <20170321221145.GA7258@camel2.lan> (raw)
In-Reply-To: <e0adcc6c-8bf4-adae-874b-c291e71e5712@laposte.net>

On Tue, Mar 21, 2017 at 10:21:04PM +0100, Emmanuel Fust? wrote:
> Le 16/03/2017 ? 23:14, Matt Flax a ?crit :
> >
> >
> >On 17/03/17 08:27, Lars-Peter Clausen wrote:
> >>On 03/16/2017 09:51 PM, Matt Flax wrote:
> >>>
> >>>On 16/03/17 06:01, Mark Brown wrote:
> >>>>On Tue, Feb 28, 2017 at 09:59:29AM +0000, Charles Keepax wrote:
> >>>>>On Mon, Feb 27, 2017 at 12:51:08PM +0100, Matthias Reichl wrote:
> >>>>>>>I have a bcm2835 (Pi 2 and 3) SoC here. It is producing
> >>>>>>>multichannel (8
> >>>>>>>out,
> >>>>>>>6 in) audio. In ALSA we call that DSP mode - right ?!
> >>>>>>No. DSP modes are protocol/timing specifications as I2S, PDP,
> >>>>>>S/PDIF, ...
> >>>>>>You can look these up in datasheets and if a chip implements such a
> >>>>>>protocol you can be sure that it adheres to that standard - i.e. it
> >>>>>>will sync the frames to the pulses on LRclk.
> >>>>>I agree with the thoughts in this thread really if the AP doesn't
> >>>>>actually support DSP A mode we shouldn't add DSP A mode.
> >>>>The trouble here is that this isn't 100% clear, the specifications of
> >>>>the DSP modes are such that only one edge in the LRCLK matters and so
> >>>>providing you're doing mono or have exact clocking they interoperate
> >>>>perfectly well.  We already frequently do similar things the other
> >>>>way,
> >>>>most of the programmable serial ports can't actually do I2S modes
> >>>>properly and rely on exact clocking to get things right when operating
> >>>>as I2S since they only sync on one edge (though they can generally
> >>>>generate the clocks correctly when operating as master, they just
> >>>>don't
> >>>>pay attention to the left/right switch edge).
> >>>>
> >>>>That said unless we're doing something with the data layout or similar
> >>>>configuration there's a fairly strong case for putting the mangling
> >>>>for
> >>>>this in the core, something like just falling back to I2S mode if we
> >>>>set
> >>>>DSP A and so on.  Which would be a lot nicer if we actually got
> >>>>round to
> >>>>putting mode capability information in the drivers.
> >>>I agree, the data layout is already configurable in the bcm2835_i2s.c
> >>>platform driver. We can already use the "snd_soc_dai_set_bclk_ratio"
> >>>function to manage word offsets in our machine drivers.
> >>>
> >>>There is nothing which says that the bcm2835 SoC is I2S restricted in
> >>>any
> >>>way. In fact, the reference document says quite the opposite.
> >>>
> >>>In the reference "BCM2835 ARM Peripherals" pdf, they call the audio
> >>>system
> >>>an "APB peripheral". They are saying that it is reconfigurable and
> >>>part of
> >>>the AMBA family of interconnect schemes.
> >>>
> >>>As far as the bcm2835_i2s platform driver goes, it has implemented an
> >>>AMBA
> >>>protocol, where audio words are counted from the LR clock onset - for
> >>>some
> >>>reason people are insisting this is an I2S bus. Really our
> >>>implementation is
> >>>not I2S at all, because word onsets are programmable and flexible in
> >>>the
> >>>bcm2835_i2s.c driver.
> >>AMBA/APB is the interface which connects the peripheral to the system
> >>memory
> >>bus. It is the interface over which the CPU does configuration register
> >>writes. This has nothing and absolutely nothing to do with the I2S
> >>interface
> >>that is also implemented by the peripheral that is used to stream audio
> >>to
> >>and from external components.
> >>
> >
> >Their (BCM reference) document [1] specifically states "It supports many
> >classic PCM formats including I2S".
> >
> >Do agree with Mark's statement "the specifications of the DSP modes are
> >such that only one edge in the LRCLK matters" ?
> >
> >If we look at the bcm2835 platform driver setup, it is concerned with bit
> >clock counting to specify the audio data for both of the AMBA/APB channels
> >from serial bitstream into memory. It has two channels into memory,
> >however "it supports many classic PCM formats" ... my vote for one classic
> >format is DSP mode !
> >
> >Do you see a problem with that ?
> >
> >thanks
> >Matt
> >[1] https://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
> >_______________________________________________
> >
> Re-reading this document, the bcm2835 PCM IP block SHOULD support real DSP
> mode, with one BCLK pulsed LRCLK, zero BCLK delay etc...
> It just need to be properly setup.

I've re-read the document, too, last week and noticed the framesync
registers - sorry, I had completely forgotten about these. I guess it
should be possible to configure the bcm2835 to DSP mode but it'd still be
limited to 2 channel setups - the hardware only has 2 channel position
registers for each direction.

> According to the same document, you could program the bmc up to 16 32bits
> channels when in master mode, so I suspect that you could go up to this
> limit in slave mode.
> But as it is designed, it could only use up to two of any channels among the
> 16.

I'm not quite sure if I can follow you on this - how would you
configure 16 channels when there are only 2 channel position registers?

With bclk ratio eg set to 16*32=512 BCM2835 will only transmit 2*32
bits of data (at configurable bit positions), the remaining 448
bits will be zero.

so long,

Hias

  reply	other threads:[~2017-03-21 22:11 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25  5:03 [PATCH 0/3] ASoC: Enable a new IC master mode: bcm2835<=>IC<=>cs42xx8 Matt Flax
2017-02-25  5:03 ` Matt Flax
2017-02-25  5:03 ` [PATCH 1/3] ASoC : Add an IC bit and frame master mode (SoC and Codec slave) Matt Flax
2017-02-25  5:03   ` Matt Flax
2017-03-15 19:02   ` Mark Brown
2017-03-15 19:02     ` Mark Brown
2017-02-25  5:03 ` [PATCH 2/3] ASoC: cs42xx8: allow IC master mode Matt Flax
2017-02-25  5:03   ` Matt Flax
2017-02-25  5:03 ` [PATCH 3/3] ASoC: bcm2835: Add mutichannel mode in DSP and IC master modes Matt Flax
2017-02-25  5:03   ` Matt Flax
2017-02-25 13:39 ` [PATCH 0/3] ASoC: Enable a new IC master mode: bcm2835<=>IC<=>cs42xx8 Matthias Reichl
2017-02-25 13:39   ` Matthias Reichl
2017-02-25 22:13   ` Matt Flax
2017-02-25 22:13     ` [alsa-devel] " Matt Flax
2017-02-26 14:49     ` Matthias Reichl
2017-02-26 14:49       ` [alsa-devel] " Matthias Reichl
2017-02-26 20:21       ` Matt Flax
2017-02-26 20:21         ` [alsa-devel] " Matt Flax
2017-02-26 22:16         ` Matthias Reichl
2017-02-26 22:16           ` [alsa-devel] " Matthias Reichl
2017-02-26 22:35           ` Matt Flax
2017-02-26 22:35             ` [alsa-devel] " Matt Flax
2017-02-27  8:04             ` Matthias Reichl
2017-02-27  8:04               ` [alsa-devel] " Matthias Reichl
2017-02-27 10:08               ` Matt Flax
2017-02-27 10:08                 ` [alsa-devel] " Matt Flax
2017-02-27 10:30                 ` Matthias Reichl
2017-02-27 10:30                   ` [alsa-devel] " Matthias Reichl
2017-02-27 11:21                   ` Matt Flax
2017-02-27 11:21                     ` [alsa-devel] " Matt Flax
2017-02-27 11:51                     ` Matthias Reichl
2017-02-27 11:51                       ` [alsa-devel] " Matthias Reichl
2017-02-28  9:59                       ` Charles Keepax
2017-02-28  9:59                         ` [alsa-devel] " Charles Keepax
2017-03-15 19:01                         ` Mark Brown
2017-03-15 19:01                           ` [alsa-devel] " Mark Brown
2017-03-16 20:51                           ` Matt Flax
2017-03-16 20:51                             ` [alsa-devel] " Matt Flax
2017-03-16 21:27                             ` Lars-Peter Clausen
2017-03-16 21:27                               ` [alsa-devel] " Lars-Peter Clausen
2017-03-16 22:14                               ` Matt Flax
2017-03-16 22:14                                 ` [alsa-devel] " Matt Flax
2017-03-21 21:21                                 ` Emmanuel Fusté
2017-03-21 21:21                                   ` [alsa-devel] " Emmanuel Fusté
2017-03-21 22:11                                   ` Matthias Reichl [this message]
2017-03-21 22:11                                     ` Matthias Reichl
2017-03-21 23:29                                     ` Matt Flax
2017-03-21 23:29                                       ` [alsa-devel] " Matt Flax
2017-03-22  9:43                                       ` Charles Keepax
2017-03-22  9:43                                         ` [alsa-devel] " Charles Keepax
2017-03-22 12:04                                         ` Matt Flax
2017-03-22 12:04                                           ` [alsa-devel] " Matt Flax
2017-03-22 12:34                                           ` Charles Keepax
2017-03-22 12:34                                             ` Charles Keepax
2017-03-22 15:38                                           ` Stephen Warren
2017-03-22 15:38                                             ` [alsa-devel] " Stephen Warren
2017-03-24 19:11                                             ` Mark Brown
2017-03-24 19:11                                               ` [alsa-devel] " Mark Brown
2017-03-24 19:09                                           ` Mark Brown
2017-03-24 19:09                                             ` [alsa-devel] " Mark Brown
2017-03-25  5:45                                             ` Matt Flax
2017-03-25  5:45                                               ` [alsa-devel] " Matt Flax
2017-03-27 10:01                                               ` Mark Brown
2017-03-27 10:01                                                 ` [alsa-devel] " Mark Brown
2017-03-27 10:35                                                 ` Matt Flax
2017-03-27 10:35                                                   ` [alsa-devel] " Matt Flax
2017-03-27 11:30                                                   ` Mark Brown
2017-03-27 11:30                                                     ` [alsa-devel] " Mark Brown
2017-03-26 19:02                                     ` Emmanuel Fusté
2017-03-26 19:02                                       ` [alsa-devel] " Emmanuel Fusté
2017-02-28 10:10         ` Charles Keepax
2017-02-28 10:10           ` [alsa-devel] " Charles Keepax
2017-02-26 20:41       ` Emmanuel Fusté
2017-02-26 20:41         ` [alsa-devel] " Emmanuel Fusté
2017-02-26 21:44         ` Matt Flax
2017-02-26 22:49           ` Emmanuel Fusté
2017-02-27  9:14         ` Matthias Reichl
2017-02-27  9:14           ` [alsa-devel] " Matthias Reichl
2017-02-27 18:19           ` Emmanuel Fusté
2017-02-27 19:12           ` Emmanuel Fusté
2017-02-27 19:12             ` [alsa-devel] " Emmanuel Fusté

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=20170321221145.GA7258@camel2.lan \
    --to=hias@horus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=emmanuel.fuste@laposte.net \
    --cc=eric@anholt.net \
    --cc=flatmax@flatmax.org \
    --cc=florian.kauer@koalo.de \
    --cc=florian.meier@koalo.de \
    --cc=lars@metafoo.de \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=phil@raspberrypi.org \
    --cc=swarren@wwwdotorg.org \
    /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.