1 /* $NetBSD: aria.c,v 1.31 2009/05/12 09:10:15 cegger Exp $ */
4 * Copyright (c) 1995, 1996, 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Roland C. Dowdeswell.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
34 * o Test the driver on cards other than a single
36 * o Look into where aria_prometheus_kludge() belongs.
37 * o Add some DMA code. It accomplishes its goal by
38 * direct IO at the moment.
39 * o Different programs should be able to open the device
40 * with O_RDONLY and O_WRONLY at the same time. But I
41 * do not see support for this in /sys/dev/audio.c, so
42 * I cannot effectively code it.
43 * o We should nicely deal with the cards that can do mu-law
45 * o Rework the mixer interface.
46 * o Deal with the lvls better. We need to do better mapping
47 * between logarithmic scales and the one byte that
49 * o Deal better with cards that have no mixer.
52 #include <sys/cdefs.h>
53 __KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.31 2009/05/12 09:10:15 cegger Exp $");
55 #include <sys/param.h>
56 #include <sys/systm.h>
57 #include <sys/errno.h>
58 #include <sys/ioctl.h>
59 #include <sys/syslog.h>
60 #include <sys/device.h>
63 #include <sys/fcntl.h>
68 #include <sys/audioio.h>
69 #include <dev/audio_if.h>
70 #include <dev/auconv.h>
72 #include <dev/mulaw.h>
73 #include <dev/isa/isavar.h>
75 #include <dev/isa/ariareg.h>
78 #define DPRINTF(x) printf x
84 struct aria_mixdev_info
{
90 struct aria_mixmaster
{
98 struct device sc_dev
; /* base device */
99 void *sc_ih
; /* interrupt vectoring */
100 bus_space_tag_t sc_iot
; /* Tag on 'da bus. */
101 bus_space_handle_t sc_ioh
; /* Handle of iospace */
102 isa_chipset_tag_t sc_ic
; /* ISA chipset info */
104 u_short sc_open
; /* reference count of open calls */
105 u_short sc_play
; /* non-paused play chans 2**chan */
106 u_short sc_record
; /* non-paused record chans 2**chan */
107 /* XXX -- keep this? */
108 u_short sc_gain
[2]; /* left/right gain (play) */
110 u_long sc_rate
; /* Sample rate for input and output */
111 u_int sc_encoding
; /* audio encoding -- mu-law/linear */
112 int sc_chans
; /* # of channels */
113 int sc_precision
; /* # bits per sample */
115 u_long sc_interrupts
; /* number of interrupts taken */
116 void (*sc_rintr
)(void*); /* record transfer completion intr handler */
117 void (*sc_pintr
)(void*); /* play transfer completion intr handler */
118 void *sc_rarg
; /* arg for sc_rintr() */
119 void *sc_parg
; /* arg for sc_pintr() */
121 int sc_blocksize
; /* literal dio block size */
122 void *sc_rdiobuffer
; /* record: where the next samples should be */
123 void *sc_pdiobuffer
; /* play: where the next samples are */
125 u_short sc_hardware
; /* bit field of hardware present */
126 #define ARIA_TELEPHONE 0x0001 /* has telephone input */
127 #define ARIA_MIXER 0x0002 /* has SC18075 digital mixer */
128 #define ARIA_MODEL 0x0004 /* is SC18025 (=0) or SC18026 (=1) */
130 struct aria_mixdev_info aria_mix
[6];
131 struct aria_mixmaster ariamix_master
;
132 u_char aria_mix_source
;
137 int ariaprobe(device_t
, cfdata_t
, void *);
138 void ariaattach(device_t
, device_t
, void *);
139 void ariaclose(void *);
140 int ariaopen(void *, int);
141 int ariareset(bus_space_tag_t
, bus_space_handle_t
);
142 int aria_reset(struct aria_softc
*);
143 int aria_getdev(void *, struct audio_device
*);
145 void aria_do_kludge(bus_space_tag_t
, bus_space_handle_t
,
147 u_short
, u_short
, u_short
, u_short
);
148 void aria_prometheus_kludge(struct isa_attach_args
*, bus_space_handle_t
);
150 int aria_query_encoding(void *, struct audio_encoding
*);
151 int aria_round_blocksize(void *, int, int, const audio_params_t
*);
152 int aria_speaker_ctl(void *, int);
153 int aria_commit_settings(void *);
154 int aria_set_params(void *, int, int, audio_params_t
*, audio_params_t
*,
155 stream_filter_list_t
*, stream_filter_list_t
*);
156 int aria_get_props(void *);
158 int aria_start_output(void *, void *, int, void (*)(void *), void*);
159 int aria_start_input(void *, void *, int, void (*)(void *), void*);
161 int aria_halt_input(void *);
162 int aria_halt_output(void *);
164 int aria_sendcmd(struct aria_softc
*, u_short
, int, int, int);
166 u_short
aria_getdspmem(struct aria_softc
*, u_short
);
167 void aria_putdspmem(struct aria_softc
*, u_short
, u_short
);
169 int aria_intr(void *);
170 short ariaversion(struct aria_softc
*);
172 void aria_set_mixer(struct aria_softc
*, int);
174 void aria_mix_write(struct aria_softc
*, int, int);
175 int aria_mix_read(struct aria_softc
*, int);
177 int aria_mixer_set_port(void *, mixer_ctrl_t
*);
178 int aria_mixer_get_port(void *, mixer_ctrl_t
*);
179 int aria_mixer_query_devinfo(void *, mixer_devinfo_t
*);
181 CFATTACH_DECL(aria
, sizeof(struct aria_softc
),
182 ariaprobe
, ariaattach
, NULL
, NULL
);
184 /* XXX temporary test for 1.3 */
187 struct cfdriver aria_cd
= {
188 NULL
, "aria", DV_DULL
192 struct audio_device aria_device
= {
199 * Define our interface to the higher level audio driver.
202 const struct audio_hw_if aria_hw_if
= {
208 aria_round_blocksize
,
209 aria_commit_settings
,
221 aria_mixer_query_devinfo
,
234 * Probe / attach routines.
238 * Probe for the aria hardware.
241 ariaprobe(device_t parent
, cfdata_t cf
, void *aux
)
243 bus_space_handle_t ioh
;
244 struct isa_attach_args
*ia
;
252 if (ISA_DIRECT_CONFIG(ia
))
255 if (!ARIA_BASE_VALID(ia
->ia_io
[0].ir_addr
)) {
256 printf("aria: configured iobase %d invalid\n",
257 ia
->ia_io
[0].ir_addr
);
261 if (!ARIA_IRQ_VALID(ia
->ia_irq
[0].ir_irq
)) {
262 printf("aria: configured irq %d invalid\n",
263 ia
->ia_irq
[0].ir_irq
);
267 if (bus_space_map(ia
->ia_iot
, ia
->ia_io
[0].ir_addr
, ARIADSP_NPORT
,
269 DPRINTF(("aria: aria probe failed\n"));
273 if (cf
->cf_flags
& 1)
274 aria_prometheus_kludge(ia
, ioh
);
276 if (ariareset(ia
->ia_iot
, ioh
) != 0) {
277 DPRINTF(("aria: aria probe failed\n"));
278 bus_space_unmap(ia
->ia_iot
, ioh
, ARIADSP_NPORT
);
282 bus_space_unmap(ia
->ia_iot
, ioh
, ARIADSP_NPORT
);
285 ia
->ia_io
[0].ir_size
= ARIADSP_NPORT
;
292 DPRINTF(("aria: aria probe succeeded\n"));
297 * I didn't call this a kludge for
298 * nothing. This is cribbed from
299 * ariainit, the author of that
300 * disassembled some code to discover
301 * how to set up the initial values of
302 * the card. Without this, the card
303 * is dead. (It will not respond to _any_
306 * ariainit can be found (ftp) at:
307 * ftp://ftp.wi.leidenuniv.nl/pub/audio/aria/programming/contrib/ariainit.zip
312 aria_prometheus_kludge(struct isa_attach_args
*ia
, bus_space_handle_t ioh1
)
315 bus_space_handle_t ioh
;
318 DPRINTF(("aria: begin aria_prometheus_kludge\n"));
320 /* Begin Config Sequence */
323 bus_space_map(iot
, 0x200, 8, 0, &ioh
);
325 bus_space_write_1(iot
, ioh
, 4, 0x4c);
326 bus_space_write_1(iot
, ioh
, 5, 0x42);
327 bus_space_write_1(iot
, ioh
, 6, 0x00);
328 bus_space_write_2(iot
, ioh
, 0, 0x0f);
329 bus_space_write_1(iot
, ioh
, 1, 0x00);
330 bus_space_write_2(iot
, ioh
, 0, 0x02);
331 bus_space_write_1(iot
, ioh
, 1, ia
->ia_io
[0].ir_addr
>>2);
334 * These next three lines set up the iobase
335 * and the irq; and disable the drq.
337 aria_do_kludge(iot
, ioh
, ioh1
, 0x111,
338 ((ia
->ia_io
[0].ir_addr
-0x280)>>2)+0xA0, 0xbf, 0xa0);
339 aria_do_kludge(iot
, ioh
, ioh1
, 0x011,
340 ia
->ia_irq
[0].ir_irq
-6, 0xf8, 0x00);
341 aria_do_kludge(iot
, ioh
, ioh1
, 0x011, 0x00, 0xef, 0x00);
343 /* The rest of these lines just disable everything else */
344 aria_do_kludge(iot
, ioh
, ioh1
, 0x113, 0x00, 0x88, 0x00);
345 aria_do_kludge(iot
, ioh
, ioh1
, 0x013, 0x00, 0xf8, 0x00);
346 aria_do_kludge(iot
, ioh
, ioh1
, 0x013, 0x00, 0xef, 0x00);
347 aria_do_kludge(iot
, ioh
, ioh1
, 0x117, 0x00, 0x88, 0x00);
348 aria_do_kludge(iot
, ioh
, ioh1
, 0x017, 0x00, 0xff, 0x00);
351 bus_space_write_1(iot
, ioh
, 0, 0x0f);
352 end
= bus_space_read_1(iot
, ioh1
, 0);
353 bus_space_write_2(iot
, ioh
, 0, 0x0f);
354 bus_space_write_1(iot
, ioh
, 1, end
|0x80);
355 bus_space_read_1(iot
, ioh
, 0);
357 bus_space_unmap(iot
, ioh
, 8);
359 * This delay is necessary for some reason,
360 * at least it would crash, and sometimes not
361 * probe properly if it did not exist.
369 bus_space_handle_t ioh
,
370 bus_space_handle_t ioh1
,
381 bus_space_write_2(iot
, ioh
, 0, func
-1);
382 bus_space_write_1(iot
, ioh
, 1, bits
);
387 bus_space_write_1(iot
, ioh
, 0, func
);
388 i
= bus_space_read_1(iot
, ioh1
, 0);
389 bus_space_write_2(iot
, ioh
, 0, func
);
390 bus_space_write_1(iot
, ioh
, 1, (i
&and) | or);
394 * Attach hardware to driver, attach hardware driver to audio
395 * pseudo-device driver.
398 ariaattach(device_t parent
, device_t self
, void *aux
)
400 bus_space_handle_t ioh
;
401 struct aria_softc
*sc
;
402 struct isa_attach_args
*ia
;
407 if (bus_space_map(ia
->ia_iot
, ia
->ia_io
[0].ir_addr
, ARIADSP_NPORT
,
409 panic("%s: can map io port range", device_xname(self
));
411 sc
->sc_iot
= ia
->ia_iot
;
413 sc
->sc_ic
= ia
->ia_ic
;
415 sc
->sc_ih
= isa_intr_establish(ia
->ia_ic
, ia
->ia_irq
[0].ir_irq
,
416 IST_EDGE
, IPL_AUDIO
, aria_intr
, sc
);
418 DPRINTF(("isa_intr_establish() returns (%x)\n", (unsigned) sc
->sc_ih
));
420 i
= aria_getdspmem(sc
, ARIAA_HARDWARE_A
);
423 sc
->sc_hardware
|= ((i
>>13)&0x01)==1 ? ARIA_TELEPHONE
:0;
424 sc
->sc_hardware
|= (((i
>>5)&0x07))==0x04 ? ARIA_MIXER
:0;
425 sc
->sc_hardware
|= (aria_getdspmem(sc
, ARIAA_MODEL_A
)>=1)?ARIA_MODEL
:0;
432 sc
->sc_blocksize
= 1024;
433 sc
->sc_precision
= 8;
438 sc
->sc_gain
[0] = 127;
439 sc
->sc_gain
[1] = 127;
441 for (i
=0; i
<6; i
++) {
442 if (i
== ARIAMIX_TEL_LVL
)
443 sc
->aria_mix
[i
].num_channels
= 1;
445 sc
->aria_mix
[i
].num_channels
= 2;
446 sc
->aria_mix
[i
].level
[0] = 127;
447 sc
->aria_mix
[i
].level
[1] = 127;
450 sc
->ariamix_master
.num_channels
= 2;
451 sc
->ariamix_master
.level
[0] = 222;
452 sc
->ariamix_master
.level
[1] = 222;
453 sc
->ariamix_master
.bass
[0] = 127;
454 sc
->ariamix_master
.bass
[1] = 127;
455 sc
->ariamix_master
.treble
[0] = 127;
456 sc
->ariamix_master
.treble
[1] = 127;
457 sc
->aria_mix_source
= 0;
459 aria_commit_settings(sc
);
461 printf(": dsp %s", (ARIA_MODEL
&sc
->sc_hardware
)?"SC18026":"SC18025");
462 if (ARIA_TELEPHONE
&sc
->sc_hardware
)
464 if (ARIA_MIXER
&sc
->sc_hardware
)
465 printf(", SC18075 mixer");
468 snprintf(aria_device
.version
, sizeof(aria_device
.version
), "%s",
469 ARIA_MODEL
& sc
->sc_hardware
? "SC18026" : "SC18025");
471 audio_attach_mi(&aria_hw_if
, (void *)sc
, &sc
->sc_dev
);
475 * Various routines to interface to higher level audio driver
479 ariaopen(void *addr
, int flags
)
481 struct aria_softc
*sc
;
484 DPRINTF(("ariaopen() called\n"));
490 sc
->sc_open
|= ARIAR_OPEN_RECORD
;
492 sc
->sc_open
|= ARIAR_OPEN_PLAY
;
498 aria_getdev(void *addr
, struct audio_device
*retp
)
506 * Various routines to interface to higher level audio driver
510 aria_query_encoding(void *addr
, struct audio_encoding
*fp
)
512 struct aria_softc
*sc
;
517 strcpy(fp
->name
, AudioEmulaw
);
518 fp
->encoding
= AUDIO_ENCODING_ULAW
;
520 if ((ARIA_MODEL
&sc
->sc_hardware
) == 0)
521 fp
->flags
= AUDIO_ENCODINGFLAG_EMULATED
;
524 strcpy(fp
->name
, AudioEalaw
);
525 fp
->encoding
= AUDIO_ENCODING_ALAW
;
527 if ((ARIA_MODEL
&sc
->sc_hardware
) == 0)
528 fp
->flags
= AUDIO_ENCODINGFLAG_EMULATED
;
531 strcpy(fp
->name
, AudioEslinear
);
532 fp
->encoding
= AUDIO_ENCODING_SLINEAR
;
534 fp
->flags
= AUDIO_ENCODINGFLAG_EMULATED
;
537 strcpy(fp
->name
, AudioEslinear_le
);
538 fp
->encoding
= AUDIO_ENCODING_SLINEAR_LE
;
543 strcpy(fp
->name
, AudioEslinear_be
);
544 fp
->encoding
= AUDIO_ENCODING_SLINEAR_BE
;
546 fp
->flags
= AUDIO_ENCODINGFLAG_EMULATED
;
549 strcpy(fp
->name
, AudioEulinear
);
550 fp
->encoding
= AUDIO_ENCODING_ULINEAR
;
555 strcpy(fp
->name
, AudioEulinear_le
);
556 fp
->encoding
= AUDIO_ENCODING_ULINEAR_LE
;
558 fp
->flags
= AUDIO_ENCODINGFLAG_EMULATED
;
561 strcpy(fp
->name
, AudioEulinear_be
);
562 fp
->encoding
= AUDIO_ENCODING_ULINEAR_BE
;
564 fp
->flags
= AUDIO_ENCODINGFLAG_EMULATED
;
575 * Store blocksize in bytes.
579 aria_round_blocksize(void *addr
, int blk
, int mode
,
580 const audio_params_t
*param
)
584 #if 0 /* XXX -- this is being a tad bit of a problem... */
585 for (i
= 64; i
< 1024; i
*= 2)
595 aria_get_props(void *addr
)
598 return AUDIO_PROP_FULLDUPLEX
;
608 stream_filter_list_t
*pfil
,
609 stream_filter_list_t
*rfil
613 struct aria_softc
*sc
;
616 switch(p
->encoding
) {
617 case AUDIO_ENCODING_ULAW
:
618 case AUDIO_ENCODING_ALAW
:
619 case AUDIO_ENCODING_SLINEAR
:
620 case AUDIO_ENCODING_SLINEAR_LE
:
621 case AUDIO_ENCODING_SLINEAR_BE
:
622 case AUDIO_ENCODING_ULINEAR
:
623 case AUDIO_ENCODING_ULINEAR_LE
:
624 case AUDIO_ENCODING_ULINEAR_BE
:
630 if (p
->sample_rate
<= 9450)
631 p
->sample_rate
= 7875;
632 else if (p
->sample_rate
<= 13387)
633 p
->sample_rate
= 11025;
634 else if (p
->sample_rate
<= 18900)
635 p
->sample_rate
= 15750;
636 else if (p
->sample_rate
<= 26775)
637 p
->sample_rate
= 22050;
638 else if (p
->sample_rate
<= 37800)
639 p
->sample_rate
= 31500;
641 p
->sample_rate
= 44100;
644 sc
->sc_encoding
= p
->encoding
;
645 sc
->sc_precision
= p
->precision
;
646 sc
->sc_chans
= p
->channels
;
647 sc
->sc_rate
= p
->sample_rate
;
649 switch(p
->encoding
) {
650 case AUDIO_ENCODING_ULAW
:
651 if ((ARIA_MODEL
&sc
->sc_hardware
) == 0) {
652 hw
.encoding
= AUDIO_ENCODING_ULINEAR_LE
;
653 pfil
->append(pfil
, mulaw_to_linear8
, &hw
);
654 rfil
->append(rfil
, linear8_to_mulaw
, &hw
);
657 case AUDIO_ENCODING_ALAW
:
658 if ((ARIA_MODEL
&sc
->sc_hardware
) == 0) {
659 hw
.encoding
= AUDIO_ENCODING_ULINEAR_LE
;
660 pfil
->append(pfil
, alaw_to_linear8
, &hw
);
661 rfil
->append(rfil
, linear8_to_alaw
, &hw
);
664 case AUDIO_ENCODING_SLINEAR
:
665 hw
.encoding
= AUDIO_ENCODING_ULINEAR_LE
;
666 pfil
->append(pfil
, change_sign8
, &hw
);
667 rfil
->append(rfil
, change_sign8
, &hw
);
669 case AUDIO_ENCODING_ULINEAR_LE
:
670 hw
.encoding
= AUDIO_ENCODING_SLINEAR_LE
;
671 pfil
->append(pfil
, change_sign16
, &hw
);
672 rfil
->append(rfil
, change_sign16
, &hw
);
674 case AUDIO_ENCODING_SLINEAR_BE
:
675 hw
.encoding
= AUDIO_ENCODING_SLINEAR_LE
;
676 pfil
->append(pfil
, swap_bytes
, &hw
);
677 rfil
->append(rfil
, swap_bytes
, &hw
);
679 case AUDIO_ENCODING_ULINEAR_BE
:
680 hw
.encoding
= AUDIO_ENCODING_SLINEAR_LE
;
681 pfil
->append(pfil
, swap_bytes_change_sign16
, &hw
);
682 rfil
->append(rfil
, swap_bytes_change_sign16
, &hw
);
690 * This is where all of the twiddling goes on.
694 aria_commit_settings(void *addr
)
696 static u_char tones
[16] =
697 { 7, 6, 5, 4, 3, 2, 1, 0, 8, 9, 10, 11, 12, 13, 14, 15 };
698 struct aria_softc
*sc
;
700 bus_space_handle_t ioh
;
706 DPRINTF(("aria_commit_settings\n"));
711 switch (sc
->sc_rate
) {
712 case 7875: format
= 0x00; samp
= 0x60; break;
713 case 11025: format
= 0x00; samp
= 0x40; break;
714 case 15750: format
= 0x10; samp
= 0x60; break;
715 case 22050: format
= 0x10; samp
= 0x40; break;
716 case 31500: format
= 0x10; samp
= 0x20; break;
717 case 44100: format
= 0x20; samp
= 0x00; break;
718 default: format
= 0x00; samp
= 0x40; break;/* XXX can we get here? */
721 if ((ARIA_MODEL
&sc
->sc_hardware
) != 0) {
722 format
|= sc
->sc_encoding
== AUDIO_ENCODING_ULAW
? 0x06 : 0x00;
723 format
|= sc
->sc_encoding
== AUDIO_ENCODING_ALAW
? 0x08 : 0x00;
726 format
|= (sc
->sc_precision
== 16) ? 0x02 : 0x00;
727 format
|= (sc
->sc_chans
== 2) ? 1 : 0;
728 samp
|= bus_space_read_2(iot
, ioh
, ARIADSP_STATUS
) & ~0x60;
730 aria_sendcmd(sc
, ARIADSPC_FORMAT
, format
, -1, -1);
731 bus_space_write_2(iot
, ioh
, ARIADSP_CONTROL
, samp
);
733 if (sc
->sc_hardware
&ARIA_MIXER
) {
734 for (i
= 0; i
< 6; i
++)
735 aria_set_mixer(sc
, i
);
737 if (sc
->sc_chans
==2) {
738 aria_sendcmd(sc
, ARIADSPC_CHAN_VOL
, ARIAR_PLAY_CHAN
,
739 ((sc
->sc_gain
[0]+sc
->sc_gain
[1])/2)<<7,
741 aria_sendcmd(sc
, ARIADSPC_CHAN_PAN
, ARIAR_PLAY_CHAN
,
742 (sc
->sc_gain
[0]-sc
->sc_gain
[1])/4+0x40,
745 aria_sendcmd(sc
, ARIADSPC_CHAN_VOL
, ARIAR_PLAY_CHAN
,
746 sc
->sc_gain
[0]<<7, -1);
747 aria_sendcmd(sc
, ARIADSPC_CHAN_PAN
, ARIAR_PLAY_CHAN
,
751 aria_sendcmd(sc
, ARIADSPC_MASMONMODE
,
752 sc
->ariamix_master
.num_channels
!= 2, -1, -1);
754 aria_sendcmd(sc
, ARIADSPC_MIXERVOL
, 0x0004,
755 sc
->ariamix_master
.level
[0] << 7,
756 sc
->ariamix_master
.level
[1] << 7);
758 /* Convert treble/bass from byte to soundcard style */
760 left
= (tones
[(sc
->ariamix_master
.treble
[0]>>4)&0x0f]<<8) |
761 tones
[(sc
->ariamix_master
.bass
[0]>>4)&0x0f];
762 right
= (tones
[(sc
->ariamix_master
.treble
[1]>>4)&0x0f]<<8) |
763 tones
[(sc
->ariamix_master
.bass
[1]>>4)&0x0f];
765 aria_sendcmd(sc
, ARIADSPC_TONE
, left
, right
, -1);
768 aria_sendcmd(sc
, ARIADSPC_BLOCKSIZE
, sc
->sc_blocksize
/2, -1, -1);
771 * If we think that the card is recording or playing, start it up again here.
772 * Some of the previous commands turn the channels off.
775 if (sc
->sc_record
&(1<<ARIAR_RECORD_CHAN
))
776 aria_sendcmd(sc
, ARIADSPC_START_REC
, ARIAR_RECORD_CHAN
, -1,-1);
778 if (sc
->sc_play
&(1<<ARIAR_PLAY_CHAN
))
779 aria_sendcmd(sc
, ARIADSPC_START_PLAY
, ARIAR_PLAY_CHAN
, -1, -1);
785 aria_set_mixer(struct aria_softc
*sc
, int i
)
790 case ARIAMIX_MIC_LVL
: source
= 0x0001; break;
791 case ARIAMIX_CD_LVL
: source
= 0x0002; break;
792 case ARIAMIX_LINE_IN_LVL
: source
= 0x0008; break;
793 case ARIAMIX_TEL_LVL
: source
= 0x0020; break;
794 case ARIAMIX_AUX_LVL
: source
= 0x0010; break;
795 case ARIAMIX_DAC_LVL
: source
= 0x0004; break;
796 default: source
= 0x0000; break;
799 if (source
!= 0x0000 && source
!= 0x0004) {
800 if (sc
->aria_mix
[i
].mute
== 1)
801 aria_sendcmd(sc
, ARIADSPC_INPMONMODE
, source
, 3, -1);
803 aria_sendcmd(sc
, ARIADSPC_INPMONMODE
, source
,
804 sc
->aria_mix
[i
].num_channels
!= 2, -1);
806 aria_sendcmd(sc
, ARIADSPC_INPMONMODE
, 0x8000|source
,
807 sc
->aria_mix
[i
].num_channels
!= 2, -1);
808 aria_sendcmd(sc
, ARIADSPC_MIXERVOL
, source
,
809 sc
->aria_mix
[i
].level
[0] << 7,
810 sc
->aria_mix
[i
].level
[1] << 7);
813 if (sc
->aria_mix_source
== i
) {
814 aria_sendcmd(sc
, ARIADSPC_ADCSOURCE
, source
, -1, -1);
816 if (sc
->sc_open
& ARIAR_OPEN_RECORD
)
817 aria_sendcmd(sc
, ARIADSPC_ADCCONTROL
, 1, -1, -1);
819 aria_sendcmd(sc
, ARIADSPC_ADCCONTROL
, 0, -1, -1);
824 ariaclose(void *addr
)
826 struct aria_softc
*sc
;
829 DPRINTF(("aria_close sc=%p\n", sc
));
833 if (aria_reset(sc
) != 0) {
840 * Reset the hardware.
843 int ariareset(bus_space_tag_t iot
, bus_space_handle_t ioh
)
845 struct aria_softc tmp
, *sc
;
850 return aria_reset(sc
);
854 aria_reset(struct aria_softc
*sc
)
857 bus_space_handle_t ioh
;
864 bus_space_write_2(iot
, ioh
, ARIADSP_CONTROL
,
865 ARIAR_ARIA_SYNTH
| ARIAR_SR22K
|ARIAR_DSPINTWR
);
866 aria_putdspmem(sc
, 0x6102, 0);
868 fail
|= aria_sendcmd(sc
, ARIADSPC_SYSINIT
, 0x0000, 0x0000, 0x0000);
870 for (i
=0; i
< ARIAR_NPOLL
; i
++)
871 if (aria_getdspmem(sc
, ARIAA_TASK_A
) == 1)
874 bus_space_write_2(iot
, ioh
, ARIADSP_CONTROL
,
875 ARIAR_ARIA_SYNTH
|ARIAR_SR22K
| ARIAR_DSPINTWR
|
877 fail
|= aria_sendcmd(sc
, ARIADSPC_MODE
, ARIAV_MODE_NO_SYNTH
,-1,-1);
883 * Lower-level routines
887 aria_putdspmem(struct aria_softc
*sc
, u_short loc
, u_short val
)
890 bus_space_handle_t ioh
;
894 bus_space_write_2(iot
, ioh
, ARIADSP_DMAADDRESS
, loc
);
895 bus_space_write_2(iot
, ioh
, ARIADSP_DMADATA
, val
);
899 aria_getdspmem(struct aria_softc
*sc
, u_short loc
)
902 bus_space_handle_t ioh
;
906 bus_space_write_2(iot
, ioh
, ARIADSP_DMAADDRESS
, loc
);
907 return bus_space_read_2(iot
, ioh
, ARIADSP_DMADATA
);
912 * each full DSP command is unified into this
916 #define ARIASEND(data, flag) \
917 for (i = ARIAR_NPOLL; \
918 (bus_space_read_2(iot, ioh, ARIADSP_STATUS) & ARIAR_BUSY) && i>0; \
921 if (bus_space_read_2(iot, ioh, ARIADSP_STATUS) & ARIAR_BUSY) \
923 bus_space_write_2(iot, ioh, ARIADSP_WRITE, (u_short)data)
926 aria_sendcmd(struct aria_softc
*sc
, u_short command
,
927 int arg1
, int arg2
, int arg3
)
930 bus_space_handle_t ioh
;
936 ARIASEND(command
, 1);
946 ARIASEND(ARIADSPC_TERM
, 16);
949 sc
->sc_sendcmd_err
++;
951 DPRINTF(("aria_sendcmd: failure=(%d) cmd=(0x%x) fail=(0x%x)\n",
952 sc
->sc_sendcmd_err
, command
, fail
));
962 aria_halt_input(void *addr
)
964 struct aria_softc
*sc
;
967 DPRINTF(("aria_halt_input\n"));
969 if (sc
->sc_record
& (1<<0)) {
970 aria_sendcmd(sc
, ARIADSPC_STOP_REC
, 0, -1, -1);
971 sc
->sc_record
&= ~(1<<0);
972 sc
->sc_rdiobuffer
= 0;
979 aria_halt_output(void *addr
)
981 struct aria_softc
*sc
;
984 DPRINTF(("aria_halt_output\n"));
986 if (sc
->sc_play
& (1<<1)) {
987 aria_sendcmd(sc
, ARIADSPC_STOP_PLAY
, 1, -1, -1);
988 sc
->sc_play
&= ~(1<<1);
989 sc
->sc_pdiobuffer
= 0;
996 * Here we just set up the buffers. If we receive
997 * an interrupt without these set, it is ignored.
1001 aria_start_input(void *addr
, void *p
, int cc
, void (*intr
)(void *), void *arg
)
1003 struct aria_softc
*sc
;
1006 DPRINTF(("aria_start_input %d @ %p\n", cc
, p
));
1008 if (cc
!= sc
->sc_blocksize
) {
1009 DPRINTF(("aria_start_input reqsize %d not sc_blocksize %d\n",
1010 cc
, sc
->sc_blocksize
));
1015 sc
->sc_rintr
= intr
;
1016 sc
->sc_rdiobuffer
= p
;
1018 if (!(sc
->sc_record
&(1<<ARIAR_RECORD_CHAN
))) {
1019 aria_sendcmd(sc
, ARIADSPC_START_REC
, ARIAR_RECORD_CHAN
, -1,-1);
1020 sc
->sc_record
|= (1<<ARIAR_RECORD_CHAN
);
1027 aria_start_output(void *addr
, void *p
, int cc
, void (*intr
)(void *), void *arg
)
1029 struct aria_softc
*sc
;
1032 DPRINTF(("aria_start_output %d @ %p\n", cc
, p
));
1034 if (cc
!= sc
->sc_blocksize
) {
1035 DPRINTF(("aria_start_output reqsize %d not sc_blocksize %d\n",
1036 cc
, sc
->sc_blocksize
));
1041 sc
->sc_pintr
= intr
;
1042 sc
->sc_pdiobuffer
= p
;
1044 if (!(sc
->sc_play
&(1<<ARIAR_PLAY_CHAN
))) {
1045 aria_sendcmd(sc
, ARIADSPC_START_PLAY
, ARIAR_PLAY_CHAN
, -1, -1);
1046 sc
->sc_play
|= (1<<ARIAR_PLAY_CHAN
);
1053 * Process an interrupt. This should be a
1054 * request (from the card) to write or read
1058 aria_intr(void *arg
)
1060 struct aria_softc
*sc
;
1061 bus_space_tag_t iot
;
1062 bus_space_handle_t ioh
;
1070 pdata
= sc
->sc_pdiobuffer
;
1071 rdata
= sc
->sc_rdiobuffer
;
1072 #if 0 /* XXX -- BAD BAD BAD (That this is #define'd out */
1073 DPRINTF(("Checking to see if this is our intr\n"));
1075 if ((inw(iobase
) & 1) != 0x1)
1076 return 0; /* not for us */
1079 sc
->sc_interrupts
++;
1081 DPRINTF(("aria_intr\n"));
1083 if ((sc
->sc_open
& ARIAR_OPEN_PLAY
) && (pdata
!=NULL
)) {
1084 DPRINTF(("aria_intr play=(%x)\n", (unsigned) pdata
));
1085 address
= 0x8000 - 2*(sc
->sc_blocksize
);
1086 address
+= aria_getdspmem(sc
, ARIAA_PLAY_FIFO_A
);
1087 bus_space_write_2(iot
, ioh
, ARIADSP_DMAADDRESS
, address
);
1088 bus_space_write_multi_2(iot
, ioh
, ARIADSP_DMADATA
, pdata
,
1089 sc
->sc_blocksize
/ 2);
1090 if (sc
->sc_pintr
!= NULL
)
1091 (*sc
->sc_pintr
)(sc
->sc_parg
);
1094 if ((sc
->sc_open
& ARIAR_OPEN_RECORD
) && (rdata
!=NULL
)) {
1095 DPRINTF(("aria_intr record=(%x)\n", (unsigned) rdata
));
1096 address
= 0x8000 - (sc
->sc_blocksize
);
1097 address
+= aria_getdspmem(sc
, ARIAA_REC_FIFO_A
);
1098 bus_space_write_2(iot
, ioh
, ARIADSP_DMAADDRESS
, address
);
1099 bus_space_read_multi_2(iot
, ioh
, ARIADSP_DMADATA
, rdata
,
1100 sc
->sc_blocksize
/ 2);
1101 if (sc
->sc_rintr
!= NULL
)
1102 (*sc
->sc_rintr
)(sc
->sc_rarg
);
1105 aria_sendcmd(sc
, ARIADSPC_TRANSCOMPLETE
, -1, -1, -1);
1111 aria_mixer_set_port(void *addr
, mixer_ctrl_t
*cp
)
1113 struct aria_softc
*sc
;
1116 DPRINTF(("aria_mixer_set_port\n"));
1120 /* This could be done better, no mixer still has some controls. */
1121 if (!(ARIA_MIXER
& sc
->sc_hardware
))
1124 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1125 mixer_level_t
*mv
= &cp
->un
.value
;
1127 case ARIAMIX_MIC_LVL
:
1128 if (mv
->num_channels
== 1 || mv
->num_channels
== 2) {
1129 sc
->aria_mix
[ARIAMIX_MIC_LVL
].num_channels
=
1131 sc
->aria_mix
[ARIAMIX_MIC_LVL
].level
[0] =
1133 sc
->aria_mix
[ARIAMIX_MIC_LVL
].level
[1] =
1139 case ARIAMIX_LINE_IN_LVL
:
1140 if (mv
->num_channels
== 1 || mv
->num_channels
== 2) {
1141 sc
->aria_mix
[ARIAMIX_LINE_IN_LVL
].num_channels
=
1143 sc
->aria_mix
[ARIAMIX_LINE_IN_LVL
].level
[0] =
1145 sc
->aria_mix
[ARIAMIX_LINE_IN_LVL
].level
[1] =
1151 case ARIAMIX_CD_LVL
:
1152 if (mv
->num_channels
== 1 || mv
->num_channels
== 2) {
1153 sc
->aria_mix
[ARIAMIX_CD_LVL
].num_channels
=
1155 sc
->aria_mix
[ARIAMIX_CD_LVL
].level
[0] =
1157 sc
->aria_mix
[ARIAMIX_CD_LVL
].level
[1] =
1163 case ARIAMIX_TEL_LVL
:
1164 if (mv
->num_channels
== 1) {
1165 sc
->aria_mix
[ARIAMIX_TEL_LVL
].num_channels
=
1167 sc
->aria_mix
[ARIAMIX_TEL_LVL
].level
[0] =
1173 case ARIAMIX_DAC_LVL
:
1174 if (mv
->num_channels
== 1 || mv
->num_channels
== 2) {
1175 sc
->aria_mix
[ARIAMIX_DAC_LVL
].num_channels
=
1177 sc
->aria_mix
[ARIAMIX_DAC_LVL
].level
[0] =
1179 sc
->aria_mix
[ARIAMIX_DAC_LVL
].level
[1] =
1185 case ARIAMIX_AUX_LVL
:
1186 if (mv
->num_channels
== 1 || mv
->num_channels
== 2) {
1187 sc
->aria_mix
[ARIAMIX_AUX_LVL
].num_channels
=
1189 sc
->aria_mix
[ARIAMIX_AUX_LVL
].level
[0] =
1191 sc
->aria_mix
[ARIAMIX_AUX_LVL
].level
[1] =
1197 case ARIAMIX_MASTER_LVL
:
1198 if (mv
->num_channels
== 1 || mv
->num_channels
== 2) {
1199 sc
->ariamix_master
.num_channels
=
1201 sc
->ariamix_master
.level
[0] = mv
->level
[0];
1202 sc
->ariamix_master
.level
[1] = mv
->level
[1];
1207 case ARIAMIX_MASTER_TREBLE
:
1208 if (mv
->num_channels
== 2) {
1209 sc
->ariamix_master
.treble
[0] =
1210 mv
->level
[0] == 0 ? 1 : mv
->level
[0];
1211 sc
->ariamix_master
.treble
[1] =
1212 mv
->level
[1] == 0 ? 1 : mv
->level
[1];
1216 case ARIAMIX_MASTER_BASS
:
1217 if (mv
->num_channels
== 2) {
1218 sc
->ariamix_master
.bass
[0] =
1219 mv
->level
[0] == 0 ? 1 : mv
->level
[0];
1220 sc
->ariamix_master
.bass
[1] =
1221 mv
->level
[1] == 0 ? 1 : mv
->level
[1];
1225 case ARIAMIX_OUT_LVL
:
1226 if (mv
->num_channels
== 1 || mv
->num_channels
== 2) {
1227 sc
->sc_gain
[0] = mv
->level
[0];
1228 sc
->sc_gain
[1] = mv
->level
[1];
1237 if (cp
->type
== AUDIO_MIXER_ENUM
)
1239 case ARIAMIX_RECORD_SOURCE
:
1240 if (cp
->un
.ord
>=0 && cp
->un
.ord
<=6) {
1241 sc
->aria_mix_source
= cp
->un
.ord
;
1246 case ARIAMIX_MIC_MUTE
:
1247 if (cp
->un
.ord
== 0 || cp
->un
.ord
== 1) {
1248 sc
->aria_mix
[ARIAMIX_MIC_LVL
].mute
=cp
->un
.ord
;
1253 case ARIAMIX_LINE_IN_MUTE
:
1254 if (cp
->un
.ord
== 0 || cp
->un
.ord
== 1) {
1255 sc
->aria_mix
[ARIAMIX_LINE_IN_LVL
].mute
=
1261 case ARIAMIX_CD_MUTE
:
1262 if (cp
->un
.ord
== 0 || cp
->un
.ord
== 1) {
1263 sc
->aria_mix
[ARIAMIX_CD_LVL
].mute
= cp
->un
.ord
;
1268 case ARIAMIX_DAC_MUTE
:
1269 if (cp
->un
.ord
== 0 || cp
->un
.ord
== 1) {
1270 sc
->aria_mix
[ARIAMIX_DAC_LVL
].mute
=cp
->un
.ord
;
1275 case ARIAMIX_AUX_MUTE
:
1276 if (cp
->un
.ord
== 0 || cp
->un
.ord
== 1) {
1277 sc
->aria_mix
[ARIAMIX_AUX_LVL
].mute
=cp
->un
.ord
;
1282 case ARIAMIX_TEL_MUTE
:
1283 if (cp
->un
.ord
== 0 || cp
->un
.ord
== 1) {
1284 sc
->aria_mix
[ARIAMIX_TEL_LVL
].mute
=cp
->un
.ord
;
1298 aria_mixer_get_port(void *addr
, mixer_ctrl_t
*cp
)
1300 struct aria_softc
*sc
;
1303 DPRINTF(("aria_mixer_get_port\n"));
1307 /* This could be done better, no mixer still has some controls. */
1308 if (!(ARIA_MIXER
&sc
->sc_hardware
))
1312 case ARIAMIX_MIC_LVL
:
1313 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1314 cp
->un
.value
.num_channels
=
1315 sc
->aria_mix
[ARIAMIX_MIC_LVL
].num_channels
;
1316 cp
->un
.value
.level
[0] =
1317 sc
->aria_mix
[ARIAMIX_MIC_LVL
].level
[0];
1318 cp
->un
.value
.level
[1] =
1319 sc
->aria_mix
[ARIAMIX_MIC_LVL
].level
[1];
1324 case ARIAMIX_LINE_IN_LVL
:
1325 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1326 cp
->un
.value
.num_channels
=
1327 sc
->aria_mix
[ARIAMIX_LINE_IN_LVL
].num_channels
;
1328 cp
->un
.value
.level
[0] =
1329 sc
->aria_mix
[ARIAMIX_LINE_IN_LVL
].level
[0];
1330 cp
->un
.value
.level
[1] =
1331 sc
->aria_mix
[ARIAMIX_LINE_IN_LVL
].level
[1];
1336 case ARIAMIX_CD_LVL
:
1337 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1338 cp
->un
.value
.num_channels
=
1339 sc
->aria_mix
[ARIAMIX_CD_LVL
].num_channels
;
1340 cp
->un
.value
.level
[0] =
1341 sc
->aria_mix
[ARIAMIX_CD_LVL
].level
[0];
1342 cp
->un
.value
.level
[1] =
1343 sc
->aria_mix
[ARIAMIX_CD_LVL
].level
[1];
1348 case ARIAMIX_TEL_LVL
:
1349 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1350 cp
->un
.value
.num_channels
=
1351 sc
->aria_mix
[ARIAMIX_TEL_LVL
].num_channels
;
1352 cp
->un
.value
.level
[0] =
1353 sc
->aria_mix
[ARIAMIX_TEL_LVL
].level
[0];
1357 case ARIAMIX_DAC_LVL
:
1358 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1359 cp
->un
.value
.num_channels
=
1360 sc
->aria_mix
[ARIAMIX_DAC_LVL
].num_channels
;
1361 cp
->un
.value
.level
[0] =
1362 sc
->aria_mix
[ARIAMIX_DAC_LVL
].level
[0];
1363 cp
->un
.value
.level
[1] =
1364 sc
->aria_mix
[ARIAMIX_DAC_LVL
].level
[1];
1369 case ARIAMIX_AUX_LVL
:
1370 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1371 cp
->un
.value
.num_channels
=
1372 sc
->aria_mix
[ARIAMIX_AUX_LVL
].num_channels
;
1373 cp
->un
.value
.level
[0] =
1374 sc
->aria_mix
[ARIAMIX_AUX_LVL
].level
[0];
1375 cp
->un
.value
.level
[1] =
1376 sc
->aria_mix
[ARIAMIX_AUX_LVL
].level
[1];
1381 case ARIAMIX_MIC_MUTE
:
1382 if (cp
->type
== AUDIO_MIXER_ENUM
) {
1383 cp
->un
.ord
= sc
->aria_mix
[ARIAMIX_MIC_LVL
].mute
;
1388 case ARIAMIX_LINE_IN_MUTE
:
1389 if (cp
->type
== AUDIO_MIXER_ENUM
) {
1390 cp
->un
.ord
= sc
->aria_mix
[ARIAMIX_LINE_IN_LVL
].mute
;
1395 case ARIAMIX_CD_MUTE
:
1396 if (cp
->type
== AUDIO_MIXER_ENUM
) {
1397 cp
->un
.ord
= sc
->aria_mix
[ARIAMIX_CD_LVL
].mute
;
1402 case ARIAMIX_DAC_MUTE
:
1403 if (cp
->type
== AUDIO_MIXER_ENUM
) {
1404 cp
->un
.ord
= sc
->aria_mix
[ARIAMIX_DAC_LVL
].mute
;
1409 case ARIAMIX_AUX_MUTE
:
1410 if (cp
->type
== AUDIO_MIXER_ENUM
) {
1411 cp
->un
.ord
= sc
->aria_mix
[ARIAMIX_AUX_LVL
].mute
;
1416 case ARIAMIX_TEL_MUTE
:
1417 if (cp
->type
== AUDIO_MIXER_ENUM
) {
1418 cp
->un
.ord
= sc
->aria_mix
[ARIAMIX_TEL_LVL
].mute
;
1423 case ARIAMIX_MASTER_LVL
:
1424 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1425 cp
->un
.value
.num_channels
=
1426 sc
->ariamix_master
.num_channels
;
1427 cp
->un
.value
.level
[0] = sc
->ariamix_master
.level
[0];
1428 cp
->un
.value
.level
[1] = sc
->ariamix_master
.level
[1];
1433 case ARIAMIX_MASTER_TREBLE
:
1434 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1435 cp
->un
.value
.num_channels
= 2;
1436 cp
->un
.value
.level
[0] = sc
->ariamix_master
.treble
[0];
1437 cp
->un
.value
.level
[1] = sc
->ariamix_master
.treble
[1];
1442 case ARIAMIX_MASTER_BASS
:
1443 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1444 cp
->un
.value
.num_channels
= 2;
1445 cp
->un
.value
.level
[0] = sc
->ariamix_master
.bass
[0];
1446 cp
->un
.value
.level
[1] = sc
->ariamix_master
.bass
[1];
1451 case ARIAMIX_OUT_LVL
:
1452 if (cp
->type
== AUDIO_MIXER_VALUE
) {
1453 cp
->un
.value
.num_channels
= sc
->sc_chans
;
1454 cp
->un
.value
.level
[0] = sc
->sc_gain
[0];
1455 cp
->un
.value
.level
[1] = sc
->sc_gain
[1];
1459 case ARIAMIX_RECORD_SOURCE
:
1460 if (cp
->type
== AUDIO_MIXER_ENUM
) {
1461 cp
->un
.ord
= sc
->aria_mix_source
;
1475 aria_mixer_query_devinfo(void *addr
, mixer_devinfo_t
*dip
)
1477 struct aria_softc
*sc
;
1479 DPRINTF(("aria_mixer_query_devinfo\n"));
1482 /* This could be done better, no mixer still has some controls. */
1483 if (!(ARIA_MIXER
& sc
->sc_hardware
))
1486 dip
->prev
= dip
->next
= AUDIO_MIXER_LAST
;
1488 switch(dip
->index
) {
1489 case ARIAMIX_MIC_LVL
:
1490 dip
->type
= AUDIO_MIXER_VALUE
;
1491 dip
->mixer_class
= ARIAMIX_INPUT_CLASS
;
1492 dip
->next
= ARIAMIX_MIC_MUTE
;
1493 strcpy(dip
->label
.name
, AudioNmicrophone
);
1494 dip
->un
.v
.num_channels
= 2;
1495 strcpy(dip
->un
.v
.units
.name
, AudioNvolume
);
1498 case ARIAMIX_LINE_IN_LVL
:
1499 dip
->type
= AUDIO_MIXER_VALUE
;
1500 dip
->mixer_class
= ARIAMIX_INPUT_CLASS
;
1501 dip
->next
= ARIAMIX_LINE_IN_MUTE
;
1502 strcpy(dip
->label
.name
, AudioNline
);
1503 dip
->un
.v
.num_channels
= 2;
1504 strcpy(dip
->un
.v
.units
.name
, AudioNvolume
);
1507 case ARIAMIX_CD_LVL
:
1508 dip
->type
= AUDIO_MIXER_VALUE
;
1509 dip
->mixer_class
= ARIAMIX_INPUT_CLASS
;
1510 dip
->next
= ARIAMIX_CD_MUTE
;
1511 strcpy(dip
->label
.name
, AudioNcd
);
1512 dip
->un
.v
.num_channels
= 2;
1513 strcpy(dip
->un
.v
.units
.name
, AudioNvolume
);
1516 case ARIAMIX_TEL_LVL
:
1517 dip
->type
= AUDIO_MIXER_VALUE
;
1518 dip
->mixer_class
= ARIAMIX_INPUT_CLASS
;
1519 dip
->next
= ARIAMIX_TEL_MUTE
;
1520 strcpy(dip
->label
.name
, "telephone");
1521 dip
->un
.v
.num_channels
= 1;
1522 strcpy(dip
->un
.v
.units
.name
, AudioNvolume
);
1525 case ARIAMIX_DAC_LVL
:
1526 dip
->type
= AUDIO_MIXER_VALUE
;
1527 dip
->mixer_class
= ARIAMIX_INPUT_CLASS
;
1528 dip
->next
= ARIAMIX_DAC_MUTE
;
1529 strcpy(dip
->label
.name
, AudioNdac
);
1530 dip
->un
.v
.num_channels
= 1;
1531 strcpy(dip
->un
.v
.units
.name
, AudioNvolume
);
1534 case ARIAMIX_AUX_LVL
:
1535 dip
->type
= AUDIO_MIXER_VALUE
;
1536 dip
->mixer_class
= ARIAMIX_INPUT_CLASS
;
1537 dip
->next
= ARIAMIX_AUX_MUTE
;
1538 strcpy(dip
->label
.name
, AudioNoutput
);
1539 dip
->un
.v
.num_channels
= 1;
1540 strcpy(dip
->un
.v
.units
.name
, AudioNvolume
);
1543 case ARIAMIX_MIC_MUTE
:
1544 dip
->prev
= ARIAMIX_MIC_LVL
;
1547 case ARIAMIX_LINE_IN_MUTE
:
1548 dip
->prev
= ARIAMIX_LINE_IN_LVL
;
1551 case ARIAMIX_CD_MUTE
:
1552 dip
->prev
= ARIAMIX_CD_LVL
;
1555 case ARIAMIX_DAC_MUTE
:
1556 dip
->prev
= ARIAMIX_DAC_LVL
;
1559 case ARIAMIX_AUX_MUTE
:
1560 dip
->prev
= ARIAMIX_AUX_LVL
;
1563 case ARIAMIX_TEL_MUTE
:
1564 dip
->prev
= ARIAMIX_TEL_LVL
;
1568 dip
->mixer_class
= ARIAMIX_INPUT_CLASS
;
1569 dip
->type
= AUDIO_MIXER_ENUM
;
1570 strcpy(dip
->label
.name
, AudioNmute
);
1571 dip
->un
.e
.num_mem
= 2;
1572 strcpy(dip
->un
.e
.member
[0].label
.name
, AudioNoff
);
1573 dip
->un
.e
.member
[0].ord
= 0;
1574 strcpy(dip
->un
.e
.member
[1].label
.name
, AudioNon
);
1575 dip
->un
.e
.member
[1].ord
= 1;
1578 case ARIAMIX_MASTER_LVL
:
1579 dip
->type
= AUDIO_MIXER_VALUE
;
1580 dip
->mixer_class
= ARIAMIX_OUTPUT_CLASS
;
1581 dip
->next
= AUDIO_MIXER_LAST
;
1582 strcpy(dip
->label
.name
, AudioNvolume
);
1583 dip
->un
.v
.num_channels
= 2;
1584 strcpy(dip
->un
.v
.units
.name
, AudioNvolume
);
1587 case ARIAMIX_MASTER_TREBLE
:
1588 dip
->type
= AUDIO_MIXER_VALUE
;
1589 dip
->mixer_class
= ARIAMIX_EQ_CLASS
;
1590 strcpy(dip
->label
.name
, AudioNtreble
);
1591 dip
->un
.v
.num_channels
= 2;
1592 strcpy(dip
->un
.v
.units
.name
, AudioNtreble
);
1595 case ARIAMIX_MASTER_BASS
:
1596 dip
->type
= AUDIO_MIXER_VALUE
;
1597 dip
->mixer_class
= ARIAMIX_EQ_CLASS
;
1598 strcpy(dip
->label
.name
, AudioNbass
);
1599 dip
->un
.v
.num_channels
= 2;
1600 strcpy(dip
->un
.v
.units
.name
, AudioNbass
);
1603 case ARIAMIX_OUT_LVL
:
1604 dip
->type
= AUDIO_MIXER_VALUE
;
1605 dip
->mixer_class
= ARIAMIX_OUTPUT_CLASS
;
1606 strcpy(dip
->label
.name
, AudioNoutput
);
1607 dip
->un
.v
.num_channels
= 2;
1608 strcpy(dip
->un
.v
.units
.name
, AudioNvolume
);
1611 case ARIAMIX_RECORD_SOURCE
:
1612 dip
->mixer_class
= ARIAMIX_RECORD_CLASS
;
1613 dip
->type
= AUDIO_MIXER_ENUM
;
1614 strcpy(dip
->label
.name
, AudioNsource
);
1615 dip
->un
.e
.num_mem
= 6;
1616 strcpy(dip
->un
.e
.member
[0].label
.name
, AudioNoutput
);
1617 dip
->un
.e
.member
[0].ord
= ARIAMIX_AUX_LVL
;
1618 strcpy(dip
->un
.e
.member
[1].label
.name
, AudioNmicrophone
);
1619 dip
->un
.e
.member
[1].ord
= ARIAMIX_MIC_LVL
;
1620 strcpy(dip
->un
.e
.member
[2].label
.name
, AudioNdac
);
1621 dip
->un
.e
.member
[2].ord
= ARIAMIX_DAC_LVL
;
1622 strcpy(dip
->un
.e
.member
[3].label
.name
, AudioNline
);
1623 dip
->un
.e
.member
[3].ord
= ARIAMIX_LINE_IN_LVL
;
1624 strcpy(dip
->un
.e
.member
[4].label
.name
, AudioNcd
);
1625 dip
->un
.e
.member
[4].ord
= ARIAMIX_CD_LVL
;
1626 strcpy(dip
->un
.e
.member
[5].label
.name
, "telephone");
1627 dip
->un
.e
.member
[5].ord
= ARIAMIX_TEL_LVL
;
1630 case ARIAMIX_INPUT_CLASS
:
1631 dip
->type
= AUDIO_MIXER_CLASS
;
1632 dip
->mixer_class
= ARIAMIX_INPUT_CLASS
;
1633 strcpy(dip
->label
.name
, AudioCinputs
);
1636 case ARIAMIX_OUTPUT_CLASS
:
1637 dip
->type
= AUDIO_MIXER_CLASS
;
1638 dip
->mixer_class
= ARIAMIX_OUTPUT_CLASS
;
1639 strcpy(dip
->label
.name
, AudioCoutputs
);
1642 case ARIAMIX_RECORD_CLASS
:
1643 dip
->type
= AUDIO_MIXER_CLASS
;
1644 dip
->mixer_class
= ARIAMIX_RECORD_CLASS
;
1645 strcpy(dip
->label
.name
, AudioCrecord
);
1648 case ARIAMIX_EQ_CLASS
:
1649 dip
->type
= AUDIO_MIXER_CLASS
;
1650 dip
->mixer_class
= ARIAMIX_EQ_CLASS
;
1651 strcpy(dip
->label
.name
, AudioCequalization
);