Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: rcar: adg: correct TIMSEL setting for SSI9
@ 2024-02-23 16:35 Eugeniu Rosca
  2024-02-25 23:21 ` Kuninori Morimoto
  0 siblings, 1 reply; 8+ messages in thread
From: Eugeniu Rosca @ 2024-02-23 16:35 UTC (permalink / raw)
  To: Kuninori Morimoto, Wolfram Sang, Takashi Iwai, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, linux-sound, Pierre-Louis Bossart,
	Charles Keepax, Vincenzo De Michele
  Cc: Eugeniu Rosca, Eugeniu Rosca, Andreas Pape, Yeswanth Rayapati

From: Andreas Pape <Andreas.Pape4@bosch.com>

Timing select register for SRC and CMD is by default
referring to the corresponding SSI word select.
The calculation rule from HW spec skips SSI8, which has
no clock connection.

0110: ssi_ws0
0111: ssi_ws1
1000: ssi_ws2
1001: ssi_ws3
1010: ssi_ws4
1011: ssi_ws5
1100: ssi_ws6
1101: ssi_ws7
<GAP>
1110: ssi_ws9
1111: Setting prohibited

The driver does not currently reflect that GAP, leading to
prohibited timsel value 1111 (0xf) for SSI9:

[21.695055] rcar_sound ec500000.sound: b adg[0]-CMDOUT_TIMSEL (32):00000f00/00000f1f

Correct the timsel assignment.

Fixes: 629509c5bc478c ("ASoC: rsnd: add Gen2 SRC and DMAEngine support")
Signed-off-by: Andreas Pape <Andreas.Pape4@bosch.com>
Signed-off-by: Yeswanth Rayapati <yeswanth.rayapati@in.bosch.com>
[erosca: minor improvements in commit description]
Signed-off-by: Eugeniu Rosca <eugeniu.rosca@bosch.com>
---
 sound/soc/sh/rcar/adg.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 230c48648af359..137db9feab495e 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -95,25 +95,40 @@ static u32 rsnd_adg_ssi_ws_timing_gen2(struct rsnd_dai_stream *io)
 {
 	struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
 	int id = rsnd_mod_id(ssi_mod);
-	int ws = id;
+
+	u8 ssi_ws[] = {
+		0x6, /* ssi0 */
+		0x7, /* ssi1 */
+		0x8, /* ssi2 */
+		0x9, /* ssi3 */
+		0xa, /* ssi4 */
+		0xb, /* ssi5 */
+		0xc, /* ssi6 */
+		0xd, /* ssi7 */
+		0xf, /* INVALID */
+		0xe, /* ssi9 */
+	};
 
 	if (rsnd_ssi_is_pin_sharing(io)) {
 		switch (id) {
 		case 1:
 		case 2:
 		case 9:
-			ws = 0;
+			id = 0;
 			break;
 		case 4:
-			ws = 3;
+			id = 3;
 			break;
 		case 8:
-			ws = 7;
+			id = 7;
 			break;
 		}
 	}
 
-	return (0x6 + ws) << 8;
+	if (id > 9)
+		return 0xf << 8;
+	else
+		return ssi_ws[id] << 8;
 }
 
 static void __rsnd_adg_get_timesel_ratio(struct rsnd_priv *priv,
-- 
2.43.2


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

end of thread, other threads:[~2024-03-01  8:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 16:35 [PATCH] ASoC: rcar: adg: correct TIMSEL setting for SSI9 Eugeniu Rosca
2024-02-25 23:21 ` Kuninori Morimoto
2024-02-27 12:07   ` Eugeniu Rosca
2024-02-27 23:22     ` Kuninori Morimoto
2024-02-28  9:45       ` Eugeniu Rosca
2024-02-28 23:36         ` Kuninori Morimoto
2024-02-29  0:16           ` Kuninori Morimoto
2024-03-01  8:58             ` Eugeniu Rosca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox