From: Olivier Moysan <olivier.moysan@st.com>
To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
tiwai@suse.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@st.com, alsa-devel@alsa-project.org,
robh@kernel.org, mark.rutland@arm.com,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
kernel@stlinux.com, linux-kernel@vger.kernel.org,
olivier.moysan@st.com
Cc: arnaud.pouliquen@st.com, benjamin.gaignard@st.com
Subject: [INTERNAL][PATCH 3/7] ASoC: stm32: sai: Fix DMA burst size
Date: Thu, 19 Oct 2017 15:03:19 +0200 [thread overview]
Message-ID: <1508418203-16840-4-git-send-email-olivier.moysan@st.com> (raw)
In-Reply-To: <1508418203-16840-1-git-send-email-olivier.moysan@st.com>
Set best burst size tradeoff for 8, 16, 32 bits transfers.
Signed-off-by: olivier moysan <olivier.moysan@st.com>
---
sound/soc/stm/stm32_sai_sub.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index fdc1891..2af397d 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -445,12 +445,16 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai,
{
struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
int cr1, cr1_mask, ret;
- int fth = STM_SAI_FIFO_TH_HALF;
- /* FIFO config */
+ /*
+ * DMA bursts increment is set to 4 words.
+ * SAI fifo threshold is set to half fifo, to keep enough space
+ * for DMA incoming bursts.
+ */
regmap_update_bits(sai->regmap, STM_SAI_CR2_REGX,
SAI_XCR2_FFLUSH | SAI_XCR2_FTH_MASK,
- SAI_XCR2_FFLUSH | SAI_XCR2_FTH_SET(fth));
+ SAI_XCR2_FFLUSH |
+ SAI_XCR2_FTH_SET(STM_SAI_FIFO_TH_HALF));
/* Mode, data format and channel config */
cr1_mask = SAI_XCR1_DS_MASK;
@@ -479,10 +483,6 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai,
return ret;
}
- /* DMA config */
- sai->dma_params.maxburst = STM_SAI_FIFO_SIZE * fth / sizeof(u32);
- snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)&sai->dma_params);
-
return 0;
}
@@ -726,7 +726,12 @@ static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai)
int cr1 = 0, cr1_mask;
sai->dma_params.addr = (dma_addr_t)(sai->phys_addr + STM_SAI_DR_REGX);
- sai->dma_params.maxburst = 1;
+ /*
+ * DMA supports 4, 8 or 16 burst sizes. Burst size 4 is the best choice,
+ * as it allows bytes, half-word and words transfers. (See DMA fifos
+ * constraints).
+ */
+ sai->dma_params.maxburst = 4;
/* Buswidth will be set by framework at runtime */
sai->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_UNDEFINED;
--
1.9.1
next prev parent reply other threads:[~2017-10-19 13:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 13:03 [INTERNAL][PATCH 0/7] ASoC: stm32: Add SAI synchronization support Olivier Moysan
2017-10-19 13:03 ` [INTERNAL][PATCH 1/7] ASoC: stm32: Add synchronization to SAI bindings Olivier Moysan
2017-10-21 10:31 ` Applied "ASoC: stm32: Add synchronization to SAI bindings" to the asoc tree Mark Brown
2017-10-19 13:03 ` [INTERNAL][PATCH 2/7] ASoC: stm32: sai: Move static settings to DAI init Olivier Moysan
2017-10-19 13:03 ` Olivier Moysan [this message]
2017-10-19 13:03 ` [INTERNAL][PATCH 4/7] ASoC: stm32: sai: fix stop management in isr Olivier Moysan
2017-10-21 10:16 ` Mark Brown
2017-10-21 10:32 ` Applied "ASoC: stm32: sai: fix stop management in isr" to the asoc tree Mark Brown
2017-10-26 15:32 ` [INTERNAL][PATCH 4/7] ASoC: stm32: sai: fix stop management in isr Takashi Iwai
2017-11-02 16:38 ` Olivier MOYSAN
2017-10-19 13:03 ` [INTERNAL][PATCH 5/7] ASoC: stm32: sai: Remove spurious IRQs on stop Olivier Moysan
2017-10-21 10:31 ` Applied "ASoC: stm32: sai: Remove spurious IRQs on stop" to the asoc tree Mark Brown
2017-10-19 13:03 ` [INTERNAL][PATCH 6/7] ASoC: stm32: sai: Fix get reset controller Olivier Moysan
2017-10-21 10:32 ` Applied "ASoC: stm32: sai: Fix get reset controller" to the asoc tree Mark Brown
2017-10-19 13:03 ` [INTERNAL][PATCH 7/7] ASoC: stm32: sai: Add synchronization support Olivier Moysan
2017-10-21 10:31 ` Applied "ASoC: stm32: sai: Add synchronization support" to the asoc tree Mark Brown
2017-10-19 13:27 ` [INTERNAL][PATCH 0/7] ASoC: stm32: Add SAI synchronization support Olivier MOYSAN
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=1508418203-16840-4-git-send-email-olivier.moysan@st.com \
--to=olivier.moysan@st.com \
--cc=alexandre.torgue@st.com \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.pouliquen@st.com \
--cc=benjamin.gaignard@st.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel@stlinux.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=tiwai@suse.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 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).