xref: /freebsd/sys/dev/sound/pci/cs4281.h (revision 41059135ce931c0f1014a999ffabc6bc470ce856)
1 /*-
2  * Copyright (c) 2000 Orion Hodson <O.Hodson@cs.ucl.ac.uk>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef _CS4281_H_
30 #define _CS4281_H_
31 
32 #define CS4281_PCI_ID 	0x60051013
33 
34 /* Ball Parks */
35 #define CS4281PCI_BA0_SIZE 	4096
36 #define CS4281PCI_BA1_SIZE	65536
37 
38 /* Register values */
39 #define CS4281PCI_HISR		0x000
40 #	define CS4281PCI_HISR_DMAI		0x00040000
41 #	define CS4281PCI_HISR_DMA(x)		(0x0100 << (x))
42 
43 #define CS4281PCI_HICR		0x008
44 #	define CS4281PCI_HICR_EOI		0x00000003
45 
46 #define CS4281PCI_HIMR		0x00c
47 #	define CS4281PCI_HIMR_DMAI		0x00040000
48 #	define CS4281PCI_HIMR_DMA(x)		(0x0100 << (x))
49 
50 #define CS4281PCI_IIER		0x010
51 
52 #define CS4281PCI_HDSR(x)	(0x0f0 + (x)*0x004)
53 #	define CS4281PCI_HDSR_CH1P		0x02000000
54 #	define CS4281PCI_HDSR_CH2P		0x01000000
55 #	define CS4281PCI_HDSR_HDTC		0x00020000
56 #	define CS4281PCI_HDSR_DTC		0x00010000
57 #	define CS4281PCI_HDSR_DRUN		0x00008000
58 #	define CS4281PCI_HDSR_RQ		0x00000080
59 
60 #define CS4281PCI_DCA(x)	(0x110 + (x) * 0x010)
61 #define CS4281PCI_DCC(x)	(0x114 + (x) * 0x010)
62 #define CS4281PCI_DBA(x)	(0x118 + (x) * 0x010)
63 #define CS4281PCI_DBC(x)	(0x11c + (x) * 0x010)
64 
65 #define CS4281PCI_DMR(x)	(0x150 + (x) * 0x008)
66 #	define CS4281PCI_DMR_DMA		0x20000000
67 #	define CS4281PCI_DMR_POLL		0x10000000
68 #	define CS4281PCI_DMR_TBC		0x02000000
69 #	define CS4281PCI_DMR_CBC		0x01000000
70 #	define CS4281PCI_DMR_SWAPC		0x00400000
71 #	define CS4281PCI_DMR_SIZE20		0x00100000
72 #	define CS4281PCI_DMR_USIGN		0x00080000
73 #	define CS4281PCI_DMR_BEND		0x00040000
74 #	define CS4281PCI_DMR_MONO		0x00020000
75 #	define CS4281PCI_DMR_SIZE8		0x00010000
76 #	define CS4281PCI_DMR_TYPE_DEMAND	0x00000000
77 #	define CS4281PCI_DMR_TYPE_SINGLE	0x00000040
78 #	define CS4281PCI_DMR_TYPE_BLOCK		0x00000080
79 #	define CS4281PCI_DMR_TYPE_CASCADE	0x000000c0
80 #	define CS4281PCI_DMR_DEC		0x00000020
81 #	define CS4281PCI_DMR_AUTO		0x00000010
82 #	define CS4281PCI_DMR_TR_PLAY		0x00000008
83 #	define CS4281PCI_DMR_TR_REC		0x00000004
84 
85 #define CS4281PCI_DCR(x)	(0x154 + (x) * 0x008)
86 #	define CS4281PCI_DCR_HTCIE		0x00020000
87 #	define CS4281PCI_DCR_TCIE		0x00010000
88 #	define CS4281PCI_DCR_MSK		0x00000001
89 
90 #define CS4281PCI_FCR(x)	(0x180 + (x) * 0x004)
91 #	define CS4281PCI_FCR_FEN		0x80000000
92 #	define CS4281PCI_FCR_DACZ		0x40000000
93 #	define CS4281PCI_FCR_PSH		0x20000000
94 #	define CS4281PCI_FCR_RS(x)		((x) << 24)
95 #	define CS4281PCI_FCR_LS(x)		((x) << 16)
96 #	define CS4281PCI_FCR_SZ(x)		((x) << 8)
97 #	define CS4281PCI_FCR_OF(x)		(x)
98 
99 #define CS4281PCI_FPDR(x)	(0x190 + (x) * 0x004)
100 
101 #define CS4281PCI_FCHS		0x20c
102 #define CS4281PCI_FSIC(x)	(0x210 + (x) * 0x004)
103 
104 #define CS4281PCI_PMCS		0x344
105 #	define CS4281PCI_PMCS_PS_MASK		0x00000003
106 #define CS4281PCI_PMCS_OFFSET	(CS4281PCI_PMCS - 0x300)
107 
108 #define CS4281PCI_CWPR		0x3e0
109 #	define CS4281PCI_CWPR_MAGIC		0x00004281
110 
111 #define CS4281PCI_EPPMC		0x3e4
112 #	define CS4281PCI_EPPMC_FPDN		0x00004000
113 #define CS4281PCI_GPIOR		0x3e8
114 
115 #define CS4281PCI_SPMC		0x3ec
116 #	define CS4281PCI_SPMC_RSTN		0x00000001
117 #	define CS4281PCI_SPMC_ASYN		0x00000002
118 #	define CS4281PCI_SPMC_WUP1		0x00000004
119 #	define CS4281PCI_SPMC_WUP2		0x00000008
120 #	define CS4281PCI_SPMC_ASDO		0x00000080
121 #	define CS4281PCI_SPMC_ASDI2E		0x00000100
122 #	define CS4281PCI_SPMC_EESPD		0x00000200
123 #	define CS4281PCI_SPMC_GISPEN		0x00004000
124 #	define CS4281PCI_SPMC_GIPPEN		0x00008000
125 
126 #define CS4281PCI_CFLR		0x3f0
127 #define CS4281PCI_IISR		0x3f4
128 #define CS4281PCI_TMS		0x3f8
129 #define CS4281PCI_SSVID		0x3fc
130 
131 #define CS4281PCI_CLKCR1	0x400
132 #	define CS_4281PCI_CLKCR1_DLLSS_MASK	0x0000000c
133 #	define CS_4281PCI_CLKCR1_DLLSS_AC97	0x00000004
134 #	define CS4281PCI_CLKCR1_DLLP		0x00000010
135 #	define CS4281PCI_CLKCR1_SWCE		0x00000020
136 #	define CS4281PCI_CLKCR1_DLLOS		0x00000040
137 #	define CS4281PCI_CLKCR1_CKRA		0x00010000
138 #	define CS4281PCI_CLKCR1_DLLRDY		0x01000000
139 #	define CS4281PCI_CLKCR1_CLKON		0x02000000
140 
141 #define CS4281PCI_FRR		0x410
142 
143 #define CS4281PCI_SLT12O	0x41c
144 #define CS4281PCI_SERMC		0x420
145 #	define CS4281PCI_SERMC_PTC_AC97		0x00000002
146 #	define CS4281PCI_SERMC_PTC_MASK		0x0000000e
147 #	define CS4281PCI_SERMC_ODSEN1		0x01000000
148 #	define CS4281PCI_SERMC_ODSEN2		0x02000000
149 #define CS4281PCI_SERC1		0x428
150 #define CS4281PCI_SERC2		0x42c
151 
152 #define CS4281PCI_SLT12M	0x45c
153 #define CS4281PCI_ACCTL		0x460
154 #	define CS4281PCI_ACCTL_ESYN		0x00000002
155 #	define CS4281PCI_ACCTL_VFRM		0x00000004
156 #	define CS4281PCI_ACCTL_DCV		0x00000008
157 #	define CS4281PCI_ACCTL_CRW		0x00000010
158 #	define CS4281PCI_ACCTL_TC		0x00000040
159 
160 #define CS4281PCI_ACSTS		0x464
161 #	define CS4281PCI_ACSTS_CRDY		0x00000001
162 #	define CS4281PCI_ACSTS_VSTS		0x00000002
163 
164 #define CS4281PCI_ACOSV		0x468
165 #	define CS4281PCI_ACOSV_SLV(x)		(1 << (x - 3))
166 #define CS4281PCI_ACCAD		0x46c
167 #define CS4281PCI_ACCDA		0x470
168 #define CS4281PCI_ACISV		0x474
169 #	define CS4281PCI_ACISV_ISV(x)		(1 << (x - 3))
170 #define CS4281PCI_ACSAD		0x478
171 #define CS4281PCI_ACSDA		0x47c
172 #define CS4281PCI_JSPT		0x480
173 #define CS4281PCI_JSCTL		0x484
174 
175 #define CS4281PCI_SSPM		0x740
176 #	define CS4281PCI_SSPM_MIXEN		0x00000040
177 #	define CS4281PCI_SSPM_CSRCEN		0x00000020
178 #	define CS4281PCI_SSPM_PSRCEN		0x00000010
179 #	define CS4281PCI_SSPM_JSEN		0x00000008
180 #	define CS4281PCI_SSPM_ACLEN		0x00000004
181 #	define CS4281PCI_SSPM_FMEN		0x00000002
182 
183 #define CS4281PCI_DACSR		0x744
184 #define CS4281PCI_ADCSR		0x748
185 #define CS4281PCI_SSCR		0x74c
186 
187 #define CS4281PCI_SRCSA		0x75c
188 #	define CS4281PCI_SRCSA_PLSS(x)		(x)
189 #	define CS4281PCI_SRCSA_PRSS(x)		((x) << 8)
190 #	define CS4281PCI_SRCSA_CLSS(x)		((x) << 16)
191 #	define CS4281PCI_SRCSA_CRSS(x)		((x) << 24)
192 
193 #define CS4281PCI_PPLVC		0x760
194 #define CS4281PCI_PPRVC		0x764
195 
196 /* Slot definitions (minimal) */
197 #define CS4281PCI_LPCM_PLAY_SLOT	0x00
198 #define CS4281PCI_RPCM_PLAY_SLOT	0x01
199 
200 #define CS4281PCI_LPCM_REC_SLOT		0x0a
201 #define CS4281PCI_RPCM_REC_SLOT		0x0b
202 
203 #define CS4281PCI_DISABLED_SLOT		0x1f
204 
205 #endif /* _CS4281_H_ */
206