alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT] ASoC: sta529: Fix update register bits in sta529_set_dai_fmt
@ 2012-12-20  8:17 Axel Lin
  2012-12-20 10:17 ` Rajeev kumar
  2012-12-20 16:01 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2012-12-20  8:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Rajeev Kumar, Liam Girdwood

Both the mask and mode settings are wrong in current code.

According to the datasheet:

S2PCFG0 (0x0A)
BIT[3:1] DATA_FORMAT
        serial interface protocol format:
        000: left Justified
        001: I2S (default)
        010: right justified
        100: PCM no delay
        101: PCM delay
        111: DSP

Thus fixes the defines for LEFT_J_DATA_FORMAT, I2S_DATA_FORMAT, and
RIGHT_J_DATA_FORMAT.
Also adds define for DATA_FORMAT_MSK.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
Hi Rajeev,
I don't have this hardware, can you test this patch?
Thanks,
Axel
 sound/soc/codecs/sta529.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index ab355c4..40c07be 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -74,9 +74,10 @@
 				SNDRV_PCM_FMTBIT_S32_LE)
 #define	S2PC_VALUE		0x98
 #define CLOCK_OUT		0x60
-#define LEFT_J_DATA_FORMAT	0x10
-#define I2S_DATA_FORMAT		0x12
-#define RIGHT_J_DATA_FORMAT	0x14
+#define DATA_FORMAT_MSK		0x0E
+#define LEFT_J_DATA_FORMAT	0x00
+#define I2S_DATA_FORMAT		0x02
+#define RIGHT_J_DATA_FORMAT	0x04
 #define CODEC_MUTE_VAL		0x80
 
 #define POWER_CNTLMSAK		0x40
@@ -289,7 +290,7 @@ static int sta529_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
 		return -EINVAL;
 	}
 
-	snd_soc_update_bits(codec, STA529_S2PCFG0, 0x0D, mode);
+	snd_soc_update_bits(codec, STA529_S2PCFG0, DATA_FORMAT_MSK, mode);
 
 	return 0;
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RFT] ASoC: sta529: Fix update register bits in sta529_set_dai_fmt
  2012-12-20  8:17 [PATCH RFT] ASoC: sta529: Fix update register bits in sta529_set_dai_fmt Axel Lin
@ 2012-12-20 10:17 ` Rajeev kumar
  2012-12-20 16:01 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Rajeev kumar @ 2012-12-20 10:17 UTC (permalink / raw)
  To: Axel Lin; +Cc: alsa-devel@alsa-project.org, Mark Brown, Liam Girdwood

Hello Axel,

On 12/20/2012 1:47 PM, Axel Lin wrote:
> Both the mask and mode settings are wrong in current code.
>
> According to the datasheet:
>
> S2PCFG0 (0x0A)
> BIT[3:1] DATA_FORMAT
>          serial interface protocol format:
>          000: left Justified
>          001: I2S (default)
>          010: right justified
>          100: PCM no delay
>          101: PCM delay
>          111: DSP
>
> Thus fixes the defines for LEFT_J_DATA_FORMAT, I2S_DATA_FORMAT, and
> RIGHT_J_DATA_FORMAT.
> Also adds define for DATA_FORMAT_MSK.
>
> Signed-off-by: Axel Lin<axel.lin@ingics.com>
> ---
> Hi Rajeev,
> I don't have this hardware, can you test this patch?

Thanks for pointing it out. I have tested it and is working fine.

Acked-By: Rajeev Kumar <rajeev-dlh.kumar@st.com>

> Thanks,
> Axel
>   sound/soc/codecs/sta529.c |    9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
> index ab355c4..40c07be 100644
> --- a/sound/soc/codecs/sta529.c
> +++ b/sound/soc/codecs/sta529.c
> @@ -74,9 +74,10 @@
>   				SNDRV_PCM_FMTBIT_S32_LE)
>   #define	S2PC_VALUE		0x98
>   #define CLOCK_OUT		0x60
> -#define LEFT_J_DATA_FORMAT	0x10
> -#define I2S_DATA_FORMAT		0x12
> -#define RIGHT_J_DATA_FORMAT	0x14
> +#define DATA_FORMAT_MSK		0x0E
> +#define LEFT_J_DATA_FORMAT	0x00
> +#define I2S_DATA_FORMAT		0x02
> +#define RIGHT_J_DATA_FORMAT	0x04


>   #define CODEC_MUTE_VAL		0x80
>
>   #define POWER_CNTLMSAK		0x40
> @@ -289,7 +290,7 @@ static int sta529_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
>   		return -EINVAL;
>   	}
>
> -	snd_soc_update_bits(codec, STA529_S2PCFG0, 0x0D, mode);
> +	snd_soc_update_bits(codec, STA529_S2PCFG0, DATA_FORMAT_MSK, mode);
>
>   	return 0;
>   }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RFT] ASoC: sta529: Fix update register bits in sta529_set_dai_fmt
  2012-12-20  8:17 [PATCH RFT] ASoC: sta529: Fix update register bits in sta529_set_dai_fmt Axel Lin
  2012-12-20 10:17 ` Rajeev kumar
@ 2012-12-20 16:01 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-12-20 16:01 UTC (permalink / raw)
  To: Axel Lin; +Cc: alsa-devel, Rajeev Kumar, Liam Girdwood


[-- Attachment #1.1: Type: text/plain, Size: 176 bytes --]

On Thu, Dec 20, 2012 at 04:17:25PM +0800, Axel Lin wrote:
> Both the mask and mode settings are wrong in current code.
> 
> According to the datasheet:

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-20 16:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20  8:17 [PATCH RFT] ASoC: sta529: Fix update register bits in sta529_set_dai_fmt Axel Lin
2012-12-20 10:17 ` Rajeev kumar
2012-12-20 16:01 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).