diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-01-14 23:35:10 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-01-14 23:35:10 +0000 |
commit | 3be2d07f3ea649fba6a539abd2665f3e0511f6d9 (patch) | |
tree | e5172dd176df4fc6830a7229a1ddd565959ff764 /sys | |
parent | e42623735b649cec551a362e562dc629b10aed29 (diff) |
Assign (stereo) channel numbers based on "sound-name-prefix" properties.
ok patrick@, ratchov@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm64/dev/aplaudio.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/arch/arm64/dev/aplaudio.c b/sys/arch/arm64/dev/aplaudio.c index 6c3665440ae..28e2aad2f1d 100644 --- a/sys/arch/arm64/dev/aplaudio.c +++ b/sys/arch/arm64/dev/aplaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplaudio.c,v 1.5 2022/12/05 07:30:51 kettenis Exp $ */ +/* $OpenBSD: aplaudio.c,v 1.6 2023/01/14 23:35:09 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2020 Patrick Wildt <patrick@blueri.se> @@ -195,8 +195,18 @@ aplaudio_set_tdm_slots(struct aplaudio_softc *sc) dai = sc->sc_dai_codec[i]; if (dai == NULL) continue; - if (dai->dd_set_tdm_slot) - dai->dd_set_tdm_slot(dai->dd_cookie, i % 2); + if (dai->dd_set_tdm_slot) { + char prefix[8]; + int slot = 0; + + if (OF_getprop(dai->dd_node, "sound-name-prefix", + prefix, sizeof(prefix)) > 0) { + if (strncmp(prefix, "Right", 5) == 0) + slot = 1; + } + + dai->dd_set_tdm_slot(dai->dd_cookie, slot); + } } } |