Merge tag 'powerpc-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux/fpc-iii.git] / sound / pci / au88x0 / au88x0_xtalk.c
blob27859536d7c021bbdae82e07b43637f496a4124c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /***************************************************************************
3 * au88x0_cxtalk.c
5 * Wed Nov 19 16:29:47 2003
6 * Copyright 2003 mjander
7 * mjander@users.sourceforge.org
8 ****************************************************************************/
13 #include "au88x0_xtalk.h"
15 /* Data (a whole lot of data.... ) */
17 static short const sXtalkWideKLeftEq = 0x269C;
18 static short const sXtalkWideKRightEq = 0x269C;
19 static short const sXtalkWideKLeftXt = 0xF25E;
20 static __maybe_unused short const sXtalkWideKRightXt = 0xF25E;
21 static short const sXtalkWideShiftLeftEq = 1;
22 static short const sXtalkWideShiftRightEq = 1;
23 static short const sXtalkWideShiftLeftXt = 0;
24 static __maybe_unused short const sXtalkWideShiftRightXt = 0;
25 static unsigned short const wXtalkWideLeftDelay = 0xd;
26 static unsigned short const wXtalkWideRightDelay = 0xd;
27 static short const sXtalkNarrowKLeftEq = 0x468D;
28 static short const sXtalkNarrowKRightEq = 0x468D;
29 static short const sXtalkNarrowKLeftXt = 0xF82E;
30 static __maybe_unused short const sXtalkNarrowKRightXt = 0xF82E;
31 static short const sXtalkNarrowShiftLeftEq = 0x3;
32 static short const sXtalkNarrowShiftRightEq = 0x3;
33 static short const sXtalkNarrowShiftLeftXt = 0;
34 static __maybe_unused short const sXtalkNarrowShiftRightXt = 0;
35 static unsigned short const wXtalkNarrowLeftDelay = 0x7;
36 static unsigned short const wXtalkNarrowRightDelay = 0x7;
38 static __maybe_unused xtalk_gains_t const asXtalkGainsDefault = {
39 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
40 0x4000, 0x4000, 0x4000, 0x4000, 0x4000
43 static __maybe_unused xtalk_gains_t const asXtalkGainsTest = {
44 0x7fff, 0x8000, 0x0000, 0x0000, 0x0001,
45 0xffff, 0x4000, 0xc000, 0x0002, 0xfffe
48 static __maybe_unused xtalk_gains_t const asXtalkGains1Chan = {
49 0x7FFF, 0, 0, 0, 0,
50 0x7FFF, 0, 0, 0, 0,
53 // Input gain for 4 A3D slices. One possible input pair is left zero.
54 static xtalk_gains_t const asXtalkGainsAllChan = {
55 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0,
56 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0
59 static xtalk_gains_t const asXtalkGainsZeros = {
60 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
63 static xtalk_dline_t const alXtalkDlineZeros = {
64 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
65 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
67 static __maybe_unused xtalk_dline_t const alXtalkDlineTest = {
68 0x0000fc18, 0xfff03e8, 0x000186a0, 0xfffe7960, 1, 0xffffffff, 0, 0,
69 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
70 0, 0, 0, 0, 0, 0, 0, 0
73 static xtalk_instate_t const asXtalkInStateZeros = {
74 0, 0, 0, 0
77 static __maybe_unused xtalk_instate_t const asXtalkInStateTest = {
78 0x0080, 0xff80, 0x0001, 0xffff
81 static xtalk_state_t const asXtalkOutStateZeros = {
82 {0, 0, 0, 0},
83 {0, 0, 0, 0},
84 {0, 0, 0, 0},
85 {0, 0, 0, 0},
86 {0, 0, 0, 0}
89 static short const sDiamondKLeftEq = 0x401d;
90 static short const sDiamondKRightEq = 0x401d;
91 static short const sDiamondKLeftXt = 0xF90E;
92 static __maybe_unused short const sDiamondKRightXt = 0xF90E;
93 static short const sDiamondShiftLeftEq = 1;
94 static short const sDiamondShiftRightEq = 1;
95 static short const sDiamondShiftLeftXt = 0;
96 static __maybe_unused short const sDiamondShiftRightXt = 0;
97 static unsigned short const wDiamondLeftDelay = 0xb;
98 static unsigned short const wDiamondRightDelay = 0xb;
100 static xtalk_coefs_t const asXtalkWideCoefsLeftEq = {
101 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
102 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
103 {0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
104 {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
105 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
107 static xtalk_coefs_t const asXtalkWideCoefsRightEq = {
108 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
109 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
110 {0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
111 {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
112 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
114 static xtalk_coefs_t const asXtalkWideCoefsLeftXt = {
115 {0x55c6, 0xc97b, 0x005b, 0x0047, 0},
116 {0x6a60, 0xca20, 0xffc6, 0x0040, 0},
117 {0x6411, 0xd711, 0xfca1, 0x0190, 0},
118 {0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
119 {0, 0, 0, 0, 0}
121 static __maybe_unused xtalk_coefs_t const asXtalkWideCoefsRightXt = {
122 {0x55c6, 0xc97b, 0x005b, 0x0047, 0},
123 {0x6a60, 0xca20, 0xffc6, 0x0040, 0},
124 {0x6411, 0xd711, 0xfca1, 0x0190, 0},
125 {0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
126 {0, 0, 0, 0, 0}
128 static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = {
129 {0x50B5, 0xD07C, 0x026D, 0xFD21, 0},
130 {0x460F, 0xE44F, 0xF75E, 0xEFA6, 0},
131 {0x556D, 0xDCAB, 0x2098, 0xF0F2, 0},
132 {0x7E03, 0xC1F0, 0x007D, 0xFF89, 0},
133 {0x383E, 0xFD9D, 0xB278, 0x4547, 0}
136 static xtalk_coefs_t const asXtalkNarrowCoefsRightEq = {
137 {0x50B5, 0xD07C, 0x026D, 0xFD21, 0},
138 {0x460F, 0xE44F, 0xF75E, 0xEFA6, 0},
139 {0x556D, 0xDCAB, 0x2098, 0xF0F2, 0},
140 {0x7E03, 0xC1F0, 0x007D, 0xFF89, 0},
141 {0x383E, 0xFD9D, 0xB278, 0x4547, 0}
144 static xtalk_coefs_t const asXtalkNarrowCoefsLeftXt = {
145 {0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0},
146 {0x6777, 0xC915, 0xFEAF, 0x00B1, 0},
147 {0x7762, 0xC7D9, 0x025B, 0xFDA6, 0},
148 {0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0},
149 {0, 0, 0, 0, 0}
152 static __maybe_unused xtalk_coefs_t const asXtalkNarrowCoefsRightXt = {
153 {0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0},
154 {0x6777, 0xC915, 0xFEAF, 0x00B1, 0},
155 {0x7762, 0xC7D9, 0x025B, 0xFDA6, 0},
156 {0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0},
157 {0, 0, 0, 0, 0}
160 static xtalk_coefs_t const asXtalkCoefsZeros = {
161 {0, 0, 0, 0, 0},
162 {0, 0, 0, 0, 0},
163 {0, 0, 0, 0, 0},
164 {0, 0, 0, 0, 0},
165 {0, 0, 0, 0, 0}
168 static xtalk_coefs_t const asXtalkCoefsPipe = {
169 {0, 0, 0x0FA0, 0, 0},
170 {0, 0, 0x0FA0, 0, 0},
171 {0, 0, 0x0FA0, 0, 0},
172 {0, 0, 0x0FA0, 0, 0},
173 {0, 0, 0x1180, 0, 0},
175 static __maybe_unused xtalk_coefs_t const asXtalkCoefsNegPipe = {
176 {0, 0, 0xF380, 0, 0},
177 {0, 0, 0xF380, 0, 0},
178 {0, 0, 0xF380, 0, 0},
179 {0, 0, 0xF380, 0, 0},
180 {0, 0, 0xF200, 0, 0}
183 static __maybe_unused xtalk_coefs_t const asXtalkCoefsNumTest = {
184 {0, 0, 0xF380, 0x8000, 0x6D60},
185 {0, 0, 0, 0, 0},
186 {0, 0, 0, 0, 0},
187 {0, 0, 0, 0, 0},
188 {0, 0, 0, 0, 0}
191 static __maybe_unused xtalk_coefs_t const asXtalkCoefsDenTest = {
192 {0xC000, 0x2000, 0x4000, 0, 0},
193 {0, 0, 0, 0, 0},
194 {0, 0, 0, 0, 0},
195 {0, 0, 0, 0, 0},
196 {0, 0, 0, 0, 0}
199 static __maybe_unused xtalk_state_t const asXtalkOutStateTest = {
200 {0x7FFF, 0x0004, 0xFFFC, 0},
201 {0xFE00, 0x0008, 0xFFF8, 0x4000},
202 {0x0200, 0x0010, 0xFFF0, 0xC000},
203 {0x8000, 0x0020, 0xFFE0, 0},
204 {0, 0, 0, 0}
207 static xtalk_coefs_t const asDiamondCoefsLeftEq = {
208 {0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0},
209 {0x45E2, 0xCA51, 0x0448, 0xFCE7, 0},
210 {0xA93E, 0xDBD5, 0x022C, 0x028A, 0},
211 {0, 0, 0, 0, 0},
212 {0, 0, 0, 0, 0}
215 static xtalk_coefs_t const asDiamondCoefsRightEq = {
216 {0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0},
217 {0x45E2, 0xCA51, 0x0448, 0xFCE7, 0},
218 {0xA93E, 0xDBD5, 0x022C, 0x028A, 0},
219 {0, 0, 0, 0, 0},
220 {0, 0, 0, 0, 0}
223 static xtalk_coefs_t const asDiamondCoefsLeftXt = {
224 {0x3B50, 0xFE08, 0xF959, 0x0060, 0},
225 {0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0},
226 {0, 0, 0, 0, 0},
227 {0, 0, 0, 0, 0},
228 {0, 0, 0, 0, 0}
231 static __maybe_unused xtalk_coefs_t const asDiamondCoefsRightXt = {
232 {0x3B50, 0xFE08, 0xF959, 0x0060, 0},
233 {0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0},
234 {0, 0, 0, 0, 0},
235 {0, 0, 0, 0, 0},
236 {0, 0, 0, 0, 0}
239 /**/
240 /* XTalk EQ and XT */
241 static void
242 vortex_XtalkHw_SetLeftEQ(vortex_t * vortex, short arg_0, short arg_4,
243 xtalk_coefs_t const coefs)
245 int i;
247 for (i = 0; i < 5; i++) {
248 hwwrite(vortex->mmio, 0x24200 + i * 0x24, coefs[i][0]);
249 hwwrite(vortex->mmio, 0x24204 + i * 0x24, coefs[i][1]);
250 hwwrite(vortex->mmio, 0x24208 + i * 0x24, coefs[i][2]);
251 hwwrite(vortex->mmio, 0x2420c + i * 0x24, coefs[i][3]);
252 hwwrite(vortex->mmio, 0x24210 + i * 0x24, coefs[i][4]);
254 hwwrite(vortex->mmio, 0x24538, arg_0 & 0xffff);
255 hwwrite(vortex->mmio, 0x2453C, arg_4 & 0xffff);
258 static void
259 vortex_XtalkHw_SetRightEQ(vortex_t * vortex, short arg_0, short arg_4,
260 xtalk_coefs_t const coefs)
262 int i;
264 for (i = 0; i < 5; i++) {
265 hwwrite(vortex->mmio, 0x242b4 + i * 0x24, coefs[i][0]);
266 hwwrite(vortex->mmio, 0x242b8 + i * 0x24, coefs[i][1]);
267 hwwrite(vortex->mmio, 0x242bc + i * 0x24, coefs[i][2]);
268 hwwrite(vortex->mmio, 0x242c0 + i * 0x24, coefs[i][3]);
269 hwwrite(vortex->mmio, 0x242c4 + i * 0x24, coefs[i][4]);
271 hwwrite(vortex->mmio, 0x24540, arg_0 & 0xffff);
272 hwwrite(vortex->mmio, 0x24544, arg_4 & 0xffff);
275 static void
276 vortex_XtalkHw_SetLeftXT(vortex_t * vortex, short arg_0, short arg_4,
277 xtalk_coefs_t const coefs)
279 int i;
281 for (i = 0; i < 5; i++) {
282 hwwrite(vortex->mmio, 0x24368 + i * 0x24, coefs[i][0]);
283 hwwrite(vortex->mmio, 0x2436c + i * 0x24, coefs[i][1]);
284 hwwrite(vortex->mmio, 0x24370 + i * 0x24, coefs[i][2]);
285 hwwrite(vortex->mmio, 0x24374 + i * 0x24, coefs[i][3]);
286 hwwrite(vortex->mmio, 0x24378 + i * 0x24, coefs[i][4]);
288 hwwrite(vortex->mmio, 0x24548, arg_0 & 0xffff);
289 hwwrite(vortex->mmio, 0x2454C, arg_4 & 0xffff);
292 static void
293 vortex_XtalkHw_SetRightXT(vortex_t * vortex, short arg_0, short arg_4,
294 xtalk_coefs_t const coefs)
296 int i;
298 for (i = 0; i < 5; i++) {
299 hwwrite(vortex->mmio, 0x2441C + i * 0x24, coefs[i][0]);
300 hwwrite(vortex->mmio, 0x24420 + i * 0x24, coefs[i][1]);
301 hwwrite(vortex->mmio, 0x24424 + i * 0x24, coefs[i][2]);
302 hwwrite(vortex->mmio, 0x24428 + i * 0x24, coefs[i][3]);
303 hwwrite(vortex->mmio, 0x2442C + i * 0x24, coefs[i][4]);
305 hwwrite(vortex->mmio, 0x24550, arg_0 & 0xffff);
306 hwwrite(vortex->mmio, 0x24554, arg_4 & 0xffff);
309 static void
310 vortex_XtalkHw_SetLeftEQStates(vortex_t * vortex,
311 xtalk_instate_t const arg_0,
312 xtalk_state_t const coefs)
314 int i;
316 for (i = 0; i < 5; i++) {
317 hwwrite(vortex->mmio, 0x24214 + i * 0x24, coefs[i][0]);
318 hwwrite(vortex->mmio, 0x24218 + i * 0x24, coefs[i][1]);
319 hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]);
320 hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]);
322 hwwrite(vortex->mmio, 0x244F8, arg_0[0]);
323 hwwrite(vortex->mmio, 0x244FC, arg_0[1]);
324 hwwrite(vortex->mmio, 0x24500, arg_0[2]);
325 hwwrite(vortex->mmio, 0x24504, arg_0[3]);
328 static void
329 vortex_XtalkHw_SetRightEQStates(vortex_t * vortex,
330 xtalk_instate_t const arg_0,
331 xtalk_state_t const coefs)
333 int i;
335 for (i = 0; i < 5; i++) {
336 hwwrite(vortex->mmio, 0x242C8 + i * 0x24, coefs[i][0]);
337 hwwrite(vortex->mmio, 0x242CC + i * 0x24, coefs[i][1]);
338 hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]);
339 hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]);
341 hwwrite(vortex->mmio, 0x24508, arg_0[0]);
342 hwwrite(vortex->mmio, 0x2450C, arg_0[1]);
343 hwwrite(vortex->mmio, 0x24510, arg_0[2]);
344 hwwrite(vortex->mmio, 0x24514, arg_0[3]);
347 static void
348 vortex_XtalkHw_SetLeftXTStates(vortex_t * vortex,
349 xtalk_instate_t const arg_0,
350 xtalk_state_t const coefs)
352 int i;
354 for (i = 0; i < 5; i++) {
355 hwwrite(vortex->mmio, 0x2437C + i * 0x24, coefs[i][0]);
356 hwwrite(vortex->mmio, 0x24380 + i * 0x24, coefs[i][1]);
357 hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]);
358 hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]);
360 hwwrite(vortex->mmio, 0x24518, arg_0[0]);
361 hwwrite(vortex->mmio, 0x2451C, arg_0[1]);
362 hwwrite(vortex->mmio, 0x24520, arg_0[2]);
363 hwwrite(vortex->mmio, 0x24524, arg_0[3]);
366 static void
367 vortex_XtalkHw_SetRightXTStates(vortex_t * vortex,
368 xtalk_instate_t const arg_0,
369 xtalk_state_t const coefs)
371 int i;
373 for (i = 0; i < 5; i++) {
374 hwwrite(vortex->mmio, 0x24430 + i * 0x24, coefs[i][0]);
375 hwwrite(vortex->mmio, 0x24434 + i * 0x24, coefs[i][1]);
376 hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]);
377 hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]);
379 hwwrite(vortex->mmio, 0x24528, arg_0[0]);
380 hwwrite(vortex->mmio, 0x2452C, arg_0[1]);
381 hwwrite(vortex->mmio, 0x24530, arg_0[2]);
382 hwwrite(vortex->mmio, 0x24534, arg_0[3]);
385 #if 0
386 static void
387 vortex_XtalkHw_GetLeftEQ(vortex_t * vortex, short *arg_0, short *arg_4,
388 xtalk_coefs_t coefs)
390 int i;
392 for (i = 0; i < 5; i++) {
393 coefs[i][0] = hwread(vortex->mmio, 0x24200 + i * 0x24);
394 coefs[i][1] = hwread(vortex->mmio, 0x24204 + i * 0x24);
395 coefs[i][2] = hwread(vortex->mmio, 0x24208 + i * 0x24);
396 coefs[i][3] = hwread(vortex->mmio, 0x2420c + i * 0x24);
397 coefs[i][4] = hwread(vortex->mmio, 0x24210 + i * 0x24);
399 *arg_0 = hwread(vortex->mmio, 0x24538) & 0xffff;
400 *arg_4 = hwread(vortex->mmio, 0x2453c) & 0xffff;
403 static void
404 vortex_XtalkHw_GetRightEQ(vortex_t * vortex, short *arg_0, short *arg_4,
405 xtalk_coefs_t coefs)
407 int i;
409 for (i = 0; i < 5; i++) {
410 coefs[i][0] = hwread(vortex->mmio, 0x242b4 + i * 0x24);
411 coefs[i][1] = hwread(vortex->mmio, 0x242b8 + i * 0x24);
412 coefs[i][2] = hwread(vortex->mmio, 0x242bc + i * 0x24);
413 coefs[i][3] = hwread(vortex->mmio, 0x242c0 + i * 0x24);
414 coefs[i][4] = hwread(vortex->mmio, 0x242c4 + i * 0x24);
416 *arg_0 = hwread(vortex->mmio, 0x24540) & 0xffff;
417 *arg_4 = hwread(vortex->mmio, 0x24544) & 0xffff;
420 static void
421 vortex_XtalkHw_GetLeftXT(vortex_t * vortex, short *arg_0, short *arg_4,
422 xtalk_coefs_t coefs)
424 int i;
426 for (i = 0; i < 5; i++) {
427 coefs[i][0] = hwread(vortex->mmio, 0x24368 + i * 0x24);
428 coefs[i][1] = hwread(vortex->mmio, 0x2436C + i * 0x24);
429 coefs[i][2] = hwread(vortex->mmio, 0x24370 + i * 0x24);
430 coefs[i][3] = hwread(vortex->mmio, 0x24374 + i * 0x24);
431 coefs[i][4] = hwread(vortex->mmio, 0x24378 + i * 0x24);
433 *arg_0 = hwread(vortex->mmio, 0x24548) & 0xffff;
434 *arg_4 = hwread(vortex->mmio, 0x2454C) & 0xffff;
437 static void
438 vortex_XtalkHw_GetRightXT(vortex_t * vortex, short *arg_0, short *arg_4,
439 xtalk_coefs_t coefs)
441 int i;
443 for (i = 0; i < 5; i++) {
444 coefs[i][0] = hwread(vortex->mmio, 0x2441C + i * 0x24);
445 coefs[i][1] = hwread(vortex->mmio, 0x24420 + i * 0x24);
446 coefs[i][2] = hwread(vortex->mmio, 0x24424 + i * 0x24);
447 coefs[i][3] = hwread(vortex->mmio, 0x24428 + i * 0x24);
448 coefs[i][4] = hwread(vortex->mmio, 0x2442C + i * 0x24);
450 *arg_0 = hwread(vortex->mmio, 0x24550) & 0xffff;
451 *arg_4 = hwread(vortex->mmio, 0x24554) & 0xffff;
454 static void
455 vortex_XtalkHw_GetLeftEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
456 xtalk_state_t coefs)
458 int i;
460 for (i = 0; i < 5; i++) {
461 coefs[i][0] = hwread(vortex->mmio, 0x24214 + i * 0x24);
462 coefs[i][1] = hwread(vortex->mmio, 0x24218 + i * 0x24);
463 coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24);
464 coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24);
466 arg_0[0] = hwread(vortex->mmio, 0x244F8);
467 arg_0[1] = hwread(vortex->mmio, 0x244FC);
468 arg_0[2] = hwread(vortex->mmio, 0x24500);
469 arg_0[3] = hwread(vortex->mmio, 0x24504);
472 static void
473 vortex_XtalkHw_GetRightEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
474 xtalk_state_t coefs)
476 int i;
478 for (i = 0; i < 5; i++) {
479 coefs[i][0] = hwread(vortex->mmio, 0x242C8 + i * 0x24);
480 coefs[i][1] = hwread(vortex->mmio, 0x242CC + i * 0x24);
481 coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24);
482 coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24);
484 arg_0[0] = hwread(vortex->mmio, 0x24508);
485 arg_0[1] = hwread(vortex->mmio, 0x2450C);
486 arg_0[2] = hwread(vortex->mmio, 0x24510);
487 arg_0[3] = hwread(vortex->mmio, 0x24514);
490 static void
491 vortex_XtalkHw_GetLeftXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
492 xtalk_state_t coefs)
494 int i;
496 for (i = 0; i < 5; i++) {
497 coefs[i][0] = hwread(vortex->mmio, 0x2437C + i * 0x24);
498 coefs[i][1] = hwread(vortex->mmio, 0x24380 + i * 0x24);
499 coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24);
500 coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24);
502 arg_0[0] = hwread(vortex->mmio, 0x24518);
503 arg_0[1] = hwread(vortex->mmio, 0x2451C);
504 arg_0[2] = hwread(vortex->mmio, 0x24520);
505 arg_0[3] = hwread(vortex->mmio, 0x24524);
508 static void
509 vortex_XtalkHw_GetRightXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
510 xtalk_state_t coefs)
512 int i;
514 for (i = 0; i < 5; i++) {
515 coefs[i][0] = hwread(vortex->mmio, 0x24430 + i * 0x24);
516 coefs[i][1] = hwread(vortex->mmio, 0x24434 + i * 0x24);
517 coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24);
518 coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24);
520 arg_0[0] = hwread(vortex->mmio, 0x24528);
521 arg_0[1] = hwread(vortex->mmio, 0x2452C);
522 arg_0[2] = hwread(vortex->mmio, 0x24530);
523 arg_0[3] = hwread(vortex->mmio, 0x24534);
526 #endif
527 /* Gains */
529 static void
530 vortex_XtalkHw_SetGains(vortex_t * vortex, xtalk_gains_t const gains)
532 int i;
534 for (i = 0; i < XTGAINS_SZ; i++) {
535 hwwrite(vortex->mmio, 0x244D0 + (i * 4), gains[i]);
539 static void
540 vortex_XtalkHw_SetGainsAllChan(vortex_t * vortex)
542 vortex_XtalkHw_SetGains(vortex, asXtalkGainsAllChan);
545 #if 0
546 static void vortex_XtalkHw_GetGains(vortex_t * vortex, xtalk_gains_t gains)
548 int i;
550 for (i = 0; i < XTGAINS_SZ; i++)
551 gains[i] = hwread(vortex->mmio, 0x244D0 + i * 4);
554 #endif
555 /* Delay parameters */
557 static void
558 vortex_XtalkHw_SetDelay(vortex_t * vortex, unsigned short right,
559 unsigned short left)
561 u32 esp0 = 0;
563 esp0 &= 0x1FFFFFFF;
564 esp0 |= 0xA0000000;
565 esp0 = (esp0 & 0xffffE0ff) | ((right & 0x1F) << 8);
566 esp0 = (esp0 & 0xfffc1fff) | ((left & 0x1F) << 0xd);
568 hwwrite(vortex->mmio, 0x24660, esp0);
571 static void
572 vortex_XtalkHw_SetLeftDline(vortex_t * vortex, xtalk_dline_t const dline)
574 int i;
576 for (i = 0; i < 0x20; i++) {
577 hwwrite(vortex->mmio, 0x24000 + (i << 2), dline[i] & 0xffff);
578 hwwrite(vortex->mmio, 0x24080 + (i << 2), dline[i] >> 0x10);
582 static void
583 vortex_XtalkHw_SetRightDline(vortex_t * vortex, xtalk_dline_t const dline)
585 int i;
587 for (i = 0; i < 0x20; i++) {
588 hwwrite(vortex->mmio, 0x24100 + (i << 2), dline[i] & 0xffff);
589 hwwrite(vortex->mmio, 0x24180 + (i << 2), dline[i] >> 0x10);
593 #if 0
594 static void
595 vortex_XtalkHw_GetDelay(vortex_t * vortex, unsigned short *right,
596 unsigned short *left)
598 int esp0;
600 esp0 = hwread(vortex->mmio, 0x24660);
601 *right = (esp0 >> 8) & 0x1f;
602 *left = (esp0 >> 0xd) & 0x1f;
605 static void vortex_XtalkHw_GetLeftDline(vortex_t * vortex, xtalk_dline_t dline)
607 int i;
609 for (i = 0; i < 0x20; i++) {
610 dline[i] =
611 (hwread(vortex->mmio, 0x24000 + (i << 2)) & 0xffff) |
612 (hwread(vortex->mmio, 0x24080 + (i << 2)) << 0x10);
616 static void vortex_XtalkHw_GetRightDline(vortex_t * vortex, xtalk_dline_t dline)
618 int i;
620 for (i = 0; i < 0x20; i++) {
621 dline[i] =
622 (hwread(vortex->mmio, 0x24100 + (i << 2)) & 0xffff) |
623 (hwread(vortex->mmio, 0x24180 + (i << 2)) << 0x10);
627 #endif
628 /* Control/Global stuff */
630 #if 0
631 static void vortex_XtalkHw_SetControlReg(vortex_t * vortex, u32 ctrl)
633 hwwrite(vortex->mmio, 0x24660, ctrl);
635 static void vortex_XtalkHw_GetControlReg(vortex_t * vortex, u32 *ctrl)
637 *ctrl = hwread(vortex->mmio, 0x24660);
639 #endif
640 static void vortex_XtalkHw_SetSampleRate(vortex_t * vortex, u32 sr)
642 u32 temp;
644 temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
645 temp = (temp & 0xffffff07) | ((sr & 0x1f) << 3);
646 hwwrite(vortex->mmio, 0x24660, temp);
649 #if 0
650 static void vortex_XtalkHw_GetSampleRate(vortex_t * vortex, u32 *sr)
652 *sr = (hwread(vortex->mmio, 0x24660) >> 3) & 0x1f;
655 #endif
656 static void vortex_XtalkHw_Enable(vortex_t * vortex)
658 u32 temp;
660 temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
661 temp |= 1;
662 hwwrite(vortex->mmio, 0x24660, temp);
666 static void vortex_XtalkHw_Disable(vortex_t * vortex)
668 u32 temp;
670 temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
671 temp &= 0xfffffffe;
672 hwwrite(vortex->mmio, 0x24660, temp);
676 static void vortex_XtalkHw_ZeroIO(vortex_t * vortex)
678 int i;
680 for (i = 0; i < 20; i++)
681 hwwrite(vortex->mmio, 0x24600 + (i << 2), 0);
682 for (i = 0; i < 4; i++)
683 hwwrite(vortex->mmio, 0x24650 + (i << 2), 0);
686 static void vortex_XtalkHw_ZeroState(vortex_t * vortex)
688 vortex_XtalkHw_ZeroIO(vortex); // inlined
690 vortex_XtalkHw_SetLeftEQ(vortex, 0, 0, asXtalkCoefsZeros);
691 vortex_XtalkHw_SetRightEQ(vortex, 0, 0, asXtalkCoefsZeros);
693 vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros);
694 vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros);
696 vortex_XtalkHw_SetGains(vortex, asXtalkGainsZeros); // inlined
698 vortex_XtalkHw_SetDelay(vortex, 0, 0); // inlined
700 vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros); // inlined
701 vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros); // inlined
702 vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros); // inlined
703 vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros); // inlined
705 vortex_XtalkHw_SetLeftEQStates(vortex, asXtalkInStateZeros,
706 asXtalkOutStateZeros);
707 vortex_XtalkHw_SetRightEQStates(vortex, asXtalkInStateZeros,
708 asXtalkOutStateZeros);
709 vortex_XtalkHw_SetLeftXTStates(vortex, asXtalkInStateZeros,
710 asXtalkOutStateZeros);
711 vortex_XtalkHw_SetRightXTStates(vortex, asXtalkInStateZeros,
712 asXtalkOutStateZeros);
715 static void vortex_XtalkHw_ProgramPipe(vortex_t * vortex)
718 vortex_XtalkHw_SetLeftEQ(vortex, 0, 1, asXtalkCoefsPipe);
719 vortex_XtalkHw_SetRightEQ(vortex, 0, 1, asXtalkCoefsPipe);
720 vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros);
721 vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros);
723 vortex_XtalkHw_SetDelay(vortex, 0, 0); // inlined
726 static void vortex_XtalkHw_ProgramXtalkWide(vortex_t * vortex)
729 vortex_XtalkHw_SetLeftEQ(vortex, sXtalkWideKLeftEq,
730 sXtalkWideShiftLeftEq, asXtalkWideCoefsLeftEq);
731 vortex_XtalkHw_SetRightEQ(vortex, sXtalkWideKRightEq,
732 sXtalkWideShiftRightEq,
733 asXtalkWideCoefsRightEq);
734 vortex_XtalkHw_SetLeftXT(vortex, sXtalkWideKLeftXt,
735 sXtalkWideShiftLeftXt, asXtalkWideCoefsLeftXt);
736 vortex_XtalkHw_SetRightXT(vortex, sXtalkWideKLeftXt,
737 sXtalkWideShiftLeftXt,
738 asXtalkWideCoefsLeftXt);
740 vortex_XtalkHw_SetDelay(vortex, wXtalkWideRightDelay, wXtalkWideLeftDelay); // inlined
743 static void vortex_XtalkHw_ProgramXtalkNarrow(vortex_t * vortex)
746 vortex_XtalkHw_SetLeftEQ(vortex, sXtalkNarrowKLeftEq,
747 sXtalkNarrowShiftLeftEq,
748 asXtalkNarrowCoefsLeftEq);
749 vortex_XtalkHw_SetRightEQ(vortex, sXtalkNarrowKRightEq,
750 sXtalkNarrowShiftRightEq,
751 asXtalkNarrowCoefsRightEq);
752 vortex_XtalkHw_SetLeftXT(vortex, sXtalkNarrowKLeftXt,
753 sXtalkNarrowShiftLeftXt,
754 asXtalkNarrowCoefsLeftXt);
755 vortex_XtalkHw_SetRightXT(vortex, sXtalkNarrowKLeftXt,
756 sXtalkNarrowShiftLeftXt,
757 asXtalkNarrowCoefsLeftXt);
759 vortex_XtalkHw_SetDelay(vortex, wXtalkNarrowRightDelay, wXtalkNarrowLeftDelay); // inlined
762 static void vortex_XtalkHw_ProgramDiamondXtalk(vortex_t * vortex)
765 //sDiamondKLeftEq,sDiamondKRightXt,asDiamondCoefsLeftEq
766 vortex_XtalkHw_SetLeftEQ(vortex, sDiamondKLeftEq,
767 sDiamondShiftLeftEq, asDiamondCoefsLeftEq);
768 vortex_XtalkHw_SetRightEQ(vortex, sDiamondKRightEq,
769 sDiamondShiftRightEq, asDiamondCoefsRightEq);
770 vortex_XtalkHw_SetLeftXT(vortex, sDiamondKLeftXt,
771 sDiamondShiftLeftXt, asDiamondCoefsLeftXt);
772 vortex_XtalkHw_SetRightXT(vortex, sDiamondKLeftXt,
773 sDiamondShiftLeftXt, asDiamondCoefsLeftXt);
775 vortex_XtalkHw_SetDelay(vortex, wDiamondRightDelay, wDiamondLeftDelay); // inlined
778 static void vortex_XtalkHw_init(vortex_t * vortex)
780 vortex_XtalkHw_ZeroState(vortex);
783 /* End of file */