xref: /linux/sound/pci/au88x0/au88x0_xtalk.c (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1005fdd53SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
21da177e4SLinus Torvalds /***************************************************************************
31da177e4SLinus Torvalds  *            au88x0_cxtalk.c
41da177e4SLinus Torvalds  *
51da177e4SLinus Torvalds  *  Wed Nov 19 16:29:47 2003
61da177e4SLinus Torvalds  *  Copyright  2003  mjander
71da177e4SLinus Torvalds  *  mjander@users.sourceforge.org
81da177e4SLinus Torvalds  ****************************************************************************/
91da177e4SLinus Torvalds 
101da177e4SLinus Torvalds /*
111da177e4SLinus Torvalds  */
121da177e4SLinus Torvalds 
131da177e4SLinus Torvalds #include "au88x0_xtalk.h"
141da177e4SLinus Torvalds 
151da177e4SLinus Torvalds /* Data (a whole lot of data.... ) */
161da177e4SLinus Torvalds 
171da177e4SLinus Torvalds static short const sXtalkWideKLeftEq = 0x269C;
181da177e4SLinus Torvalds static short const sXtalkWideKRightEq = 0x269C;
191da177e4SLinus Torvalds static short const sXtalkWideKLeftXt = 0xF25E;
20*ad1e0b7dSPierre-Louis Bossart static __maybe_unused short const sXtalkWideKRightXt = 0xF25E;
211da177e4SLinus Torvalds static short const sXtalkWideShiftLeftEq = 1;
221da177e4SLinus Torvalds static short const sXtalkWideShiftRightEq = 1;
231da177e4SLinus Torvalds static short const sXtalkWideShiftLeftXt = 0;
24*ad1e0b7dSPierre-Louis Bossart static __maybe_unused short const sXtalkWideShiftRightXt = 0;
251da177e4SLinus Torvalds static unsigned short const wXtalkWideLeftDelay = 0xd;
261da177e4SLinus Torvalds static unsigned short const wXtalkWideRightDelay = 0xd;
271da177e4SLinus Torvalds static short const sXtalkNarrowKLeftEq = 0x468D;
281da177e4SLinus Torvalds static short const sXtalkNarrowKRightEq = 0x468D;
291da177e4SLinus Torvalds static short const sXtalkNarrowKLeftXt = 0xF82E;
30*ad1e0b7dSPierre-Louis Bossart static __maybe_unused short const sXtalkNarrowKRightXt = 0xF82E;
311da177e4SLinus Torvalds static short const sXtalkNarrowShiftLeftEq = 0x3;
321da177e4SLinus Torvalds static short const sXtalkNarrowShiftRightEq = 0x3;
331da177e4SLinus Torvalds static short const sXtalkNarrowShiftLeftXt = 0;
34*ad1e0b7dSPierre-Louis Bossart static __maybe_unused short const sXtalkNarrowShiftRightXt = 0;
351da177e4SLinus Torvalds static unsigned short const wXtalkNarrowLeftDelay = 0x7;
361da177e4SLinus Torvalds static unsigned short const wXtalkNarrowRightDelay = 0x7;
371da177e4SLinus Torvalds 
38*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_gains_t const asXtalkGainsDefault = {
3976474da0SRaymond Yau 	0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
4076474da0SRaymond Yau 	0x4000, 0x4000, 0x4000, 0x4000,	0x4000
411da177e4SLinus Torvalds };
421da177e4SLinus Torvalds 
43*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_gains_t const asXtalkGainsTest = {
4476474da0SRaymond Yau 	0x7fff, 0x8000, 0x0000, 0x0000, 0x0001,
4576474da0SRaymond Yau 	0xffff, 0x4000, 0xc000, 0x0002, 0xfffe
461da177e4SLinus Torvalds };
4776474da0SRaymond Yau 
48*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_gains_t const asXtalkGains1Chan = {
4976474da0SRaymond Yau 	0x7FFF, 0, 0, 0, 0,
5076474da0SRaymond Yau 	0x7FFF, 0, 0, 0, 0,
511da177e4SLinus Torvalds };
521da177e4SLinus Torvalds 
531da177e4SLinus Torvalds // Input gain for 4 A3D slices. One possible input pair is left zero.
541da177e4SLinus Torvalds static xtalk_gains_t const asXtalkGainsAllChan = {
5576474da0SRaymond Yau 	0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0,
5676474da0SRaymond Yau 	0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF,	0
571da177e4SLinus Torvalds };
581da177e4SLinus Torvalds 
5976474da0SRaymond Yau static xtalk_gains_t const asXtalkGainsZeros = {
6076474da0SRaymond Yau 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0
6176474da0SRaymond Yau };
6276474da0SRaymond Yau 
6376474da0SRaymond Yau static xtalk_dline_t const alXtalkDlineZeros = {
6476474da0SRaymond Yau 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6576474da0SRaymond Yau 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
6676474da0SRaymond Yau };
67*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_dline_t const alXtalkDlineTest = {
6876474da0SRaymond Yau 	0x0000fc18, 0xfff03e8, 0x000186a0, 0xfffe7960, 1, 0xffffffff, 0, 0,
6976474da0SRaymond Yau 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
7076474da0SRaymond Yau 	0, 0, 0, 0, 0, 0, 0, 0
7176474da0SRaymond Yau };
7276474da0SRaymond Yau 
7376474da0SRaymond Yau static xtalk_instate_t const asXtalkInStateZeros = {
741da177e4SLinus Torvalds 	0, 0, 0, 0
751da177e4SLinus Torvalds };
761da177e4SLinus Torvalds 
77*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_instate_t const asXtalkInStateTest = {
7876474da0SRaymond Yau 	0x0080, 0xff80, 0x0001, 0xffff
7976474da0SRaymond Yau };
8076474da0SRaymond Yau 
8176474da0SRaymond Yau static xtalk_state_t const asXtalkOutStateZeros = {
8276474da0SRaymond Yau 	{0, 0, 0, 0},
8376474da0SRaymond Yau 	{0, 0, 0, 0},
8476474da0SRaymond Yau 	{0, 0, 0, 0},
8576474da0SRaymond Yau 	{0, 0, 0, 0},
8676474da0SRaymond Yau 	{0, 0, 0, 0}
8776474da0SRaymond Yau };
886581f4e7STakashi Iwai 
891da177e4SLinus Torvalds static short const sDiamondKLeftEq = 0x401d;
901da177e4SLinus Torvalds static short const sDiamondKRightEq = 0x401d;
911da177e4SLinus Torvalds static short const sDiamondKLeftXt = 0xF90E;
92*ad1e0b7dSPierre-Louis Bossart static __maybe_unused short const sDiamondKRightXt = 0xF90E;
9376474da0SRaymond Yau static short const sDiamondShiftLeftEq = 1;
941da177e4SLinus Torvalds static short const sDiamondShiftRightEq = 1;
951da177e4SLinus Torvalds static short const sDiamondShiftLeftXt = 0;
96*ad1e0b7dSPierre-Louis Bossart static __maybe_unused short const sDiamondShiftRightXt = 0;
971da177e4SLinus Torvalds static unsigned short const wDiamondLeftDelay = 0xb;
981da177e4SLinus Torvalds static unsigned short const wDiamondRightDelay = 0xb;
991da177e4SLinus Torvalds 
1001da177e4SLinus Torvalds static xtalk_coefs_t const asXtalkWideCoefsLeftEq = {
1011da177e4SLinus Torvalds 	{0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
1021da177e4SLinus Torvalds 	{0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
10376474da0SRaymond Yau 	{0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
10476474da0SRaymond Yau 	{0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
1051da177e4SLinus Torvalds 	{0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
1061da177e4SLinus Torvalds };
1071da177e4SLinus Torvalds static xtalk_coefs_t const asXtalkWideCoefsRightEq = {
1081da177e4SLinus Torvalds 	{0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
1091da177e4SLinus Torvalds 	{0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
11076474da0SRaymond Yau 	{0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
11176474da0SRaymond Yau 	{0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
1121da177e4SLinus Torvalds 	{0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
1131da177e4SLinus Torvalds };
1141da177e4SLinus Torvalds static xtalk_coefs_t const asXtalkWideCoefsLeftXt = {
11576474da0SRaymond Yau 	{0x55c6, 0xc97b, 0x005b, 0x0047, 0},
11676474da0SRaymond Yau 	{0x6a60, 0xca20, 0xffc6, 0x0040, 0},
11776474da0SRaymond Yau 	{0x6411, 0xd711, 0xfca1, 0x0190, 0},
11876474da0SRaymond Yau 	{0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
1191da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
1201da177e4SLinus Torvalds };
121*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_coefs_t const asXtalkWideCoefsRightXt = {
12276474da0SRaymond Yau 	{0x55c6, 0xc97b, 0x005b, 0x0047, 0},
12376474da0SRaymond Yau 	{0x6a60, 0xca20, 0xffc6, 0x0040, 0},
12476474da0SRaymond Yau 	{0x6411, 0xd711, 0xfca1, 0x0190, 0},
12576474da0SRaymond Yau 	{0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
1261da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
1271da177e4SLinus Torvalds };
1281da177e4SLinus Torvalds static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = {
1291da177e4SLinus Torvalds 	{0x50B5, 0xD07C, 0x026D, 0xFD21, 0},
1301da177e4SLinus Torvalds 	{0x460F, 0xE44F, 0xF75E, 0xEFA6, 0},
1311da177e4SLinus Torvalds 	{0x556D, 0xDCAB, 0x2098, 0xF0F2, 0},
1321da177e4SLinus Torvalds 	{0x7E03, 0xC1F0, 0x007D, 0xFF89, 0},
1331da177e4SLinus Torvalds 	{0x383E, 0xFD9D, 0xB278, 0x4547, 0}
1341da177e4SLinus Torvalds };
1351da177e4SLinus Torvalds 
1361da177e4SLinus Torvalds static xtalk_coefs_t const asXtalkNarrowCoefsRightEq = {
1371da177e4SLinus Torvalds 	{0x50B5, 0xD07C, 0x026D, 0xFD21, 0},
1381da177e4SLinus Torvalds 	{0x460F, 0xE44F, 0xF75E, 0xEFA6, 0},
1391da177e4SLinus Torvalds 	{0x556D, 0xDCAB, 0x2098, 0xF0F2, 0},
1401da177e4SLinus Torvalds 	{0x7E03, 0xC1F0, 0x007D, 0xFF89, 0},
1411da177e4SLinus Torvalds 	{0x383E, 0xFD9D, 0xB278, 0x4547, 0}
1421da177e4SLinus Torvalds };
1431da177e4SLinus Torvalds 
1441da177e4SLinus Torvalds static xtalk_coefs_t const asXtalkNarrowCoefsLeftXt = {
1451da177e4SLinus Torvalds 	{0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0},
1461da177e4SLinus Torvalds 	{0x6777, 0xC915, 0xFEAF, 0x00B1, 0},
1471da177e4SLinus Torvalds 	{0x7762, 0xC7D9, 0x025B, 0xFDA6, 0},
1481da177e4SLinus Torvalds 	{0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0},
1491da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
1501da177e4SLinus Torvalds };
1511da177e4SLinus Torvalds 
152*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_coefs_t const asXtalkNarrowCoefsRightXt = {
1531da177e4SLinus Torvalds 	{0x3CB2, 0xDF49, 0xF6EA, 0x095B, 0},
1541da177e4SLinus Torvalds 	{0x6777, 0xC915, 0xFEAF, 0x00B1, 0},
1551da177e4SLinus Torvalds 	{0x7762, 0xC7D9, 0x025B, 0xFDA6, 0},
1561da177e4SLinus Torvalds 	{0x6B7A, 0xD2AA, 0xF2FB, 0x0B64, 0},
1571da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
1581da177e4SLinus Torvalds };
1591da177e4SLinus Torvalds 
16076474da0SRaymond Yau static xtalk_coefs_t const asXtalkCoefsZeros = {
16176474da0SRaymond Yau 	{0, 0, 0, 0, 0},
16276474da0SRaymond Yau 	{0, 0, 0, 0, 0},
16376474da0SRaymond Yau 	{0, 0, 0, 0, 0},
16476474da0SRaymond Yau 	{0, 0, 0, 0, 0},
16576474da0SRaymond Yau 	{0, 0, 0, 0, 0}
16676474da0SRaymond Yau };
16776474da0SRaymond Yau 
1681da177e4SLinus Torvalds static xtalk_coefs_t const asXtalkCoefsPipe = {
1691da177e4SLinus Torvalds 	{0, 0, 0x0FA0, 0, 0},
1701da177e4SLinus Torvalds 	{0, 0, 0x0FA0, 0, 0},
1711da177e4SLinus Torvalds 	{0, 0, 0x0FA0, 0, 0},
1721da177e4SLinus Torvalds 	{0, 0, 0x0FA0, 0, 0},
1731da177e4SLinus Torvalds 	{0, 0, 0x1180, 0, 0},
1741da177e4SLinus Torvalds };
175*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_coefs_t const asXtalkCoefsNegPipe = {
1761da177e4SLinus Torvalds 	{0, 0, 0xF380, 0, 0},
1771da177e4SLinus Torvalds 	{0, 0, 0xF380, 0, 0},
1781da177e4SLinus Torvalds 	{0, 0, 0xF380, 0, 0},
1791da177e4SLinus Torvalds 	{0, 0, 0xF380, 0, 0},
1801da177e4SLinus Torvalds 	{0, 0, 0xF200, 0, 0}
1811da177e4SLinus Torvalds };
1821da177e4SLinus Torvalds 
183*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_coefs_t const asXtalkCoefsNumTest = {
1841da177e4SLinus Torvalds 	{0, 0, 0xF380, 0x8000, 0x6D60},
1851da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
1861da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
1871da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
1881da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
1891da177e4SLinus Torvalds };
1901da177e4SLinus Torvalds 
191*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_coefs_t const asXtalkCoefsDenTest = {
1921da177e4SLinus Torvalds 	{0xC000, 0x2000, 0x4000, 0, 0},
1931da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
1941da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
1951da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
1961da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
1971da177e4SLinus Torvalds };
1981da177e4SLinus Torvalds 
199*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_state_t const asXtalkOutStateTest = {
2001da177e4SLinus Torvalds 	{0x7FFF, 0x0004, 0xFFFC, 0},
2011da177e4SLinus Torvalds 	{0xFE00, 0x0008, 0xFFF8, 0x4000},
20276474da0SRaymond Yau 	{0x0200, 0x0010, 0xFFF0, 0xC000},
2031da177e4SLinus Torvalds 	{0x8000, 0x0020, 0xFFE0, 0},
2041da177e4SLinus Torvalds 	{0, 0, 0, 0}
2051da177e4SLinus Torvalds };
2061da177e4SLinus Torvalds 
2071da177e4SLinus Torvalds static xtalk_coefs_t const asDiamondCoefsLeftEq = {
2081da177e4SLinus Torvalds 	{0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0},
2091da177e4SLinus Torvalds 	{0x45E2, 0xCA51, 0x0448, 0xFCE7, 0},
2101da177e4SLinus Torvalds 	{0xA93E, 0xDBD5, 0x022C, 0x028A, 0},
2111da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
2121da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
2131da177e4SLinus Torvalds };
2141da177e4SLinus Torvalds 
2151da177e4SLinus Torvalds static xtalk_coefs_t const asDiamondCoefsRightEq = {
2161da177e4SLinus Torvalds 	{0x0F1E, 0x2D05, 0xF8E3, 0x07C8, 0},
2171da177e4SLinus Torvalds 	{0x45E2, 0xCA51, 0x0448, 0xFCE7, 0},
2181da177e4SLinus Torvalds 	{0xA93E, 0xDBD5, 0x022C, 0x028A, 0},
2191da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
2201da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
2211da177e4SLinus Torvalds };
2221da177e4SLinus Torvalds 
2231da177e4SLinus Torvalds static xtalk_coefs_t const asDiamondCoefsLeftXt = {
2241da177e4SLinus Torvalds 	{0x3B50, 0xFE08, 0xF959, 0x0060, 0},
2251da177e4SLinus Torvalds 	{0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0},
2261da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
2271da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
2281da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
2291da177e4SLinus Torvalds };
2301da177e4SLinus Torvalds 
231*ad1e0b7dSPierre-Louis Bossart static __maybe_unused xtalk_coefs_t const asDiamondCoefsRightXt = {
2321da177e4SLinus Torvalds 	{0x3B50, 0xFE08, 0xF959, 0x0060, 0},
2331da177e4SLinus Torvalds 	{0x9FCB, 0xD8F1, 0x00A2, 0x003A, 0},
2341da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
2351da177e4SLinus Torvalds 	{0, 0, 0, 0, 0},
2361da177e4SLinus Torvalds 	{0, 0, 0, 0, 0}
2371da177e4SLinus Torvalds };
2381da177e4SLinus Torvalds 
2391da177e4SLinus Torvalds  /**/
2401da177e4SLinus Torvalds /* XTalk EQ and XT */
2411da177e4SLinus Torvalds static void
vortex_XtalkHw_SetLeftEQ(vortex_t * vortex,short arg_0,short arg_4,xtalk_coefs_t const coefs)2421da177e4SLinus Torvalds vortex_XtalkHw_SetLeftEQ(vortex_t * vortex, short arg_0, short arg_4,
2431da177e4SLinus Torvalds 			 xtalk_coefs_t const coefs)
2441da177e4SLinus Torvalds {
2451da177e4SLinus Torvalds 	int i;
2461da177e4SLinus Torvalds 
2471da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
2481da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24200 + i * 0x24, coefs[i][0]);
2491da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24204 + i * 0x24, coefs[i][1]);
2501da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24208 + i * 0x24, coefs[i][2]);
2511da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x2420c + i * 0x24, coefs[i][3]);
2521da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24210 + i * 0x24, coefs[i][4]);
2531da177e4SLinus Torvalds 	}
2541da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24538, arg_0 & 0xffff);
2551da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x2453C, arg_4 & 0xffff);
2561da177e4SLinus Torvalds }
2571da177e4SLinus Torvalds 
2581da177e4SLinus Torvalds static void
vortex_XtalkHw_SetRightEQ(vortex_t * vortex,short arg_0,short arg_4,xtalk_coefs_t const coefs)2591da177e4SLinus Torvalds vortex_XtalkHw_SetRightEQ(vortex_t * vortex, short arg_0, short arg_4,
2601da177e4SLinus Torvalds 			  xtalk_coefs_t const coefs)
2611da177e4SLinus Torvalds {
2621da177e4SLinus Torvalds 	int i;
2631da177e4SLinus Torvalds 
2641da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
2651da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x242b4 + i * 0x24, coefs[i][0]);
2661da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x242b8 + i * 0x24, coefs[i][1]);
2671da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x242bc + i * 0x24, coefs[i][2]);
2681da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x242c0 + i * 0x24, coefs[i][3]);
2691da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x242c4 + i * 0x24, coefs[i][4]);
2701da177e4SLinus Torvalds 	}
2711da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24540, arg_0 & 0xffff);
2721da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24544, arg_4 & 0xffff);
2731da177e4SLinus Torvalds }
2741da177e4SLinus Torvalds 
2751da177e4SLinus Torvalds static void
vortex_XtalkHw_SetLeftXT(vortex_t * vortex,short arg_0,short arg_4,xtalk_coefs_t const coefs)2761da177e4SLinus Torvalds vortex_XtalkHw_SetLeftXT(vortex_t * vortex, short arg_0, short arg_4,
2771da177e4SLinus Torvalds 			 xtalk_coefs_t const coefs)
2781da177e4SLinus Torvalds {
2791da177e4SLinus Torvalds 	int i;
2801da177e4SLinus Torvalds 
2811da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
2821da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24368 + i * 0x24, coefs[i][0]);
2831da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x2436c + i * 0x24, coefs[i][1]);
2841da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24370 + i * 0x24, coefs[i][2]);
2851da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24374 + i * 0x24, coefs[i][3]);
2861da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24378 + i * 0x24, coefs[i][4]);
2871da177e4SLinus Torvalds 	}
2881da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24548, arg_0 & 0xffff);
2891da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x2454C, arg_4 & 0xffff);
2901da177e4SLinus Torvalds }
2911da177e4SLinus Torvalds 
2921da177e4SLinus Torvalds static void
vortex_XtalkHw_SetRightXT(vortex_t * vortex,short arg_0,short arg_4,xtalk_coefs_t const coefs)2931da177e4SLinus Torvalds vortex_XtalkHw_SetRightXT(vortex_t * vortex, short arg_0, short arg_4,
2941da177e4SLinus Torvalds 			  xtalk_coefs_t const coefs)
2951da177e4SLinus Torvalds {
2961da177e4SLinus Torvalds 	int i;
2971da177e4SLinus Torvalds 
2981da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
2991da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x2441C + i * 0x24, coefs[i][0]);
3001da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24420 + i * 0x24, coefs[i][1]);
3011da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24424 + i * 0x24, coefs[i][2]);
3021da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24428 + i * 0x24, coefs[i][3]);
3031da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x2442C + i * 0x24, coefs[i][4]);
3041da177e4SLinus Torvalds 	}
3051da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24550, arg_0 & 0xffff);
3061da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24554, arg_4 & 0xffff);
3071da177e4SLinus Torvalds }
3081da177e4SLinus Torvalds 
3091da177e4SLinus Torvalds static void
vortex_XtalkHw_SetLeftEQStates(vortex_t * vortex,xtalk_instate_t const arg_0,xtalk_state_t const coefs)3101da177e4SLinus Torvalds vortex_XtalkHw_SetLeftEQStates(vortex_t * vortex,
3111da177e4SLinus Torvalds 			       xtalk_instate_t const arg_0,
3121da177e4SLinus Torvalds 			       xtalk_state_t const coefs)
3131da177e4SLinus Torvalds {
3141da177e4SLinus Torvalds 	int i;
3151da177e4SLinus Torvalds 
3161da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
3171da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24214 + i * 0x24, coefs[i][0]);
3181da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24218 + i * 0x24, coefs[i][1]);
3191da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]);
3201da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]);
3211da177e4SLinus Torvalds 	}
3229489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x244F8, arg_0[0]);
3239489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x244FC, arg_0[1]);
3249489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24500, arg_0[2]);
3259489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24504, arg_0[3]);
3261da177e4SLinus Torvalds }
3271da177e4SLinus Torvalds 
3281da177e4SLinus Torvalds static void
vortex_XtalkHw_SetRightEQStates(vortex_t * vortex,xtalk_instate_t const arg_0,xtalk_state_t const coefs)3291da177e4SLinus Torvalds vortex_XtalkHw_SetRightEQStates(vortex_t * vortex,
3301da177e4SLinus Torvalds 				xtalk_instate_t const arg_0,
3311da177e4SLinus Torvalds 				xtalk_state_t const coefs)
3321da177e4SLinus Torvalds {
3331da177e4SLinus Torvalds 	int i;
3341da177e4SLinus Torvalds 
3351da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
3361da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x242C8 + i * 0x24, coefs[i][0]);
3371da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x242CC + i * 0x24, coefs[i][1]);
3381da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]);
3391da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]);
3401da177e4SLinus Torvalds 	}
3419489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24508, arg_0[0]);
3429489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x2450C, arg_0[1]);
3439489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24510, arg_0[2]);
3449489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24514, arg_0[3]);
3451da177e4SLinus Torvalds }
3461da177e4SLinus Torvalds 
3471da177e4SLinus Torvalds static void
vortex_XtalkHw_SetLeftXTStates(vortex_t * vortex,xtalk_instate_t const arg_0,xtalk_state_t const coefs)3481da177e4SLinus Torvalds vortex_XtalkHw_SetLeftXTStates(vortex_t * vortex,
3491da177e4SLinus Torvalds 			       xtalk_instate_t const arg_0,
3501da177e4SLinus Torvalds 			       xtalk_state_t const coefs)
3511da177e4SLinus Torvalds {
3521da177e4SLinus Torvalds 	int i;
3531da177e4SLinus Torvalds 
3541da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
3551da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x2437C + i * 0x24, coefs[i][0]);
3561da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24380 + i * 0x24, coefs[i][1]);
3571da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]);
3581da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]);
3591da177e4SLinus Torvalds 	}
3609489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24518, arg_0[0]);
3619489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x2451C, arg_0[1]);
3629489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24520, arg_0[2]);
3639489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24524, arg_0[3]);
3641da177e4SLinus Torvalds }
3651da177e4SLinus Torvalds 
3661da177e4SLinus Torvalds static void
vortex_XtalkHw_SetRightXTStates(vortex_t * vortex,xtalk_instate_t const arg_0,xtalk_state_t const coefs)3671da177e4SLinus Torvalds vortex_XtalkHw_SetRightXTStates(vortex_t * vortex,
3681da177e4SLinus Torvalds 				xtalk_instate_t const arg_0,
3691da177e4SLinus Torvalds 				xtalk_state_t const coefs)
3701da177e4SLinus Torvalds {
3711da177e4SLinus Torvalds 	int i;
3721da177e4SLinus Torvalds 
3731da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
3741da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24430 + i * 0x24, coefs[i][0]);
3751da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24434 + i * 0x24, coefs[i][1]);
3761da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]);
3771da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]);
3781da177e4SLinus Torvalds 	}
3799489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24528, arg_0[0]);
3809489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x2452C, arg_0[1]);
3819489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24530, arg_0[2]);
3829489f2c6SRaymond Yau 	hwwrite(vortex->mmio, 0x24534, arg_0[3]);
3831da177e4SLinus Torvalds }
3841da177e4SLinus Torvalds 
3851da177e4SLinus Torvalds #if 0
3861da177e4SLinus Torvalds static void
3871da177e4SLinus Torvalds vortex_XtalkHw_GetLeftEQ(vortex_t * vortex, short *arg_0, short *arg_4,
3881da177e4SLinus Torvalds 			 xtalk_coefs_t coefs)
3891da177e4SLinus Torvalds {
3901da177e4SLinus Torvalds 	int i;
3911da177e4SLinus Torvalds 
3921da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
3931da177e4SLinus Torvalds 		coefs[i][0] = hwread(vortex->mmio, 0x24200 + i * 0x24);
3941da177e4SLinus Torvalds 		coefs[i][1] = hwread(vortex->mmio, 0x24204 + i * 0x24);
3951da177e4SLinus Torvalds 		coefs[i][2] = hwread(vortex->mmio, 0x24208 + i * 0x24);
3961da177e4SLinus Torvalds 		coefs[i][3] = hwread(vortex->mmio, 0x2420c + i * 0x24);
3971da177e4SLinus Torvalds 		coefs[i][4] = hwread(vortex->mmio, 0x24210 + i * 0x24);
3981da177e4SLinus Torvalds 	}
3991da177e4SLinus Torvalds 	*arg_0 = hwread(vortex->mmio, 0x24538) & 0xffff;
4001da177e4SLinus Torvalds 	*arg_4 = hwread(vortex->mmio, 0x2453c) & 0xffff;
4011da177e4SLinus Torvalds }
4021da177e4SLinus Torvalds 
4031da177e4SLinus Torvalds static void
4041da177e4SLinus Torvalds vortex_XtalkHw_GetRightEQ(vortex_t * vortex, short *arg_0, short *arg_4,
4051da177e4SLinus Torvalds 			  xtalk_coefs_t coefs)
4061da177e4SLinus Torvalds {
4071da177e4SLinus Torvalds 	int i;
4081da177e4SLinus Torvalds 
4091da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
4101da177e4SLinus Torvalds 		coefs[i][0] = hwread(vortex->mmio, 0x242b4 + i * 0x24);
4111da177e4SLinus Torvalds 		coefs[i][1] = hwread(vortex->mmio, 0x242b8 + i * 0x24);
4121da177e4SLinus Torvalds 		coefs[i][2] = hwread(vortex->mmio, 0x242bc + i * 0x24);
4131da177e4SLinus Torvalds 		coefs[i][3] = hwread(vortex->mmio, 0x242c0 + i * 0x24);
4141da177e4SLinus Torvalds 		coefs[i][4] = hwread(vortex->mmio, 0x242c4 + i * 0x24);
4151da177e4SLinus Torvalds 	}
4161da177e4SLinus Torvalds 	*arg_0 = hwread(vortex->mmio, 0x24540) & 0xffff;
4171da177e4SLinus Torvalds 	*arg_4 = hwread(vortex->mmio, 0x24544) & 0xffff;
4181da177e4SLinus Torvalds }
4191da177e4SLinus Torvalds 
4201da177e4SLinus Torvalds static void
4211da177e4SLinus Torvalds vortex_XtalkHw_GetLeftXT(vortex_t * vortex, short *arg_0, short *arg_4,
4221da177e4SLinus Torvalds 			 xtalk_coefs_t coefs)
4231da177e4SLinus Torvalds {
4241da177e4SLinus Torvalds 	int i;
4251da177e4SLinus Torvalds 
4261da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
4271da177e4SLinus Torvalds 		coefs[i][0] = hwread(vortex->mmio, 0x24368 + i * 0x24);
4281da177e4SLinus Torvalds 		coefs[i][1] = hwread(vortex->mmio, 0x2436C + i * 0x24);
4291da177e4SLinus Torvalds 		coefs[i][2] = hwread(vortex->mmio, 0x24370 + i * 0x24);
4301da177e4SLinus Torvalds 		coefs[i][3] = hwread(vortex->mmio, 0x24374 + i * 0x24);
4311da177e4SLinus Torvalds 		coefs[i][4] = hwread(vortex->mmio, 0x24378 + i * 0x24);
4321da177e4SLinus Torvalds 	}
4331da177e4SLinus Torvalds 	*arg_0 = hwread(vortex->mmio, 0x24548) & 0xffff;
4341da177e4SLinus Torvalds 	*arg_4 = hwread(vortex->mmio, 0x2454C) & 0xffff;
4351da177e4SLinus Torvalds }
4361da177e4SLinus Torvalds 
4371da177e4SLinus Torvalds static void
4381da177e4SLinus Torvalds vortex_XtalkHw_GetRightXT(vortex_t * vortex, short *arg_0, short *arg_4,
4391da177e4SLinus Torvalds 			  xtalk_coefs_t coefs)
4401da177e4SLinus Torvalds {
4411da177e4SLinus Torvalds 	int i;
4421da177e4SLinus Torvalds 
4431da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
4441da177e4SLinus Torvalds 		coefs[i][0] = hwread(vortex->mmio, 0x2441C + i * 0x24);
4451da177e4SLinus Torvalds 		coefs[i][1] = hwread(vortex->mmio, 0x24420 + i * 0x24);
4461da177e4SLinus Torvalds 		coefs[i][2] = hwread(vortex->mmio, 0x24424 + i * 0x24);
4471da177e4SLinus Torvalds 		coefs[i][3] = hwread(vortex->mmio, 0x24428 + i * 0x24);
4481da177e4SLinus Torvalds 		coefs[i][4] = hwread(vortex->mmio, 0x2442C + i * 0x24);
4491da177e4SLinus Torvalds 	}
4501da177e4SLinus Torvalds 	*arg_0 = hwread(vortex->mmio, 0x24550) & 0xffff;
4511da177e4SLinus Torvalds 	*arg_4 = hwread(vortex->mmio, 0x24554) & 0xffff;
4521da177e4SLinus Torvalds }
4531da177e4SLinus Torvalds 
4541da177e4SLinus Torvalds static void
4551da177e4SLinus Torvalds vortex_XtalkHw_GetLeftEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
4561da177e4SLinus Torvalds 			       xtalk_state_t coefs)
4571da177e4SLinus Torvalds {
4581da177e4SLinus Torvalds 	int i;
4591da177e4SLinus Torvalds 
4601da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
4611da177e4SLinus Torvalds 		coefs[i][0] = hwread(vortex->mmio, 0x24214 + i * 0x24);
4621da177e4SLinus Torvalds 		coefs[i][1] = hwread(vortex->mmio, 0x24218 + i * 0x24);
4631da177e4SLinus Torvalds 		coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24);
4641da177e4SLinus Torvalds 		coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24);
4651da177e4SLinus Torvalds 	}
4669489f2c6SRaymond Yau 	arg_0[0] = hwread(vortex->mmio, 0x244F8);
4679489f2c6SRaymond Yau 	arg_0[1] = hwread(vortex->mmio, 0x244FC);
4689489f2c6SRaymond Yau 	arg_0[2] = hwread(vortex->mmio, 0x24500);
4699489f2c6SRaymond Yau 	arg_0[3] = hwread(vortex->mmio, 0x24504);
4701da177e4SLinus Torvalds }
4711da177e4SLinus Torvalds 
4721da177e4SLinus Torvalds static void
4731da177e4SLinus Torvalds vortex_XtalkHw_GetRightEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
4741da177e4SLinus Torvalds 				xtalk_state_t coefs)
4751da177e4SLinus Torvalds {
4761da177e4SLinus Torvalds 	int i;
4771da177e4SLinus Torvalds 
4781da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
4791da177e4SLinus Torvalds 		coefs[i][0] = hwread(vortex->mmio, 0x242C8 + i * 0x24);
4801da177e4SLinus Torvalds 		coefs[i][1] = hwread(vortex->mmio, 0x242CC + i * 0x24);
4811da177e4SLinus Torvalds 		coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24);
4821da177e4SLinus Torvalds 		coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24);
4831da177e4SLinus Torvalds 	}
4849489f2c6SRaymond Yau 	arg_0[0] = hwread(vortex->mmio, 0x24508);
4859489f2c6SRaymond Yau 	arg_0[1] = hwread(vortex->mmio, 0x2450C);
4869489f2c6SRaymond Yau 	arg_0[2] = hwread(vortex->mmio, 0x24510);
4879489f2c6SRaymond Yau 	arg_0[3] = hwread(vortex->mmio, 0x24514);
4881da177e4SLinus Torvalds }
4891da177e4SLinus Torvalds 
4901da177e4SLinus Torvalds static void
4911da177e4SLinus Torvalds vortex_XtalkHw_GetLeftXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
4921da177e4SLinus Torvalds 			       xtalk_state_t coefs)
4931da177e4SLinus Torvalds {
4941da177e4SLinus Torvalds 	int i;
4951da177e4SLinus Torvalds 
4961da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
4971da177e4SLinus Torvalds 		coefs[i][0] = hwread(vortex->mmio, 0x2437C + i * 0x24);
4981da177e4SLinus Torvalds 		coefs[i][1] = hwread(vortex->mmio, 0x24380 + i * 0x24);
4991da177e4SLinus Torvalds 		coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24);
5001da177e4SLinus Torvalds 		coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24);
5011da177e4SLinus Torvalds 	}
5029489f2c6SRaymond Yau 	arg_0[0] = hwread(vortex->mmio, 0x24518);
5039489f2c6SRaymond Yau 	arg_0[1] = hwread(vortex->mmio, 0x2451C);
5049489f2c6SRaymond Yau 	arg_0[2] = hwread(vortex->mmio, 0x24520);
5059489f2c6SRaymond Yau 	arg_0[3] = hwread(vortex->mmio, 0x24524);
5061da177e4SLinus Torvalds }
5071da177e4SLinus Torvalds 
5081da177e4SLinus Torvalds static void
5091da177e4SLinus Torvalds vortex_XtalkHw_GetRightXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
5101da177e4SLinus Torvalds 				xtalk_state_t coefs)
5111da177e4SLinus Torvalds {
5121da177e4SLinus Torvalds 	int i;
5131da177e4SLinus Torvalds 
5141da177e4SLinus Torvalds 	for (i = 0; i < 5; i++) {
5151da177e4SLinus Torvalds 		coefs[i][0] = hwread(vortex->mmio, 0x24430 + i * 0x24);
5161da177e4SLinus Torvalds 		coefs[i][1] = hwread(vortex->mmio, 0x24434 + i * 0x24);
5171da177e4SLinus Torvalds 		coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24);
5181da177e4SLinus Torvalds 		coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24);
5191da177e4SLinus Torvalds 	}
5209489f2c6SRaymond Yau 	arg_0[0] = hwread(vortex->mmio, 0x24528);
5219489f2c6SRaymond Yau 	arg_0[1] = hwread(vortex->mmio, 0x2452C);
5229489f2c6SRaymond Yau 	arg_0[2] = hwread(vortex->mmio, 0x24530);
5239489f2c6SRaymond Yau 	arg_0[3] = hwread(vortex->mmio, 0x24534);
5241da177e4SLinus Torvalds }
5251da177e4SLinus Torvalds 
5261da177e4SLinus Torvalds #endif
5271da177e4SLinus Torvalds /* Gains */
5281da177e4SLinus Torvalds 
5291da177e4SLinus Torvalds static void
vortex_XtalkHw_SetGains(vortex_t * vortex,xtalk_gains_t const gains)5301da177e4SLinus Torvalds vortex_XtalkHw_SetGains(vortex_t * vortex, xtalk_gains_t const gains)
5311da177e4SLinus Torvalds {
5321da177e4SLinus Torvalds 	int i;
5331da177e4SLinus Torvalds 
5341da177e4SLinus Torvalds 	for (i = 0; i < XTGAINS_SZ; i++) {
5351da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x244D0 + (i * 4), gains[i]);
5361da177e4SLinus Torvalds 	}
5371da177e4SLinus Torvalds }
5381da177e4SLinus Torvalds 
5391da177e4SLinus Torvalds static void
vortex_XtalkHw_SetGainsAllChan(vortex_t * vortex)5401da177e4SLinus Torvalds vortex_XtalkHw_SetGainsAllChan(vortex_t * vortex)
5411da177e4SLinus Torvalds {
5421da177e4SLinus Torvalds 	vortex_XtalkHw_SetGains(vortex, asXtalkGainsAllChan);
5431da177e4SLinus Torvalds }
5441da177e4SLinus Torvalds 
5451da177e4SLinus Torvalds #if 0
5461da177e4SLinus Torvalds static void vortex_XtalkHw_GetGains(vortex_t * vortex, xtalk_gains_t gains)
5471da177e4SLinus Torvalds {
5481da177e4SLinus Torvalds 	int i;
5491da177e4SLinus Torvalds 
5501da177e4SLinus Torvalds 	for (i = 0; i < XTGAINS_SZ; i++)
5511da177e4SLinus Torvalds 		gains[i] = hwread(vortex->mmio, 0x244D0 + i * 4);
5521da177e4SLinus Torvalds }
5531da177e4SLinus Torvalds 
5541da177e4SLinus Torvalds #endif
5551da177e4SLinus Torvalds /* Delay parameters */
5561da177e4SLinus Torvalds 
5571da177e4SLinus Torvalds static void
vortex_XtalkHw_SetDelay(vortex_t * vortex,unsigned short right,unsigned short left)5581da177e4SLinus Torvalds vortex_XtalkHw_SetDelay(vortex_t * vortex, unsigned short right,
5591da177e4SLinus Torvalds 			unsigned short left)
5601da177e4SLinus Torvalds {
56197c67b65STakashi Iwai 	u32 esp0 = 0;
5621da177e4SLinus Torvalds 
5631da177e4SLinus Torvalds 	esp0 &= 0x1FFFFFFF;
5641da177e4SLinus Torvalds 	esp0 |= 0xA0000000;
5651da177e4SLinus Torvalds 	esp0 = (esp0 & 0xffffE0ff) | ((right & 0x1F) << 8);
5661da177e4SLinus Torvalds 	esp0 = (esp0 & 0xfffc1fff) | ((left & 0x1F) << 0xd);
5671da177e4SLinus Torvalds 
5681da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24660, esp0);
5691da177e4SLinus Torvalds }
5701da177e4SLinus Torvalds 
5711da177e4SLinus Torvalds static void
vortex_XtalkHw_SetLeftDline(vortex_t * vortex,xtalk_dline_t const dline)5721da177e4SLinus Torvalds vortex_XtalkHw_SetLeftDline(vortex_t * vortex, xtalk_dline_t const dline)
5731da177e4SLinus Torvalds {
5741da177e4SLinus Torvalds 	int i;
5751da177e4SLinus Torvalds 
5761da177e4SLinus Torvalds 	for (i = 0; i < 0x20; i++) {
5771da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24000 + (i << 2), dline[i] & 0xffff);
5781da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24080 + (i << 2), dline[i] >> 0x10);
5791da177e4SLinus Torvalds 	}
5801da177e4SLinus Torvalds }
5811da177e4SLinus Torvalds 
5821da177e4SLinus Torvalds static void
vortex_XtalkHw_SetRightDline(vortex_t * vortex,xtalk_dline_t const dline)5831da177e4SLinus Torvalds vortex_XtalkHw_SetRightDline(vortex_t * vortex, xtalk_dline_t const dline)
5841da177e4SLinus Torvalds {
5851da177e4SLinus Torvalds 	int i;
5861da177e4SLinus Torvalds 
5871da177e4SLinus Torvalds 	for (i = 0; i < 0x20; i++) {
5881da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24100 + (i << 2), dline[i] & 0xffff);
5891da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24180 + (i << 2), dline[i] >> 0x10);
5901da177e4SLinus Torvalds 	}
5911da177e4SLinus Torvalds }
5921da177e4SLinus Torvalds 
5931da177e4SLinus Torvalds #if 0
5941da177e4SLinus Torvalds static void
5951da177e4SLinus Torvalds vortex_XtalkHw_GetDelay(vortex_t * vortex, unsigned short *right,
5961da177e4SLinus Torvalds 			unsigned short *left)
5971da177e4SLinus Torvalds {
5981da177e4SLinus Torvalds 	int esp0;
5991da177e4SLinus Torvalds 
6001da177e4SLinus Torvalds 	esp0 = hwread(vortex->mmio, 0x24660);
6011da177e4SLinus Torvalds 	*right = (esp0 >> 8) & 0x1f;
6021da177e4SLinus Torvalds 	*left = (esp0 >> 0xd) & 0x1f;
6031da177e4SLinus Torvalds }
6041da177e4SLinus Torvalds 
6051da177e4SLinus Torvalds static void vortex_XtalkHw_GetLeftDline(vortex_t * vortex, xtalk_dline_t dline)
6061da177e4SLinus Torvalds {
6071da177e4SLinus Torvalds 	int i;
6081da177e4SLinus Torvalds 
6091da177e4SLinus Torvalds 	for (i = 0; i < 0x20; i++) {
6101da177e4SLinus Torvalds 		dline[i] =
6111da177e4SLinus Torvalds 		    (hwread(vortex->mmio, 0x24000 + (i << 2)) & 0xffff) |
6121da177e4SLinus Torvalds 		    (hwread(vortex->mmio, 0x24080 + (i << 2)) << 0x10);
6131da177e4SLinus Torvalds 	}
6141da177e4SLinus Torvalds }
6151da177e4SLinus Torvalds 
6161da177e4SLinus Torvalds static void vortex_XtalkHw_GetRightDline(vortex_t * vortex, xtalk_dline_t dline)
6171da177e4SLinus Torvalds {
6181da177e4SLinus Torvalds 	int i;
6191da177e4SLinus Torvalds 
6201da177e4SLinus Torvalds 	for (i = 0; i < 0x20; i++) {
6211da177e4SLinus Torvalds 		dline[i] =
6221da177e4SLinus Torvalds 		    (hwread(vortex->mmio, 0x24100 + (i << 2)) & 0xffff) |
6231da177e4SLinus Torvalds 		    (hwread(vortex->mmio, 0x24180 + (i << 2)) << 0x10);
6241da177e4SLinus Torvalds 	}
6251da177e4SLinus Torvalds }
6261da177e4SLinus Torvalds 
6271da177e4SLinus Torvalds #endif
6281da177e4SLinus Torvalds /* Control/Global stuff */
6291da177e4SLinus Torvalds 
6301da177e4SLinus Torvalds #if 0
63197c67b65STakashi Iwai static void vortex_XtalkHw_SetControlReg(vortex_t * vortex, u32 ctrl)
6321da177e4SLinus Torvalds {
6331da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24660, ctrl);
6341da177e4SLinus Torvalds }
63597c67b65STakashi Iwai static void vortex_XtalkHw_GetControlReg(vortex_t * vortex, u32 *ctrl)
6361da177e4SLinus Torvalds {
6371da177e4SLinus Torvalds 	*ctrl = hwread(vortex->mmio, 0x24660);
6381da177e4SLinus Torvalds }
6391da177e4SLinus Torvalds #endif
vortex_XtalkHw_SetSampleRate(vortex_t * vortex,u32 sr)64097c67b65STakashi Iwai static void vortex_XtalkHw_SetSampleRate(vortex_t * vortex, u32 sr)
6411da177e4SLinus Torvalds {
64297c67b65STakashi Iwai 	u32 temp;
6431da177e4SLinus Torvalds 
6441da177e4SLinus Torvalds 	temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
6451da177e4SLinus Torvalds 	temp = (temp & 0xffffff07) | ((sr & 0x1f) << 3);
6461da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24660, temp);
6471da177e4SLinus Torvalds }
6481da177e4SLinus Torvalds 
6491da177e4SLinus Torvalds #if 0
65097c67b65STakashi Iwai static void vortex_XtalkHw_GetSampleRate(vortex_t * vortex, u32 *sr)
6511da177e4SLinus Torvalds {
6521da177e4SLinus Torvalds 	*sr = (hwread(vortex->mmio, 0x24660) >> 3) & 0x1f;
6531da177e4SLinus Torvalds }
6541da177e4SLinus Torvalds 
6551da177e4SLinus Torvalds #endif
vortex_XtalkHw_Enable(vortex_t * vortex)6561da177e4SLinus Torvalds static void vortex_XtalkHw_Enable(vortex_t * vortex)
6571da177e4SLinus Torvalds {
65897c67b65STakashi Iwai 	u32 temp;
6591da177e4SLinus Torvalds 
6601da177e4SLinus Torvalds 	temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
6611da177e4SLinus Torvalds 	temp |= 1;
6621da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24660, temp);
6631da177e4SLinus Torvalds 
6641da177e4SLinus Torvalds }
6651da177e4SLinus Torvalds 
vortex_XtalkHw_Disable(vortex_t * vortex)6661da177e4SLinus Torvalds static void vortex_XtalkHw_Disable(vortex_t * vortex)
6671da177e4SLinus Torvalds {
66897c67b65STakashi Iwai 	u32 temp;
6691da177e4SLinus Torvalds 
6701da177e4SLinus Torvalds 	temp = (hwread(vortex->mmio, 0x24660) & 0x1FFFFFFF) | 0xC0000000;
6711da177e4SLinus Torvalds 	temp &= 0xfffffffe;
6721da177e4SLinus Torvalds 	hwwrite(vortex->mmio, 0x24660, temp);
6731da177e4SLinus Torvalds 
6741da177e4SLinus Torvalds }
6751da177e4SLinus Torvalds 
vortex_XtalkHw_ZeroIO(vortex_t * vortex)6761da177e4SLinus Torvalds static void vortex_XtalkHw_ZeroIO(vortex_t * vortex)
6771da177e4SLinus Torvalds {
6781da177e4SLinus Torvalds 	int i;
6791da177e4SLinus Torvalds 
6801da177e4SLinus Torvalds 	for (i = 0; i < 20; i++)
6811da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24600 + (i << 2), 0);
6821da177e4SLinus Torvalds 	for (i = 0; i < 4; i++)
6831da177e4SLinus Torvalds 		hwwrite(vortex->mmio, 0x24650 + (i << 2), 0);
6841da177e4SLinus Torvalds }
6851da177e4SLinus Torvalds 
vortex_XtalkHw_ZeroState(vortex_t * vortex)6861da177e4SLinus Torvalds static void vortex_XtalkHw_ZeroState(vortex_t * vortex)
6871da177e4SLinus Torvalds {
6881da177e4SLinus Torvalds 	vortex_XtalkHw_ZeroIO(vortex);	// inlined
6891da177e4SLinus Torvalds 
6901da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftEQ(vortex, 0, 0, asXtalkCoefsZeros);
6911da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightEQ(vortex, 0, 0, asXtalkCoefsZeros);
6921da177e4SLinus Torvalds 
6931da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros);
6941da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros);
6951da177e4SLinus Torvalds 
6961da177e4SLinus Torvalds 	vortex_XtalkHw_SetGains(vortex, asXtalkGainsZeros);	// inlined
6971da177e4SLinus Torvalds 
6981da177e4SLinus Torvalds 	vortex_XtalkHw_SetDelay(vortex, 0, 0);	// inlined
6991da177e4SLinus Torvalds 
7001da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros);	// inlined
7011da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros);	// inlined
7021da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftDline(vortex, alXtalkDlineZeros);	// inlined
7031da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightDline(vortex, alXtalkDlineZeros);	// inlined
7041da177e4SLinus Torvalds 
7051da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftEQStates(vortex, asXtalkInStateZeros,
7061da177e4SLinus Torvalds 				       asXtalkOutStateZeros);
7071da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightEQStates(vortex, asXtalkInStateZeros,
7081da177e4SLinus Torvalds 					asXtalkOutStateZeros);
7091da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftXTStates(vortex, asXtalkInStateZeros,
7101da177e4SLinus Torvalds 				       asXtalkOutStateZeros);
7111da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightXTStates(vortex, asXtalkInStateZeros,
7121da177e4SLinus Torvalds 					asXtalkOutStateZeros);
7131da177e4SLinus Torvalds }
7141da177e4SLinus Torvalds 
vortex_XtalkHw_ProgramPipe(vortex_t * vortex)7151da177e4SLinus Torvalds static void vortex_XtalkHw_ProgramPipe(vortex_t * vortex)
7161da177e4SLinus Torvalds {
7171da177e4SLinus Torvalds 
7181da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftEQ(vortex, 0, 1, asXtalkCoefsPipe);
7191da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightEQ(vortex, 0, 1, asXtalkCoefsPipe);
7201da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftXT(vortex, 0, 0, asXtalkCoefsZeros);
7211da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightXT(vortex, 0, 0, asXtalkCoefsZeros);
7221da177e4SLinus Torvalds 
7231da177e4SLinus Torvalds 	vortex_XtalkHw_SetDelay(vortex, 0, 0);	// inlined
7241da177e4SLinus Torvalds }
7251da177e4SLinus Torvalds 
vortex_XtalkHw_ProgramXtalkWide(vortex_t * vortex)7261da177e4SLinus Torvalds static void vortex_XtalkHw_ProgramXtalkWide(vortex_t * vortex)
7271da177e4SLinus Torvalds {
7281da177e4SLinus Torvalds 
7291da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftEQ(vortex, sXtalkWideKLeftEq,
7301da177e4SLinus Torvalds 				 sXtalkWideShiftLeftEq, asXtalkWideCoefsLeftEq);
7311da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightEQ(vortex, sXtalkWideKRightEq,
7321da177e4SLinus Torvalds 				  sXtalkWideShiftRightEq,
7331da177e4SLinus Torvalds 				  asXtalkWideCoefsRightEq);
7341da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftXT(vortex, sXtalkWideKLeftXt,
7351da177e4SLinus Torvalds 				 sXtalkWideShiftLeftXt, asXtalkWideCoefsLeftXt);
7361da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightXT(vortex, sXtalkWideKLeftXt,
7371da177e4SLinus Torvalds 				  sXtalkWideShiftLeftXt,
7381da177e4SLinus Torvalds 				  asXtalkWideCoefsLeftXt);
7391da177e4SLinus Torvalds 
7401da177e4SLinus Torvalds 	vortex_XtalkHw_SetDelay(vortex, wXtalkWideRightDelay, wXtalkWideLeftDelay);	// inlined
7411da177e4SLinus Torvalds }
7421da177e4SLinus Torvalds 
vortex_XtalkHw_ProgramXtalkNarrow(vortex_t * vortex)7431da177e4SLinus Torvalds static void vortex_XtalkHw_ProgramXtalkNarrow(vortex_t * vortex)
7441da177e4SLinus Torvalds {
7451da177e4SLinus Torvalds 
7461da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftEQ(vortex, sXtalkNarrowKLeftEq,
7471da177e4SLinus Torvalds 				 sXtalkNarrowShiftLeftEq,
7481da177e4SLinus Torvalds 				 asXtalkNarrowCoefsLeftEq);
7491da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightEQ(vortex, sXtalkNarrowKRightEq,
7501da177e4SLinus Torvalds 				  sXtalkNarrowShiftRightEq,
7511da177e4SLinus Torvalds 				  asXtalkNarrowCoefsRightEq);
7521da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftXT(vortex, sXtalkNarrowKLeftXt,
7531da177e4SLinus Torvalds 				 sXtalkNarrowShiftLeftXt,
7541da177e4SLinus Torvalds 				 asXtalkNarrowCoefsLeftXt);
7551da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightXT(vortex, sXtalkNarrowKLeftXt,
7561da177e4SLinus Torvalds 				  sXtalkNarrowShiftLeftXt,
7571da177e4SLinus Torvalds 				  asXtalkNarrowCoefsLeftXt);
7581da177e4SLinus Torvalds 
7591da177e4SLinus Torvalds 	vortex_XtalkHw_SetDelay(vortex, wXtalkNarrowRightDelay, wXtalkNarrowLeftDelay);	// inlined
7601da177e4SLinus Torvalds }
7611da177e4SLinus Torvalds 
vortex_XtalkHw_ProgramDiamondXtalk(vortex_t * vortex)7621da177e4SLinus Torvalds static void vortex_XtalkHw_ProgramDiamondXtalk(vortex_t * vortex)
7631da177e4SLinus Torvalds {
7641da177e4SLinus Torvalds 
7651da177e4SLinus Torvalds 	//sDiamondKLeftEq,sDiamondKRightXt,asDiamondCoefsLeftEq
7661da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftEQ(vortex, sDiamondKLeftEq,
7671da177e4SLinus Torvalds 				 sDiamondShiftLeftEq, asDiamondCoefsLeftEq);
7681da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightEQ(vortex, sDiamondKRightEq,
7691da177e4SLinus Torvalds 				  sDiamondShiftRightEq, asDiamondCoefsRightEq);
7701da177e4SLinus Torvalds 	vortex_XtalkHw_SetLeftXT(vortex, sDiamondKLeftXt,
7711da177e4SLinus Torvalds 				 sDiamondShiftLeftXt, asDiamondCoefsLeftXt);
7721da177e4SLinus Torvalds 	vortex_XtalkHw_SetRightXT(vortex, sDiamondKLeftXt,
7731da177e4SLinus Torvalds 				  sDiamondShiftLeftXt, asDiamondCoefsLeftXt);
7741da177e4SLinus Torvalds 
7751da177e4SLinus Torvalds 	vortex_XtalkHw_SetDelay(vortex, wDiamondRightDelay, wDiamondLeftDelay);	// inlined
7761da177e4SLinus Torvalds }
7771da177e4SLinus Torvalds 
vortex_XtalkHw_init(vortex_t * vortex)7781da177e4SLinus Torvalds static void vortex_XtalkHw_init(vortex_t * vortex)
7791da177e4SLinus Torvalds {
7801da177e4SLinus Torvalds 	vortex_XtalkHw_ZeroState(vortex);
7811da177e4SLinus Torvalds }
7821da177e4SLinus Torvalds 
7831da177e4SLinus Torvalds /* End of file */
784