Axel Lin | 18 Nov 09:05 2011
Picon

[PATCH 1/2] ASoC: cs42l73: Unify the way to define bits of register

Current code defines some bits with left shift to the proper bit defined in
datasheet, but some don't.
Unify the definition with proper left shift and adjust the code accordingly.

Signed-off-by: Axel Lin <axel.lin <at> gmail.com>
---
Hi, 
I don't have this hardware handy.
I'd appreciate if someone can test this serial of patches.

Thanks
Axel
 sound/soc/codecs/cs42l73.c |    6 +++---
 sound/soc/codecs/cs42l73.h |   18 +++++++++---------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index 6fe259a..0306e72 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
 <at>  <at>  -1028,13 +1028,13  <at>  <at>  static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 		switch (format) {
 		case SND_SOC_DAIFMT_DSP_B:
 			if (inv == SND_SOC_DAIFMT_IB_IF)
-				spc |= (PCM_MODE0 << 4);
+				spc |= PCM_MODE0;
 			if (inv == SND_SOC_DAIFMT_IB_NF)
-				spc |= (PCM_MODE1 << 4);
+				spc |= PCM_MODE1;
 		break;
(Continue reading)

Axel Lin | 18 Nov 09:06 2011
Picon

[PATCH 2/2] ASoC: cs42l73: Fix clear wrong bits in cs42l73_set_dai_fmt

What we want is to clear BIT[5:4](PCM_MODE_MASK) and BIT[3](PCM_BIT_ORDER) bits,
but current code clears BIT[2:0].

Signed-off-by: Axel Lin <axel.lin <at> gmail.com>
---
 sound/soc/codecs/cs42l73.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index 0306e72..a2af595 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
 <at>  <at>  -1024,7 +1024,8  <at>  <at>  static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
 	}

 	if (spc & SPDIF_PCM) {
-		spc &= (31 << 3);	/* Clear PCM mode, set MSB->LSB */
+		/* Clear PCM mode, clear PCM_BIT_ORDER bit for MSB->LSB */
+		spc &= ~(PCM_MODE_MASK | PCM_BIT_ORDER);
 		switch (format) {
 		case SND_SOC_DAIFMT_DSP_B:
 			if (inv == SND_SOC_DAIFMT_IB_IF)
--

-- 
1.7.5.4

Brian Austin | 18 Nov 15:50 2011
Picon

Re: [PATCH 1/2] ASoC: cs42l73: Unify the way to define bits of register


On Fri, 18 Nov 2011, Axel Lin wrote:

> Current code defines some bits with left shift to the proper bit defined in
> datasheet, but some don't.
> Unify the definition with proper left shift and adjust the code accordingly.
>
> Signed-off-by: Axel Lin <axel.lin <at> gmail.com>
> ---
> Hi,
> I don't have this hardware handy.
> I'd appreciate if someone can test this serial of patches.
>
> Thanks
> Axel

I'll try and verify this today. The changes looks fine though.

Thanks,
Brian

Brian Austin | 18 Nov 19:57 2011
Picon

Re: [PATCH 1/2] ASoC: cs42l73: Unify the way to define bits of register


On Fri, 18 Nov 2011, Axel Lin wrote:

> Current code defines some bits with left shift to the proper bit defined in
> datasheet, but some don't.
> Unify the definition with proper left shift and adjust the code accordingly.
>
> Signed-off-by: Axel Lin <axel.lin <at> gmail.com>
> ---
> Hi,
> I don't have this hardware handy.
> I'd appreciate if someone can test this serial of patches.
>
> Thanks
> Axel

Tested both and it works great. The style is much better too :)
Thanks,

Acked-by: Brian Austin <brian.austin <at> cirrus.com>

Mark Brown | 22 Nov 14:02 2011

Re: [PATCH 1/2] ASoC: cs42l73: Unify the way to define bits of register

On Fri, Nov 18, 2011 at 04:05:13PM +0800, Axel Lin wrote:
> Current code defines some bits with left shift to the proper bit defined in
> datasheet, but some don't.
> Unify the definition with proper left shift and adjust the code accordingly.

applied, thanks.

Gmane