* [PATCH 2/4 v2] ASoC: fsi: Add FIFO size calculate
@ 2010-03-25 10:15 Kuninori Morimoto
2010-03-25 10:42 ` Liam Girdwood
2010-03-25 16:04 ` Mark Brown
0 siblings, 2 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2010-03-25 10:15 UTC (permalink / raw)
To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
---
v1 -> v2
o move calculate area to fsi_fifo_init
o modify fifo calculation way
o Add tiny document for fifo calculation
sound/soc/sh/fsi.c | 70 ++++++++++++++++++++++++++++++++--------------------
1 files changed, 43 insertions(+), 27 deletions(-)
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 7c295df..ae88865 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -46,8 +46,9 @@
#define MUTE 0x020C
#define CLK_RST 0x0210
#define SOFT_RST 0x0214
+#define FIFO_SZ 0x0218
#define MREG_START INT_ST
-#define MREG_END SOFT_RST
+#define MREG_END FIFO_SZ
/* DO_FMT */
/* DI_FMT */
@@ -85,6 +86,11 @@
#define IR (1 << 4) /* Interrupt Reset */
#define FSISR (1 << 0) /* Software Reset */
+/* FIFO_SZ */
+#define OUT_SZ_MASK 0x7
+#define BO_SZ_SHIFT 8
+#define AO_SZ_SHIFT 0
+
#define FSI_RATES SNDRV_PCM_RATE_8000_96000
#define FSI_FMTS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE)
@@ -384,9 +390,42 @@ static void fsi_clk_ctrl(struct fsi_priv *fsi, int enable)
fsi_master_mask_set(master, CLK_RST, val, 0);
}
-static void fsi_fifo_init(struct fsi_priv *fsi, int is_play)
+static void fsi_fifo_init(struct fsi_priv *fsi,
+ int is_play,
+ struct snd_soc_dai *dai)
{
- u32 ctrl;
+ struct fsi_master *master = fsi_get_master(fsi);
+ u32 ctrl, shift, i;
+
+ /* get on-chip RAM capacity */
+ shift = fsi_master_read(master, FIFO_SZ);
+ shift >>= fsi_is_port_a(fsi) ? AO_SZ_SHIFT : BO_SZ_SHIFT;
+ shift &= OUT_SZ_MASK;
+ fsi->fifo_max = 256 << shift;
+ dev_dbg(dai->dev, "fifo = %d words\n", fsi->fifo_max);
+
+ /*
+ * The maximum number of sample data varies depending
+ * on the number of channels selected for the format.
+ *
+ * FIFOs are used in 4-channel units in 3-channel mode
+ * and in 8-channel units in 5- to 7-channel mode
+ * meaning that more FIFOs than the required size of DPRAM
+ * are used.
+ *
+ * ex) if 256 words of DP-RAM is connected
+ * 1 channel: 256 (256 x 1 = 256)
+ * 2 channels: 128 (128 x 2 = 256)
+ * 3 channels: 64 ( 64 x 3 = 192)
+ * 4 channels: 64 ( 64 x 4 = 256)
+ * 5 channels: 32 ( 32 x 5 = 160)
+ * 6 channels: 32 ( 32 x 6 = 192)
+ * 7 channels: 32 ( 32 x 7 = 224)
+ * 8 channels: 32 ( 32 x 8 = 256)
+ */
+ for (i = 1; i < fsi->chan; i <<= 1)
+ fsi->fifo_max >>= 1;
+ dev_dbg(dai->dev, "%d channel %d store\n", fsi->chan, fsi->fifo_max);
ctrl = is_play ? DOFF_CTL : DIFF_CTL;
@@ -689,29 +728,6 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
dev_err(dai->dev, "unknown format.\n");
return -EINVAL;
}
-
- switch (fsi->chan) {
- case 1:
- fsi->fifo_max = 256;
- break;
- case 2:
- fsi->fifo_max = 128;
- break;
- case 3:
- case 4:
- fsi->fifo_max = 64;
- break;
- case 5:
- case 6:
- case 7:
- case 8:
- fsi->fifo_max = 32;
- break;
- default:
- dev_err(dai->dev, "channel size error.\n");
- return -EINVAL;
- }
-
fsi_reg_write(fsi, reg, data);
/*
@@ -725,7 +741,7 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
fsi_irq_clear_status(fsi);
/* fifo init */
- fsi_fifo_init(fsi, is_play);
+ fsi_fifo_init(fsi, is_play, dai);
return ret;
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 2/4 v2] ASoC: fsi: Add FIFO size calculate
2010-03-25 10:15 [PATCH 2/4 v2] ASoC: fsi: Add FIFO size calculate Kuninori Morimoto
@ 2010-03-25 10:42 ` Liam Girdwood
2010-03-25 16:04 ` Mark Brown
1 sibling, 0 replies; 6+ messages in thread
From: Liam Girdwood @ 2010-03-25 10:42 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown
On Thu, 2010-03-25 at 19:15 +0900, Kuninori Morimoto wrote:
> Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
> ---
> v1 -> v2
>
> o move calculate area to fsi_fifo_init
> o modify fifo calculation way
> o Add tiny document for fifo calculation
>
> sound/soc/sh/fsi.c | 70 ++++++++++++++++++++++++++++++++--------------------
> 1 files changed, 43 insertions(+), 27 deletions(-)
Both 2/4 and 4/4
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4 v2] ASoC: fsi: Add FIFO size calculate
2010-03-25 10:15 [PATCH 2/4 v2] ASoC: fsi: Add FIFO size calculate Kuninori Morimoto
2010-03-25 10:42 ` Liam Girdwood
@ 2010-03-25 16:04 ` Mark Brown
2010-03-26 0:21 ` Kuninori Morimoto
1 sibling, 1 reply; 6+ messages in thread
From: Mark Brown @ 2010-03-25 16:04 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood
On Thu, Mar 25, 2010 at 07:15:51PM +0900, Kuninori Morimoto wrote:
> Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
> ---
> v1 -> v2
>
> o move calculate area to fsi_fifo_init
> o modify fifo calculation way
> o Add tiny document for fifo calculation
This patch is fine but it doesn't apply against for-2.6.35. Could you
please check and resubmit? I suspect a collision with the previously
applied patches.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4 v2] ASoC: fsi: Add FIFO size calculate
2010-03-25 16:04 ` Mark Brown
@ 2010-03-26 0:21 ` Kuninori Morimoto
2010-03-26 11:17 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Kuninori Morimoto @ 2010-03-26 0:21 UTC (permalink / raw)
To: Mark Brown; +Cc: Linux-ALSA
Dear Mark
Thank you for comment.
> On Thu, Mar 25, 2010 at 07:15:51PM +0900, Kuninori Morimoto wrote:
> > Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
> > ---
> > v1 -> v2
> >
> > o move calculate area to fsi_fifo_init
> > o modify fifo calculation way
> > o Add tiny document for fifo calculation
>
> This patch is fine but it doesn't apply against for-2.6.35. Could you
> please check and resubmit? I suspect a collision with the previously
> applied patches.
Hmm strange...
I created it on "for-2.6.35"
and it works well in my environment on it
-----------
[morimoto] git checkout asoc/for-2.6.35
Previous HEAD position was afa9f82... ASoC: fsi: Add FSI2 device support
HEAD is now at 10ea76c... ASoC: fsi: IRQ related process had be united
[morimoto] git am -3 /tmp/${[PATCH 2/4 v2]}
Applying: ASoC: fsi: Add FIFO size calculate
[morimoto] git am -3 /tmp/${[PATCH 4/4 v2]}
Applying: ASoC: fsi: Add FSI2 device support
-----------
Ahhh...
Sorry. my mail server seems little strange.
I guess you got my mail [4/4] -> [2/4] order ?
correct order is [2/4] -> [4/4]
Below is your issue ?
it is [4/4] -> [2/4] order.
If so, please change [2/4] -> [4/4] order.
So sorry.
---------------
[morimoto] git checkout asoc/for-2.6.35
Previous HEAD position was afa9f82... ASoC: fsi: Add FSI2 device support
HEAD is now at 10ea76c... ASoC: fsi: IRQ related process had be united
[morimoto] git am -3 /tmp/${[PATCH 4/4 v2]}
Applying: ASoC: fsi: Add FSI2 device support
error: patch failed: sound/soc/sh/fsi.c:47
error: sound/soc/sh/fsi.c: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging sound/soc/sh/fsi.c
CONFLICT (content): Merge conflict in sound/soc/sh/fsi.c
Failed to merge in the changes.
Patch failed at 0001 ASoC: fsi: Add FSI2 device support
When you have resolved this problem run "git am -3 --resolved".
If you would prefer to skip this patch, instead run "git am -3 --skip".
To restore the original branch and stop patching run "git am -3 --abort".
[morimoto] git diff
diff --cc sound/soc/sh/fsi.c
index 7c295df,f14bbb0..0000000
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@@ -46,8 -50,9 +50,14 @@@
#define MUTE 0x020C
#define CLK_RST 0x0210
#define SOFT_RST 0x0214
++<<<<<<< HEAD:sound/soc/sh/fsi.c
+#define MREG_START INT_ST
+#define MREG_END SOFT_RST
++=======
+ #define FIFO_SZ 0x0218
+ #define MREG_START CPU_INT_ST
+ #define MREG_END FIFO_SZ
++>>>>>>> ASoC: fsi: Add FSI2 device support:sound/soc/sh/fsi.c
/* DO_FMT */
/* DI_FMT */
---------------
Best regards
--
Kuninori Morimoto
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 2/4 v2] ASoC: fsi: Add FIFO size calculate
2010-03-26 0:21 ` Kuninori Morimoto
@ 2010-03-26 11:17 ` Mark Brown
2010-03-29 6:16 ` Kuninori Morimoto
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2010-03-26 11:17 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA
On Fri, Mar 26, 2010 at 09:21:43AM +0900, Kuninori Morimoto wrote:
> it is [4/4] -> [2/4] order.
> If so, please change [2/4] -> [4/4] order.
> So sorry.
Ah, no - I'd not deleted the earlier version of the patch from my local
tree from when I checked why patch 4 was failing. Sorry about that, my
mistake - I've applied both patches now.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4 v2] ASoC: fsi: Add FIFO size calculate
2010-03-26 11:17 ` Mark Brown
@ 2010-03-29 6:16 ` Kuninori Morimoto
0 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2010-03-29 6:16 UTC (permalink / raw)
To: Mark Brown; +Cc: Linux-ALSA
Dear Mark
> > it is [4/4] -> [2/4] order.
> > If so, please change [2/4] -> [4/4] order.
> > So sorry.
>
> Ah, no - I'd not deleted the earlier version of the patch from my local
> tree from when I checked why patch 4 was failing. Sorry about that, my
> mistake - I've applied both patches now.
Hahahaha... =)
No worry. It is always happen on my desk =)
Best regards
--
Kuninori Morimoto
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-03-29 6:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-25 10:15 [PATCH 2/4 v2] ASoC: fsi: Add FIFO size calculate Kuninori Morimoto
2010-03-25 10:42 ` Liam Girdwood
2010-03-25 16:04 ` Mark Brown
2010-03-26 0:21 ` Kuninori Morimoto
2010-03-26 11:17 ` Mark Brown
2010-03-29 6:16 ` Kuninori Morimoto
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.