Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/4] sound: qcom: audioreach: support WSA speakers only on WSA2
@ 2026-06-10  7:41 Neil Armstrong
  2026-06-10  7:41 ` [PATCH 1/4] ASoC: qcom: audioreach: compute active channel maps from channel_map Neil Armstrong
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Neil Armstrong @ 2026-06-10  7:41 UTC (permalink / raw)
  To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: kancy2333, linux-sound, linux-arm-msm, linux-kernel, devicetree,
	Neil Armstrong, Srinivas Kandagatla

The Qualcom SM8650 based Ayaneo Pocket S2 gaming device has a set
of 2 WSA speakers connected on the WSA2 lines.

But the Audioreach DSP only handles WSA2 in pair with the WSA
interface by using the upper bits of the active_channels_mask
for WSA2 and the lower bits for WSA:

 __________________________________________________
| Bits  |     3    |     2    |   1     |     0   |
---------------------------------------------------
| Line  | WSA2 Ch2 | WSA2 Ch1 | WSA Ch2 | WSA Ch1 |
---------------------------------------------------

Setting only the WSA2 upper bits is perfectly valid and
functional but the current Audioreach code builds the bitmask
from the channels count with:
	active_channels_mask = (1 << num_channels) - 1;

In order to enable the WSA2 bits the channel count should be 4,
but the lower WSA bits are then also enabled and the DSP errors
out when trying to play on the disabled WSA interface.

A solution would've been to add a fake WSA2 topology element which
would be translated into the top bits only, but it's not clean and
add some special exceptions in the generic Audioreach code.

The solution suggested by Srinivas is to use the channel mapping to
set this bitmask.

This works but makes all the other calls using the channel mapping fail
because the DSP requires the channel_mapping table to start from index 0
and using num_channel length in order to apply the mapping on the
active_channels_mask bits in order.

So if you have an active_channels_mask like:
 _______________________
| Bits  | 3 | 2 | 1 | 0 |
-------------------------
| Mask  | 1 | 1 | 0 | 0 |
------------------------

And the channel mapping:
 _________________________________
| Channel |  3 |  2 |   1  |   0  |
-----------------------------------
| Mapping | FR | FL | NULL | NULL |
-----------------------------------

Will need to be converted to:
 ____________________
| Channel |  1 |  0 |
---------------------
| Mapping | FR | FL |
---------------------

And the DSP will map FR on WSA2 Ch2 and FL on WSA2 Ch1 as:
 _________________________________
| Line    |  WSA2 Ch2 | WSA2 Ch1 |
----------------------------------
| Mapping |     FR    |     FL   |
----------------------------------

So we need to skip the empty channel mapping entries in all other
users of the channel_map to build valid channel_mapping tables.

This should not break any other usecases since the default channel
mapping always start from index 0, and will add flexibilty to allow
some special non linear mapping for other interfaces as well.

Finally we add a special prepare callback for the Ayaneo PS2 sound card
which sets the custom channel mapping for the WSA interface to make audio
work properly on the gaming device.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
Neil Armstrong (4):
      ASoC: qcom: audioreach: compute active channel maps from channel_map
      ASoC: qcom: sc8280xp: add Ayaneo Pocket S2 card with special WSA channel mapping
      arm64: dts: qcom: sm8650-ayaneo-pocket-s2: switch sound card to ayaneo,pocket-s2-sndcard
      ASoC: dt-bindings: qcom,sm8250: Add Ayaneo Pocket S2 sound card

 .../devicetree/bindings/sound/qcom,sm8250.yaml     |  1 +
 .../boot/dts/qcom/sm8650-ayaneo-pocket-s2.dts      |  2 +-
 sound/soc/qcom/qdsp6/audioreach.c                  | 47 ++++++++++++++----
 sound/soc/qcom/sc8280xp.c                          | 56 ++++++++++++++++++++++
 4 files changed, 95 insertions(+), 11 deletions(-)
---
base-commit: 1ed783a6906ab62a54d631ff3e8c5cba0f4f4b54
change-id: 20260609-topic-sm8650-ayaneo-pocket-s2-wsa2-fix-eb90567f6ca5

Best regards,
--  
Neil Armstrong <neil.armstrong@linaro.org>


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

end of thread, other threads:[~2026-06-15  9:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10  7:41 [PATCH 0/4] sound: qcom: audioreach: support WSA speakers only on WSA2 Neil Armstrong
2026-06-10  7:41 ` [PATCH 1/4] ASoC: qcom: audioreach: compute active channel maps from channel_map Neil Armstrong
2026-06-15  8:38   ` Srinivas Kandagatla
2026-06-15  9:31     ` Neil Armstrong
2026-06-15  9:36       ` Srinivas Kandagatla
2026-06-10  7:41 ` [PATCH 2/4] ASoC: qcom: sc8280xp: add Ayaneo Pocket S2 card with special WSA channel mapping Neil Armstrong
2026-06-15  8:42   ` Srinivas Kandagatla
2026-06-10  7:41 ` [PATCH 3/4] arm64: dts: qcom: sm8650-ayaneo-pocket-s2: switch sound card to ayaneo,pocket-s2-sndcard Neil Armstrong
2026-06-12  7:57   ` Dmitry Baryshkov
2026-06-12  7:59     ` Neil Armstrong
2026-06-12  8:23       ` Dmitry Baryshkov
2026-06-12  8:30         ` Neil Armstrong
2026-06-10  7:41 ` [PATCH 4/4] ASoC: dt-bindings: qcom,sm8250: Add Ayaneo Pocket S2 sound card Neil Armstrong
2026-06-11  9:04   ` Krzysztof Kozlowski
2026-06-10 10:12 ` [PATCH 0/4] sound: qcom: audioreach: support WSA speakers only on WSA2 Mark Brown
2026-06-10 11:52   ` Neil Armstrong

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