From: kettenis Date: Sat, 14 Jan 2023 23:35:09 +0000 (+0000) Subject: Assign (stereo) channel numbers based on "sound-name-prefix" properties. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ee8269ddb4b2451f6b04c27d348abc5a38574ca8;p=openbsd Assign (stereo) channel numbers based on "sound-name-prefix" properties. ok patrick@, ratchov@ --- 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 * Copyright (c) 2020 Patrick Wildt @@ -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); + } } }