Subject: ym(4)
To: None <augustss@netbsd.org>
From: ITOH Yasufumi <itohy@netbsd.org>
List: tech-kern
Date: 09/02/2000 13:25:59
Hello,
I think this change to sys/dev/isa/ym.c is wrong.
| revision 1.15
| date: 2000/07/04 10:02:45; author: augustss; state: Exp; lines: +14 -1
| MAke sure bass&treble start in their mid position.
The reasons are:
1. ym_mixer_set_port() does not work properly before the
initialization of power-saving stuff. In this case,
it destroys all the setting of CODEC including the mixer.
2. The equalizer of OPL3-SA3 chip is "enhancement-only".
That is, the equalizer is flat if the values are set to 0.
I'd like to apply this change. OK?
--
ITOH, Yasufumi
diff -uF^[a-zA-Z_][a-z A-Z0-9_]*([^;]*$ ym.c.orig ym.c
--- ym.c.orig Wed Jul 5 16:50:39 2000
+++ ym.c Mon Aug 28 07:43:49 2000
@@ -124,8 +124,15 @@
#define YM_VOL_OPL3 184
#endif
-#ifndef YM_VOL_EQUAL
-#define YM_VOL_EQUAL 128
+/*
+ * The equalizer is ``flat'' if the 3D Enhance is turned off,
+ * but you can set other default values.
+ */
+#ifndef YM_ENHANCE_BASS
+#define YM_ENHANCE_BASS 0
+#endif
+#ifndef YM_ENHANCE_TREBLE
+#define YM_ENHANCE_TREBLE 0
#endif
#ifdef __i386__ /* XXX */
@@ -206,7 +213,9 @@ ym_attach(sc)
static struct ad1848_volume vol_master = {YM_VOL_MASTER, YM_VOL_MASTER};
static struct ad1848_volume vol_dac = {YM_VOL_DAC, YM_VOL_DAC};
static struct ad1848_volume vol_opl3 = {YM_VOL_OPL3, YM_VOL_OPL3};
+#if YM_ENHANCE_BASS || YM_ENHANCE_TREBLE
mixer_ctrl_t mctl;
+#endif
struct audio_attach_args arg;
callout_init(&sc->sc_powerdown_ch);
@@ -239,14 +248,6 @@ ym_attach(sc)
ad1848_set_channel_gain(ac, AD1848_DAC_CHANNEL, &vol_dac);
ad1848_set_channel_gain(ac, AD1848_AUX2_CHANNEL, &vol_opl3);
- /* Set tone control to middle position. */
- mctl.un.value.num_channels = 1;
- mctl.un.value.level[AUDIO_MIXER_LEVEL_MONO] = YM_VOL_EQUAL;
- mctl.dev = YM_MASTER_BASS;
- ym_mixer_set_port(sc, &mctl);
- mctl.dev = YM_MASTER_TREBLE;
- ym_mixer_set_port(sc, &mctl);
-
/*
* Mute all external sources. If you change this, you must
* also change the initial value of sc->sc_external_sources
@@ -313,6 +314,20 @@ ym_attach(sc)
ym_mute(sc, SA3_VOL_L, sc->master_mute);
ym_mute(sc, SA3_VOL_R, sc->master_mute);
}
+
+#if YM_ENHANCE_BASS || YM_ENHANCE_TREBLE
+ /* Set tone control to the default position. */
+ mctl.un.value.num_channels = 1;
+ mctl.un.value.level[AUDIO_MIXER_LEVEL_MONO] = YM_VOL_EQUAL;
+#if YM_ENHANCE_BASS
+ mctl.dev = YM_ENHANCE_BASS;
+ ym_mixer_set_port(sc, &mctl);
+#endif
+#if YM_ENHANCE_TREBLE
+ mctl.dev = YM_MASTER_TREBLE;
+ ym_mixer_set_port(sc, &mctl);
+#endif
+#endif
}
static __inline int