* [PATCH 5.10.y-cip 1/9] iopoll: Do not use timekeeping in read_poll_timeout_atomic()
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
@ 2026-02-26 19:42 ` Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 2/9] dmaengine: sh: rz-dmac: Fix rz_dmac_terminate_all() Biju
` (8 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Biju @ 2026-02-26 19:42 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Geert Uytterhoeven <geert+renesas@glider.be>
[ Upstream commit 7349a69cf3125e92d48e442d9f400ba446fa314f ]
read_poll_timeout_atomic() uses ktime_get() to implement the timeout
feature, just like its non-atomic counterpart. However, there are
several issues with this, due to its use in atomic contexts:
1. When called in the s2ram path (as typically done by clock or PM
domain drivers), timekeeping may be suspended, triggering the
WARN_ON(timekeeping_suspended) in ktime_get():
WARNING: CPU: 0 PID: 654 at kernel/time/timekeeping.c:843 ktime_get+0x28/0x78
Calling ktime_get_mono_fast_ns() instead of ktime_get() would get
rid of that warning. However, that would break timeout handling,
as (at least on systems with an ARM architectured timer), the time
returned by ktime_get_mono_fast_ns() does not advance while
timekeeping is suspended.
Interestingly, (on the same ARM systems) the time returned by
ktime_get() does advance while timekeeping is suspended, despite
the warning.
2. Depending on the actual clock source, and especially before a
high-resolution clocksource (e.g. the ARM architectured timer)
becomes available, time may not advance in atomic contexts, thus
breaking timeout handling.
Fix this by abandoning the idea that one can rely on timekeeping to
implement timeout handling in all atomic contexts, and switch from a
global time-based to a locally-estimated timeout handling. In most
(all?) cases the timeout condition is exceptional and an error
condition, hence any additional delays due to underestimating wall clock
time are irrelevant.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/3d2a2f4e553489392d871108797c3be08f88300b.1685692810.git.geert+renesas@glider.be
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
include/linux/iopoll.h | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 0417360a6db9..19a7b00baff4 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -74,6 +74,10 @@
* Returns 0 on success and -ETIMEDOUT upon a timeout. In either
* case, the last read value at @args is stored in @val.
*
+ * This macro does not rely on timekeeping. Hence it is safe to call even when
+ * timekeeping is suspended, at the expense of an underestimation of wall clock
+ * time, which is rather minimal with a non-zero delay_us.
+ *
* When available, you'll probably want to use one of the specialized
* macros defined below rather than this macro directly.
*/
@@ -81,22 +85,30 @@
delay_before_read, args...) \
({ \
u64 __timeout_us = (timeout_us); \
+ s64 __left_ns = __timeout_us * NSEC_PER_USEC; \
unsigned long __delay_us = (delay_us); \
- ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
- if (delay_before_read && __delay_us) \
+ u64 __delay_ns = __delay_us * NSEC_PER_USEC; \
+ if (delay_before_read && __delay_us) { \
udelay(__delay_us); \
+ if (__timeout_us) \
+ __left_ns -= __delay_ns; \
+ } \
for (;;) { \
(val) = op(args); \
if (cond) \
break; \
- if (__timeout_us && \
- ktime_compare(ktime_get(), __timeout) > 0) { \
+ if (__timeout_us && __left_ns < 0) { \
(val) = op(args); \
break; \
} \
- if (__delay_us) \
+ if (__delay_us) { \
udelay(__delay_us); \
+ if (__timeout_us) \
+ __left_ns -= __delay_ns; \
+ } \
cpu_relax(); \
+ if (__timeout_us) \
+ __left_ns--; \
} \
(cond) ? 0 : -ETIMEDOUT; \
})
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5.10.y-cip 2/9] dmaengine: sh: rz-dmac: Fix rz_dmac_terminate_all()
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 1/9] iopoll: Do not use timekeeping in read_poll_timeout_atomic() Biju
@ 2026-02-26 19:42 ` Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 3/9] ASoC: renesas: rz-ssi: Fix channel swap issue in full duplex mode Biju
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Biju @ 2026-02-26 19:42 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Biju Das <biju.das.jz@bp.renesas.com>
[ Upstream commit 747213b08a1ab6a76e3e3b3e7a209cc1d402b5d0 ]
After audio full duplex testing, playing the recorded file contains a few
playback frames from the previous time. The rz_dmac_terminate_all() does
not reset all the hardware descriptors queued previously, leading to the
wrong descriptor being picked up during the next DMA transfer. Fix the
above issue by resetting all the descriptor headers for a channel in
rz_dmac_terminate_all() as rz_dmac_lmdesc_recycle() points to the proper
descriptor header filled by the rz_dmac_prepare_descs_for_slave_sg().
Cc: stable@kernel.org
Fixes: 5000d37042a6 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20251113195052.564338-1-biju.das.jz@bp.renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/dma/sh/rz-dmac.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index 2d31c583508a..71c37d5e3227 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -533,11 +533,16 @@ rz_dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
static int rz_dmac_terminate_all(struct dma_chan *chan)
{
struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
+ struct rz_lmdesc *lmdesc = channel->lmdesc.base;
unsigned long flags;
+ unsigned int i;
LIST_HEAD(head);
rz_dmac_disable_hw(channel);
spin_lock_irqsave(&channel->vc.lock, flags);
+ for (i = 0; i < DMAC_NR_LMDESC; i++)
+ lmdesc[i].header = 0;
+
list_splice_tail_init(&channel->ld_active, &channel->ld_free);
list_splice_tail_init(&channel->ld_queue, &channel->ld_free);
vchan_get_all_descriptors(&channel->vc, &head);
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5.10.y-cip 3/9] ASoC: renesas: rz-ssi: Fix channel swap issue in full duplex mode
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 1/9] iopoll: Do not use timekeeping in read_poll_timeout_atomic() Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 2/9] dmaengine: sh: rz-dmac: Fix rz_dmac_terminate_all() Biju
@ 2026-02-26 19:42 ` Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 4/9] ASoC: renesas: rz-ssi: Fix rz_ssi_priv::hw_params_cache::sample_width Biju
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Biju @ 2026-02-26 19:42 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Biju Das <biju.das.jz@bp.renesas.com>
[ Upstream commit 52a525011cb8e293799a085436f026f2958403f9 ]
The full duplex audio starts with half duplex mode and then switch to
full duplex mode (another FIFO reset) when both playback/capture
streams available leading to random audio left/right channel swap
issue. Fix this channel swap issue by detecting the full duplex
condition by populating struct dup variable in startup() callback
and synchronize starting both the play and capture at the same time
in rz_ssi_start().
Cc: stable@kernel.org
Fixes: 4f8cd05a4305 ("ASoC: sh: rz-ssi: Add full duplex support")
Co-developed-by: Tony Tang <tony.tang.ks@renesas.com>
Signed-off-by: Tony Tang <tony.tang.ks@renesas.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20251114073709.4376-2-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 51 ++++++++++++++++++++++++++++++++++++-------
1 file changed, 43 insertions(+), 8 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index f32ad81b08f8..90ee5564622a 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -134,6 +134,12 @@ struct rz_ssi_priv {
bool bckp_rise; /* Bit clock polarity (SSICR.BCKP) */
bool dma_rt;
+ struct {
+ bool tx_active;
+ bool rx_active;
+ bool one_stream_triggered;
+ } dup;
+
/* Full duplex communication support */
struct {
unsigned int rate;
@@ -349,13 +355,12 @@ static int rz_ssi_start(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
bool is_full_duplex;
u32 ssicr, ssifcr;
- is_full_duplex = rz_ssi_is_stream_running(&ssi->playback) ||
- rz_ssi_is_stream_running(&ssi->capture);
+ is_full_duplex = ssi->dup.tx_active && ssi->dup.rx_active;
ssicr = rz_ssi_reg_readl(ssi, SSICR);
ssifcr = rz_ssi_reg_readl(ssi, SSIFCR);
if (!is_full_duplex) {
ssifcr &= ~0xF;
- } else {
+ } else if (ssi->dup.one_stream_triggered) {
rz_ssi_reg_mask_setl(ssi, SSICR, SSICR_TEN | SSICR_REN, 0);
rz_ssi_set_idle(ssi);
ssifcr &= ~SSIFCR_FIFO_RST;
@@ -391,12 +396,16 @@ static int rz_ssi_start(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
SSISR_RUIRQ), 0);
strm->running = 1;
- if (is_full_duplex)
- ssicr |= SSICR_TEN | SSICR_REN;
- else
+ if (!is_full_duplex) {
ssicr |= is_play ? SSICR_TEN : SSICR_REN;
-
- rz_ssi_reg_writel(ssi, SSICR, ssicr);
+ rz_ssi_reg_writel(ssi, SSICR, ssicr);
+ } else if (ssi->dup.one_stream_triggered) {
+ ssicr |= SSICR_TEN | SSICR_REN;
+ rz_ssi_reg_writel(ssi, SSICR, ssicr);
+ ssi->dup.one_stream_triggered = false;
+ } else {
+ ssi->dup.one_stream_triggered = true;
+ }
return 0;
}
@@ -930,6 +939,30 @@ static int rz_ssi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
return 0;
}
+static int rz_ssi_startup(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct rz_ssi_priv *ssi = snd_soc_dai_get_drvdata(dai);
+
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ ssi->dup.tx_active = true;
+ else
+ ssi->dup.rx_active = true;
+
+ return 0;
+}
+
+static void rz_ssi_shutdown(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct rz_ssi_priv *ssi = snd_soc_dai_get_drvdata(dai);
+
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ ssi->dup.tx_active = false;
+ else
+ ssi->dup.rx_active = false;
+}
+
static bool rz_ssi_is_valid_hw_params(struct rz_ssi_priv *ssi, unsigned int rate,
unsigned int channels,
unsigned int sample_width,
@@ -1000,6 +1033,8 @@ static int rz_ssi_dai_hw_params(struct snd_pcm_substream *substream,
}
static const struct snd_soc_dai_ops rz_ssi_dai_ops = {
+ .startup = rz_ssi_startup,
+ .shutdown = rz_ssi_shutdown,
.trigger = rz_ssi_dai_trigger,
.set_fmt = rz_ssi_dai_set_fmt,
.hw_params = rz_ssi_dai_hw_params,
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5.10.y-cip 4/9] ASoC: renesas: rz-ssi: Fix rz_ssi_priv::hw_params_cache::sample_width
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
` (2 preceding siblings ...)
2026-02-26 19:42 ` [PATCH 5.10.y-cip 3/9] ASoC: renesas: rz-ssi: Fix channel swap issue in full duplex mode Biju
@ 2026-02-26 19:42 ` Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 5/9] ASoC: renesas: rz-ssi: Use dev variable in probe() Biju
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Biju @ 2026-02-26 19:42 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Biju Das <biju.das.jz@bp.renesas.com>
[ Upstream commit 2bae7beda19f3b2dc6ab2062c94df19c27923712 ]
The strm->sample_width is not filled during rz_ssi_dai_hw_params(). This
wrong value is used for caching sample_width in struct hw_params_cache.
Fix this issue by replacing 'strm->sample_width'->'params_width(params)'
in rz_ssi_dai_hw_params(). After this drop the variable sample_width
from struct rz_ssi_stream as it is unused.
Cc: stable@kernel.org
Fixes: 4f8cd05a4305 ("ASoC: sh: rz-ssi: Add full duplex support")
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20251114073709.4376-3-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 90ee5564622a..d10ca9ee99fe 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -14,6 +14,7 @@
#include <linux/of_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
+#include <sound/pcm_params.h>
#include <sound/soc.h>
/* REGISTER OFFSET */
@@ -88,7 +89,6 @@ struct rz_ssi_stream {
int dma_buffer_pos; /* The address for the next DMA descriptor */
int completed_dma_buf_pos; /* The address of the last completed DMA descriptor. */
int period_counter; /* for keeping track of periods transferred */
- int sample_width;
int buffer_pos; /* current frame position in the buffer */
int running; /* 0=stopped, 1=running */
@@ -232,10 +232,7 @@ static inline bool rz_ssi_is_stream_running(struct rz_ssi_stream *strm)
static void rz_ssi_stream_init(struct rz_ssi_stream *strm,
struct snd_pcm_substream *substream)
{
- struct snd_pcm_runtime *runtime = substream->runtime;
-
rz_ssi_set_substream(strm, substream);
- strm->sample_width = samples_to_bytes(runtime, 1);
strm->dma_buffer_pos = 0;
strm->completed_dma_buf_pos = 0;
strm->period_counter = 0;
@@ -993,9 +990,9 @@ static int rz_ssi_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct rz_ssi_priv *ssi = snd_soc_dai_get_drvdata(dai);
- struct rz_ssi_stream *strm = rz_ssi_stream_get(ssi, substream);
unsigned int sample_bits = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min;
+ unsigned int sample_width = params_width(params);
unsigned int channels = params_channels(params);
unsigned int rate = params_rate(params);
int ret;
@@ -1014,16 +1011,14 @@ static int rz_ssi_dai_hw_params(struct snd_pcm_substream *substream,
if (rz_ssi_is_stream_running(&ssi->playback) ||
rz_ssi_is_stream_running(&ssi->capture)) {
- if (rz_ssi_is_valid_hw_params(ssi, rate, channels,
- strm->sample_width, sample_bits))
+ if (rz_ssi_is_valid_hw_params(ssi, rate, channels, sample_width, sample_bits))
return 0;
dev_err(ssi->dev, "Full duplex needs same HW params\n");
return -EINVAL;
}
- rz_ssi_cache_hw_params(ssi, rate, channels, strm->sample_width,
- sample_bits);
+ rz_ssi_cache_hw_params(ssi, rate, channels, sample_width, sample_bits);
ret = rz_ssi_swreset(ssi);
if (ret)
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5.10.y-cip 5/9] ASoC: renesas: rz-ssi: Use dev variable in probe()
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
` (3 preceding siblings ...)
2026-02-26 19:42 ` [PATCH 5.10.y-cip 4/9] ASoC: renesas: rz-ssi: Fix rz_ssi_priv::hw_params_cache::sample_width Biju
@ 2026-02-26 19:42 ` Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 6/9] ASoC: renesas: rz-ssi: Remove trailing comma in the terminator entry Biju
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Biju @ 2026-02-26 19:42 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Biju Das <biju.das.jz@bp.renesas.com>
[ Upstream commit d6c160d5e86f4e7354dd6c3154b7cb562abc6c7d ]
Replace '&pdev->dev' by 'dev' in probe(), this makes few error paths
shorter.
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20251114075856.4751-2-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index d10ca9ee99fe..5d3a318f5d09 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -1132,19 +1132,16 @@ static int rz_ssi_probe(struct platform_device *pdev)
audio_clk = devm_clk_get(dev, "audio_clk1");
if (IS_ERR(audio_clk))
- return dev_err_probe(&pdev->dev, PTR_ERR(audio_clk),
- "no audio clk1");
+ return dev_err_probe(dev, PTR_ERR(audio_clk), "no audio clk1");
ssi->audio_clk_1 = clk_get_rate(audio_clk);
audio_clk = devm_clk_get(dev, "audio_clk2");
if (IS_ERR(audio_clk))
- return dev_err_probe(&pdev->dev, PTR_ERR(audio_clk),
- "no audio clk2");
+ return dev_err_probe(dev, PTR_ERR(audio_clk), "no audio clk2");
ssi->audio_clk_2 = clk_get_rate(audio_clk);
if (!(ssi->audio_clk_1 || ssi->audio_clk_2))
- return dev_err_probe(&pdev->dev, -EINVAL,
- "no audio clk1 or audio clk2");
+ return dev_err_probe(dev, -EINVAL, "no audio clk1 or audio clk2");
ssi->audio_mck = ssi->audio_clk_1 ? ssi->audio_clk_1 : ssi->audio_clk_2;
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5.10.y-cip 6/9] ASoC: renesas: rz-ssi: Remove trailing comma in the terminator entry
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
` (4 preceding siblings ...)
2026-02-26 19:42 ` [PATCH 5.10.y-cip 5/9] ASoC: renesas: rz-ssi: Use dev variable in probe() Biju
@ 2026-02-26 19:42 ` Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 7/9] ASoC: renesas: rz-ssi: Move DMA configuration Biju
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Biju @ 2026-02-26 19:42 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Biju Das <biju.das.jz@bp.renesas.com>
[ Upstream commit a472f0b157832fc91c83179b1628d8f660c84c82 ]
Remove trailing comma in the terminator entry for OF table. While at it,
add a space between the braces and comment block.
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20251114075856.4751-3-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 5d3a318f5d09..d90a80ffdddb 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -1259,7 +1259,7 @@ static int rz_ssi_remove(struct platform_device *pdev)
static const struct of_device_id rz_ssi_of_match[] = {
{ .compatible = "renesas,rz-ssi", },
- {/* Sentinel */},
+ { /* Sentinel */ }
};
MODULE_DEVICE_TABLE(of, rz_ssi_of_match);
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5.10.y-cip 7/9] ASoC: renesas: rz-ssi: Move DMA configuration
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
` (5 preceding siblings ...)
2026-02-26 19:42 ` [PATCH 5.10.y-cip 6/9] ASoC: renesas: rz-ssi: Remove trailing comma in the terminator entry Biju
@ 2026-02-26 19:42 ` Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 8/9] ASoC: renesas: rz-ssi: Add support for 24 bits sample width Biju
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Biju @ 2026-02-26 19:42 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Biju Das <biju.das.jz@bp.renesas.com>
[ Upstream commit b541cb0a27dfa7504a8008320502f869c75f8bfc ]
Move DMA configuration from rz_ssi_dma_request() to rz_ssi_dai_trigger()
for supporting sample widths higher than 16.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20251114075856.4751-4-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index d90a80ffdddb..354fcdbd3805 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -789,14 +789,6 @@ static int rz_ssi_dma_request(struct rz_ssi_priv *ssi, struct device *dev)
if (!rz_ssi_is_dma_enabled(ssi))
goto no_dma;
- if (ssi->playback.dma_ch &&
- (rz_ssi_dma_slave_config(ssi, ssi->playback.dma_ch, true) < 0))
- goto no_dma;
-
- if (ssi->capture.dma_ch &&
- (rz_ssi_dma_slave_config(ssi, ssi->capture.dma_ch, false) < 0))
- goto no_dma;
-
return 0;
no_dma:
@@ -844,24 +836,27 @@ static int rz_ssi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
if (cmd == SNDRV_PCM_TRIGGER_START)
rz_ssi_stream_init(strm, substream);
- if (ssi->dma_rt) {
- bool is_playback;
+ if (rz_ssi_is_dma_enabled(ssi)) {
+ bool is_playback = rz_ssi_stream_is_play(substream);
+
+ if (ssi->dma_rt)
+ ret = rz_ssi_dma_slave_config(ssi, ssi->playback.dma_ch,
+ is_playback);
+ else
+ ret = rz_ssi_dma_slave_config(ssi, strm->dma_ch,
+ is_playback);
- is_playback = rz_ssi_stream_is_play(substream);
- ret = rz_ssi_dma_slave_config(ssi, ssi->playback.dma_ch,
- is_playback);
/* Fallback to pio */
if (ret < 0) {
ssi->playback.transfer = rz_ssi_pio_send;
ssi->capture.transfer = rz_ssi_pio_recv;
rz_ssi_release_dma_channels(ssi);
+ } else {
+ /* For DMA, queue up multiple DMA descriptors */
+ num_transfer = 4;
}
}
- /* For DMA, queue up multiple DMA descriptors */
- if (rz_ssi_is_dma_enabled(ssi))
- num_transfer = 4;
-
for (i = 0; i < num_transfer; i++) {
ret = strm->transfer(ssi, strm);
if (ret)
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5.10.y-cip 8/9] ASoC: renesas: rz-ssi: Add support for 24 bits sample width
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
` (6 preceding siblings ...)
2026-02-26 19:42 ` [PATCH 5.10.y-cip 7/9] ASoC: renesas: rz-ssi: Move DMA configuration Biju
@ 2026-02-26 19:42 ` Biju
2026-02-26 19:42 ` [PATCH 5.10.y-cip 9/9] ASoC: renesas: rz-ssi: Add support for 32 " Biju
2026-02-27 9:36 ` [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Pavel Machek
9 siblings, 0 replies; 12+ messages in thread
From: Biju @ 2026-02-26 19:42 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Biju Das <biju.das.jz@bp.renesas.com>
[ Upstream commit 9e10709f831408d948be66bc8f6329fa37a3dc82 ]
Add support for 24 bits sample format width for RZ/G2L SoCs.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20251114075856.4751-5-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 75 ++++++++++++++++++++++++++++++++-----------
1 file changed, 57 insertions(+), 18 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index 354fcdbd3805..ccc33ca34b48 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -39,6 +39,7 @@
#define SSICR_MST BIT(14)
#define SSICR_BCKP BIT(13)
#define SSICR_LRCKP BIT(12)
+#define SSICR_PDTA BIT(9)
#define SSICR_CKDV(x) (((x) & 0xf) << 4)
#define SSICR_TEN BIT(1)
#define SSICR_REN BIT(0)
@@ -75,7 +76,7 @@
#define PREALLOC_BUFFER_MAX (SZ_32K)
#define SSI_RATES SNDRV_PCM_RATE_8000_48000 /* 8k-48kHz */
-#define SSI_FMTS SNDRV_PCM_FMTBIT_S16_LE
+#define SSI_FMTS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
#define SSI_CHAN_MIN 2
#define SSI_CHAN_MAX 2
#define SSI_FIFO_DEPTH 32
@@ -309,11 +310,24 @@ static int rz_ssi_clk_setup(struct rz_ssi_priv *ssi, unsigned int rate,
}
/*
- * DWL: Data Word Length = 16 bits
+ * DWL: Data Word Length = {16, 24} bits
* SWL: System Word Length = 32 bits
*/
ssicr |= SSICR_CKDV(clk_ckdv);
- ssicr |= SSICR_DWL(1) | SSICR_SWL(3);
+ switch (ssi->hw_params_cache.sample_width) {
+ case 16:
+ ssicr |= SSICR_DWL(1);
+ break;
+ case 24:
+ ssicr |= SSICR_DWL(5) | SSICR_PDTA;
+ break;
+ default:
+ dev_err(ssi->dev, "Not support %u data width",
+ ssi->hw_params_cache.sample_width);
+ return -EINVAL;
+ }
+
+ ssicr |= SSICR_SWL(3);
rz_ssi_reg_writel(ssi, SSICR, ssicr);
rz_ssi_reg_writel(ssi, SSIFCR,
(SSIFCR_AUCKE | SSIFCR_TFRST | SSIFCR_RFRST));
@@ -472,7 +486,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;
- u16 *buf;
int fifo_samples;
int frames_left;
int samples;
@@ -507,12 +520,23 @@ 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 += strm->buffer_pos * runtime->channels;
+ if (ssi->hw_params_cache.sample_width == 16) {
+ u16 *buf;
- /* Note, only supports 16-bit samples */
- for (i = 0; i < samples; i++)
- *buf++ = (u16)(rz_ssi_reg_readl(ssi, SSIFRDR) >> 16);
+ buf = (u16 *)runtime->dma_area;
+ buf += strm->buffer_pos * runtime->channels;
+
+ for (i = 0; i < samples; i++)
+ *buf++ = (u16)(rz_ssi_reg_readl(ssi, SSIFRDR) >> 16);
+ } else {
+ u32 *buf;
+
+ buf = (u32 *)runtime->dma_area;
+ buf += strm->buffer_pos * runtime->channels;
+
+ for (i = 0; i < samples; i++)
+ *buf++ = rz_ssi_reg_readl(ssi, SSIFRDR);
+ }
rz_ssi_reg_mask_setl(ssi, SSIFSR, SSIFSR_RDF, 0);
rz_ssi_pointer_update(strm, samples / runtime->channels);
@@ -530,7 +554,6 @@ static int rz_ssi_pio_send(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
int frames_left;
int i;
u32 ssifsr;
- u16 *buf;
if (!rz_ssi_stream_is_valid(ssi, strm))
return -EINVAL;
@@ -557,12 +580,23 @@ static int rz_ssi_pio_send(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
return 0;
/* calculate new buffer index */
- buf = (u16 *)(runtime->dma_area);
- buf += strm->buffer_pos * runtime->channels;
+ if (ssi->hw_params_cache.sample_width == 16) {
+ u16 *buf;
+
+ buf = (u16 *)(runtime->dma_area);
+ buf += strm->buffer_pos * runtime->channels;
+
+ for (i = 0; i < samples; i++)
+ rz_ssi_reg_writel(ssi, SSIFTDR, ((u32)(*buf++) << 16));
+ } else {
+ u32 *buf;
- /* Note, only supports 16-bit samples */
- for (i = 0; i < samples; i++)
- rz_ssi_reg_writel(ssi, SSIFTDR, ((u32)(*buf++) << 16));
+ buf = (u32 *)(runtime->dma_area);
+ buf += strm->buffer_pos * runtime->channels;
+
+ for (i = 0; i < samples; i++)
+ rz_ssi_reg_writel(ssi, SSIFTDR, *buf++);
+ }
rz_ssi_reg_mask_setl(ssi, SSIFSR, SSIFSR_TDE, 0);
rz_ssi_pointer_update(strm, samples / runtime->channels);
@@ -673,8 +707,13 @@ static int rz_ssi_dma_slave_config(struct rz_ssi_priv *ssi,
cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
cfg.dst_addr = ssi->phys + SSIFTDR;
cfg.src_addr = ssi->phys + SSIFRDR;
- cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
- cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ if (ssi->hw_params_cache.sample_width == 16) {
+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ } else {
+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+ }
return dmaengine_slave_config(dma_ch, &cfg);
}
@@ -992,7 +1031,7 @@ static int rz_ssi_dai_hw_params(struct snd_pcm_substream *substream,
unsigned int rate = params_rate(params);
int ret;
- if (sample_bits != 16) {
+ if (!(sample_bits == 16 || sample_bits == 24)) {
dev_err(ssi->dev, "Unsupported sample width: %d\n",
sample_bits);
return -EINVAL;
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5.10.y-cip 9/9] ASoC: renesas: rz-ssi: Add support for 32 bits sample width
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
` (7 preceding siblings ...)
2026-02-26 19:42 ` [PATCH 5.10.y-cip 8/9] ASoC: renesas: rz-ssi: Add support for 24 bits sample width Biju
@ 2026-02-26 19:42 ` Biju
2026-02-27 9:36 ` [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Pavel Machek
9 siblings, 0 replies; 12+ messages in thread
From: Biju @ 2026-02-26 19:42 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Biju Das <biju.das.jz@bp.renesas.com>
[ Upstream commit 124f6155f3d97b0e33f178c10a5138a42c8fd207 ]
Add support for 32 bits sample format width for RZ/G2L SoCs.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20251114075856.4751-6-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
sound/soc/sh/rz-ssi.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c
index ccc33ca34b48..0c2dbc7528f2 100644
--- a/sound/soc/sh/rz-ssi.c
+++ b/sound/soc/sh/rz-ssi.c
@@ -76,7 +76,8 @@
#define PREALLOC_BUFFER_MAX (SZ_32K)
#define SSI_RATES SNDRV_PCM_RATE_8000_48000 /* 8k-48kHz */
-#define SSI_FMTS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
+#define SSI_FMTS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | \
+ SNDRV_PCM_FMTBIT_S32_LE)
#define SSI_CHAN_MIN 2
#define SSI_CHAN_MAX 2
#define SSI_FIFO_DEPTH 32
@@ -310,7 +311,7 @@ static int rz_ssi_clk_setup(struct rz_ssi_priv *ssi, unsigned int rate,
}
/*
- * DWL: Data Word Length = {16, 24} bits
+ * DWL: Data Word Length = {16, 24, 32} bits
* SWL: System Word Length = 32 bits
*/
ssicr |= SSICR_CKDV(clk_ckdv);
@@ -321,6 +322,9 @@ static int rz_ssi_clk_setup(struct rz_ssi_priv *ssi, unsigned int rate,
case 24:
ssicr |= SSICR_DWL(5) | SSICR_PDTA;
break;
+ case 32:
+ ssicr |= SSICR_DWL(6);
+ break;
default:
dev_err(ssi->dev, "Not support %u data width",
ssi->hw_params_cache.sample_width);
@@ -1031,7 +1035,7 @@ static int rz_ssi_dai_hw_params(struct snd_pcm_substream *substream,
unsigned int rate = params_rate(params);
int ret;
- if (!(sample_bits == 16 || sample_bits == 24)) {
+ if (!(sample_bits == 16 || sample_bits == 24 || sample_bits == 32)) {
dev_err(ssi->dev, "Unsupported sample width: %d\n",
sample_bits);
return -EINVAL;
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements
2026-02-26 19:42 [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Biju
` (8 preceding siblings ...)
2026-02-26 19:42 ` [PATCH 5.10.y-cip 9/9] ASoC: renesas: rz-ssi: Add support for 32 " Biju
@ 2026-02-27 9:36 ` Pavel Machek
2026-03-01 23:33 ` nobuhiro.iwamatsu.x90
9 siblings, 1 reply; 12+ messages in thread
From: Pavel Machek @ 2026-02-27 9:36 UTC (permalink / raw)
To: Biju; +Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Biju Das, Lad Prabhakar
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
Hi!
> Add support for 24, 32 bit sample format width. Also fix
> channel swap issue.
This looks okay to me.
Reviewed-by: Pavel Machek <pavel@nabladev.com>
I can apply the series if it passes testing and there are no other
comments.
Best regards,
Pavel
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread* RE: [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements
2026-02-27 9:36 ` [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements Pavel Machek
@ 2026-03-01 23:33 ` nobuhiro.iwamatsu.x90
0 siblings, 0 replies; 12+ messages in thread
From: nobuhiro.iwamatsu.x90 @ 2026-03-01 23:33 UTC (permalink / raw)
To: pavel, biju.das.au; +Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj
Hi all,
> -----Original Message-----
> From: Pavel Machek <pavel@nabladev.com>
> Sent: Friday, February 27, 2026 6:37 PM
> To: Biju <biju.das.au@gmail.com>
> Cc: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 □DITC○CPT)
> <nobuhiro.iwamatsu.x90@mail.toshiba>; Pavel Machek <pavel@nabladev.com>; Biju Das
> <biju.das.jz@bp.renesas.com>; Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Subject: Re: [PATCH 5.10.y-cip 0/9] RZ/G2L SSI Improvements
>
> Hi!
>
> > Add support for 24, 32 bit sample format width. Also fix channel swap
> > issue.
>
> This looks okay to me.
>
> Reviewed-by: Pavel Machek <pavel@nabladev.com>
>
> I can apply the series if it passes testing and there are no other comments.
I reviewed this series, looks good too me too.
I will apply and push with Pavel's reviewed-by tag.
>
> Best regards,
> Pavel
Best regards,
Nobuhio
^ permalink raw reply [flat|nested] 12+ messages in thread