From: Alexander <subaparts@yandex.ru>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, ryan@bluewatersys.com,
linux-arm-kernel@lists.infradead.org, lrg@slimlogic.co.uk
Subject: [PATCH] ASoC: EP93xx: fixed LRCLK rate and DMA oper. in I2S code
Date: Thu, 09 Dec 2010 03:59:35 +0300 [thread overview]
Message-ID: <1291856375.31916.94.camel@r60e> (raw)
In-Reply-To: <20101208124637.GD16418@rakim.wolfsonmicro.main>
From: Alexander Sverdlin <subaparts@yandex.ru>
Changes to I2S code:
- SCLK and LRCLK rates are corrected, assuming we always send 32 bits * 2 channels to codec.
- Formats list shortened to just S32_LE, this makes all the DMA transactions right,
while ALSA will do all sample format translation for us.
Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru>
---
sound/soc/ep93xx/ep93xx-i2s.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/soc/ep93xx/ep93xx-i2s.c b/sound/soc/ep93xx/ep93xx-i2s.c
index 4f48733..3e4c3d9 100644
--- a/sound/soc/ep93xx/ep93xx-i2s.c
+++ b/sound/soc/ep93xx/ep93xx-i2s.c
@@ -267,14 +267,16 @@ static int ep93xx_i2s_hw_params(struct snd_pcm_substream *substream,
ep93xx_i2s_write_reg(info, EP93XX_I2S_RXWRDLEN, word_len);
/*
- * Calculate the sdiv (bit clock) and lrdiv (left/right clock) values.
- * If the lrclk is pulse length is larger than the word size, then the
- * bit clock will be gated for the unused bits.
+ * EP93xx I2S module can be setup so SCLK / LRCLK value can be
+ * 32, 64, 128. MCLK / SCLK value can be 2 and 4.
+ * We set LRCLK equal to `rate' and minimum SCLK / LRCLK
+ * value is 64, because our sample size is 32 bit * 2 channels.
+ * I2S standard permits us to transmit more bits than
+ * the codec uses.
*/
- div = (clk_get_rate(info->mclk) / params_rate(params)) *
- params_channels(params);
+ div = clk_get_rate(info->mclk) / params_rate(params);
for (sdiv = 2; sdiv <= 4; sdiv += 2)
- for (lrdiv = 32; lrdiv <= 128; lrdiv <<= 1)
+ for (lrdiv = 64; lrdiv <= 128; lrdiv <<= 1)
if (sdiv * lrdiv == div) {
found = 1;
goto out;
@@ -341,9 +343,7 @@ static struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
.set_fmt = ep93xx_i2s_set_dai_fmt,
};
-#define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
- SNDRV_PCM_FMTBIT_S24_LE | \
- SNDRV_PCM_FMTBIT_S32_LE)
+#define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S32_LE)
static struct snd_soc_dai_driver ep93xx_i2s_dai = {
.symmetric_rates= 1,
WARNING: multiple messages have this Message-ID (diff)
From: subaparts@yandex.ru (Alexander)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ASoC: EP93xx: fixed LRCLK rate and DMA oper. in I2S code
Date: Thu, 09 Dec 2010 03:59:35 +0300 [thread overview]
Message-ID: <1291856375.31916.94.camel@r60e> (raw)
In-Reply-To: <20101208124637.GD16418@rakim.wolfsonmicro.main>
From: Alexander Sverdlin <subaparts@yandex.ru>
Changes to I2S code:
- SCLK and LRCLK rates are corrected, assuming we always send 32 bits * 2 channels to codec.
- Formats list shortened to just S32_LE, this makes all the DMA transactions right,
while ALSA will do all sample format translation for us.
Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru>
---
sound/soc/ep93xx/ep93xx-i2s.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/soc/ep93xx/ep93xx-i2s.c b/sound/soc/ep93xx/ep93xx-i2s.c
index 4f48733..3e4c3d9 100644
--- a/sound/soc/ep93xx/ep93xx-i2s.c
+++ b/sound/soc/ep93xx/ep93xx-i2s.c
@@ -267,14 +267,16 @@ static int ep93xx_i2s_hw_params(struct snd_pcm_substream *substream,
ep93xx_i2s_write_reg(info, EP93XX_I2S_RXWRDLEN, word_len);
/*
- * Calculate the sdiv (bit clock) and lrdiv (left/right clock) values.
- * If the lrclk is pulse length is larger than the word size, then the
- * bit clock will be gated for the unused bits.
+ * EP93xx I2S module can be setup so SCLK / LRCLK value can be
+ * 32, 64, 128. MCLK / SCLK value can be 2 and 4.
+ * We set LRCLK equal to `rate' and minimum SCLK / LRCLK
+ * value is 64, because our sample size is 32 bit * 2 channels.
+ * I2S standard permits us to transmit more bits than
+ * the codec uses.
*/
- div = (clk_get_rate(info->mclk) / params_rate(params)) *
- params_channels(params);
+ div = clk_get_rate(info->mclk) / params_rate(params);
for (sdiv = 2; sdiv <= 4; sdiv += 2)
- for (lrdiv = 32; lrdiv <= 128; lrdiv <<= 1)
+ for (lrdiv = 64; lrdiv <= 128; lrdiv <<= 1)
if (sdiv * lrdiv == div) {
found = 1;
goto out;
@@ -341,9 +343,7 @@ static struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
.set_fmt = ep93xx_i2s_set_dai_fmt,
};
-#define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
- SNDRV_PCM_FMTBIT_S24_LE | \
- SNDRV_PCM_FMTBIT_S32_LE)
+#define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S32_LE)
static struct snd_soc_dai_driver ep93xx_i2s_dai = {
.symmetric_rates= 1,
next prev parent reply other threads:[~2010-12-09 0:59 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
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 ` Alexander [this message]
2010-12-09 0:59 ` [PATCH] ASoC: EP93xx: fixed LRCLK rate and DMA oper. in I2S code 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=1291856375.31916.94.camel@r60e \
--to=subaparts@yandex.ru \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=lrg@slimlogic.co.uk \
--cc=ryan@bluewatersys.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.