linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output
@ 2020-04-15 14:10 Matthias Blankertz
  2020-04-15 14:10 ` [PATCH 1/2] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode Matthias Blankertz
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Matthias Blankertz @ 2020-04-15 14:10 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	alsa-devel, linux-kernel, linux-renesas-soc

This fixes two issues in the snd-soc-rcar driver blocking multichannel
HDMI audio out: The parent SSI in a multi-SSI configuration is not
correctly set up and started, and the SSI->HDMI channel mapping is
wrong.

With these patches, the following device tree snippet can be used on an
r8a7795-based platform (Salvator-X) to enable multichannel HDMI audio on
HDMI0:

rsnd_port1: port@1 {
	rsnd_endpoint1: endpoint {
		remote-endpoint = <&dw_hdmi0_snd_in>;

		dai-format = "i2s";
		bitclock-master = <&rsnd_endpoint1>;
		frame-master = <&rsnd_endpoint1>;

		playback = <&ssi0 &ssi1 &ssi2 &ssi9>;
	};
};

With a capable receiver attached, all of 2ch (stereo), 6ch (e.g. 5.1)
and 8ch audio output should work.


Matthias Blankertz (2):
  ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode
  ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode

 sound/soc/sh/rcar/ssi.c  | 8 ++++----
 sound/soc/sh/rcar/ssiu.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)


base-commit: 7111951b8d4973bda27ff663f2cf18b663d15b48
-- 
2.26.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode
  2020-04-15 14:10 [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output Matthias Blankertz
@ 2020-04-15 14:10 ` Matthias Blankertz
  2020-04-16 15:23   ` Applied "ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode" to the asoc tree Mark Brown
  2020-04-15 14:10 ` [PATCH 2/2] ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode Matthias Blankertz
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Matthias Blankertz @ 2020-04-15 14:10 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	alsa-devel, linux-kernel, linux-renesas-soc

The parent SSI of a multi-SSI setup must be fully setup, started and
stopped since it is also part of the playback/capture setup. So only
skip the SSI (as per commit 203cdf51f288 ("ASoC: rsnd: SSI parent cares
SWSP bit") and commit 597b046f0d99 ("ASoC: rsnd: control SSICR::EN
correctly")) if the SSI is parent outside of a multi-SSI setup.

Signed-off-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
---
 sound/soc/sh/rcar/ssi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index fc5d089868df..d51fb3a39448 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -407,7 +407,7 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod,
 	 * We shouldn't exchange SWSP after running.
 	 * This means, parent needs to care it.
 	 */
-	if (rsnd_ssi_is_parent(mod, io))
+	if (rsnd_ssi_is_parent(mod, io) && !rsnd_ssi_multi_slaves(io))
 		goto init_end;
 
 	if (rsnd_io_is_play(io))
@@ -559,7 +559,7 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
 	 * EN is for data output.
 	 * SSI parent EN is not needed.
 	 */
-	if (rsnd_ssi_is_parent(mod, io))
+	if (rsnd_ssi_is_parent(mod, io) && !rsnd_ssi_multi_slaves(io))
 		return 0;
 
 	ssi->cr_en = EN;
@@ -582,7 +582,7 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
 	if (!rsnd_ssi_is_run_mods(mod, io))
 		return 0;
 
-	if (rsnd_ssi_is_parent(mod, io))
+	if (rsnd_ssi_is_parent(mod, io) && !rsnd_ssi_multi_slaves(io))
 		return 0;
 
 	cr  =	ssi->cr_own	|
@@ -620,7 +620,7 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod,
 	if (rsnd_is_gen1(priv))
 		return 0;
 
-	if (rsnd_ssi_is_parent(mod, io))
+	if (rsnd_ssi_is_parent(mod, io) && !rsnd_ssi_multi_slaves(io))
 		return 0;
 
 	if (!rsnd_ssi_is_run_mods(mod, io))
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode
  2020-04-15 14:10 [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output Matthias Blankertz
  2020-04-15 14:10 ` [PATCH 1/2] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode Matthias Blankertz
@ 2020-04-15 14:10 ` Matthias Blankertz
  2020-04-16 15:23   ` Applied "ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode" to the asoc tree Mark Brown
  2020-04-16  1:35 ` [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output Kuninori Morimoto
  2020-04-17 16:15 ` Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Matthias Blankertz @ 2020-04-15 14:10 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	alsa-devel, linux-kernel, linux-renesas-soc

The HDMI?_SEL register maps up to four stereo SSI data lanes onto the
sdata[0..3] inputs of the HDMI output block. The upper half of the
register contains four blocks of 4 bits, with the most significant
controlling the sdata3 line and the least significant the sdata0 line.

The shift calculation has an off-by-one error, causing the parent SSI to
be mapped to sdata3, the first multi-SSI child to sdata0 and so forth.
As the parent SSI transmits the stereo L/R channels, and the HDMI core
expects it on the sdata0 line, this causes no audio to be output when
playing stereo audio on a multichannel capable HDMI out, and
multichannel audio has permutated channels.

Fix the shift calculation to map the parent SSI to sdata0, the first
child to sdata1 etc.

Signed-off-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
---
 sound/soc/sh/rcar/ssiu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index f35d88211887..9c7c3e7539c9 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -221,7 +221,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
 			i;
 
 		for_each_rsnd_mod_array(i, pos, io, rsnd_ssi_array) {
-			shift	= (i * 4) + 16;
+			shift	= (i * 4) + 20;
 			val	= (val & ~(0xF << shift)) |
 				rsnd_mod_id(pos) << shift;
 		}
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output
  2020-04-15 14:10 [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output Matthias Blankertz
  2020-04-15 14:10 ` [PATCH 1/2] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode Matthias Blankertz
  2020-04-15 14:10 ` [PATCH 2/2] ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode Matthias Blankertz
@ 2020-04-16  1:35 ` Kuninori Morimoto
  2020-04-17 16:15 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Kuninori Morimoto @ 2020-04-16  1:35 UTC (permalink / raw)
  To: Matthias Blankertz
  Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel, linux-renesas-soc


Hi

> This fixes two issues in the snd-soc-rcar driver blocking multichannel
> HDMI audio out: The parent SSI in a multi-SSI configuration is not
> correctly set up and started, and the SSI->HDMI channel mapping is
> wrong.
> 
> With these patches, the following device tree snippet can be used on an
> r8a7795-based platform (Salvator-X) to enable multichannel HDMI audio on
> HDMI0:
> 
> rsnd_port1: port@1 {
> 	rsnd_endpoint1: endpoint {
> 		remote-endpoint = <&dw_hdmi0_snd_in>;
> 
> 		dai-format = "i2s";
> 		bitclock-master = <&rsnd_endpoint1>;
> 		frame-master = <&rsnd_endpoint1>;
> 
> 		playback = <&ssi0 &ssi1 &ssi2 &ssi9>;
> 	};
> };
> 
> With a capable receiver attached, all of 2ch (stereo), 6ch (e.g. 5.1)
> and 8ch audio output should work.
> 
> 
> Matthias Blankertz (2):
>   ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode
>   ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode
> 
>  sound/soc/sh/rcar/ssi.c  | 8 ++++----
>  sound/soc/sh/rcar/ssiu.c | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)

For all patches

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Applied "ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode" to the asoc tree
  2020-04-15 14:10 ` [PATCH 2/2] ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode Matthias Blankertz
@ 2020-04-16 15:23   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-04-16 15:23 UTC (permalink / raw)
  To: Matthias Blankertz
  Cc: alsa-devel, Kuninori Morimoto, Liam Girdwood, linux-kernel,
	linux-renesas-soc, Mark Brown, Takashi Iwai

The patch

   ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

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

From b94e164759b82d0c1c80d4b1c8f12c9bee83f11d Mon Sep 17 00:00:00 2001
From: Matthias Blankertz <matthias.blankertz@cetitec.com>
Date: Wed, 15 Apr 2020 16:10:17 +0200
Subject: [PATCH] ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode

The HDMI?_SEL register maps up to four stereo SSI data lanes onto the
sdata[0..3] inputs of the HDMI output block. The upper half of the
register contains four blocks of 4 bits, with the most significant
controlling the sdata3 line and the least significant the sdata0 line.

The shift calculation has an off-by-one error, causing the parent SSI to
be mapped to sdata3, the first multi-SSI child to sdata0 and so forth.
As the parent SSI transmits the stereo L/R channels, and the HDMI core
expects it on the sdata0 line, this causes no audio to be output when
playing stereo audio on a multichannel capable HDMI out, and
multichannel audio has permutated channels.

Fix the shift calculation to map the parent SSI to sdata0, the first
child to sdata1 etc.

Signed-off-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20200415141017.384017-3-matthias.blankertz@cetitec.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/ssiu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index f35d88211887..9c7c3e7539c9 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -221,7 +221,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
 			i;
 
 		for_each_rsnd_mod_array(i, pos, io, rsnd_ssi_array) {
-			shift	= (i * 4) + 16;
+			shift	= (i * 4) + 20;
 			val	= (val & ~(0xF << shift)) |
 				rsnd_mod_id(pos) << shift;
 		}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Applied "ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode" to the asoc tree
  2020-04-15 14:10 ` [PATCH 1/2] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode Matthias Blankertz
@ 2020-04-16 15:23   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-04-16 15:23 UTC (permalink / raw)
  To: Matthias Blankertz
  Cc: alsa-devel, Kuninori Morimoto, Liam Girdwood, linux-kernel,
	linux-renesas-soc, Mark Brown, Takashi Iwai

The patch

   ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

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

From a09fb3f28a60ba3e928a1fa94b0456780800299d Mon Sep 17 00:00:00 2001
From: Matthias Blankertz <matthias.blankertz@cetitec.com>
Date: Wed, 15 Apr 2020 16:10:16 +0200
Subject: [PATCH] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode

The parent SSI of a multi-SSI setup must be fully setup, started and
stopped since it is also part of the playback/capture setup. So only
skip the SSI (as per commit 203cdf51f288 ("ASoC: rsnd: SSI parent cares
SWSP bit") and commit 597b046f0d99 ("ASoC: rsnd: control SSICR::EN
correctly")) if the SSI is parent outside of a multi-SSI setup.

Signed-off-by: Matthias Blankertz <matthias.blankertz@cetitec.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20200415141017.384017-2-matthias.blankertz@cetitec.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/ssi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index fc5d089868df..d51fb3a39448 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -407,7 +407,7 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod,
 	 * We shouldn't exchange SWSP after running.
 	 * This means, parent needs to care it.
 	 */
-	if (rsnd_ssi_is_parent(mod, io))
+	if (rsnd_ssi_is_parent(mod, io) && !rsnd_ssi_multi_slaves(io))
 		goto init_end;
 
 	if (rsnd_io_is_play(io))
@@ -559,7 +559,7 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
 	 * EN is for data output.
 	 * SSI parent EN is not needed.
 	 */
-	if (rsnd_ssi_is_parent(mod, io))
+	if (rsnd_ssi_is_parent(mod, io) && !rsnd_ssi_multi_slaves(io))
 		return 0;
 
 	ssi->cr_en = EN;
@@ -582,7 +582,7 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
 	if (!rsnd_ssi_is_run_mods(mod, io))
 		return 0;
 
-	if (rsnd_ssi_is_parent(mod, io))
+	if (rsnd_ssi_is_parent(mod, io) && !rsnd_ssi_multi_slaves(io))
 		return 0;
 
 	cr  =	ssi->cr_own	|
@@ -620,7 +620,7 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod,
 	if (rsnd_is_gen1(priv))
 		return 0;
 
-	if (rsnd_ssi_is_parent(mod, io))
+	if (rsnd_ssi_is_parent(mod, io) && !rsnd_ssi_multi_slaves(io))
 		return 0;
 
 	if (!rsnd_ssi_is_run_mods(mod, io))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output
  2020-04-15 14:10 [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output Matthias Blankertz
                   ` (2 preceding siblings ...)
  2020-04-16  1:35 ` [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output Kuninori Morimoto
@ 2020-04-17 16:15 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-04-17 16:15 UTC (permalink / raw)
  To: Matthias Blankertz
  Cc: linux-kernel, Liam Girdwood, Kuninori Morimoto, Takashi Iwai,
	alsa-devel, linux-renesas-soc

On Wed, 15 Apr 2020 16:10:15 +0200, Matthias Blankertz wrote:
> This fixes two issues in the snd-soc-rcar driver blocking multichannel
> HDMI audio out: The parent SSI in a multi-SSI configuration is not
> correctly set up and started, and the SSI->HDMI channel mapping is
> wrong.
> 
> With these patches, the following device tree snippet can be used on an
> r8a7795-based platform (Salvator-X) to enable multichannel HDMI audio on
> HDMI0:
> 
> [...]

Applied, thanks!

[1/2] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode
      commit: a09fb3f28a60ba3e928a1fa94b0456780800299d
[2/2] ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode
      commit: b94e164759b82d0c1c80d4b1c8f12c9bee83f11d

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-04-17 16:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-15 14:10 [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output Matthias Blankertz
2020-04-15 14:10 ` [PATCH 1/2] ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode Matthias Blankertz
2020-04-16 15:23   ` Applied "ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode" to the asoc tree Mark Brown
2020-04-15 14:10 ` [PATCH 2/2] ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode Matthias Blankertz
2020-04-16 15:23   ` Applied "ASoC: rsnd: Fix HDMI channel mapping for multi-SSI mode" to the asoc tree Mark Brown
2020-04-16  1:35 ` [PATCH 0/2] ASoC: rsnd: Fixes for multichannel HDMI audio output Kuninori Morimoto
2020-04-17 16:15 ` Mark Brown

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).