From: Matt Flax <flatmax@flatmax.org>
To: alsa-devel@alsa-project.org,
Stephen Warren <swarren@wwwdotorg.org>,
Lee Jones <lee@kernel.org>, Eric Anholt <eric@anholt.net>,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Florian Meier <florian.meier@koalo.de>,
broonie@kernel.org, phil@raspberrypi.org
Cc: Matt Flax <flatmax@flatmax.org>
Subject: [PATCH] ASoC: bcm2835: Add 8 channel (multitrack) capability
Date: Tue, 7 Feb 2017 10:09:36 +1100 [thread overview]
Message-ID: <1486422576-6958-1-git-send-email-flatmax@flatmax.org> (raw)
This patch adds 8 channel capability by allowing DSP modes. It
also increases the channels_max (in the bcm2835_i2s_dai structure)
to 8.
The driver guards against multitrack mode when the codec isn't
master. The driver guards against multitrack capability when in
I2S mode.
Signed-off-by: Matt Flax <flatmax@flatmax.org>
---
sound/soc/bcm/bcm2835-i2s.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
index 6ba2049..022ca13 100644
--- a/sound/soc/bcm/bcm2835-i2s.c
+++ b/sound/soc/bcm/bcm2835-i2s.c
@@ -276,11 +276,16 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
/* otherwise calculate a fitting block ratio */
bclk_ratio = 2 * data_length;
- /* Clock should only be set up here if CPU is clock master */
+ /* Clock should only be set up here if CPU is clock master.
+ If codec isn't master guard against multichannel mode. */
switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS:
case SND_SOC_DAIFMT_CBS_CFM:
clk_set_rate(dev->clk, sampling_rate * bclk_ratio);
+ case SND_SOC_DAIFMT_CBM_CFS:
+ /* Codec must be master in multichannel mode */
+ if (params_channels(params) > 2)
+ return -EINVAL;
break;
default:
break;
@@ -294,8 +299,14 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
format |= BCM2835_I2S_CHWID((data_length-8)&0xf);
+ /* Default data delay to 1 bit.
+ In I2S mode, we must have 2 channels */
switch (dev->fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
+ if (params_channels(params) != 2)
+ return -EINVAL;
+ case SND_SOC_DAIFMT_DSP_A:
+ case SND_SOC_DAIFMT_DSP_B:
data_delay = 1;
break;
default:
@@ -312,6 +323,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
switch (params_channels(params)) {
case 2:
+ case 8:
format = BCM2835_I2S_CH1(format) | BCM2835_I2S_CH2(format);
format |= BCM2835_I2S_CH1(BCM2835_I2S_CHPOS(ch1pos));
format |= BCM2835_I2S_CH2(BCM2835_I2S_CHPOS(ch2pos));
@@ -577,7 +589,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = {
.probe = bcm2835_i2s_dai_probe,
.playback = {
.channels_min = 2,
- .channels_max = 2,
+ .channels_max = 8,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE
| SNDRV_PCM_FMTBIT_S24_LE
@@ -585,7 +597,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = {
},
.capture = {
.channels_min = 2,
- .channels_max = 2,
+ .channels_max = 8,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE
| SNDRV_PCM_FMTBIT_S24_LE
--
2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: flatmax@flatmax.org (Matt Flax)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ASoC: bcm2835: Add 8 channel (multitrack) capability
Date: Tue, 7 Feb 2017 10:09:36 +1100 [thread overview]
Message-ID: <1486422576-6958-1-git-send-email-flatmax@flatmax.org> (raw)
This patch adds 8 channel capability by allowing DSP modes. It
also increases the channels_max (in the bcm2835_i2s_dai structure)
to 8.
The driver guards against multitrack mode when the codec isn't
master. The driver guards against multitrack capability when in
I2S mode.
Signed-off-by: Matt Flax <flatmax@flatmax.org>
---
sound/soc/bcm/bcm2835-i2s.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
index 6ba2049..022ca13 100644
--- a/sound/soc/bcm/bcm2835-i2s.c
+++ b/sound/soc/bcm/bcm2835-i2s.c
@@ -276,11 +276,16 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
/* otherwise calculate a fitting block ratio */
bclk_ratio = 2 * data_length;
- /* Clock should only be set up here if CPU is clock master */
+ /* Clock should only be set up here if CPU is clock master.
+ If codec isn't master guard against multichannel mode. */
switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS:
case SND_SOC_DAIFMT_CBS_CFM:
clk_set_rate(dev->clk, sampling_rate * bclk_ratio);
+ case SND_SOC_DAIFMT_CBM_CFS:
+ /* Codec must be master in multichannel mode */
+ if (params_channels(params) > 2)
+ return -EINVAL;
break;
default:
break;
@@ -294,8 +299,14 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
format |= BCM2835_I2S_CHWID((data_length-8)&0xf);
+ /* Default data delay to 1 bit.
+ In I2S mode, we must have 2 channels */
switch (dev->fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
+ if (params_channels(params) != 2)
+ return -EINVAL;
+ case SND_SOC_DAIFMT_DSP_A:
+ case SND_SOC_DAIFMT_DSP_B:
data_delay = 1;
break;
default:
@@ -312,6 +323,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
switch (params_channels(params)) {
case 2:
+ case 8:
format = BCM2835_I2S_CH1(format) | BCM2835_I2S_CH2(format);
format |= BCM2835_I2S_CH1(BCM2835_I2S_CHPOS(ch1pos));
format |= BCM2835_I2S_CH2(BCM2835_I2S_CHPOS(ch2pos));
@@ -577,7 +589,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = {
.probe = bcm2835_i2s_dai_probe,
.playback = {
.channels_min = 2,
- .channels_max = 2,
+ .channels_max = 8,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE
| SNDRV_PCM_FMTBIT_S24_LE
@@ -585,7 +597,7 @@ static struct snd_soc_dai_driver bcm2835_i2s_dai = {
},
.capture = {
.channels_min = 2,
- .channels_max = 2,
+ .channels_max = 8,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE
| SNDRV_PCM_FMTBIT_S24_LE
--
2.7.4
next reply other threads:[~2017-02-06 23:09 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 23:09 Matt Flax [this message]
2017-02-06 23:09 ` [PATCH] ASoC: bcm2835: Add 8 channel (multitrack) capability Matt Flax
2017-02-08 18:28 ` Mark Brown
2017-02-08 18:28 ` Mark Brown
2017-02-08 18:54 ` Matthias Reichl
2017-02-08 18:54 ` Matthias Reichl
2017-02-08 21:13 ` Matt Flax
2017-02-08 21:13 ` [alsa-devel] " Matt Flax
2017-02-08 22:48 ` Matt Flax
2017-02-08 22:48 ` [alsa-devel] " Matt Flax
2017-02-09 9:29 ` Matthias Reichl
2017-02-09 9:29 ` [alsa-devel] " Matthias Reichl
2017-02-08 20:41 ` Matt Flax
2017-02-08 20:41 ` [alsa-devel] " Matt Flax
2017-02-08 21:14 ` Matt Flax
2017-02-08 21:14 ` [alsa-devel] " Matt Flax
2017-02-12 23:27 ` [PATCH v2] " Matt Flax
2017-02-12 23:27 ` Matt Flax
2017-02-13 20:51 ` Eric Anholt
2017-02-13 20:51 ` Eric Anholt
2017-02-14 9:32 ` Charles Keepax
2017-02-14 9:32 ` [alsa-devel] " Charles Keepax
2017-02-14 20:36 ` Matt Flax
2017-02-14 20:36 ` [alsa-devel] " Matt Flax
2017-02-14 20:52 ` [PATCH v3] " Matt Flax
2017-02-14 20:52 ` Matt Flax
2017-02-14 21:00 ` Matt Flax
2017-02-14 21:00 ` [alsa-devel] " Matt Flax
2017-02-14 21:04 ` [PATCH v4] " Matt Flax
2017-02-14 21:04 ` Matt Flax
2017-02-15 8:30 ` Arnaud Mouiche
2017-02-22 5:15 ` Matt Flax
2017-02-15 9:24 ` Charles Keepax
2017-02-15 9:24 ` Charles Keepax
2017-02-15 12:37 ` Florian Kauer
2017-02-15 12:37 ` Florian Kauer
2017-02-15 19:26 ` Eric Anholt
2017-02-15 19:26 ` Eric Anholt
2017-02-22 5:18 ` [PATCH v5] " Matt Flax
2017-02-22 5:18 ` Matt Flax
2017-02-22 5:20 ` Matt Flax
2017-02-22 5:20 ` Matt Flax
2017-02-22 5:22 ` [PATCH v6] " Matt Flax
2017-02-22 5:22 ` Matt Flax
2017-02-22 6:49 ` [alsa-devel] " kbuild test robot
2017-02-22 6:49 ` kbuild test robot
2017-02-22 18:28 ` Mark Brown
2017-02-22 18:28 ` Mark Brown
2017-02-22 22:45 ` Matt Flax
2017-02-22 22:45 ` [alsa-devel] " Matt Flax
2017-02-23 17:28 ` Mark Brown
2017-02-23 17:28 ` [alsa-devel] " Mark Brown
2017-02-22 6:56 ` [PATCH v8] " Matt Flax
2017-02-22 6:56 ` Matt Flax
2017-02-24 12:18 ` Matthias Reichl
2017-02-24 12:18 ` [alsa-devel] " Matthias Reichl
2017-02-24 13:50 ` Matt Flax
2017-02-24 13:50 ` [alsa-devel] " Matt Flax
2017-02-24 20:25 ` Matthias Reichl
2017-02-24 20:25 ` [alsa-devel] " Matthias Reichl
2017-02-24 21:30 ` Matt Flax
2017-02-24 21:30 ` [alsa-devel] " Matt Flax
2017-02-24 23:02 ` Matthias Reichl
2017-02-24 23:02 ` [alsa-devel] " Matthias Reichl
2017-02-25 0:08 ` Emmanuel Fusté
2017-02-25 0:08 ` [alsa-devel] " Emmanuel Fusté
2017-02-25 2:38 ` Matt Flax
2017-02-25 2:38 ` [alsa-devel] " Matt Flax
2017-02-25 5:04 ` Matt Flax
2017-02-25 5:04 ` [alsa-devel] " Matt Flax
2017-02-26 20:28 ` Matt Flax
2017-02-26 20:28 ` [alsa-devel] " Matt Flax
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=1486422576-6958-1-git-send-email-flatmax@flatmax.org \
--to=flatmax@flatmax.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=eric@anholt.net \
--cc=florian.meier@koalo.de \
--cc=lee@kernel.org \
--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.