From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Brian Austin <brian.austin@cirrus.com>,
alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>,
Paul Handrigan <Paul.Handrigan@cirrus.com>,
Tim Howe <tim.howe@cirrus.com>
Subject: [PATCH] ASoC: cs4349: Fix setting digital interface format
Date: Sun, 19 Jul 2015 22:42:49 +0800 [thread overview]
Message-ID: <1437316969.9569.1.camel@ingics.com> (raw)
Mode Control - Register 02h
Digital Interface Format (DIF[2:0]) Bits 6-4
DIF2 DIF1 DIF0 Description
0 0 0 Left-Justified, up to 24-bit data
0 0 1 I²S, up to 24-bit data
0 1 0 Right-Justified, 16-bit data
0 1 1 Right-Justified, 24-bit data
1 0 0 TDM slot 0
1 0 1 TDM slot 1
1 1 0 TDM slot 2
1 1 1 TDM slot 3
The DIF_MASK is 0x70, so current code does not correctly set the DIFx
setting. Fix it.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
I assume the path "ASoC: cs4349: Don't use rtd->codec" will be applied
first, so this patch is on top of that patch.
sound/soc/codecs/cs4349.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/cs4349.c b/sound/soc/codecs/cs4349.c
index 7f5c3c70..989289d 100644
--- a/sound/soc/codecs/cs4349.c
+++ b/sound/soc/codecs/cs4349.c
@@ -98,17 +98,16 @@ static int cs4349_pcm_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_codec *codec = dai->codec;
struct cs4349_private *cs4349 = snd_soc_codec_get_drvdata(codec);
- int mode, fmt, ret;
+ int fmt, ret;
- mode = snd_soc_read(codec, CS4349_MODE);
cs4349->rate = params_rate(params);
switch (cs4349->mode) {
case SND_SOC_DAIFMT_I2S:
- mode |= MODE_FORMAT(DIF_I2S);
+ fmt = DIF_I2S;
break;
case SND_SOC_DAIFMT_LEFT_J:
- mode |= MODE_FORMAT(DIF_LEFT_JST);
+ fmt = DIF_LEFT_JST;
break;
case SND_SOC_DAIFMT_RIGHT_J:
switch (params_width(params)) {
@@ -121,13 +120,13 @@ static int cs4349_pcm_hw_params(struct snd_pcm_substream *substream,
default:
return -EINVAL;
}
- mode |= MODE_FORMAT(fmt);
break;
default:
return -EINVAL;
}
- ret = snd_soc_write(codec, CS4349_MODE, mode);
+ ret = snd_soc_update_bits(codec, CS4349_MODE, DIF_MASK,
+ MODE_FORMAT(fmt));
if (ret < 0)
return ret;
--
2.1.0
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next reply other threads:[~2015-07-19 14:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-19 14:42 Axel Lin [this message]
2015-07-20 17:52 ` Applied "ASoC: cs4349: Fix setting digital interface format" to the asoc tree Mark Brown
2015-07-30 21:33 ` [PATCH] ASoC: cs4349: Fix setting digital interface format Tim Howe
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=1437316969.9569.1.camel@ingics.com \
--to=axel.lin@ingics.com \
--cc=Paul.Handrigan@cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=brian.austin@cirrus.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=tim.howe@cirrus.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.