ymvar.h revision 1.4 1 1.4 itohy /* $NetBSD: ymvar.h,v 1.4 1999/10/05 03:46:08 itohy Exp $ */
2 1.4 itohy
3 1.4 itohy /*-
4 1.4 itohy * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 1.4 itohy * All rights reserved.
6 1.4 itohy *
7 1.4 itohy * This code is derived from software contributed to The NetBSD Foundation
8 1.4 itohy * by ITOH Yasufumi.
9 1.4 itohy *
10 1.4 itohy * Redistribution and use in source and binary forms, with or without
11 1.4 itohy * modification, are permitted provided that the following conditions
12 1.4 itohy * are met:
13 1.4 itohy * 1. Redistributions of source code must retain the above copyright
14 1.4 itohy * notice, this list of conditions and the following disclaimer.
15 1.4 itohy * 2. Redistributions in binary form must reproduce the above copyright
16 1.4 itohy * notice, this list of conditions and the following disclaimer in the
17 1.4 itohy * documentation and/or other materials provided with the distribution.
18 1.4 itohy * 3. All advertising materials mentioning features or use of this software
19 1.4 itohy * must display the following acknowledgement:
20 1.4 itohy * This product includes software developed by the NetBSD
21 1.4 itohy * Foundation, Inc. and its contributors.
22 1.4 itohy * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.4 itohy * contributors may be used to endorse or promote products derived
24 1.4 itohy * from this software without specific prior written permission.
25 1.4 itohy *
26 1.4 itohy * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.4 itohy * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.4 itohy * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.4 itohy * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.4 itohy * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.4 itohy * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.4 itohy * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.4 itohy * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.4 itohy * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.4 itohy * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.4 itohy * POSSIBILITY OF SUCH DAMAGE.
37 1.4 itohy */
38 1.1 augustss
39 1.1 augustss /*
40 1.1 augustss * Copyright (c) 1994 John Brezak
41 1.1 augustss * Copyright (c) 1991-1993 Regents of the University of California.
42 1.1 augustss * All rights reserved.
43 1.1 augustss *
44 1.1 augustss * Redistribution and use in source and binary forms, with or without
45 1.1 augustss * modification, are permitted provided that the following conditions
46 1.1 augustss * are met:
47 1.1 augustss * 1. Redistributions of source code must retain the above copyright
48 1.1 augustss * notice, this list of conditions and the following disclaimer.
49 1.1 augustss * 2. Redistributions in binary form must reproduce the above copyright
50 1.1 augustss * notice, this list of conditions and the following disclaimer in the
51 1.1 augustss * documentation and/or other materials provided with the distribution.
52 1.1 augustss * 3. All advertising materials mentioning features or use of this software
53 1.1 augustss * must display the following acknowledgement:
54 1.1 augustss * This product includes software developed by the Computer Systems
55 1.1 augustss * Engineering Group at Lawrence Berkeley Laboratory.
56 1.1 augustss * 4. Neither the name of the University nor of the Laboratory may be used
57 1.1 augustss * to endorse or promote products derived from this software without
58 1.1 augustss * specific prior written permission.
59 1.1 augustss *
60 1.1 augustss * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
61 1.1 augustss * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62 1.1 augustss * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
63 1.1 augustss * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
64 1.1 augustss * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65 1.1 augustss * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
66 1.1 augustss * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67 1.1 augustss * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68 1.1 augustss * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
69 1.1 augustss * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
70 1.1 augustss * SUCH DAMAGE.
71 1.1 augustss *
72 1.1 augustss */
73 1.1 augustss
74 1.1 augustss /*
75 1.1 augustss * Original code from OpenBSD.
76 1.1 augustss */
77 1.1 augustss
78 1.1 augustss /*
79 1.1 augustss * Mixer devices
80 1.1 augustss */
81 1.4 itohy #define YM_DAC_LVL 0
82 1.4 itohy #define YM_MIDI_LVL 1
83 1.4 itohy #define YM_CD_LVL 2
84 1.4 itohy #define YM_LINE_LVL 3
85 1.4 itohy #define YM_SPEAKER_LVL 4
86 1.4 itohy #define YM_MIC_LVL 5
87 1.4 itohy #define YM_MONITOR_LVL 6
88 1.4 itohy #define YM_DAC_MUTE 7
89 1.4 itohy #define YM_MIDI_MUTE 8
90 1.4 itohy #define YM_CD_MUTE 9
91 1.4 itohy #define YM_LINE_MUTE 10
92 1.4 itohy #define YM_SPEAKER_MUTE 11
93 1.4 itohy #define YM_MIC_MUTE 12
94 1.4 itohy #define YM_MONITOR_MUTE 13
95 1.1 augustss
96 1.4 itohy #define YM_REC_LVL 14
97 1.1 augustss #define YM_RECORD_SOURCE 15
98 1.1 augustss
99 1.4 itohy #define YM_OUTPUT_LVL 16
100 1.4 itohy #define YM_OUTPUT_MUTE 17
101 1.4 itohy
102 1.4 itohy #define YM_MASTER_EQMODE 18
103 1.4 itohy #define YM_MASTER_TREBLE 19
104 1.4 itohy #define YM_MASTER_BASS 20
105 1.4 itohy #define YM_MASTER_WIDE 21
106 1.4 itohy
107 1.4 itohy #ifndef AUDIO_NO_POWER_CTL
108 1.4 itohy #define YM_PWR_MODE 22
109 1.4 itohy #define YM_PWR_TIMEOUT 23
110 1.4 itohy #endif
111 1.1 augustss
112 1.1 augustss /* Classes - don't change this without looking at mixer_classes array */
113 1.4 itohy #ifdef AUDIO_NO_POWER_CTL
114 1.4 itohy #define YM_CLASS_TOP 22
115 1.4 itohy #else
116 1.4 itohy #define YM_CLASS_TOP 24
117 1.4 itohy #endif
118 1.4 itohy #define YM_INPUT_CLASS (YM_CLASS_TOP + 0)
119 1.4 itohy #define YM_RECORD_CLASS (YM_CLASS_TOP + 1)
120 1.4 itohy #define YM_OUTPUT_CLASS (YM_CLASS_TOP + 2)
121 1.4 itohy #define YM_MONITOR_CLASS (YM_CLASS_TOP + 3)
122 1.4 itohy #define YM_EQ_CLASS (YM_CLASS_TOP + 4)
123 1.4 itohy #ifndef AUDIO_NO_POWER_CTL
124 1.4 itohy #define YM_PWR_CLASS (YM_CLASS_TOP + 5)
125 1.4 itohy #endif
126 1.4 itohy
127 1.4 itohy /* XXX should be in <sys/audioio.h> */
128 1.4 itohy #define AudioNmode "mode"
129 1.4 itohy #define AudioNdesktop "desktop"
130 1.4 itohy #define AudioNlaptop "laptop"
131 1.4 itohy #define AudioNsubnote "subnote"
132 1.4 itohy #define AudioNhifi "hifi"
133 1.4 itohy
134 1.4 itohy #ifndef AUDIO_NO_POWER_CTL
135 1.4 itohy #define AudioCpower "power"
136 1.4 itohy #define AudioNpower "power"
137 1.4 itohy #define AudioNtimeout "timeout"
138 1.4 itohy #define AudioNpowerdown "powerdown"
139 1.4 itohy #define AudioNpowersave "powersave"
140 1.4 itohy #define AudioNnosave "nosave"
141 1.4 itohy #endif
142 1.1 augustss
143 1.1 augustss
144 1.1 augustss struct ym_softc {
145 1.4 itohy struct ad1848_isa_softc sc_ad1848;
146 1.4 itohy #define ym_irq sc_ad1848.sc_irq
147 1.4 itohy #define ym_playdrq sc_ad1848.sc_playdrq
148 1.4 itohy #define ym_recdrq sc_ad1848.sc_recdrq
149 1.2 pk
150 1.1 augustss bus_space_tag_t sc_iot; /* tag */
151 1.1 augustss bus_space_handle_t sc_ioh; /* handle */
152 1.1 augustss isa_chipset_tag_t sc_ic;
153 1.1 augustss
154 1.4 itohy bus_space_handle_t sc_controlioh;
155 1.4 itohy bus_space_handle_t sc_opl_ioh;
156 1.4 itohy bus_space_handle_t sc_sb_ioh; /* only used to disable it */
157 1.4 itohy
158 1.4 itohy int master_mute, mic_mute;
159 1.4 itohy struct ad1848_volume master_gain;
160 1.4 itohy u_int8_t mic_gain;
161 1.4 itohy
162 1.4 itohy u_int8_t sc_version; /* hardware version */
163 1.4 itohy
164 1.4 itohy /* 3D encehamcement */
165 1.4 itohy u_int8_t sc_eqmode;
166 1.4 itohy struct ad1848_volume sc_treble, sc_bass, sc_wide;
167 1.4 itohy #define YM_EQ_OFF(v) \
168 1.4 itohy ((v)->left < (AUDIO_MAX_GAIN + 1) / (SA3_3D_BITS + 1) && \
169 1.4 itohy (v)->right < (AUDIO_MAX_GAIN + 1) / (SA3_3D_BITS + 1))
170 1.4 itohy
171 1.4 itohy struct device *sc_audiodev;
172 1.4 itohy
173 1.4 itohy #if NMPU_YM > 0
174 1.4 itohy bus_space_handle_t sc_mpu_ioh;
175 1.4 itohy struct device *sc_mpudev;
176 1.4 itohy #endif
177 1.4 itohy
178 1.4 itohy #ifndef AUDIO_NO_POWER_CTL
179 1.4 itohy enum ym_pow_mode {
180 1.4 itohy YM_POWER_POWERDOWN, YM_POWER_POWERSAVE, YM_POWER_NOSAVE
181 1.4 itohy } sc_pow_mode;
182 1.4 itohy int sc_pow_timeout;
183 1.4 itohy
184 1.4 itohy u_int8_t sc_codec_scan[0x20];
185 1.4 itohy #define YM_SAVE_REG_MAX SA3_HVOL_INTR_CNF
186 1.4 itohy u_int8_t sc_sa3_scan[YM_SAVE_REG_MAX + 1];
187 1.4 itohy
188 1.4 itohy u_int16_t sc_on_blocks;
189 1.4 itohy u_int16_t sc_turning_off;
190 1.4 itohy
191 1.4 itohy int sc_in_power_ctl;
192 1.4 itohy #define YM_POWER_CTL_INUSE 1
193 1.4 itohy #define YM_POWER_CTL_WANTED 2
194 1.4 itohy #endif /* not AUDIO_NO_POWER_CTL */
195 1.1 augustss };
196 1.1 augustss
197 1.4 itohy #ifndef AUDIO_NO_POWER_CTL
198 1.4 itohy /* digital */
199 1.4 itohy #define YM_POWER_CODEC_P SA3_DPWRDWN_WSS_P
200 1.4 itohy #define YM_POWER_CODEC_R SA3_DPWRDWN_WSS_R
201 1.4 itohy #define YM_POWER_OPL3 SA3_DPWRDWN_FM
202 1.4 itohy #define YM_POWER_MPU401 SA3_DPWRDWN_MPU
203 1.4 itohy #define YM_POWER_JOYSTICK SA3_DPWRDWN_JOY
204 1.4 itohy /* analog */
205 1.4 itohy #define YM_POWER_3D (SA3_APWRDWN_WIDE << 8)
206 1.4 itohy #define YM_POWER_CODEC_DA (SA3_APWRDWN_DA << 8)
207 1.4 itohy #define YM_POWER_CODEC_AD (SA3_APWRDWN_AD << 8)
208 1.4 itohy #define YM_POWER_OPL3_DA (SA3_APWRDWN_FMDAC << 8)
209 1.4 itohy /* pseudo */
210 1.4 itohy #define YM_POWER_CODEC_CTL 0x8000
211 1.4 itohy
212 1.4 itohy #define YM_POWER_CODEC_DIGITAL \
213 1.4 itohy (YM_POWER_CODEC_P | YM_POWER_CODEC_R | YM_POWER_CODEC_CTL)
214 1.4 itohy /* 3D enhance is passive */
215 1.4 itohy #define YM_POWER_ACTIVE (0xffff & ~YM_POWER_3D)
216 1.4 itohy
217 1.4 itohy #ifdef _KERNEL
218 1.4 itohy void ym_power_ctl __P((struct ym_softc *, int, int));
219 1.4 itohy #endif
220 1.4 itohy #endif /* not AUDIO_NO_POWER_CTL */
221 1.4 itohy
222 1.4 itohy #ifdef _KERNEL
223 1.4 itohy void ym_attach __P((struct ym_softc *));
224 1.4 itohy #endif
225