staging: brcm80211: decreased indentation level of brcms_c_wme_setparams function
[zen-stable.git] / sound / pci / au88x0 / au88x0_xtalk.c
blobb4151e208b719d60d3b55ec209c1e00a927fae9c
1 /***************************************************************************
2 * au88x0_cxtalk.c
4 * Wed Nov 19 16:29:47 2003
5 * Copyright 2003 mjander
6 * mjander@users.sourceforge.org
7 ****************************************************************************/
9 /*
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include "au88x0_xtalk.h"
27 /* Data (a whole lot of data.... ) */
29 static short const sXtalkWideKLeftEq = 0x269C;
30 static short const sXtalkWideKRightEq = 0x269C;
31 static short const sXtalkWideKLeftXt = 0xF25E;
32 static short const sXtalkWideKRightXt = 0xF25E;
33 static short const sXtalkWideShiftLeftEq = 1;
34 static short const sXtalkWideShiftRightEq = 1;
35 static short const sXtalkWideShiftLeftXt = 0;
36 static short const sXtalkWideShiftRightXt = 0;
37 static unsigned short const wXtalkWideLeftDelay = 0xd;
38 static unsigned short const wXtalkWideRightDelay = 0xd;
39 static short const sXtalkNarrowKLeftEq = 0x468D;
40 static short const sXtalkNarrowKRightEq = 0x468D;
41 static short const sXtalkNarrowKLeftXt = 0xF82E;
42 static short const sXtalkNarrowKRightXt = 0xF82E;
43 static short const sXtalkNarrowShiftLeftEq = 0x3;
44 static short const sXtalkNarrowShiftRightEq = 0x3;
45 static short const sXtalkNarrowShiftLeftXt = 0;
46 static short const sXtalkNarrowShiftRightXt = 0;
47 static unsigned short const wXtalkNarrowLeftDelay = 0x7;
48 static unsigned short const wXtalkNarrowRightDelay = 0x7;
50 static xtalk_gains_t const asXtalkGainsDefault = {
51 0x4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000,
52 0x4000
55 static xtalk_gains_t const asXtalkGainsTest = {
56 0x8000, 0x7FFF, 0, 0xFFFF, 0x0001, 0xC000, 0x4000, 0xFFFE, 0x0002,
59 static xtalk_gains_t const asXtalkGains1Chan = {
60 0x7FFF, 0, 0, 0, 0x7FFF, 0, 0, 0, 0, 0
63 // Input gain for 4 A3D slices. One possible input pair is left zero.
64 static xtalk_gains_t const asXtalkGainsAllChan = {
65 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF,
67 //0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff,0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff
69 static xtalk_gains_t const asXtalkGainsZeros;
71 static xtalk_dline_t const alXtalkDlineZeros;
72 static xtalk_dline_t const alXtalkDlineTest = {
73 0xFC18, 0x03E8FFFF, 0x186A0, 0x7960FFFE, 1, 0xFFFFFFFF,
74 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
75 0, 0, 0, 0
78 static xtalk_instate_t const asXtalkInStateZeros;
79 static xtalk_instate_t const asXtalkInStateTest =
80 { 0xFF80, 0x0080, 0xFFFF, 0x0001 };
81 static xtalk_state_t const asXtalkOutStateZeros;
83 static short const sDiamondKLeftEq = 0x401d;
84 static short const sDiamondKRightEq = 0x401d;
85 static short const sDiamondKLeftXt = 0xF90E;
86 static short const sDiamondKRightXt = 0xF90E;
87 static short const sDiamondShiftLeftEq = 1; /* 0xF90E Is this a bug ??? */
88 static short const sDiamondShiftRightEq = 1;
89 static short const sDiamondShiftLeftXt = 0;
90 static short const sDiamondShiftRightXt = 0;
91 static unsigned short const wDiamondLeftDelay = 0xb;
92 static unsigned short const wDiamondRightDelay = 0xb;
94 static xtalk_coefs_t const asXtalkWideCoefsLeftEq = {
95 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
96 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
97 {0x340B, 0xf504, 0x6CE8, 0x0D23, 0x00E4},
98 {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA},
99 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
101 static xtalk_coefs_t const asXtalkWideCoefsRightEq = {
102 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
103 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
104 {0x340B, 0xF504, 0x6CE8, 0x0D23, 0x00E4},
105 {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA},
106 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
108 static xtalk_coefs_t const asXtalkWideCoefsLeftXt = {
109 {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047},
110 {0x6000, 0x206A, 0xC6CA, 0x40FF, 0},
111 {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001},
112 {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0},
113 {0, 0, 0, 0, 0}
115 static xtalk_coefs_t const asXtalkWideCoefsRightXt = {
116 {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047},
117 {0x6000, 0x206A, 0xC6CA, 0x40FF, 0},
118 {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001},
119 {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0},
120 {0, 0, 0, 0, 0}
122 static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = {
123 {0x50B5, 0xD07C, 0x026D, 0xFD21, 0},
124 {0x460F, 0xE44F, 0xF75E, 0xEFA6, 0},
125 {0x556D, 0xDCAB, 0x2098, 0xF0F2, 0},
126 {0x7E03, 0xC1F0, 0x007D, 0xFF89, 0},
127 {0x383E, 0xFD9D, 0xB278, 0x4547, 0}
130 static xtalk_coefs_t const asXtalkNarrowCoefsRightEq = {
131 {0x50B5, 0xD07C, 0x026D, 0xFD21, 0},
132 {0x460F, 0xE44F, 0xF75E, 0xEFA6, 0},
133 {0x556D, 0xDCAB, 0x2098, 0xF0F2, 0},
134 {0x7E03, 0xC1F0, 0x007D, 0xFF89, 0},
135 {0x383E, 0xFD9D, 0xB278, 0x4547, 0}
138 static xtalk_coefs_t const asXtalkNarrowCoefsLeftXt = {
139 {0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0},
140 {0x6777, 0xC915, 0xFEAF, 0x00B1, 0},
141 {0x7762, 0xC7D9, 0x025B, 0xFDA6, 0},
142 {0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0},
143 {0, 0, 0, 0, 0}
146 static xtalk_coefs_t const asXtalkNarrowCoefsRightXt = {
147 {0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0},
148 {0x6777, 0xC915, 0xFEAF, 0x00B1, 0},
149 {0x7762, 0xC7D9, 0x025B, 0xFDA6, 0},
150 {0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0},
151 {0, 0, 0, 0, 0}
154 static xtalk_coefs_t const asXtalkCoefsZeros;
155 static xtalk_coefs_t const asXtalkCoefsPipe = {
156 {0, 0, 0x0FA0, 0, 0},
157 {0, 0, 0x0FA0, 0, 0},
158 {0, 0, 0x0FA0, 0, 0},
159 {0, 0, 0x0FA0, 0, 0},
160 {0, 0, 0x1180, 0, 0},
162 static xtalk_coefs_t const asXtalkCoefsNegPipe = {
163 {0, 0, 0xF380, 0, 0},
164 {0, 0, 0xF380, 0, 0},
165 {0, 0, 0xF380, 0, 0},
166 {0, 0, 0xF380, 0, 0},
167 {0, 0, 0xF200, 0, 0}
170 static xtalk_coefs_t const asXtalkCoefsNumTest = {
171 {0, 0, 0xF380, 0x8000, 0x6D60},
172 {0, 0, 0, 0, 0},
173 {0, 0, 0, 0, 0},
174 {0, 0, 0, 0, 0},
175 {0, 0, 0, 0, 0}
178 static xtalk_coefs_t const asXtalkCoefsDenTest = {
179 {0xC000, 0x2000, 0x4000, 0, 0},
180 {0, 0, 0, 0, 0},
181 {0, 0, 0, 0, 0},
182 {0, 0, 0, 0, 0},
183 {0, 0, 0, 0, 0}
186 static xtalk_state_t const asXtalkOutStateTest = {
187 {0x7FFF, 0x0004, 0xFFFC, 0},
188 {0xFE00, 0x0008, 0xFFF8, 0x4000},
189 {0x200, 0x0010, 0xFFF0, 0xC000},
190 {0x8000, 0x0020, 0xFFE0, 0},
191 {0, 0, 0, 0}
194 static xtalk_coefs_t const asDiamondCoefsLeftEq = {
195 {0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0},
196 {0x45E2, 0xCA51, 0x0448, 0xFCE7, 0},
197 {0xA93E, 0xDBD5, 0x022C, 0x028A, 0},
198 {0, 0, 0, 0, 0},
199 {0, 0, 0, 0, 0}
202 static xtalk_coefs_t const asDiamondCoefsRightEq = {
203 {0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0},
204 {0x45E2, 0xCA51, 0x0448, 0xFCE7, 0},
205 {0xA93E, 0xDBD5, 0x022C, 0x028A, 0},
206 {0, 0, 0, 0, 0},
207 {0, 0, 0, 0, 0}
210 static xtalk_coefs_t const asDiamondCoefsLeftXt = {
211 {0x3B50, 0xFE08, 0xF959, 0x0060, 0},
212 {0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0},
213 {0, 0, 0, 0, 0},
214 {0, 0, 0, 0, 0},
215 {0, 0, 0, 0, 0}
218 static xtalk_coefs_t const asDiamondCoefsRightXt = {
219 {0x3B50, 0xFE08, 0xF959, 0x0060, 0},
220 {0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0},
221 {0, 0, 0, 0, 0},
222 {0, 0, 0, 0, 0},
223 {0, 0, 0, 0, 0}
226 /**/
227 /* XTalk EQ and XT */
228 static void
229 vortex_XtalkHw_SetLeftEQ(vortex_t * vortex, short arg_0, short arg_4,
230 xtalk_coefs_t const coefs)
232 int i;
234 for (i = 0; i < 5; i++) {
235 hwwrite(vortex->mmio, 0x24200 + i * 0x24, coefs[i][0]);
236 hwwrite(vortex->mmio, 0x24204 + i * 0x24, coefs[i][1]);
237 hwwrite(vortex->mmio, 0x24208 + i * 0x24, coefs[i][2]);
238 hwwrite(vortex->mmio, 0x2420c + i * 0x24, coefs[i][3]);
239 hwwrite(vortex->mmio, 0x24210 + i * 0x24, coefs[i][4]);
241 hwwrite(vortex->mmio, 0x24538, arg_0 & 0xffff);
242 hwwrite(vortex->mmio, 0x2453C, arg_4 & 0xffff);
245 static void
246 vortex_XtalkHw_SetRightEQ(vortex_t * vortex, short arg_0, short arg_4,
247 xtalk_coefs_t const coefs)
249 int i;
251 for (i = 0; i < 5; i++) {
252 hwwrite(vortex->mmio, 0x242b4 + i * 0x24, coefs[i][0]);
253 hwwrite(vortex->mmio, 0x242b8 + i * 0x24, coefs[i][1]);
254 hwwrite(vortex->mmio, 0x242bc + i * 0x24, coefs[i][2]);
255 hwwrite(vortex->mmio, 0x242c0 + i * 0x24, coefs[i][3]);
256 hwwrite(vortex->mmio, 0x242c4 + i * 0x24, coefs[i][4]);
258 hwwrite(vortex->mmio, 0x24540, arg_0 & 0xffff);
259 hwwrite(vortex->mmio, 0x24544, arg_4 & 0xffff);
262 static void
263 vortex_XtalkHw_SetLeftXT(vortex_t * vortex, short arg_0, short arg_4,
264 xtalk_coefs_t const coefs)
266 int i;
268 for (i = 0; i < 5; i++) {
269 hwwrite(vortex->mmio, 0x24368 + i * 0x24, coefs[i][0]);
270 hwwrite(vortex->mmio, 0x2436c + i * 0x24, coefs[i][1]);
271 hwwrite(vortex->mmio, 0x24370 + i * 0x24, coefs[i][2]);
272 hwwrite(vortex->mmio, 0x24374 + i * 0x24, coefs[i][3]);
273 hwwrite(vortex->mmio, 0x24378 + i * 0x24, coefs[i][4]);
275 hwwrite(vortex->mmio, 0x24548, arg_0 & 0xffff);
276 hwwrite(vortex->mmio, 0x2454C, arg_4 & 0xffff);
279 static void
280 vortex_XtalkHw_SetRightXT(vortex_t * vortex, short arg_0, short arg_4,
281 xtalk_coefs_t const coefs)
283 int i;
285 for (i = 0; i < 5; i++) {
286 hwwrite(vortex->mmio, 0x2441C + i * 0x24, coefs[i][0]);
287 hwwrite(vortex->mmio, 0x24420 + i * 0x24, coefs[i][1]);
288 hwwrite(vortex->mmio, 0x24424 + i * 0x24, coefs[i][2]);
289 hwwrite(vortex->mmio, 0x24428 + i * 0x24, coefs[i][3]);
290 hwwrite(vortex->mmio, 0x2442C + i * 0x24, coefs[i][4]);
292 hwwrite(vortex->mmio, 0x24550, arg_0 & 0xffff);
293 hwwrite(vortex->mmio, 0x24554, arg_4 & 0xffff);
296 static void
297 vortex_XtalkHw_SetLeftEQStates(vortex_t * vortex,
298 xtalk_instate_t const arg_0,
299 xtalk_state_t const coefs)
301 int i;
303 for (i = 0; i < 5; i++) {
304 hwwrite(vortex->mmio, 0x24214 + i * 0x24, coefs[i][0]);
305 hwwrite(vortex->mmio, 0x24218 + i * 0x24, coefs[i][1]);
306 hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]);
307 hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]);
309 hwwrite(vortex->mmio, 0x244F8 + i * 0x24, arg_0[0]);
310 hwwrite(vortex->mmio, 0x244FC + i * 0x24, arg_0[1]);
311 hwwrite(vortex->mmio, 0x24500 + i * 0x24, arg_0[2]);
312 hwwrite(vortex->mmio, 0x24504 + i * 0x24, arg_0[3]);
315 static void
316 vortex_XtalkHw_SetRightEQStates(vortex_t * vortex,
317 xtalk_instate_t const arg_0,
318 xtalk_state_t const coefs)
320 int i;
322 for (i = 0; i < 5; i++) {
323 hwwrite(vortex->mmio, 0x242C8 + i * 0x24, coefs[i][0]);
324 hwwrite(vortex->mmio, 0x242CC + i * 0x24, coefs[i][1]);
325 hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]);
326 hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]);
328 hwwrite(vortex->mmio, 0x24508 + i * 0x24, arg_0[0]);
329 hwwrite(vortex->mmio, 0x2450C + i * 0x24, arg_0[1]);
330 hwwrite(vortex->mmio, 0x24510 + i * 0x24, arg_0[2]);
331 hwwrite(vortex->mmio, 0x24514 + i * 0x24, arg_0[3]);
334 static void
335 vortex_XtalkHw_SetLeftXTStates(vortex_t * vortex,
336 xtalk_instate_t const arg_0,
337 xtalk_state_t const coefs)
339 int i;
341 for (i = 0; i < 5; i++) {
342 hwwrite(vortex->mmio, 0x2437C + i * 0x24, coefs[i][0]);
343 hwwrite(vortex->mmio, 0x24380 + i * 0x24, coefs[i][1]);
344 hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]);
345 hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]);
347 hwwrite(vortex->mmio, 0x24518 + i * 0x24, arg_0[0]);
348 hwwrite(vortex->mmio, 0x2451C + i * 0x24, arg_0[1]);
349 hwwrite(vortex->mmio, 0x24520 + i * 0x24, arg_0[2]);
350 hwwrite(vortex->mmio, 0x24524 + i * 0x24, arg_0[3]);
353 static void
354 vortex_XtalkHw_SetRightXTStates(vortex_t * vortex,
355 xtalk_instate_t const arg_0,
356 xtalk_state_t const coefs)
358 int i;
360 for (i = 0; i < 5; i++) {
361 hwwrite(vortex->mmio, 0x24430 + i * 0x24, coefs[i][0]);
362 hwwrite(vortex->mmio, 0x24434 + i * 0x24, coefs[i][1]);
363 hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]);
364 hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]);
366 hwwrite(vortex->mmio, 0x24528 + i * 0x24, arg_0[0]);
367 hwwrite(vortex->mmio, 0x2452C + i * 0x24, arg_0[1]);
368 hwwrite(vortex->mmio, 0x24530 + i * 0x24, arg_0[2]);
369 hwwrite(vortex->mmio, 0x24534 + i * 0x24, arg_0[3]);
372 #if 0
373 static void
374 vortex_XtalkHw_GetLeftEQ(vortex_t * vortex, short *arg_0, short *arg_4,
375 xtalk_coefs_t coefs)
377 int i;
379 for (i = 0; i < 5; i++) {
380 coefs[i][0] = hwread(vortex->mmio, 0x24200 + i * 0x24);
381 coefs[i][1] = hwread(vortex->mmio, 0x24204 + i * 0x24);
382 coefs[i][2] = hwread(vortex->mmio, 0x24208 + i * 0x24);
383 coefs[i][3] = hwread(vortex->mmio, 0x2420c + i * 0x24);
384 coefs[i][4] = hwread(vortex->mmio, 0x24210 + i * 0x24);
386 *arg_0 = hwread(vortex->mmio, 0x24538) & 0xffff;
387 *arg_4 = hwread(vortex->mmio, 0x2453c) & 0xffff;
390 static void
391 vortex_XtalkHw_GetRightEQ(vortex_t * vortex, short *arg_0, short *arg_4,
392 xtalk_coefs_t coefs)
394 int i;
396 for (i = 0; i < 5; i++) {
397 coefs[i][0] = hwread(vortex->mmio, 0x242b4 + i * 0x24);
398 coefs[i][1] = hwread(vortex->mmio, 0x242b8 + i * 0x24);
399 coefs[i][2] = hwread(vortex->mmio, 0x242bc + i * 0x24);
400 coefs[i][3] = hwread(vortex->mmio, 0x242c0 + i * 0x24);
401 coefs[i][4] = hwread(vortex->mmio, 0x242c4 + i * 0x24);
403 *arg_0 = hwread(vortex->mmio, 0x24540) & 0xffff;
404 *arg_4 = hwread(vortex->mmio, 0x24544) & 0xffff;
407 static void
408 vortex_XtalkHw_GetLeftXT(vortex_t * vortex, short *arg_0, short *arg_4,
409 xtalk_coefs_t coefs)
411 int i;
413 for (i = 0; i < 5; i++) {
414 coefs[i][0] = hwread(vortex->mmio, 0x24368 + i * 0x24);
415 coefs[i][1] = hwread(vortex->mmio, 0x2436C + i * 0x24);
416 coefs[i][2] = hwread(vortex->mmio, 0x24370 + i * 0x24);
417 coefs[i][3] = hwread(vortex->mmio, 0x24374 + i * 0x24);
418 coefs[i][4] = hwread(vortex->mmio, 0x24378 + i * 0x24);
420 *arg_0 = hwread(vortex->mmio, 0x24548) & 0xffff;
421 *arg_4 = hwread(vortex->mmio, 0x2454C) & 0xffff;
424 static void
425 vortex_XtalkHw_GetRightXT(vortex_t * vortex, short *arg_0, short *arg_4,
426 xtalk_coefs_t coefs)
428 int i;
430 for (i = 0; i < 5; i++) {
431 coefs[i][0] = hwread(vortex->mmio, 0x2441C + i * 0x24);
432 coefs[i][1] = hwread(vortex->mmio, 0x24420 + i * 0x24);
433 coefs[i][2] = hwread(vortex->mmio, 0x24424 + i * 0x24);
434 coefs[i][3] = hwread(vortex->mmio, 0x24428 + i * 0x24);
435 coefs[i][4] = hwread(vortex->mmio, 0x2442C + i * 0x24);
437 *arg_0 = hwread(vortex->mmio, 0x24550) & 0xffff;
438 *arg_4 = hwread(vortex->mmio, 0x24554) & 0xffff;
441 static void
442 vortex_XtalkHw_GetLeftEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
443 xtalk_state_t coefs)
445 int i;
447 for (i = 0; i < 5; i++) {
448 coefs[i][0] = hwread(vortex->mmio, 0x24214 + i * 0x24);
449 coefs[i][1] = hwread(vortex->mmio, 0x24218 + i * 0x24);
450 coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24);
451 coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24);
453 arg_0[0] = hwread(vortex->mmio, 0x244F8 + i * 0x24);
454 arg_0[1] = hwread(vortex->mmio, 0x244FC + i * 0x24);
455 arg_0[2] = hwread(vortex->mmio, 0x24500 + i * 0x24);
456 arg_0[3] = hwread(vortex->mmio, 0x24504 + i * 0x24);
459 static void
460 vortex_XtalkHw_GetRightEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
461 xtalk_state_t coefs)
463 int i;
465 for (i = 0; i < 5; i++) {
466 coefs[i][0] = hwread(vortex->mmio, 0x242C8 + i * 0x24);
467 coefs[i][1] = hwread(vortex->mmio, 0x242CC + i * 0x24);
468 coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24);
469 coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24);
471 arg_0[0] = hwread(vortex->mmio, 0x24508 + i * 0x24);
472 arg_0[1] = hwread(vortex->mmio, 0x2450C + i * 0x24);
473 arg_0[2] = hwread(vortex->mmio, 0x24510 + i * 0x24);
474 arg_0[3] = hwread(vortex->mmio, 0x24514 + i * 0x24);
477 static void
478 vortex_XtalkHw_GetLeftXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
479 xtalk_state_t coefs)
481 int i;
483 for (i = 0; i < 5; i++) {
484 coefs[i][0] = hwread(vortex->mmio, 0x2437C + i * 0x24);
485 coefs[i][1] = hwread(vortex->mmio, 0x24380 + i * 0x24);
486 coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24);
487 coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24);
489 arg_0[0] = hwread(vortex->mmio, 0x24518 + i * 0x24);
490 arg_0[1] = hwread(vortex->mmio, 0x2451C + i * 0x24);
491 arg_0[2] = hwread(vortex->mmio, 0x24520 + i * 0x24);
492 arg_0[3] = hwread(vortex->mmio, 0x24524 + i * 0x24);
495 static void
496 vortex_XtalkHw_GetRightXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
497 xtalk_state_t coefs)
499 int i;
501 for (i = 0; i < 5; i++) {
502 coefs[i][0] = hwread(vortex->mmio, 0x24430 + i * 0x24);
503 coefs[i][1] = hwread(vortex->mmio, 0x24434 + i * 0x24);
504 coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24);
505 coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24);
507 arg_0[0] = hwread(vortex->mmio, 0x24528 + i * 0x24);
508 arg_0[1] = hwread(vortex->mmio, 0x2452C + i * 0x24);
509 arg_0[2] = hwread(vortex->mmio, 0x24530 + i * 0x24);
510 arg_0[3] = hwread(vortex->mmio, 0x24534 + i * 0x24);
513 #endif
514 /* Gains */
516 static void
517 vortex_XtalkHw_SetGains(vortex_t * vortex, xtalk_gains_t const gains)
519 int i;
521 for (i = 0; i < XTGAINS_SZ; i++) {
522 hwwrite(vortex->mmio, 0x244D0 + (i * 4), gains[i]);
526 static void
527 vortex_XtalkHw_SetGainsAllChan(vortex_t * vortex)
529 vortex_XtalkHw_SetGains(vortex, asXtalkGainsAllChan);
532 #if 0
533 static void vortex_XtalkHw_GetGains(vortex_t * vortex, xtalk_gains_t gains)
535 int i;
537 for (i = 0; i < XTGAINS_SZ; i++)
538 gains[i] = hwread(vortex->mmio, 0x244D0 + i * 4);
541 #endif
542 /* Delay parameters */
544 static void
545 vortex_XtalkHw_SetDelay(vortex_t * vortex, unsigned short right,
546 unsigned short left)
548 u32 esp0 = 0;
550 esp0 &= 0x1FFFFFFF;
551 esp0 |= 0xA0000000;
552 esp0 = (esp0 & 0xffffE0ff) | ((right & 0x1F) << 8);
553 esp0 = (esp0 & 0xfffc1fff) | ((left & 0x1F) << 0xd);
555 hwwrite(vortex->mmio, 0x24660, esp0);
558 static void
559 vortex_XtalkHw_SetLeftDline(vortex_t * vortex, xtalk_dline_t const dline)
561 int i;
563 for (i = 0; i < 0x20; i++) {
564 hwwrite(vortex->mmio, 0x24000 + (i << 2), dline[i] & 0xffff);
565 hwwrite(vortex->mmio, 0x24080 + (i << 2), dline[i] >> 0x10);
569 static void
570 vortex_XtalkHw_SetRightDline(vortex_t * vortex, xtalk_dline_t const dline)
572 int i;
574 for (i = 0; i < 0x20; i++) {
575 hwwrite(vortex->mmio, 0x24100 + (i << 2), dline[i] & 0xffff);
576 hwwrite(vortex->mmio, 0x24180 + (i << 2), dline[i] >> 0x10);
580 #if 0
581 static void
582 vortex_XtalkHw_GetDelay(vortex_t * vortex, unsigned short *right,
583 unsigned short *left)
585 int esp0;
587 esp0 = hwread(vortex->mmio, 0x24660);
588 *right = (esp0 >> 8) & 0x1f;
589 *left = (esp0 >> 0xd) & 0x1f;
592 static void vortex_XtalkHw_GetLeftDline(vortex_t * vortex, xtalk_dline_t dline)
594 int i;
596 for (i = 0; i < 0x20; i++) {
597 dline[i] =
598 (hwread(vortex->mmio, 0x24000 + (i << 2)) & 0xffff) |
599 (hwread(vortex->mmio, 0x24080 + (i << 2)) << 0x10);
603 static void vortex_XtalkHw_GetRightDline(vortex_t * vortex, xtalk_dline_t dline)
605 int i;
607 for (i = 0; i < 0x20; i++) {
608 dline[i] =
609 (hwread(vortex->mmio, 0x24100 + (i << 2)) & 0xffff) |
610 (hwread(vortex->mmio, 0x24180 + (i << 2)) << 0x10);
614 #endif
615 /* Control/Global stuff */
617 #if 0
618 static void vortex_XtalkHw_SetControlReg(vortex_t * vortex, u32 ctrl)
620 hwwrite(vortex->mmio, 0x24660, ctrl);
622 static void vortex_XtalkHw_GetControlReg(vortex_t * vortex, u32 *ctrl)
624 *ctrl = hwread(vortex->mmio, 0x24660);
626 #endif
627 static void vortex_XtalkHw_SetSampleRate(vortex_t * vortex, u32 sr)
629 u32 temp;
631 temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
632 temp = (temp & 0xffffff07) | ((sr & 0x1f) << 3);
633 hwwrite(vortex->mmio, 0x24660, temp);
636 #if 0
637 static void vortex_XtalkHw_GetSampleRate(vortex_t * vortex, u32 *sr)
639 *sr = (hwread(vortex->mmio, 0x24660) >> 3) & 0x1f;
642 #endif
643 static void vortex_XtalkHw_Enable(vortex_t * vortex)
645 u32 temp;
647 temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
648 temp |= 1;
649 hwwrite(vortex->mmio, 0x24660, temp);
653 static void vortex_XtalkHw_Disable(vortex_t * vortex)
655 u32 temp;
657 temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
658 temp &= 0xfffffffe;
659 hwwrite(vortex->mmio, 0x24660, temp);
663 static void vortex_XtalkHw_ZeroIO(vortex_t * vortex)
665 int i;
667 for (i = 0; i < 20; i++)
668 hwwrite(vortex->mmio, 0x24600 + (i << 2), 0);
669 for (i = 0; i < 4; i++)
670 hwwrite(vortex->mmio, 0x24650 + (i << 2), 0);
673 static void vortex_XtalkHw_ZeroState(vortex_t * vortex)
675 vortex_XtalkHw_ZeroIO(vortex); // inlined
677 vortex_XtalkHw_SetLeftEQ(vortex, 0, 0, asXtalkCoefsZeros);
678 vortex_XtalkHw_SetRightEQ(vortex, 0, 0, asXtalkCoefsZeros);
680 vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros);
681 vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros);
683 vortex_XtalkHw_SetGains(vortex, asXtalkGainsZeros); // inlined
685 vortex_XtalkHw_SetDelay(vortex, 0, 0); // inlined
687 vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros); // inlined
688 vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros); // inlined
689 vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros); // inlined
690 vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros); // inlined
692 vortex_XtalkHw_SetLeftEQStates(vortex, asXtalkInStateZeros,
693 asXtalkOutStateZeros);
694 vortex_XtalkHw_SetRightEQStates(vortex, asXtalkInStateZeros,
695 asXtalkOutStateZeros);
696 vortex_XtalkHw_SetLeftXTStates(vortex, asXtalkInStateZeros,
697 asXtalkOutStateZeros);
698 vortex_XtalkHw_SetRightXTStates(vortex, asXtalkInStateZeros,
699 asXtalkOutStateZeros);
702 static void vortex_XtalkHw_ProgramPipe(vortex_t * vortex)
705 vortex_XtalkHw_SetLeftEQ(vortex, 0, 1, asXtalkCoefsPipe);
706 vortex_XtalkHw_SetRightEQ(vortex, 0, 1, asXtalkCoefsPipe);
707 vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros);
708 vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros);
710 vortex_XtalkHw_SetDelay(vortex, 0, 0); // inlined
713 static void vortex_XtalkHw_ProgramXtalkWide(vortex_t * vortex)
716 vortex_XtalkHw_SetLeftEQ(vortex, sXtalkWideKLeftEq,
717 sXtalkWideShiftLeftEq, asXtalkWideCoefsLeftEq);
718 vortex_XtalkHw_SetRightEQ(vortex, sXtalkWideKRightEq,
719 sXtalkWideShiftRightEq,
720 asXtalkWideCoefsRightEq);
721 vortex_XtalkHw_SetLeftXT(vortex, sXtalkWideKLeftXt,
722 sXtalkWideShiftLeftXt, asXtalkWideCoefsLeftXt);
723 vortex_XtalkHw_SetRightXT(vortex, sXtalkWideKLeftXt,
724 sXtalkWideShiftLeftXt,
725 asXtalkWideCoefsLeftXt);
727 vortex_XtalkHw_SetDelay(vortex, wXtalkWideRightDelay, wXtalkWideLeftDelay); // inlined
730 static void vortex_XtalkHw_ProgramXtalkNarrow(vortex_t * vortex)
733 vortex_XtalkHw_SetLeftEQ(vortex, sXtalkNarrowKLeftEq,
734 sXtalkNarrowShiftLeftEq,
735 asXtalkNarrowCoefsLeftEq);
736 vortex_XtalkHw_SetRightEQ(vortex, sXtalkNarrowKRightEq,
737 sXtalkNarrowShiftRightEq,
738 asXtalkNarrowCoefsRightEq);
739 vortex_XtalkHw_SetLeftXT(vortex, sXtalkNarrowKLeftXt,
740 sXtalkNarrowShiftLeftXt,
741 asXtalkNarrowCoefsLeftXt);
742 vortex_XtalkHw_SetRightXT(vortex, sXtalkNarrowKLeftXt,
743 sXtalkNarrowShiftLeftXt,
744 asXtalkNarrowCoefsLeftXt);
746 vortex_XtalkHw_SetDelay(vortex, wXtalkNarrowRightDelay, wXtalkNarrowLeftDelay); // inlined
749 static void vortex_XtalkHw_ProgramDiamondXtalk(vortex_t * vortex)
752 //sDiamondKLeftEq,sDiamondKRightXt,asDiamondCoefsLeftEq
753 vortex_XtalkHw_SetLeftEQ(vortex, sDiamondKLeftEq,
754 sDiamondShiftLeftEq, asDiamondCoefsLeftEq);
755 vortex_XtalkHw_SetRightEQ(vortex, sDiamondKRightEq,
756 sDiamondShiftRightEq, asDiamondCoefsRightEq);
757 vortex_XtalkHw_SetLeftXT(vortex, sDiamondKLeftXt,
758 sDiamondShiftLeftXt, asDiamondCoefsLeftXt);
759 vortex_XtalkHw_SetRightXT(vortex, sDiamondKLeftXt,
760 sDiamondShiftLeftXt, asDiamondCoefsLeftXt);
762 vortex_XtalkHw_SetDelay(vortex, wDiamondRightDelay, wDiamondLeftDelay); // inlined
765 static void vortex_XtalkHw_init(vortex_t * vortex)
767 vortex_XtalkHw_ZeroState(vortex);
770 /* End of file */