Skip to contentSkip to conversation

ASoC: S3C: Fix PCM RX FIFO settings

PATCH Superseded Seungwhan Youn 5 participants 9 messages Sep 8, 2010 – Sep 11, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: S3C: Fix PCM RX FIFO settings

When PCM capture, sound recorded abnormally because of RX FIFO threshold settings are missing. So, This patch modify PCM RX FIFO setting codes same as TX.

---
 sound/soc/s3c24xx/s3c-pcm.c |    3 +++
 sound/soc/s3c24xx/s3c-pcm.h |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
sound/soc/s3c24xx/s3c-pcm.c +3 -0
index 43dcc6b..deaa3f2 100644
@@ -107,11 +107,14 @@ static void s3c_pcm_snd_rxctrl(struct s3c_pcm_info *pcm, int on)
 
 	ctl = readl(regs + S3C_PCM_CTL);
 	clkctl = readl(regs + S3C_PCM_CLKCTL);
+	ctl &= ~(S3C_PCM_CTL_RXDIPSTICK_MASK
+			 << S3C_PCM_CTL_RXDIPSTICK_SHIFT);
 
 	if (on) {
 		ctl |= S3C_PCM_CTL_RXDMA_EN;
 		ctl |= S3C_PCM_CTL_RXFIFO_EN;
 		ctl |= S3C_PCM_CTL_ENABLE;
+		ctl |= (0x20<<S3C_PCM_CTL_RXDIPSTICK_SHIFT);
 		clkctl |= S3C_PCM_CLKCTL_SERCLK_EN;
 	} else {
 		ctl &= ~S3C_PCM_CTL_RXDMA_EN;
sound/soc/s3c24xx/s3c-pcm.h +2 -1
index 3e9bfc9..b85eaf2 100644
@@ -22,7 +22,8 @@
 /* PCM_CTL Bit-Fields */
 #define S3C_PCM_CTL_TXDIPSTICK_MASK		(0x3f)
 #define S3C_PCM_CTL_TXDIPSTICK_SHIFT	(13)
-#define S3C_PCM_CTL_RXDIPSTICK_MSK		(0x3f<<7)
+#define S3C_PCM_CTL_RXDIPSTICK_MASK		(0x3f)
+#define S3C_PCM_CTL_RXDIPSTICK_SHIFT	(7)
 #define S3C_PCM_CTL_TXDMA_EN		(0x1<<6)
 #define S3C_PCM_CTL_RXDMA_EN		(0x1<<5)
 #define S3C_PCM_CTL_TXMSB_AFTER_FSYNC	(0x1<<4)
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 16 lines · Seungwhan Youn

When PCM capture, sound recorded abnormally because of RX FIFO threshold settings are missing. So, This patch modify PCM RX FIFO setting codes same as TX.

---
 sound/soc/s3c24xx/s3c-pcm.c |    3 +++
 sound/soc/s3c24xx/s3c-pcm.h |    3 ++-

 2 files changed, 5 insertions(+), 1 deletions(-)
sound/soc/s3c24xx/s3c-pcm.c +0 -0
index 43dcc6b..deaa3f2 100644
@@ -107,11 +107,14 @@ static void s3c_pcm_snd_rxctrl(struct s3c_pcm_info *pcm, int on)
 

sound/soc/s3c24xx/s3c-pcm.c static void s3c_pcm_snd_rxctrl(struct s3c_pcm_info *pcm, int on) · line 117

Quoted 10 lines
sound/soc/s3c24xx/s3c-pcm.c +3 -0
        ctl = readl(regs + S3C_PCM_CTL);
        clkctl = readl(regs + S3C_PCM_CLKCTL);
+       ctl &= ~(S3C_PCM_CTL_RXDIPSTICK_MASK
+                        << S3C_PCM_CTL_RXDIPSTICK_SHIFT);
 
        if (on) {
                ctl |= S3C_PCM_CTL_RXDMA_EN;
                ctl |= S3C_PCM_CTL_RXFIFO_EN;
                ctl |= S3C_PCM_CTL_ENABLE;
+               ctl |= (0x20<<S3C_PCM_CTL_RXDIPSTICK_SHIFT);

Yes, the change is needed.
But I think we should use small value as fifo_dipstick (maybe 0x4 ?), because Fifo is considered:-
Almost_empty when fifo_depth < fifo_dipstick
Almost_full when fifo_depth > (32 – fifo_dipstick)

And, please modify for TX as well.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
Quoted 22 lines · Jassi Brar
Quoted 21 lines · Seungwhan Youn

When PCM capture, sound recorded abnormally because of RX FIFO threshold settings are missing. So, This patch modify PCM RX FIFO setting codes same as TX.

---
 sound/soc/s3c24xx/s3c-pcm.c |    3 +++
 sound/soc/s3c24xx/s3c-pcm.h |    3 ++-

 2 files changed, 5 insertions(+), 1 deletions(-)
sound/soc/s3c24xx/s3c-pcm.c +2 -0
index 43dcc6b..deaa3f2 100644
@@ -107,11 +107,14 @@ static void s3c_pcm_snd_rxctrl(struct s3c_pcm_info *pcm, int on)
 
        ctl = readl(regs + S3C_PCM_CTL);
        clkctl = readl(regs + S3C_PCM_CLKCTL);
+       ctl &= ~(S3C_PCM_CTL_RXDIPSTICK_MASK
+                        << S3C_PCM_CTL_RXDIPSTICK_SHIFT);
 
Quoted 11 lines

sound/soc/s3c24xx/s3c-pcm.c static void s3c_pcm_snd_rxctrl(struct s3c_pcm_info *pcm, int on) · line 117

Quoted 5 lines
sound/soc/s3c24xx/s3c-pcm.c +1 -0
        if (on) {
                ctl |= S3C_PCM_CTL_RXDMA_EN;
                ctl |= S3C_PCM_CTL_RXFIFO_EN;
                ctl |= S3C_PCM_CTL_ENABLE;
+               ctl |= (0x20<<S3C_PCM_CTL_RXDIPSTICK_SHIFT);

Yes, the change is needed.
But I think we should use small value as fifo_dipstick (maybe 0x4 ?), because Fifo is considered:-
   Almost_empty      when      fifo_depth < fifo_dipstick Almost_full             when      fifo_depth > (32 – fifo_dipstick)

Yes, you're right.

Quoted 3 lines

And, please modify for TX as well.

I'll fix this fifo_dipstick value to be a suitable one and re-submit with TX's fifo_dipstick.

Thanks for your opinion.
Claude.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw

PATCH v2 1/2 ASoC: S3C: Fix PCM RX FIFO settings

When PCM capture, sound recorded abnormally because of RX FIFO threshold settings are missing. So, This patch modify PCM RX FIFO setting codes same as TX.
And for DMA, if PCM RXFIFO_DIPSTICK is not '0', it doesn't effect to DMA request, because DMA refer RX_FIFO_EMPTY flag as the DMA request.

---
 sound/soc/s3c24xx/s3c-pcm.c |    3 +++
 sound/soc/s3c24xx/s3c-pcm.h |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
sound/soc/s3c24xx/s3c-pcm.c +3 -0
index 43dcc6b..deaa3f2 100644
@@ -107,11 +107,14 @@ static void s3c_pcm_snd_rxctrl(struct s3c_pcm_info *pcm, int on)
 
 	ctl = readl(regs + S3C_PCM_CTL);
 	clkctl = readl(regs + S3C_PCM_CLKCTL);
+	ctl &= ~(S3C_PCM_CTL_RXDIPSTICK_MASK
+			 << S3C_PCM_CTL_RXDIPSTICK_SHIFT);
 
 	if (on) {
 		ctl |= S3C_PCM_CTL_RXDMA_EN;
 		ctl |= S3C_PCM_CTL_RXFIFO_EN;
 		ctl |= S3C_PCM_CTL_ENABLE;
+		ctl |= (0x20<<S3C_PCM_CTL_RXDIPSTICK_SHIFT);
 		clkctl |= S3C_PCM_CLKCTL_SERCLK_EN;
 	} else {
 		ctl &= ~S3C_PCM_CTL_RXDMA_EN;
sound/soc/s3c24xx/s3c-pcm.h +2 -1
index 3e9bfc9..b85eaf2 100644
@@ -22,7 +22,8 @@
 /* PCM_CTL Bit-Fields */
 #define S3C_PCM_CTL_TXDIPSTICK_MASK		(0x3f)
 #define S3C_PCM_CTL_TXDIPSTICK_SHIFT	(13)
-#define S3C_PCM_CTL_RXDIPSTICK_MSK		(0x3f<<7)
+#define S3C_PCM_CTL_RXDIPSTICK_MASK		(0x3f)
+#define S3C_PCM_CTL_RXDIPSTICK_SHIFT	(7)
 #define S3C_PCM_CTL_TXDMA_EN		(0x1<<6)
 #define S3C_PCM_CTL_RXDMA_EN		(0x1<<5)
 #define S3C_PCM_CTL_TXMSB_AFTER_FSYNC	(0x1<<4)
Signature · 1 line
1.6.2.5
Acked-by on v2 1/2
#4 lore raw
Quoted 8 lines · Seungwhan Youn

When PCM capture, sound recorded abnormally because of RX FIFO threshold settings are missing. So, This patch modify PCM RX FIFO setting codes same as TX.
And for DMA, if PCM RXFIFO_DIPSTICK is not '0', it doesn't effect to DMA request, because DMA refer RX_FIFO_EMPTY flag as the DMA request.

Both

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
#8 lore raw

PATCH v2 2/2 ASoC: S3C: Fix PCM TXFIFO_DIPSTICK value

In reply to Seungwhan Youn

This patch modify FIFO_DIPSTICK value of PCM TX FIFO to be a optimal one. Privious value (0x20) did not support 'Almost_full' of PCM FIFO for the DMA request.

---
 sound/soc/s3c24xx/s3c-pcm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/s3c24xx/s3c-pcm.c +1 -1
index c5ca902..df6948f 100644
@@ -78,7 +78,7 @@ static void s3c_pcm_snd_txctrl(struct s3c_pcm_info *pcm, int on)
 		ctl |= S3C_PCM_CTL_TXDMA_EN;
 		ctl |= S3C_PCM_CTL_TXFIFO_EN;
 		ctl |= S3C_PCM_CTL_ENABLE;
-		ctl |= (0x20<<S3C_PCM_CTL_TXDIPSTICK_SHIFT);
+		ctl |= (0x4<<S3C_PCM_CTL_TXDIPSTICK_SHIFT);
 		clkctl |= S3C_PCM_CLKCTL_SERCLK_EN;
 	} else {
 		ctl &= ~S3C_PCM_CTL_TXDMA_EN;
Signature · 1 line
1.6.2.5