xref: /openbsd/sys/dev/ic/cs4231reg.h (revision 4b1a56af)
1 /* $OpenBSD: cs4231reg.h,v 1.8 2022/01/09 05:42:38 jsg Exp $ */
2 /* $NetBSD: cs4231reg.h,v 1.4 1996/02/16 08:12:33 mycroft Exp $ */
3 
4 /*-
5  * Copyright (c) 1996 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Ken Hornstein and John Kohl.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*
34  * Register defs for Crystal Semiconductor CS4231 Audio Codec/mixer
35  * chip, used on Gravis UltraSound MAX cards.
36  *
37  * Block diagram:
38  *             +----------------------------------------------------+
39  *             |						    |
40  *             |   +----------------------------------------------+ |
41  *	       |   |mixed in       +-+  		          | |
42  *	       |   +------------>--| |  		          | |
43  *             | mic in            | |			          | |
44  *   Mic --+-->| --------- GAIN ->-| |			          | |
45  *         |   | AUX 1 in          |M|				  | |
46  *   GF1 --)-->| -------------+-->-|U|				  | |
47  *	   |   | Line in      |	   |X|---- GAIN ----------+	  | |
48  *  Line --)-->| ---------+---)-->-| |			  |	  | |
49  *	   |   |	  |   |    | |			  |	  | |
50  *	   |   |	  |   |    +-+		         ADC 	  | |
51  *	   |   |	  |   |      		          | 	  | |
52  *	   |   |	  |   |				  |	  | |
53  *	   |   |	  |   +--- L/M --\		  |	  | | AMP-->
54  *	   |   |	  |   	   	  \		  |	  | |  |
55  *	   |   |	  |   	   	   \	          |	  | |  |
56  *	   |   |	  +---- L/M -------O-->--+--------)-------+-|--+-> line
57  *	   |   |   mono in	       	  /|     |        |	    |
58  *	   +---|-->------------ L/M -----/ |     |        |	    |
59  *	       |   AUX 2 in		   |     |        |	    |
60  *  CD --------|-->------------ L/M -------+    L/M       |	    |
61  *	       |				 |        v	    |
62  *	       |				 |        |	    |
63  *	       |				DAC       |	    |
64  *	       |				 |        |	    |
65  *             +----------------------------------------------------+
66  *	       					 |        |
67  *						 |        |
68  *						 v        v
69  *     	       	       	       	       	       	  Pc BUS (DISK) ???
70  *
71  * Documentation for this chip can be found at:
72  *	http://www.cirrus.com/products/overviews/cs4231.html
73  */
74 
75 /* CS4231/AD1845 mode2 registers; added to AD1848 registers */
76 #define CS_ALT_FEATURE1		0x10
77 #define CS_ALT_FEATURE2		0x11
78 #define CS_LEFT_LINE_CONTROL	0x12
79 #define CS_RIGHT_LINE_CONTROL	0x13
80 #define		LINE_INPUT_ATTEN_BITS	0x1f
81 #define		LINE_INPUT_ATTEN_MASK	0xe0
82 #define		LINE_INPUT_MUTE		0x80
83 #define		LINE_INPUT_MUTE_MASK	0x7f
84 #define CS_TIMER_LOW		0x14
85 #define CS_TIMER_HIGH		0x15
86 #define CS_UPPER_FREQUENCY_SEL	0x16
87 #define CS_LOWER_FREQUENCY_SEL	0x17
88 #define CS_IRQ_STATUS		0x18
89 #define		CS_IRQ_PU		0x01	/* Playback Underrun */
90 #define		CS_IRQ_PO		0x02	/* Playback Overrun */
91 #define		CS_IRQ_CO		0x04	/* Capture Overrun */
92 #define		CS_IRQ_CU		0x08	/* Capture Underrun */
93 #define		CS_IRQ_PI		0x10	/* Playback Interrupt */
94 #define		CS_IRQ_CI		0x20	/* Capture Interrupt */
95 #define		CS_IRQ_TI		0x40	/* Timer Interrupt */
96 #define		CS_IRQ_RES		0x80	/* reserved */
97 #define CS_VERSION_ID		0x19
98 #define CS_MONO_IO_CONTROL	0x1A
99 #define		MONO_INPUT_ATTEN_BITS	0x0f
100 #define		MONO_INPUT_ATTEN_MASK	0xf0
101 #define		MONO_OUTPUT_MUTE	0x40
102 #define		MONO_INPUT_MUTE		0x80
103 #define		MONO_INPUT_MUTE_MASK	0x7f
104 #define CS_POWERDOWN_CONTROL	0x1B
105 #define CS_REC_FORMAT		0x1C
106 #define CS_XTAL_SELECT		0x1D
107 #define CS_UPPER_REC_CNT	0x1E
108 #define CS_LOWER_REC_CNT	0x1F
109