From: Daniel Mack <zonque@gmail.com>
To: alsa-devel@alsa-project.org
Cc: khilman@ti.com, mporter@ti.com,
broonie@opensource.wolfsonmicro.com, nsekhar@ti.com,
vaibhav.bedia@ti.com, gururaja.hebbar@ti.com,
Daniel Mack <zonque@gmail.com>
Subject: [PATCH 2/3] ALSA: ASoC: McASP: determine XSSZ value programatically
Date: Wed, 5 Dec 2012 16:37:41 +0100 [thread overview]
Message-ID: <1354721862-10318-2-git-send-email-zonque@gmail.com> (raw)
In-Reply-To: <1354721862-10318-1-git-send-email-zonque@gmail.com>
This shouldn't change any functionality and is just a preparation a
special case handling.
Signed-off-by: Daniel Mack <zonque@gmail.com>
---
sound/soc/davinci/davinci-mcasp.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 023a70d..68a2ea0 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -621,48 +621,48 @@ static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id,
static int davinci_config_channel_size(struct davinci_audio_dev *dev,
int channel_size)
{
- u32 fmt = 0;
- u32 mask, rotate;
+ u32 fmt, mask, rotate;
+ u8 n_bits = 0;
switch (channel_size) {
case DAVINCI_AUDIO_WORD_8:
- fmt = 0x03;
+ n_bits = 8;
rotate = 6;
mask = 0x000000ff;
break;
case DAVINCI_AUDIO_WORD_12:
- fmt = 0x05;
+ n_bits = 12;
rotate = 5;
mask = 0x00000fff;
break;
case DAVINCI_AUDIO_WORD_16:
- fmt = 0x07;
+ n_bits = 16;
rotate = 4;
mask = 0x0000ffff;
break;
case DAVINCI_AUDIO_WORD_20:
- fmt = 0x09;
+ n_bits = 20;
rotate = 3;
mask = 0x000fffff;
break;
case DAVINCI_AUDIO_WORD_24:
- fmt = 0x0B;
+ n_bits = 24;
rotate = 2;
mask = 0x00ffffff;
break;
case DAVINCI_AUDIO_WORD_28:
- fmt = 0x0D;
+ n_bits = 28;
rotate = 1;
mask = 0x0fffffff;
break;
case DAVINCI_AUDIO_WORD_32:
- fmt = 0x0F;
+ n_bits = 32;
rotate = 0;
mask = 0xffffffff;
break;
@@ -671,6 +671,9 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,
return -EINVAL;
}
+ /* mapping of the XSSZ bit-field as described in the datasheet */
+ fmt = (n_bits >> 1) - 1;
+
mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG,
RXSSZ(fmt), RXSSZ(0x0F));
mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG,
--
1.7.11.7
next prev parent reply other threads:[~2012-12-05 15:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 15:37 [PATCH 1/3] ALSA: ASoC: McASP: remove unused variables Daniel Mack
2012-12-05 15:37 ` Daniel Mack [this message]
2012-12-05 17:18 ` [PATCH 2/3] ALSA: ASoC: McASP: determine XSSZ value programatically Daniel Mack
2012-12-06 3:18 ` Hebbar, Gururaja
2012-12-06 11:21 ` Daniel Mack
2012-12-05 15:37 ` [PATCH 3/3] ALSA: ASoC: McASP: implement a way to force BCLK/LRCLK ratios Daniel Mack
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=1354721862-10318-2-git-send-email-zonque@gmail.com \
--to=zonque@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gururaja.hebbar@ti.com \
--cc=khilman@ti.com \
--cc=mporter@ti.com \
--cc=nsekhar@ti.com \
--cc=vaibhav.bedia@ti.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