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