NetBSD Problem Report #29178
From kuebart@mathematik.uni-ulm.de Mon Jan 31 22:59:59 2005
Return-Path: <kuebart@mathematik.uni-ulm.de>
Received: from mout2.freenet.de (mout2.freenet.de [194.97.50.155])
by narn.netbsd.org (Postfix) with ESMTP id 34E2063B400
for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Jan 2005 22:59:58 +0000 (UTC)
Message-Id: <E1CvkWQ-00004m-8U@jaja>
Date: Mon, 31 Jan 2005 23:59:54 +0100
From: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>
Reply-To: kuebart@mathematik.uni-ulm.de
To: gnats-bugs@netbsd.org
Subject: confusing behaviour because mixer classes in eap driver are misnamed
X-Send-Pr-Version: 3.95
>Number: 29178
>Category: kern
>Synopsis: confusing behaviour because mixer classes in eap driver are misnamed
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: fredb
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 31 23:00:01 +0000 2005
>Closed-Date: Mon Feb 14 19:42:36 +0000 2005
>Last-Modified: Mon Feb 14 19:42:36 +0000 2005
>Originator: Joachim Kuebart
>Release: NetBSD 2.0B
>Organization:
>Environment:
System: NetBSD jaja 2.0B NetBSD 2.0B (ALPHA-$Revision: 1.191 $) #3: Mon Jan 31 23:19:23 CET 2005 joki@jaja:/usr/obj/usr/src/sys/arch/alpha/compile/JAJA alpha
Architecture: alpha
Machine: alpha
>Description:
The class assignments for the mixer controls in the eap driver are
misleading. The current mixer looks like this:
outputs.master=200,200 volume
inputs.dac=200,200 volume
inputs.fmsynth=200,200 volume
inputs.cd=200,200 volume
inputs.line=200,200 volume
inputs.aux=200,200 volume
inputs.mic=0 volume
inputs.mic.preamp=off [ off on ]
record.source=mic { mic cd line fmsynth aux dac }
outputs.select=mic,cd,line,fmsynth,aux,dac { mic cd line fmsynth aux dac }
There are two problems with this: firstly, a study of
<ftp://ftp.alsa-project.org/pub/manuals/asahi_kasei/4531.pdf> reveals
that the mixers addressed by the inputs.* volume settings actually
affect both the play-through as well as the recording volume. This
means that they should be in the record.* class rather than the
inputs.* class according to my understanding of the following section
of audio(9):
Each of the named sources for which the recording level can
be set should have a control in the AudioCrecord class of
type AUDIO_MIXER_VALUE...
Controls for various sources that affect only the playback
output, as opposed to recording, should be in the
AudioCinputs class.
Note that the AK4531 does not have any volume controls that affect
only playback (except for outputs.master, obviously).
Secondly, the outputs.select control is apparently wrong as it is
supposed to refer to output destinations, cf. again audio(9):
If the play mixer is capable of output to more than one
destination, it should define AudioNselect in class
AudioCoutputs. This mixer control should be of type
AUDIO_MIXER_ENUM or AUDIO_MIXER_SET and enumerate the
possible destinations.
Instead, the channel names in the above example as well as the
circuitry inside the AK4531 show that these controls actually control
which inputs are switched through to the output mixer. The sentence
...various sources in class AudioCrecord will be combined and
presented to the single recording output, in the same fashion
that the sources of class AudioCinputs are combined and
presented to the playback output(s).
in audio(9) suggests that this is what the inputs.select control is
supposed to do.
Note again that the AK4531 has only one output and thus does not
offer the functionality described for outputs.select.
>How-To-Repeat:
The described problem appears to be one of nomenclature at first
sight, but it actually has a greater effect on how the "port" value
in AUDIO_SET and AUDIO_GET ioctls is treated. With the current
implementation, one has the problem that an audio program that
selects "speaker" output (as, for example, libmikmod) will instead
deactivate output alltogether because the outputs.select control gets
set to zero for want of a mixer labelled "speaker" on the AK4531.
This is clearly not the intended behaviour.
>Fix:
The fix I suggest is to rename several mixer controls for the eap
driver as follows:
outputs.master=200,200 volume
record.dac=200,200 volume
record.fmsynth=200,200 volume
record.cd=200,200 volume
record.line=200,200 volume
record.aux=200,200 volume
record.mic=0 volume
record.mic.preamp=off [ off on ]
record.source=mic { mic cd line fmsynth aux dac }
inputs.source=mic,cd,line,fmsynth,aux,dac { mic cd line fmsynth aux dac }
This is achieved by the following patch against -current sources:
Index: eap.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/eap.c,v
retrieving revision 1.76
diff -u -p -r1.76 eap.c
--- eap.c 15 Jan 2005 15:19:52 -0000 1.76
+++ eap.c 31 Jan 2005 22:53:52 -0000
@@ -164,7 +164,7 @@ struct eap_softc {
u_short sc_port[AK_NPORTS]; /* mirror of the hardware setting */
u_int sc_record_source; /* recording source mask */
- u_int sc_output_source; /* output source mask */
+ u_int sc_input_source; /* input source mask */
u_int sc_mic_preamp;
char sc_1371; /* Using ES1371/AC97 codec */
@@ -703,7 +703,7 @@ eap_attach(struct device *parent, struct
eap_hw_if = &eap1370_hw_if;
/* Enable all relevant mixer switches. */
- ctl.dev = EAP_OUTPUT_SELECT;
+ ctl.dev = EAP_INPUT_SOURCE;
ctl.type = AUDIO_MIXER_SET;
ctl.un.mask = 1 << EAP_VOICE_VOL | 1 << EAP_FM_VOL |
1 << EAP_CD_VOL | 1 << EAP_LINE_VOL | 1 << EAP_AUX_VOL |
@@ -1478,10 +1478,10 @@ eap1370_mixer_set_port(void *addr, mixer
eap1370_set_mixer(sc, AK_IN_MIXER2_R, r2);
return 0;
}
- if (cp->dev == EAP_OUTPUT_SELECT) {
+ if (cp->dev == EAP_INPUT_SOURCE) {
if (cp->type != AUDIO_MIXER_SET)
return EINVAL;
- m = sc->sc_output_source = cp->un.mask;
+ m = sc->sc_input_source = cp->un.mask;
o1 = o2 = 0;
if (m & (1 << EAP_VOICE_VOL))
o2 |= AK_M_VOICE_L | AK_M_VOICE_R;
@@ -1578,10 +1578,10 @@ eap1370_mixer_get_port(void *addr, mixer
return EINVAL;
cp->un.mask = sc->sc_record_source;
return 0;
- case EAP_OUTPUT_SELECT:
+ case EAP_INPUT_SOURCE:
if (cp->type != AUDIO_MIXER_SET)
return EINVAL;
- cp->un.mask = sc->sc_output_source;
+ cp->un.mask = sc->sc_input_source;
return 0;
case EAP_MIC_PREAMP:
if (cp->type != AUDIO_MIXER_ENUM)
@@ -1648,7 +1648,7 @@ eap1370_query_devinfo(void *addr, mixer_
return 0;
case EAP_VOICE_VOL:
dip->type = AUDIO_MIXER_VALUE;
- dip->mixer_class = EAP_INPUT_CLASS;
+ dip->mixer_class = EAP_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
strcpy(dip->label.name, AudioNdac);
@@ -1657,7 +1657,7 @@ eap1370_query_devinfo(void *addr, mixer_
return 0;
case EAP_FM_VOL:
dip->type = AUDIO_MIXER_VALUE;
- dip->mixer_class = EAP_INPUT_CLASS;
+ dip->mixer_class = EAP_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
strcpy(dip->label.name, AudioNfmsynth);
@@ -1666,7 +1666,7 @@ eap1370_query_devinfo(void *addr, mixer_
return 0;
case EAP_CD_VOL:
dip->type = AUDIO_MIXER_VALUE;
- dip->mixer_class = EAP_INPUT_CLASS;
+ dip->mixer_class = EAP_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
strcpy(dip->label.name, AudioNcd);
@@ -1675,7 +1675,7 @@ eap1370_query_devinfo(void *addr, mixer_
return 0;
case EAP_LINE_VOL:
dip->type = AUDIO_MIXER_VALUE;
- dip->mixer_class = EAP_INPUT_CLASS;
+ dip->mixer_class = EAP_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
strcpy(dip->label.name, AudioNline);
@@ -1684,7 +1684,7 @@ eap1370_query_devinfo(void *addr, mixer_
return 0;
case EAP_AUX_VOL:
dip->type = AUDIO_MIXER_VALUE;
- dip->mixer_class = EAP_INPUT_CLASS;
+ dip->mixer_class = EAP_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = AUDIO_MIXER_LAST;
strcpy(dip->label.name, AudioNaux);
@@ -1693,7 +1693,7 @@ eap1370_query_devinfo(void *addr, mixer_
return 0;
case EAP_MIC_VOL:
dip->type = AUDIO_MIXER_VALUE;
- dip->mixer_class = EAP_INPUT_CLASS;
+ dip->mixer_class = EAP_RECORD_CLASS;
dip->prev = AUDIO_MIXER_LAST;
dip->next = EAP_MIC_PREAMP;
strcpy(dip->label.name, AudioNmicrophone);
@@ -1719,10 +1719,10 @@ eap1370_query_devinfo(void *addr, mixer_
strcpy(dip->un.s.member[5].label.name, AudioNdac);
dip->un.s.member[5].mask = 1 << EAP_VOICE_VOL;
return 0;
- case EAP_OUTPUT_SELECT:
- dip->mixer_class = EAP_OUTPUT_CLASS;
+ case EAP_INPUT_SOURCE:
+ dip->mixer_class = EAP_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNselect);
+ strcpy(dip->label.name, AudioNsource);
dip->type = AUDIO_MIXER_SET;
dip->un.s.num_mem = 6;
strcpy(dip->un.s.member[0].label.name, AudioNmicrophone);
@@ -1740,7 +1740,7 @@ eap1370_query_devinfo(void *addr, mixer_
return 0;
case EAP_MIC_PREAMP:
dip->type = AUDIO_MIXER_ENUM;
- dip->mixer_class = EAP_INPUT_CLASS;
+ dip->mixer_class = EAP_RECORD_CLASS;
dip->prev = EAP_MIC_VOL;
dip->next = AUDIO_MIXER_LAST;
strcpy(dip->label.name, AudioNpreamp);
Index: eapreg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/eapreg.h,v
retrieving revision 1.9
diff -u -p -r1.9 eapreg.h
--- eapreg.h 15 Jan 2005 15:19:52 -0000 1.9
+++ eapreg.h 31 Jan 2005 22:53:52 -0000
@@ -269,7 +269,7 @@
#define EAP_AUX_VOL 5
#define EAP_MIC_VOL 6
#define EAP_RECORD_SOURCE 7
-#define EAP_OUTPUT_SELECT 8
+#define EAP_INPUT_SOURCE 8
#define EAP_MIC_PREAMP 9
#define EAP_OUTPUT_CLASS 10
#define EAP_RECORD_CLASS 11
>Release-Note:
>Audit-Trail:
From: fredb@immanent.net (Frederick Bruckman)
To: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/29178: confusing behaviour because mixer classes in eap driver are misnamed
Date: Fri, 11 Feb 2005 18:29:59 -0600 (CST)
In article <20050131230001.6D9E863B849@narn.netbsd.org>,
Joachim Kuebart <kuebart@mathematik.uni-ulm.de> writes:
> There are two problems with this: firstly, a study of
> <ftp://ftp.alsa-project.org/pub/manuals/asahi_kasei/4531.pdf> reveals
> that the mixers addressed by the inputs.* volume settings actually
> affect both the play-through as well as the recording volume. This
> means that they should be in the record.* class rather than the
> inputs.* class according to my understanding of the following section
> of audio(9):
>
> Each of the named sources for which the recording level can
> be set should have a control in the AudioCrecord class of
> type AUDIO_MIXER_VALUE...
>
> Controls for various sources that affect only the playback
> output, as opposed to recording, should be in the
> AudioCinputs class.
I wrote that text, but I'm not so sure now it make sense. I thought all
the underlying hardware would like this this:
INPUT \
OUTPUT
RECORD /
...but it sounds like yours, at least, goes like this:
OUTPUT
/
INPUT--+
\
RECORD
If that's the case, "input" seems like a a better name for a mixer node
that controls *both* playback and record, doesn't it? (If you agree, I
could change that man page.)
> Note that the AK4531 does not have any volume controls that affect
> only playback (except for outputs.master, obviously).
>
> Secondly, the outputs.select control is apparently wrong as it is
> supposed to refer to output destinations, cf. again audio(9):
>
> If the play mixer is capable of output to more than one
> destination, it should define AudioNselect in class
> AudioCoutputs. This mixer control should be of type
> AUDIO_MIXER_ENUM or AUDIO_MIXER_SET and enumerate the
> possible destinations.
>
> Instead, the channel names in the above example as well as the
> circuitry inside the AK4531 show that these controls actually control
> which inputs are switched through to the output mixer. The sentence
>
> ...various sources in class AudioCrecord will be combined and
> presented to the single recording output, in the same fashion
> that the sources of class AudioCinputs are combined and
> presented to the playback output(s).
>
> in audio(9) suggests that this is what the inputs.select control is
> supposed to do.
Yes, I agree completely. (I wrote that text, too.)
> Note again that the AK4531 has only one output and thus does not
> offer the functionality described for outputs.select.
The idea behind my last change to the audio layer, was for the volume
setter to prefer the mixer and the detail control if available, else to
go with the master. I didn't get to test with anything that had an
"output.select", so I guessed as best I could. It sounds like this is
a bug in the underlying driver, though.
> The described problem appears to be one of nomenclature at first
> sight, but it actually has a greater effect on how the "port" value
> in AUDIO_SET and AUDIO_GET ioctls is treated. With the current
> implementation, one has the problem that an audio program that
> selects "speaker" output (as, for example, libmikmod) will instead
> deactivate output alltogether because the outputs.select control gets
> set to zero for want of a mixer labelled "speaker" on the AK4531.
> This is clearly not the intended behaviour.
If you trim your patch to only change the outputs.select to inputs.select,
does that still fix your problem with "mikmod"?
I have an "eap", which however doesn't even have an "outputs.select":
# grep eap /var/run/dmesg.boot
eap0 at pci4 dev 6 function 0: Ensoniq AudioPCI 97 ES1371-B (rev. 0x09)
eap0: interrupting at ioapic0 pin 20 (irq 5)
eap0: ac97: Crystal CS4297A codec; headphone, 20 bit DAC, 18 bit ADC, Crystal Semi 3D
eap0: ac97: ext id 200<AMAP>
audio0 at eap0: full duplex, mmap, independent
midi0 at eap0: AudioPCI MIDI UART
# mixerctl -a | grep outputs
outputs.master=119,119
outputs.master.mute=off
outputs.mono=255
outputs.mono.mute=on
outputs.mono.source=mixerout
outputs.headphones=255,255
outputs.headphones.mute=off
outputs.spatial=on
outputs.spatial.center=0
outputs.spatial.depth=96
I suppose many don't, so that one change should be "safe".
Kind regards,
Frederick
From: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>
To: Frederick Bruckman <fredb@immanent.net>
Cc: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>,
gnats-bugs@netbsd.org
Subject: Re: kern/29178: confusing behaviour because mixer classes in eap driver are misnamed
Date: Sat, 12 Feb 2005 20:51:56 +0100
On Fri, Feb 11, 2005 at 06:29:59PM -0600, Frederick Bruckman wrote:
> In article <20050131230001.6D9E863B849@narn.netbsd.org>,
>
> ...but it sounds like yours, at least, goes like this:
>
>
> B OUTPUT
> /
> INPUT-A-+
> \
> C RECORD
>
> If that's the case, "input" seems like a a better name for a mixer node
> that controls *both* playback and record, doesn't it? (If you agree, I
> could change that man page.)
I do agree that the appropriate class for the volume controls at A in the
picture above is definitely "inputs." The part of my patch that puts these
in the "record" class should be ignored and I will supply a new patch without
it upon request or when the remaining issues are resolved (whichever occurs
first :-).
As far as I can see, there are three naming possibilities for selector B:
(Since it selects among DAC, Line-In, CD etc., "outputs.select" is clearly
wrong since that chooses among speaker, headphone and line out).
"outputs.source"
Under this name, all controls (mic, cd, line, fmsynth, aux and dac)
would make sense. The only downside to this name I can think of is
that I don't see it mentioned anywhere, so it doesn't seem to be
widely used. Maybe other hardware doesn't have this kind of
output-source selection.
"monitor.monitor"
To me this seems like an appropriate name as the selector controls
which inputs are played-through, irrespective of whether they are
being recorded or not. That is, the inputs selected here can be
"monitored" prior to starting a recording. The downside to this
suggestion is that in order to hear DAC output, it has to be
"monitored." But with a sane initial setting (currently: all on),
most software would probably "just work."
"inputs.source"
This is a good place to put the mic, cd, line and aux controls.
Also, it fits well because the volume controls are called inputs.dac
and so on.
However, this solution is a little assymetric since the volume
controls affect both recording as well as playback levels, while the
selector only affects playback. Also, the "fmsynth" and "dac"
sources seem a little misplaced as they're "card-internal" inputs.
On the other hand, there's not really any other place to put them...
With the current implementation, the record.port value of audio_info
in AUDIO_SETINFO value controls this selector and therefore selects
which of the mic, line and cd sources are played-through, which is
not what I would expect from record.port. I would instead expect it
to select the recording source, being selector C "record.source". To
fix this, the code in dev/audio.c should to be changed to use
"record.source" for the value of record.port.
Maybe someone with more overview of the different sound hardwares available
can comment on some of these choices. In the meantime, I vote for
"inputs.source."
> The idea behind my last change to the audio layer, was for the volume
> setter to prefer the mixer and the detail control if available, else to
> go with the master. I didn't get to test with anything that had an
> "output.select", so I guessed as best I could. It sounds like this is
> a bug in the underlying driver, though.
I must admit I don't completely follow the use_mixerout/cur_port semantics,
but that's due to my ignorance of the underlying hardware. However, I'm quite
sure that the bug is indeed the underlying driver (eap) offering
"outputs.select" which it doesn't have.
> If you trim your patch to only change the outputs.select to inputs.select,
> does that still fix your problem with "mikmod"?
Further investigation of libmikmod revealed the problem was this: first,
AUDIO_GETINFO was used, returning a play.port value of 0 since no "speaker,"
"headhone" or "line out" controls exist in outputs.select. On the subsequent
AUDIO_SETINFO, the effect was to set outputs.select to 0 and in particular
disable DAC playback altogether. As soon as "outputs.select" is renamed to
anything else (see discussion above), the problem goes away.
> I have an "eap", which however doesn't even have an "outputs.select":
Yours is an AC97 which is quite different from mine (shares almost no code
in dev/pci/eap.c):
eap0 at pci0 dev 6 function 0: vendor 0x1274 product 0x5000 (rev. 0x00)
eap0: interrupting at eb164 irq 11
audio0 at eap0: full duplex, mmap, independent
midi0 at eap0: AudioPCI MIDI UART
eap0 at pci0 dev 6 function 0: vendor 0x1274 product 0x5000 (rev. 0x00)
eap0: interrupting at eb164 irq 11
audio0 at eap0: full duplex, mmap, independent
midi0 at eap0: AudioPCI MIDI UART
Sorry for such a long post, am I just confused or is this really such an
involved topic?
Cheers,
cu Jo
--
La perfection est atteinte non quand il ne reste rien à ajouter, mais quand
il ne reste rien à enlever. (Antoine de Saint-Exupéry)
From: Frederick Bruckman <fredb@immanent.net>
To: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/29178: confusing behaviour because mixer classes in eap
driver are misnamed
Date: Sun, 13 Feb 2005 13:57:48 -0600 (CST)
On Sat, 12 Feb 2005, Joachim Kuebart wrote:
> I do agree that the appropriate class for the volume controls at A in the
> picture above is definitely "inputs." The part of my patch that puts these
> in the "record" class should be ignored and I will supply a new patch without
> it upon request or when the remaining issues are resolved (whichever occurs
> first :-).
Please?!
> As far as I can see, there are three naming possibilities for selector B:
> (Since it selects among DAC, Line-In, CD etc., "outputs.select" is clearly
> wrong since that chooses among speaker, headphone and line out).
"inputs.source" sounds good to me.
> With the current implementation, the record.port value of audio_info
> in AUDIO_SETINFO value controls this selector and therefore selects
> which of the mic, line and cd sources are played-through, which is
> not what I would expect from record.port. I would instead expect it
> to select the recording source, being selector C "record.source". To
> fix this, the code in dev/audio.c should to be changed to use
> "record.source" for the value of record.port.
Oh, I see now why you wanted to move everything to "record". Here's
a patch (below) to choose "record.source" over "inputs.source", if it
exists. Also, it permits "inputs.master" as a fallback for
"record.master", for symmetry, although no driver I know of currently
has that.
Note that some drivers don't have "record.source", but only
"inputs.source" (which incidently sets the recording source, recalling
ASCII art exhibit "A"). We need to be careful not to break things for
those folks. I actually think it's more useful to be able to set the
input source for playback than record, but the control is called
"record.port", not "input.port", so your point is taken.
> Sorry for such a long post, am I just confused or is this really such an
> involved topic?
I can only speak for myself, but it takes my a while to wrap my head
around all this. The difficulty with working with the "audio"
abstraction is that you have to try to make reasonable guesses about
all possible hardware and drivers (as opposed to the more usual thing,
of dictating an interface to which the drivers must conform).
Frederick
Index: ./sys/dev/audio.c
===================================================================
RCS file: /cvsroot/src/sys/dev/audio.c,v
retrieving revision 1.182.2.1
diff -u -r1.182.2.1 audio.c
--- ./sys/dev/audio.c 23 Jul 2004 23:05:50 -0000 1.182.2.1
+++ ./sys/dev/audio.c 13 Feb 2005 19:14:55 -0000
@@ -231,7 +231,8 @@
void *hdlp = sa->hdl;
int error;
mixer_devinfo_t mi;
- int iclass, mclass, oclass, props;
+ int iclass, mclass, oclass, rclass, props;
+ int record_master_found, record_source_found;
#ifdef DIAGNOSTIC
if (hwp == 0 ||
@@ -296,7 +297,7 @@
sc->sc_input_fragment_length = 0;
- iclass = mclass = oclass = -1;
+ iclass = mclass = oclass = rclass = -1;
sc->sc_inports.index = -1;
sc->sc_inports.master = -1;
sc->sc_inports.nports = 0;
@@ -314,33 +315,52 @@
sc->sc_outports.mixerout = -1;
sc->sc_outports.cur_port = -1;
sc->sc_monitor_port = -1;
+ /*
+ * Read through the underlying driver's list, picking out the class
+ * names from the mixer descriptions. We'll need them to decode the
+ * mixer descriptions on the next pass through the loop.
+ */
for(mi.index = 0; ; mi.index++) {
if (hwp->query_devinfo(hdlp, &mi) != 0)
break;
+ /*
+ * The type of AUDIO_MIXER_CLASS merely introduces a class.
+ * All the other types describe an actual mixer.
+ */
if (mi.type == AUDIO_MIXER_CLASS) {
- if (strcmp(mi.label.name, AudioCrecord) == 0)
+ if (strcmp(mi.label.name, AudioCinputs) == 0)
iclass = mi.mixer_class;
if (strcmp(mi.label.name, AudioCmonitor) == 0)
mclass = mi.mixer_class;
if (strcmp(mi.label.name, AudioCoutputs) == 0)
oclass = mi.mixer_class;
+ if (strcmp(mi.label.name, AudioCrecord) == 0)
+ rclass = mi.mixer_class;
}
}
+ /*
+ * This is where we assign each control in the "audio" model, to the
+ * underlying "mixer" control. We walk through the whole list once,
+ * assigning likely candidates as we come across them.
+ */
+ record_master_found = 0;
+ record_source_found = 0;
for(mi.index = 0; ; mi.index++) {
if (hwp->query_devinfo(hdlp, &mi) != 0)
break;
if (mi.type == AUDIO_MIXER_CLASS)
continue;
if (mi.mixer_class == iclass) {
- if (strcmp(mi.label.name, AudioNmaster) == 0)
- sc->sc_inports.master = mi.index;
-#if 1 /* Deprecated. Use AudioNmaster. */
- if (strcmp(mi.label.name, AudioNrecord) == 0)
- sc->sc_inports.master = mi.index;
- if (strcmp(mi.label.name, AudioNvolume) == 0)
+ /*
+ * AudioCinputs is only a fallback, when we don't
+ * find what we're looking for in AudioCrecord, so
+ * check the flags before accepting one of these.
+ */
+ if (strcmp(mi.label.name, AudioNmaster) == 0
+ && record_master_found == 0)
sc->sc_inports.master = mi.index;
-#endif
- if (strcmp(mi.label.name, AudioNsource) == 0) {
+ if (strcmp(mi.label.name, AudioNsource) == 0
+ && record_source_found == 0) {
if (mi.type == AUDIO_MIXER_ENUM) {
int i;
for(i = 0; i < mi.un.e.num_mem; i++)
@@ -361,6 +381,38 @@
if (strcmp(mi.label.name, AudioNselect) == 0)
au_setup_ports(sc, &sc->sc_outports, &mi,
otable);
+ } else if (mi.mixer_class == rclass) {
+ /*
+ * These are the preferred mixers for the audio record
+ * controls, so set the flags here, but don't check.
+ */
+ if (strcmp(mi.label.name, AudioNmaster) == 0) {
+ sc->sc_inports.master = mi.index;
+ record_master_found = 1;
+ }
+#if 1 /* Deprecated. Use AudioNmaster. */
+ if (strcmp(mi.label.name, AudioNrecord) == 0) {
+ sc->sc_inports.master = mi.index;
+ record_master_found = 1;
+ }
+ if (strcmp(mi.label.name, AudioNvolume) == 0) {
+ sc->sc_inports.master = mi.index;
+ record_master_found = 1;
+ }
+#endif
+ if (strcmp(mi.label.name, AudioNsource) == 0) {
+ if (mi.type == AUDIO_MIXER_ENUM) {
+ int i;
+ for(i = 0; i < mi.un.e.num_mem; i++)
+ if (strcmp(mi.un.e.member[i].label.name,
+ AudioNmixerout) == 0)
+ sc->sc_inports.mixerout =
+ mi.un.e.member[i].ord;
+ }
+ au_setup_ports(sc, &sc->sc_inports, &mi,
+ itable);
+ record_source_found = 1;
+ }
}
}
DPRINTF(("audio_attach: inputs ports=0x%x, input master=%d, "
Responsible-Changed-From-To: kern-bug-people->fredb
Responsible-Changed-By: fredb@netbsd.org
Responsible-Changed-When: Sun, 13 Feb 2005 20:08:56 +0000
Responsible-Changed-Why:
I was the last person to go near this.
State-Changed-From-To: open->feedback
State-Changed-By: fredb@netbsd.org
State-Changed-When: Sun, 13 Feb 2005 20:10:52 +0000
State-Changed-Why:
Waiting for (promised) revised patch. ;-)
From: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>
To: Frederick Bruckman <fredb@immanent.net>
Cc: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>,
gnats-bugs@netbsd.org
Subject: Re: kern/29178: confusing behaviour because mixer classes in eap driver are misnamed
Date: Sun, 13 Feb 2005 22:55:18 +0100
Ok,
this is the reduced patch to rename outputs.select to inputs.source in
pci/eap.c:
Index: eap.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/eap.c,v
retrieving revision 1.76
diff -u -p -r1.76 eap.c
--- eap.c 15 Jan 2005 15:19:52 -0000 1.76
+++ eap.c 13 Feb 2005 20:25:45 -0000
@@ -164,7 +164,7 @@ struct eap_softc {
u_short sc_port[AK_NPORTS]; /* mirror of the hardware setting */
u_int sc_record_source; /* recording source mask */
- u_int sc_output_source; /* output source mask */
+ u_int sc_input_source; /* input source mask */
u_int sc_mic_preamp;
char sc_1371; /* Using ES1371/AC97 codec */
@@ -703,7 +703,7 @@ eap_attach(struct device *parent, struct
eap_hw_if = &eap1370_hw_if;
/* Enable all relevant mixer switches. */
- ctl.dev = EAP_OUTPUT_SELECT;
+ ctl.dev = EAP_INPUT_SOURCE;
ctl.type = AUDIO_MIXER_SET;
ctl.un.mask = 1 << EAP_VOICE_VOL | 1 << EAP_FM_VOL |
1 << EAP_CD_VOL | 1 << EAP_LINE_VOL | 1 << EAP_AUX_VOL |
@@ -1478,10 +1478,10 @@ eap1370_mixer_set_port(void *addr, mixer
eap1370_set_mixer(sc, AK_IN_MIXER2_R, r2);
return 0;
}
- if (cp->dev == EAP_OUTPUT_SELECT) {
+ if (cp->dev == EAP_INPUT_SOURCE) {
if (cp->type != AUDIO_MIXER_SET)
return EINVAL;
- m = sc->sc_output_source = cp->un.mask;
+ m = sc->sc_input_source = cp->un.mask;
o1 = o2 = 0;
if (m & (1 << EAP_VOICE_VOL))
o2 |= AK_M_VOICE_L | AK_M_VOICE_R;
@@ -1578,10 +1578,10 @@ eap1370_mixer_get_port(void *addr, mixer
return EINVAL;
cp->un.mask = sc->sc_record_source;
return 0;
- case EAP_OUTPUT_SELECT:
+ case EAP_INPUT_SOURCE:
if (cp->type != AUDIO_MIXER_SET)
return EINVAL;
- cp->un.mask = sc->sc_output_source;
+ cp->un.mask = sc->sc_input_source;
return 0;
case EAP_MIC_PREAMP:
if (cp->type != AUDIO_MIXER_ENUM)
@@ -1719,10 +1719,10 @@ eap1370_query_devinfo(void *addr, mixer_
strcpy(dip->un.s.member[5].label.name, AudioNdac);
dip->un.s.member[5].mask = 1 << EAP_VOICE_VOL;
return 0;
- case EAP_OUTPUT_SELECT:
- dip->mixer_class = EAP_OUTPUT_CLASS;
+ case EAP_INPUT_SOURCE:
+ dip->mixer_class = EAP_INPUT_CLASS;
dip->prev = dip->next = AUDIO_MIXER_LAST;
- strcpy(dip->label.name, AudioNselect);
+ strcpy(dip->label.name, AudioNsource);
dip->type = AUDIO_MIXER_SET;
dip->un.s.num_mem = 6;
strcpy(dip->un.s.member[0].label.name, AudioNmicrophone);
Index: eapreg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/eapreg.h,v
retrieving revision 1.9
diff -u -p -r1.9 eapreg.h
--- eapreg.h 15 Jan 2005 15:19:52 -0000 1.9
+++ eapreg.h 13 Feb 2005 20:25:45 -0000
@@ -269,7 +269,7 @@
#define EAP_AUX_VOL 5
#define EAP_MIC_VOL 6
#define EAP_RECORD_SOURCE 7
-#define EAP_OUTPUT_SELECT 8
+#define EAP_INPUT_SOURCE 8
#define EAP_MIC_PREAMP 9
#define EAP_OUTPUT_CLASS 10
#define EAP_RECORD_CLASS 11
From: Frederick Bruckman <fredb@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/29178 CVS commit: src/sys/dev
Date: Sun, 13 Feb 2005 23:53:21 +0000 (UTC)
Module Name: src
Committed By: fredb
Date: Sun Feb 13 23:53:20 UTC 2005
Modified Files:
src/sys/dev: audio.c
Log Message:
For the "record.port", choose "record.source" over "inputs.source" if the
former exists. Partial fix for PR kern/29178.
To generate a diff of this commit:
cvs rdiff -r1.191 -r1.192 src/sys/dev/audio.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Frederick Bruckman <fredb@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/29178 CVS commit: src/sys/dev/pci
Date: Sun, 13 Feb 2005 23:58:38 +0000 (UTC)
Module Name: src
Committed By: fredb
Date: Sun Feb 13 23:58:38 UTC 2005
Modified Files:
src/sys/dev/pci: eap.c eapreg.h
Log Message:
"output.source" on the Ensoniq 1371 really should be "input.source". Making
it so lets the audio(4) interface -- play.port and play.gain -- attach
properly. Analysis and patch provided by Joachim Kuebart in PR kern/29178.
To generate a diff of this commit:
cvs rdiff -r1.76 -r1.77 src/sys/dev/pci/eap.c
cvs rdiff -r1.9 -r1.10 src/sys/dev/pci/eapreg.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Frederick Bruckman <fredb@immanent.net>
To: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/29178: confusing behaviour because mixer classes in eap
driver are misnamed
Date: Sun, 13 Feb 2005 18:25:34 -0600 (CST)
On Sun, 13 Feb 2005, Joachim Kuebart wrote:
> this is the reduced patch to rename outputs.select to inputs.source in
> pci/eap.c:
I've committed both changes. Please verify that everything is correct,
and let me know if I can close the PR.
Kind regards,
Frederick
From: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>
To: Frederick Bruckman <fredb@immanent.net>
Cc: Joachim Kuebart <kuebart@mathematik.uni-ulm.de>,
gnats-bugs@netbsd.org
Subject: Re: kern/29178: confusing behaviour because mixer classes in eap driver are misnamed
Date: Mon, 14 Feb 2005 20:35:17 +0100
Hi Frederick,
just tried a new kernel and mikmod works, so everything seems to be fine. :-)
Thanks a lot,
cu Jo
--
La perfection est atteinte non quand il ne reste rien à ajouter, mais quand
il ne reste rien à enlever. (Antoine de Saint-Exupéry)
State-Changed-From-To: feedback->closed
State-Changed-By: fredb@netbsd.org
State-Changed-When: Mon, 14 Feb 2005 19:42:36 +0000
State-Changed-Why:
Fixed.
Thanks for your contribution to NetBSD!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.