From: "Piotr Gliźniewicz" <p.glizniewicz@gmail.com>
To: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>
Cc: "Torsten Schenk" <torsten.schenk@zoho.com>,
linux-sound@vger.kernel.org,
"Piotr Gliźniewicz" <p.glizniewicz@gmail.com>
Subject: [PATCH 2/3] ALSA: 6fire: add a playback channel map
Date: Fri, 16 Oct 2026 09:31:31 +0200 [thread overview]
Message-ID: <20261016073132.109288-3-p.glizniewicz@gmail.com> (raw)
In-Reply-To: <20261016073132.109288-1-p.glizniewicz@gmail.com>
The driver registers no "Playback Channel Map" control, so a program
that needs the speaker position of each playback channel has to assume
an order; speaker-test, for example, assumes FL FR RL RR FC LFE for 6
channels. Channel n of the PCM goes to Line Out n, and the manual of
the card assigns Line Out 1 to 6 to front left and right, centre and
subwoofer, and rear left and right.
Add a playback channel map in the order of the manual,
FL FR FC LFE RL RR. A stream with 2 to 5 channels gets the first
positions of the list. A 1-channel stream gets MONO, as in every
1-channel entry of a channel map in sound/; the card plays it on Line
Out 1 only. The map has an entry for every channel count from 1 to 6,
because reading the control fails with -EINVAL for a count without an
entry.
Tested on a DMX 6Fire USB with kernel 7.2.10: during playback with 1,
3, 5 and 6 channels the control reads MONO, FL FR FC, FL FR FC LFE RL
and FL FR FC LFE RL RR, and the "Front Center" test of
speaker-test -c 6 played on Line Out 3.
Assisted-by: LLM
Signed-off-by: Piotr Gliźniewicz <p.glizniewicz@gmail.com>
---
sound/usb/6fire/pcm.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 0285d79ac..d99395229 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -612,6 +612,28 @@ static void usb6fire_pcm_free(struct pcm_runtime *rt)
kfree(rt);
}
+/*
+ * playback channel map: channel n goes to analog output n, which the
+ * manual of the card assigns to FL FR FC LFE RL RR for n = 1..6; a
+ * 1-channel stream is MONO, as in snd_pcm_std_chmaps, and plays on
+ * analog output 1 only
+ */
+static const struct snd_pcm_chmap_elem usb6fire_pcm_chmaps[] = {
+ { .channels = 1, .map = { SNDRV_CHMAP_MONO } },
+ { .channels = 2, .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
+ { .channels = 3, .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
+ SNDRV_CHMAP_FC } },
+ { .channels = 4, .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
+ SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } },
+ { .channels = 5, .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
+ SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE,
+ SNDRV_CHMAP_RL } },
+ { .channels = 6, .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
+ SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE,
+ SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
+ { }
+};
+
int usb6fire_pcm_init(struct sfire_chip *chip)
{
int i;
@@ -665,6 +687,14 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
rt->instance = pcm;
chip->pcm = rt;
+
+ /* on error, rt is freed with the card */
+ ret = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+ usb6fire_pcm_chmaps, OUT_N_CHANNELS, 0, NULL);
+ if (ret < 0) {
+ dev_err(&chip->dev->dev, "cannot add channel map.\n");
+ return ret;
+ }
return 0;
error:
--
2.56.0
next prev parent reply other threads:[~2026-10-16 7:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 7:31 [PATCH 0/3] ALSA: 6fire: S/PDIF output Piotr Gliźniewicz
2026-10-16 7:31 ` [PATCH 1/3] ALSA: 6fire: take stream_mutex in the Digital Thru control Piotr Gliźniewicz
2026-10-16 7:31 ` Piotr Gliźniewicz [this message]
2026-10-16 7:31 ` [PATCH 3/3] ALSA: 6fire: add S/PDIF output Piotr Gliźniewicz
2026-10-16 16:46 ` [PATCH 0/3] ALSA: 6fire: " Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261016073132.109288-3-p.glizniewicz@gmail.com \
--to=p.glizniewicz@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=torsten.schenk@zoho.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.