mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: qcom: sc8280xp: support Senary MI2S
@ 2026-07-04 19:28 Jorijn van der Graaf
  2026-07-05  0:40 ` Val Packett
  0 siblings, 1 reply; 3+ messages in thread
From: Jorijn van der Graaf @ 2026-07-04 19:28 UTC (permalink / raw)
  To: Srinivas Kandagatla, Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
	linux-arm-msm, linux-kernel, Jorijn van der Graaf

Extend the clock-provider DAI fmt setup to Senary MI2S; without it
q6i2s_set_fmt() is never called, ws_src remains external and the DSP
does not drive the I2S clocks.

Force 32-bit slots on this interface in the BE fixup. The only Senary
MI2S user so far is the Fairphone (Gen. 6), whose AW88261 speaker
amplifiers derive their boost converter clock from BCLK and are
configured by their firmware profile for 48 kHz x 32 bit x 2
(3.072 MHz BCLK), matching the downstream configuration of this
backend (bit_width 32). The board DTS enabling this interface is
headed upstream separately via linux-arm-msm. Should a board with
different requirements on this interface appear, the fixup can be
keyed on the card compatible instead.

Note the snd_mask_none() before snd_mask_set_format(): the latter only
ORs the format bit into the mask, and with the default S16 left in
place DPCM refinement still resolves to S16.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
---
 sound/soc/qcom/sc8280xp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index 7925aa3f63ba..5a0b7f05c12b 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -34,6 +34,7 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
 	switch (cpu_dai->id) {
 	case PRIMARY_MI2S_RX...QUATERNARY_MI2S_TX:
 	case QUINARY_MI2S_RX...QUINARY_MI2S_TX:
+	case SENARY_MI2S_RX...SENARY_MI2S_TX:
 		snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP);
 		break;
 	case WSA_CODEC_DMA_RX_0:
@@ -88,6 +89,17 @@ static int sc8280xp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 	case TX_CODEC_DMA_TX_3:
 		channels->min = 1;
 		break;
+	case SENARY_MI2S_RX...SENARY_MI2S_TX:
+		/*
+		 * Run the interface in 32-bit slots (3.072 MHz BCLK at
+		 * 48 kHz stereo), as the speaker amplifiers on this
+		 * interface require. The default S16 must be cleared
+		 * first: snd_mask_set_format() only ORs the bit in, and
+		 * DPCM refinement would still resolve to S16.
+		 */
+		snd_mask_none(fmt);
+		snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
+		break;
 	default:
 		break;
 	}

base-commit: be44d21728b6646189779923b841ad3a46d694e5
-- 
2.55.0


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

* Re: [PATCH] ASoC: qcom: sc8280xp: support Senary MI2S
  2026-07-04 19:28 [PATCH] ASoC: qcom: sc8280xp: support Senary MI2S Jorijn van der Graaf
@ 2026-07-05  0:40 ` Val Packett
  2026-07-05  3:36   ` Jorijn van der Graaf
  0 siblings, 1 reply; 3+ messages in thread
From: Val Packett @ 2026-07-05  0:40 UTC (permalink / raw)
  To: Jorijn van der Graaf, Srinivas Kandagatla, Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
	linux-arm-msm, linux-kernel


On 7/4/26 4:28 PM, Jorijn van der Graaf wrote:
> Extend the clock-provider DAI fmt setup to Senary MI2S; without it
> q6i2s_set_fmt() is never called, ws_src remains external and the DSP
> does not drive the I2S clocks.
>
> Force 32-bit slots on this interface in the BE fixup. The only Senary
> MI2S user so far is the Fairphone (Gen. 6), whose AW88261 speaker
> amplifiers derive their boost converter clock from BCLK and are
> configured by their firmware profile for 48 kHz x 32 bit x 2
> (3.072 MHz BCLK), matching the downstream configuration of this
> backend (bit_width 32). [..]

Since 
https://lore.kernel.org/all/178104655633.212106.619790244001573816.b4-ty@b4/ 
you no longer need to care about what the profile specifies. The aw88261 
driver properly participates in format negotiation now. The "firmware" 
register list binaries are therefore nearly irrelevant. Please don't add 
any more of this force-32-bit nonsense! We've just gotten rid of it on 
the Fairphone 5 and other kodiak devices.


Thanks,
~val


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

* Re: [PATCH] ASoC: qcom: sc8280xp: support Senary MI2S
  2026-07-05  0:40 ` Val Packett
@ 2026-07-05  3:36   ` Jorijn van der Graaf
  0 siblings, 0 replies; 3+ messages in thread
From: Jorijn van der Graaf @ 2026-07-05  3:36 UTC (permalink / raw)
  To: Val Packett, Srinivas Kandagatla, Mark Brown
  Cc: Jorijn van der Graaf, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, Luca Weiss, linux-sound, linux-arm-msm,
	linux-kernel

On 7/5/26 2:40 AM, Val Packett wrote:
> Since
> https://lore.kernel.org/all/178104655633.212106.619790244001573816.b4-ty@b4/
> you no longer need to care about what the profile specifies. The aw88261
> driver properly participates in format negotiation now. The "firmware"
> register list binaries are therefore nearly irrelevant. Please don't add
> any more of this force-32-bit nonsense! We've just gotten rid of it on
> the Fairphone 5 and other kodiak devices.

I apologize for not catching this, I was developing on the 7.1-based
milos-mainline staging tree which doesn't include your series yet.
There a 16-bit stream plays silence, since the amp keeps the profile's
32-bit frame config, and I wrongly took that for a hardware
requirement.

To retest, I backported your series onto my 7.1 tree (together with
my pending power-up check fix [1], without which the amplifiers fail
an unrelated SYSST check on this board), and can confirm 1b92b0673d5e
("ASoC: codecs: aw88261: support changing sample rate and bit width")
works as advertised on the FP6: with the fixup dropped the backend runs S16
end-to-end and the amps get reprogrammed to 16-bit frames at 32fs
(I2SCTRL1 0x3408, SYSST 0x311 while playing) and sound is fine.
I'll send a v2 with the fixup dropped.

However, I could only get there after locally reverting caea99ac809d
("ASoC: codecs: aw88261: remove async start"): with the synchronous
start the amps can never power up on this platform. The Fairphone
(Gen. 6) uses the AudioReach/q6apm stack, where the BE port only
starts the I2S clocks at trigger time (q6apm_lpass_dai_trigger() ->
q6apm_graph_start(); prepare only prepares the graph). aw88261_start()
now runs synchronously from the DAPM PRE_PMU handler, i.e. during
prepare, before the trigger can ever run — so the power-up check
always sees SYSST = 0x0020 (NOCLKS) and gives up:

  aw88261 6-0035: check pll lock fail,reg_val:0x0020
  aw88261 6-0035: mode1 iis signal check error
  ...
  aw88261 6-0035: aw88261_dev_start failed, cnt:4, ret:-1
  aw88261 6-0035: start failure (-1)

A plain revert would bring back the missed-short-sounds problem you
fixed, so I fixed it on the platform side instead: starting the graph
at the end of q6apm_lpass_dai_prepare(), mirroring what
q6afe_dai_prepare() does on the legacy stack, makes the clocks run
before the DAPM power-up sequence. With that change and your series
untouched, the amplifiers start synchronously on the FP6, including
for the first short stream of the boot. I'll send that as an RFC
("ASoC: qcom: q6apm-lpass-dais: start the graph at prepare") right
after this mail. I may well be missing why AudioReach starts its
ports at trigger rather than at prepare like q6afe, so input from
you and Srinivas is very welcome there.

[1] https://lore.kernel.org/linux-sound/20260704192857.88366-1-jorijnvdgraaf@catcrafts.net/

Thank you for your review,
Jorijn van der Graaf

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

end of thread, other threads:[~2026-07-05  3:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-04 19:28 [PATCH] ASoC: qcom: sc8280xp: support Senary MI2S Jorijn van der Graaf
2026-07-05  0:40 ` Val Packett
2026-07-05  3:36   ` Jorijn van der Graaf

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

all inboxes | Powered by JetHome®