Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Mixer changes:
details: https://anonhg.NetBSD.org/src/rev/c242e98e1b19
branches: trunk
changeset: 538196:c242e98e1b19
user: kent <kent%NetBSD.org@localhost>
date: Mon Oct 14 08:48:15 2002 +0000
description:
Mixer changes:
- Add "outputs.surround", "outputs.center", and "outputs.lfe"
- If the codec is not capable of a feature, mixer variables
about the feature is not created. For example, no
"outputs.tone" for a codec without tone control.
- Set the following mixer values in ac97_attach():
outputs.master=127,127
outputs.master.mute=off
outputs.headphones.mute=off
outputs.surround=127,127
outputs.surround.mute=off
outputs.center=127
outputs.center.mute=off
outputs.lfe=127
outputs.lfe.mute=off
inputs.dac.mute=off
inputs.cd.mute=off
inputs.line.mute=off
inputs.aux.mute=off
inputs.video.mute=off
record.volume.mute=off
because the default setting of AC'97 codec (all mutes are on,
and maximum volume) is troublesome.
- Make "char*" parameters of ac97_get_portnum_by_name() "const char*"
Codec ID changes:
- If a codec ID is unknown but its vendor ID is known,
ac97_attach() prints the vendor name like "dev0: <vendor name>
unknown (0xXXXXXXXX) codec;"
- Add IDs of Asahi Kasei AK4542, AK4544, AK4544A, AK4545,
Realtek ALC100
- Correct a vendor name: "Advance Logic" -> "Avance Logic"
- Add capability of codec-specific initialization
ac97_attach():
- CDAC, SDAC, and LDAC are eanabled.
- DELAY() before mixer settings. ThinkPad X24 needs it.
ALC650 codec specific change:
- Add "outputs.surround.lineinjack" to switch the line-in jack
to the surround output
- Add "outputs.center.micjack" and "outputs.lfe.micjack" (alias
of "outputs.center.micjack") to switch the mic jack to the
center/lfe output.
diffstat:
sys/dev/ic/ac97.c | 484 +++++++++++++++++++++++++++++++++++++++-----------
sys/dev/ic/ac97var.h | 6 +-
2 files changed, 376 insertions(+), 114 deletions(-)
diffs (truncated from 834 to 300 lines):
diff -r a65fef2cf098 -r c242e98e1b19 sys/dev/ic/ac97.c
--- a/sys/dev/ic/ac97.c Mon Oct 14 06:31:37 2002 +0000
+++ b/sys/dev/ic/ac97.c Mon Oct 14 08:48:15 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ac97.c,v 1.32 2002/10/11 02:32:23 kent Exp $ */
+/* $NetBSD: ac97.c,v 1.33 2002/10/14 08:48:15 kent Exp $ */
/* $OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $ */
/*
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.32 2002/10/11 02:32:23 kent Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.33 2002/10/14 08:48:15 kent Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -77,32 +77,34 @@
#include <dev/ic/ac97reg.h>
#include <dev/ic/ac97var.h>
+#define Ac97Ntone "tone"
+#define Ac97Nphone "phone"
+
static const struct audio_mixer_enum ac97_on_off = { 2,
{ { { AudioNoff } , 0 },
- { { AudioNon } , 1 } }};
-
+ { { AudioNon } , 1 } }};
static const struct audio_mixer_enum ac97_mic_select = { 2,
- { { { AudioNmicrophone "0" },
+ { { { AudioNmicrophone "0" },
0 },
- { { AudioNmicrophone "1" },
+ { { AudioNmicrophone "1" },
1 } }};
static const struct audio_mixer_enum ac97_mono_select = { 2,
{ { { AudioNmixerout },
0 },
- { { AudioNmicrophone },
+ { { AudioNmicrophone },
1 } }};
static const struct audio_mixer_enum ac97_source = { 8,
{ { { AudioNmicrophone } , 0 },
{ { AudioNcd }, 1 },
- { { "video" }, 2 },
+ { { AudioNvideo }, 2 },
{ { AudioNaux }, 3 },
{ { AudioNline }, 4 },
{ { AudioNmixerout }, 5 },
{ { AudioNmixerout AudioNmono }, 6 },
- { { "phone" }, 7 }}};
+ { { Ac97Nphone }, 7 }}};
/*
* Due to different values for each source that uses these structures,
@@ -121,8 +123,8 @@
const char *class;
const char *device;
const char *qualifier;
+
int type;
-
const void *info;
int info_size;
@@ -132,120 +134,155 @@
u_int8_t ofs:4;
u_int8_t mute:1;
u_int8_t polarity:1; /* Does 0 == MAX or MIN */
+ enum {
+ CHECK_NONE = 0,
+ CHECK_SURROUND,
+ CHECK_CENTER,
+ CHECK_LFE,
+ CHECK_HEADPHONES,
+ CHECK_TONE,
+ CHECK_MIC,
+ CHECK_LOUDNESS,
+ CHECK_3D
+ } req_feature;
int prev;
- int next;
+ int next;
int mixer_class;
} source_info[] = {
- { AudioCinputs , NULL, NULL, AUDIO_MIXER_CLASS,
- },
- { AudioCoutputs, NULL, NULL, AUDIO_MIXER_CLASS,
- },
- { AudioCrecord , NULL, NULL, AUDIO_MIXER_CLASS,
- },
+ { AudioCinputs, NULL, NULL,
+ AUDIO_MIXER_CLASS, },
+ { AudioCoutputs, NULL, NULL,
+ AUDIO_MIXER_CLASS, },
+ { AudioCrecord, NULL, NULL,
+ AUDIO_MIXER_CLASS, },
/* Stereo master volume*/
- { AudioCoutputs, AudioNmaster, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_stereo),
+ { AudioCoutputs, AudioNmaster, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
AC97_REG_MASTER_VOLUME, 0x8000, 5, 0, 1,
},
/* Mono volume */
- { AudioCoutputs, AudioNmono, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_mono),
+ { AudioCoutputs, AudioNmono, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_mono),
AC97_REG_MASTER_VOLUME_MONO, 0x8000, 6, 0, 1,
},
- { AudioCoutputs, AudioNmono,AudioNsource, AUDIO_MIXER_ENUM,
- WRAP(ac97_mono_select),
+ { AudioCoutputs, AudioNmono, AudioNsource,
+ AUDIO_MIXER_ENUM, WRAP(ac97_mono_select),
AC97_REG_GP, 0x0000, 1, 9, 0,
},
/* Headphone volume */
- { AudioCoutputs, AudioNheadphone, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_stereo),
- AC97_REG_HEADPHONE_VOLUME, 0x8000, 6, 0, 1,
+ { AudioCoutputs, AudioNheadphone, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
+ AC97_REG_HEADPHONE_VOLUME, 0x8000, 6, 0, 1, 0, CHECK_HEADPHONES
+ },
+ /* Surround volume - logic hard coded for mute */
+ { AudioCoutputs, AudioNsurround, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
+ AC97_REG_SURR_MASTER, 0x8080, 5, 0, 1, 0, CHECK_SURROUND
+ },
+ /* Center volume*/
+ { AudioCoutputs, AudioNcenter, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_mono),
+ AC97_REG_CENTER_LFE_MASTER, 0x8080, 5, 0, 0, 0, CHECK_CENTER
+ },
+ { AudioCoutputs, AudioNcenter, AudioNmute,
+ AUDIO_MIXER_ENUM, WRAP(ac97_on_off),
+ AC97_REG_CENTER_LFE_MASTER, 0x8080, 1, 7, 0, 0, CHECK_CENTER
+ },
+ /* LFE volume*/
+ { AudioCoutputs, AudioNlfe, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_mono),
+ AC97_REG_CENTER_LFE_MASTER, 0x8080, 5, 8, 0, 0, CHECK_LFE
+ },
+ { AudioCoutputs, AudioNlfe, AudioNmute,
+ AUDIO_MIXER_ENUM, WRAP(ac97_on_off),
+ AC97_REG_CENTER_LFE_MASTER, 0x8080, 1, 15, 0, 0, CHECK_LFE
},
/* Tone */
- { AudioCoutputs, "tone", NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_stereo),
- AC97_REG_MASTER_TONE, 0x0f0f, 4, 0, 0,
+ { AudioCoutputs, Ac97Ntone, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
+ AC97_REG_MASTER_TONE, 0x0f0f, 4, 0, 0, 0, CHECK_TONE
},
/* PC Beep Volume */
- { AudioCinputs, AudioNspeaker, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_mono),
+ { AudioCinputs, AudioNspeaker, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_mono),
AC97_REG_PCBEEP_VOLUME, 0x0000, 4, 1, 1,
},
+
/* Phone */
- { AudioCinputs, "phone", NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_mono),
+ { AudioCinputs, Ac97Nphone, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_mono),
AC97_REG_PHONE_VOLUME, 0x8008, 5, 0, 1,
},
/* Mic Volume */
- { AudioCinputs, AudioNmicrophone, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_mono),
+ { AudioCinputs, AudioNmicrophone, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_mono),
AC97_REG_MIC_VOLUME, 0x8008, 5, 0, 1,
},
- { AudioCinputs, AudioNmicrophone, AudioNpreamp, AUDIO_MIXER_ENUM,
- WRAP(ac97_on_off),
+ { AudioCinputs, AudioNmicrophone, AudioNpreamp,
+ AUDIO_MIXER_ENUM, WRAP(ac97_on_off),
AC97_REG_MIC_VOLUME, 0x8008, 1, 6, 0,
},
- { AudioCinputs, AudioNmicrophone, AudioNsource, AUDIO_MIXER_ENUM,
- WRAP(ac97_mic_select),
+ { AudioCinputs, AudioNmicrophone, AudioNsource,
+ AUDIO_MIXER_ENUM, WRAP(ac97_mic_select),
AC97_REG_GP, 0x0000, 1, 8, 0,
},
/* Line in Volume */
- { AudioCinputs, AudioNline, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_stereo),
+ { AudioCinputs, AudioNline, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
AC97_REG_LINEIN_VOLUME, 0x8808, 5, 0, 1,
},
/* CD Volume */
- { AudioCinputs, AudioNcd, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_stereo),
+ { AudioCinputs, AudioNcd, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
AC97_REG_CD_VOLUME, 0x8808, 5, 0, 1,
},
/* Video Volume */
- { AudioCinputs, "video", NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_stereo),
+ { AudioCinputs, AudioNvideo, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
AC97_REG_VIDEO_VOLUME, 0x8808, 5, 0, 1,
},
/* AUX volume */
- { AudioCinputs, AudioNaux, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_stereo),
+ { AudioCinputs, AudioNaux, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
AC97_REG_AUX_VOLUME, 0x8808, 5, 0, 1,
},
/* PCM out volume */
- { AudioCinputs, AudioNdac, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_stereo),
+ { AudioCinputs, AudioNdac, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
AC97_REG_PCMOUT_VOLUME, 0x8808, 5, 0, 1,
},
/* Record Source - some logic for this is hard coded - see below */
- { AudioCrecord, AudioNsource, NULL, AUDIO_MIXER_ENUM,
- WRAP(ac97_source),
+ { AudioCrecord, AudioNsource, NULL,
+ AUDIO_MIXER_ENUM, WRAP(ac97_source),
AC97_REG_RECORD_SELECT, 0x0000, 3, 0, 0,
},
/* Record Gain */
- { AudioCrecord, AudioNvolume, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_stereo),
+ { AudioCrecord, AudioNvolume, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_stereo),
AC97_REG_RECORD_GAIN, 0x8000, 4, 0, 1,
},
/* Record Gain mic */
- { AudioCrecord, AudioNmicrophone, NULL, AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_mono),
- AC97_REG_RECORD_GAIN_MIC, 0x8000, 4, 0, 1, 1,
+ { AudioCrecord, AudioNmicrophone, NULL,
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_mono),
+ AC97_REG_RECORD_GAIN_MIC, 0x8000, 4, 0, 1, 1, CHECK_MIC
},
/* */
- { AudioCoutputs, AudioNloudness, NULL, AUDIO_MIXER_ENUM,
- WRAP(ac97_on_off),
- AC97_REG_GP, 0x0000, 1, 12, 0,
+ { AudioCoutputs, AudioNloudness, NULL,
+ AUDIO_MIXER_ENUM, WRAP(ac97_on_off),
+ AC97_REG_GP, 0x0000, 1, 12, 0, 0, CHECK_LOUDNESS
},
- { AudioCoutputs, AudioNspatial, NULL, AUDIO_MIXER_ENUM,
- WRAP(ac97_on_off),
- AC97_REG_GP, 0x0000, 1, 13, 0,
+ { AudioCoutputs, AudioNspatial, NULL,
+ AUDIO_MIXER_ENUM, WRAP(ac97_on_off),
+ AC97_REG_GP, 0x0000, 1, 13, 0, 1, CHECK_3D
},
- { AudioCoutputs, AudioNspatial, "center", AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_mono),
- AC97_REG_3D_CONTROL, 0x0000, 4, 8, 0, 1,
+ { AudioCoutputs, AudioNspatial, "center",
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_mono),
+ AC97_REG_3D_CONTROL, 0x0000, 4, 8, 0, 1, CHECK_3D
},
- { AudioCoutputs, AudioNspatial, "depth", AUDIO_MIXER_VALUE,
- WRAP(ac97_volume_mono),
- AC97_REG_3D_CONTROL, 0x0000, 4, 0, 0, 1,
+ { AudioCoutputs, AudioNspatial, "depth",
+ AUDIO_MIXER_VALUE, WRAP(ac97_volume_mono),
+ AC97_REG_3D_CONTROL, 0x0000, 4, 0, 0, 1, CHECK_3D
},
/* Missing features: Simulated Stereo, POP, Loopback mode */
@@ -264,7 +301,8 @@
struct ac97_host_if *host_if;
- struct ac97_source_info source_info[2 * SOURCE_INFO_SIZE];
+#define MAX_SOURCES (2 * SOURCE_INFO_SIZE)
+ struct ac97_source_info source_info[MAX_SOURCES];
int num_source_info;
enum ac97_host_flags host_flags;
@@ -278,12 +316,15 @@
int ac97_mixer_get_port __P((struct ac97_codec_if *self, mixer_ctrl_t *cp));
int ac97_mixer_set_port __P((struct ac97_codec_if *self, mixer_ctrl_t *));
int ac97_query_devinfo __P((struct ac97_codec_if *self, mixer_devinfo_t *));
-int ac97_get_portnum_by_name __P((struct ac97_codec_if *, char *, char *,
- char *));
Home |
Main Index |
Thread Index |
Old Index