Re: [PATCH v2 1/2] ASoC: renesas: rz-ssi: Fix channel swap issue in full duplex mode

From: Geert Uytterhoeven

Date: Thu Nov 13 2025 - 03:51:15 EST


Hi Biju,

On Thu, 13 Nov 2025 at 09:25, Biju <biju.das.au@xxxxxxxxx> wrote:
> From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxx
> Fixes: 4f8cd05a4305 ("ASoC: sh: rz-ssi: Add full duplex support")
> Co-developed-by: Tony Tang <tony.tang.ks@xxxxxxxxxxx>
> Signed-off-by: Tony Tang <tony.tang.ks@xxxxxxxxxxx>
> Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
> Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/sound/soc/renesas/rz-ssi.c
> +++ b/sound/soc/renesas/rz-ssi.c
> @@ -374,12 +379,18 @@ 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) {
> + 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;
> + }
> + } else {
> ssicr |= is_play ? SSICR_TEN : SSICR_REN;
> -
> - rz_ssi_reg_writel(ssi, SSICR, ssicr);
> + rz_ssi_reg_writel(ssi, SSICR, ssicr);
> + }

You can reduce indentation by restructuring the tests:

if (!is_full_duplex) {
...
} else if (ssi->dup.one_stream_triggered) {
...
} else {
...
}

>
> return 0;
> }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds