[PATCH 0/3] ASoC: sh: rz-ssi: Trivial changes
Hi All,
This patch series has trivial changes for rz-ssi driver. Patches 1 (partial) & 2 are from series [3].
patch 1/3 is just a cosmetic change which was part of patch [0] where it uses a do-while instead of while-do. Patch 2/3 is from series [1] where a helper function is added and patch 3/3 is a new patch which removes duplicate macros.
All the patches apply to [2] (sound -next)
[0] https://patchwork.kernel.org/project/alsa-devel/patch/ 20220115012303.29651-2-prabhakar.mahadev-lad.rj@bp.renesas.com/ [1] https://patchwork.kernel.org/project/alsa-devel/patch/ 20220115012303.29651-6-prabhakar.mahadev-lad.rj@bp.renesas.com/ [2] https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/log/ [3] https://patchwork.kernel.org/project/alsa-devel/list/?series=605672
Cheers, Prabhakar
Lad Prabhakar (3): ASoC: sh: rz-ssi: Use a do-while loop in rz_ssi_pio_recv() ASoC: sh: rz-ssi: Add rz_ssi_set_substream() helper function ASoC: sh: rz-ssi: Remove duplicate macros
sound/soc/sh/rz-ssi.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
Use a do-while loop while reading the samples from RX FIFO. The "done" flag was only changed as an outcome of the last if-statement (last step) in this entire procedure. This patch moves the condition from if statement to while and drops the "done" variable for readability.
While at it, also drop the unneeded parentheses around runtime->dma_area.
Signed-off-by: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com --- Hi All,
This change was part of patch [0], as v1 series was applied I am just sending the cosmetic changes from v2 for readability.
[0] https://patchwork.kernel.org/project/alsa-devel/patch/ 20220115012303.29651-6-prabhakar.mahadev-lad.rj@bp.renesas.com/
Cheers, Prabhakar --- sound/soc/sh/rz-ssi.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c index 81e1786b827d..2c8775d37f50 100644 --- a/sound/soc/sh/rz-ssi.c +++ b/sound/soc/sh/rz-ssi.c @@ -408,7 +408,6 @@ static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm) { struct snd_pcm_substream *substream = strm->substream; struct snd_pcm_runtime *runtime; - bool done = false; u16 *buf; int fifo_samples; int frames_left; @@ -420,7 +419,7 @@ static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
runtime = substream->runtime;
- while (!done) { + do { /* frames left in this period */ frames_left = runtime->period_size - (strm->buffer_pos % runtime->period_size); @@ -444,7 +443,7 @@ static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm) break;
/* calculate new buffer index */ - buf = (u16 *)(runtime->dma_area); + buf = (u16 *)runtime->dma_area; buf += strm->buffer_pos * runtime->channels;
/* Note, only supports 16-bit samples */ @@ -453,11 +452,7 @@ static int rz_ssi_pio_recv(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
rz_ssi_reg_mask_setl(ssi, SSIFSR, SSIFSR_RDF, 0); rz_ssi_pointer_update(strm, samples / runtime->channels); - - /* check if there are no more samples in the RX FIFO */ - if (!(!frames_left && fifo_samples >= runtime->channels)) - done = true; - } + } while (!frames_left && fifo_samples >= runtime->channels);
return 0; }
A copy of substream pointer is stored in priv structure during rz_ssi_dai_trigger() callback ie in SNDRV_PCM_TRIGGER_START case and the pointer is assigned to NULL in case of SNDRV_PCM_TRIGGER_STOP.
The driver used the locks only in rz_ssi_stream_is_valid() and assigned the local substream pointer to NULL in rz_ssi_dai_trigger() callback but never locked it while making a local copy.
This patch adds the rz_ssi_set_substream() helper function to set the substream pointer with locks acquired and replaces the instances of setting the local substream pointer with the rz_ssi_set_substream() function.
Reported-by: Pavel Machek pavel@denx.de Signed-off-by: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Reviewed-by: Biju Das biju.das.jz@bp.renesas.com --- sound/soc/sh/rz-ssi.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c index 2c8775d37f50..1a46c9f3c4e5 100644 --- a/sound/soc/sh/rz-ssi.c +++ b/sound/soc/sh/rz-ssi.c @@ -188,6 +188,17 @@ static inline bool rz_ssi_is_dma_enabled(struct rz_ssi_priv *ssi) return (ssi->playback.dma_ch && (ssi->dma_rt || ssi->capture.dma_ch)); }
+static void rz_ssi_set_substream(struct rz_ssi_stream *strm, + struct snd_pcm_substream *substream) +{ + struct rz_ssi_priv *ssi = strm->priv; + unsigned long flags; + + spin_lock_irqsave(&ssi->lock, flags); + strm->substream = substream; + spin_unlock_irqrestore(&ssi->lock, flags); +} + static bool rz_ssi_stream_is_valid(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm) { @@ -206,7 +217,7 @@ static void rz_ssi_stream_init(struct rz_ssi_stream *strm, { struct snd_pcm_runtime *runtime = substream->runtime;
- strm->substream = substream; + rz_ssi_set_substream(strm, substream); strm->sample_width = samples_to_bytes(runtime, 1); strm->dma_buffer_pos = 0; strm->period_counter = 0; @@ -224,11 +235,8 @@ static void rz_ssi_stream_quit(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm) { struct snd_soc_dai *dai = rz_ssi_get_dai(strm->substream); - unsigned long flags;
- spin_lock_irqsave(&ssi->lock, flags); - strm->substream = NULL; - spin_unlock_irqrestore(&ssi->lock, flags); + rz_ssi_set_substream(strm, NULL);
if (strm->oerr_num > 0) dev_info(dai->dev, "overrun = %d\n", strm->oerr_num);
Remove SSICR_MST and SSICR_CKDV macros which are defined more than once.
Signed-off-by: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com --- sound/soc/sh/rz-ssi.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c index 1a46c9f3c4e5..e8edaed05d4c 100644 --- a/sound/soc/sh/rz-ssi.c +++ b/sound/soc/sh/rz-ssi.c @@ -28,8 +28,6 @@ /* SSI REGISTER BITS */ #define SSICR_DWL(x) (((x) & 0x7) << 19) #define SSICR_SWL(x) (((x) & 0x7) << 16) -#define SSICR_MST BIT(14) -#define SSICR_CKDV(x) (((x) & 0xf) << 4)
#define SSICR_CKS BIT(30) #define SSICR_TUIEN BIT(29)
Hi Prabhakar,
Thanks for the patch
-----Original Message----- From: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com Sent: 25 January 2022 13:25 To: Mark Brown broonie@kernel.org; Liam Girdwood lgirdwood@gmail.com; Jaroslav Kysela perex@perex.cz; Takashi Iwai tiwai@suse.com; alsa- devel@alsa-project.org; Pavel Machek pavel@denx.de Cc: linux-kernel@vger.kernel.org; linux-renesas-soc@vger.kernel.org; Biju Das biju.das.jz@bp.renesas.com; Prabhakar prabhakar.csengg@gmail.com; Prabhakar Mahadev Lad prabhakar.mahadev-lad.rj@bp.renesas.com Subject: [PATCH 3/3] ASoC: sh: rz-ssi: Remove duplicate macros
Remove SSICR_MST and SSICR_CKDV macros which are defined more than once.
Signed-off-by: Lad Prabhakar prabhakar.mahadev-lad.rj@bp.renesas.com
Reviewed-by: Biju Das biju.das.jz@bp.renesas.com
Cheers, Biju
sound/soc/sh/rz-ssi.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c index 1a46c9f3c4e5..e8edaed05d4c 100644 --- a/sound/soc/sh/rz-ssi.c +++ b/sound/soc/sh/rz-ssi.c @@ -28,8 +28,6 @@ /* SSI REGISTER BITS */ #define SSICR_DWL(x) (((x) & 0x7) << 19) #define SSICR_SWL(x) (((x) & 0x7) << 16) -#define SSICR_MST BIT(14) -#define SSICR_CKDV(x) (((x) & 0xf) << 4)
#define SSICR_CKS BIT(30)
#define SSICR_TUIEN BIT(29)
2.17.1
On Tue, 25 Jan 2022 13:24:54 +0000, Lad Prabhakar wrote:
This patch series has trivial changes for rz-ssi driver. Patches 1 (partial) & 2 are from series [3].
patch 1/3 is just a cosmetic change which was part of patch [0] where it uses a do-while instead of while-do. Patch 2/3 is from series [1] where a helper function is added and patch 3/3 is a new patch which removes duplicate macros.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: sh: rz-ssi: Use a do-while loop in rz_ssi_pio_recv() commit: 7276d3f329c633340f3c539ce35ed254d2fe467b [2/3] ASoC: sh: rz-ssi: Add rz_ssi_set_substream() helper function commit: 962ff7ecb60b684fe15b135ccbe07628b8bb522a [3/3] ASoC: sh: rz-ssi: Remove duplicate macros commit: acfa1e2c2ff5cd7fb7948b0c5c2057acd9dceb14
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Biju Das
-
Lad Prabhakar
-
Mark Brown