xref: /linux/sound/pci/ice1712/vt1720_mobo.c (revision e23e7a1436207217000c2854214bc908936af3cb)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  *   ALSA driver for VT1720/VT1724 (Envy24PT/Envy24HT)
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  *   Lowlevel functions for VT1720-based motherboards
51da177e4SLinus Torvalds  *
61da177e4SLinus Torvalds  *	Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
71da177e4SLinus Torvalds  *
81da177e4SLinus Torvalds  *   This program is free software; you can redistribute it and/or modify
91da177e4SLinus Torvalds  *   it under the terms of the GNU General Public License as published by
101da177e4SLinus Torvalds  *   the Free Software Foundation; either version 2 of the License, or
111da177e4SLinus Torvalds  *   (at your option) any later version.
121da177e4SLinus Torvalds  *
131da177e4SLinus Torvalds  *   This program is distributed in the hope that it will be useful,
141da177e4SLinus Torvalds  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
151da177e4SLinus Torvalds  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
161da177e4SLinus Torvalds  *   GNU General Public License for more details.
171da177e4SLinus Torvalds  *
181da177e4SLinus Torvalds  *   You should have received a copy of the GNU General Public License
191da177e4SLinus Torvalds  *   along with this program; if not, write to the Free Software
201da177e4SLinus Torvalds  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
211da177e4SLinus Torvalds  *
221da177e4SLinus Torvalds  */
231da177e4SLinus Torvalds 
241da177e4SLinus Torvalds #include <linux/delay.h>
251da177e4SLinus Torvalds #include <linux/interrupt.h>
261da177e4SLinus Torvalds #include <linux/init.h>
271da177e4SLinus Torvalds #include <sound/core.h>
281da177e4SLinus Torvalds 
291da177e4SLinus Torvalds #include "ice1712.h"
30189bc171STakashi Iwai #include "envy24ht.h"
311da177e4SLinus Torvalds #include "vt1720_mobo.h"
321da177e4SLinus Torvalds 
331da177e4SLinus Torvalds 
34*e23e7a14SBill Pemberton static int k8x800_init(struct snd_ice1712 *ice)
351da177e4SLinus Torvalds {
361da177e4SLinus Torvalds 	ice->vt1720 = 1;
371da177e4SLinus Torvalds 
381da177e4SLinus Torvalds 	/* VT1616 codec */
391da177e4SLinus Torvalds 	ice->num_total_dacs = 6;
401da177e4SLinus Torvalds 	ice->num_total_adcs = 2;
411da177e4SLinus Torvalds 
421da177e4SLinus Torvalds 	/* WM8728 codec */
431da177e4SLinus Torvalds 	/* FIXME: TODO */
441da177e4SLinus Torvalds 
451da177e4SLinus Torvalds 	return 0;
461da177e4SLinus Torvalds }
471da177e4SLinus Torvalds 
48*e23e7a14SBill Pemberton static int k8x800_add_controls(struct snd_ice1712 *ice)
491da177e4SLinus Torvalds {
501da177e4SLinus Torvalds 	/* FIXME: needs some quirks for VT1616? */
511da177e4SLinus Torvalds 	return 0;
521da177e4SLinus Torvalds }
531da177e4SLinus Torvalds 
541da177e4SLinus Torvalds /* EEPROM image */
551da177e4SLinus Torvalds 
56*e23e7a14SBill Pemberton static unsigned char k8x800_eeprom[] = {
57189bc171STakashi Iwai 	[ICE_EEP2_SYSCONF]     = 0x01,	/* clock 256, 1ADC, 2DACs */
58189bc171STakashi Iwai 	[ICE_EEP2_ACLINK]      = 0x02,	/* ACLINK, packed */
59189bc171STakashi Iwai 	[ICE_EEP2_I2S]         = 0x00,	/* - */
60189bc171STakashi Iwai 	[ICE_EEP2_SPDIF]       = 0x00,	/* - */
61189bc171STakashi Iwai 	[ICE_EEP2_GPIO_DIR]    = 0xff,
62189bc171STakashi Iwai 	[ICE_EEP2_GPIO_DIR1]   = 0xff,
63189bc171STakashi Iwai 	[ICE_EEP2_GPIO_DIR2]   = 0x00,	/* - */
64189bc171STakashi Iwai 	[ICE_EEP2_GPIO_MASK]   = 0xff,
65189bc171STakashi Iwai 	[ICE_EEP2_GPIO_MASK1]  = 0xff,
66189bc171STakashi Iwai 	[ICE_EEP2_GPIO_MASK2]  = 0x00,	/* - */
67189bc171STakashi Iwai 	[ICE_EEP2_GPIO_STATE]  = 0x00,
68189bc171STakashi Iwai 	[ICE_EEP2_GPIO_STATE1] = 0x00,
69189bc171STakashi Iwai 	[ICE_EEP2_GPIO_STATE2] = 0x00,	/* - */
701da177e4SLinus Torvalds };
711da177e4SLinus Torvalds 
72*e23e7a14SBill Pemberton static unsigned char sn25p_eeprom[] = {
73189bc171STakashi Iwai 	[ICE_EEP2_SYSCONF]     = 0x01,	/* clock 256, 1ADC, 2DACs */
74189bc171STakashi Iwai 	[ICE_EEP2_ACLINK]      = 0x02,	/* ACLINK, packed */
75189bc171STakashi Iwai 	[ICE_EEP2_I2S]         = 0x00,	/* - */
76189bc171STakashi Iwai 	[ICE_EEP2_SPDIF]       = 0x41,	/* - */
77189bc171STakashi Iwai 	[ICE_EEP2_GPIO_DIR]    = 0xff,
78189bc171STakashi Iwai 	[ICE_EEP2_GPIO_DIR1]   = 0xff,
79189bc171STakashi Iwai 	[ICE_EEP2_GPIO_DIR2]   = 0x00,	/* - */
80189bc171STakashi Iwai 	[ICE_EEP2_GPIO_MASK]   = 0xff,
81189bc171STakashi Iwai 	[ICE_EEP2_GPIO_MASK1]  = 0xff,
82189bc171STakashi Iwai 	[ICE_EEP2_GPIO_MASK2]  = 0x00,	/* - */
83189bc171STakashi Iwai 	[ICE_EEP2_GPIO_STATE]  = 0x00,
84189bc171STakashi Iwai 	[ICE_EEP2_GPIO_STATE1] = 0x00,
85189bc171STakashi Iwai 	[ICE_EEP2_GPIO_STATE2] = 0x00,	/* - */
8609f9a891STakashi Iwai };
8709f9a891STakashi Iwai 
881da177e4SLinus Torvalds 
891da177e4SLinus Torvalds /* entry point */
90*e23e7a14SBill Pemberton struct snd_ice1712_card_info snd_vt1720_mobo_cards[] = {
911da177e4SLinus Torvalds 	{
921da177e4SLinus Torvalds 		.subvendor = VT1720_SUBDEVICE_K8X800,
931da177e4SLinus Torvalds 		.name = "Albatron K8X800 Pro II",
941da177e4SLinus Torvalds 		.model = "k8x800",
951da177e4SLinus Torvalds 		.chip_init = k8x800_init,
961da177e4SLinus Torvalds 		.build_controls = k8x800_add_controls,
971da177e4SLinus Torvalds 		.eeprom_size = sizeof(k8x800_eeprom),
981da177e4SLinus Torvalds 		.eeprom_data = k8x800_eeprom,
991da177e4SLinus Torvalds 	},
1001da177e4SLinus Torvalds 	{
1011da177e4SLinus Torvalds 		.subvendor = VT1720_SUBDEVICE_ZNF3_150,
1021da177e4SLinus Torvalds 		.name = "Chaintech ZNF3-150",
1031da177e4SLinus Torvalds 		/* identical with k8x800 */
1041da177e4SLinus Torvalds 		.chip_init = k8x800_init,
1051da177e4SLinus Torvalds 		.build_controls = k8x800_add_controls,
1061da177e4SLinus Torvalds 		.eeprom_size = sizeof(k8x800_eeprom),
1071da177e4SLinus Torvalds 		.eeprom_data = k8x800_eeprom,
1081da177e4SLinus Torvalds 	},
1091da177e4SLinus Torvalds 	{
1101da177e4SLinus Torvalds 		.subvendor = VT1720_SUBDEVICE_ZNF3_250,
1111da177e4SLinus Torvalds 		.name = "Chaintech ZNF3-250",
1121da177e4SLinus Torvalds 		/* identical with k8x800 */
1131da177e4SLinus Torvalds 		.chip_init = k8x800_init,
1141da177e4SLinus Torvalds 		.build_controls = k8x800_add_controls,
1151da177e4SLinus Torvalds 		.eeprom_size = sizeof(k8x800_eeprom),
1161da177e4SLinus Torvalds 		.eeprom_data = k8x800_eeprom,
1171da177e4SLinus Torvalds 	},
1181da177e4SLinus Torvalds 	{
1191da177e4SLinus Torvalds 		.subvendor = VT1720_SUBDEVICE_9CJS,
1201da177e4SLinus Torvalds 		.name = "Chaintech 9CJS",
1211da177e4SLinus Torvalds 		/* identical with k8x800 */
1221da177e4SLinus Torvalds 		.chip_init = k8x800_init,
1231da177e4SLinus Torvalds 		.build_controls = k8x800_add_controls,
1241da177e4SLinus Torvalds 		.eeprom_size = sizeof(k8x800_eeprom),
1251da177e4SLinus Torvalds 		.eeprom_data = k8x800_eeprom,
1261da177e4SLinus Torvalds 	},
127b9cce374STakashi Iwai 	{
128b9cce374STakashi Iwai 		.subvendor = VT1720_SUBDEVICE_SN25P,
129b9cce374STakashi Iwai 		.name = "Shuttle SN25P",
13009f9a891STakashi Iwai 		.model = "sn25p",
131b9cce374STakashi Iwai 		.chip_init = k8x800_init,
132b9cce374STakashi Iwai 		.build_controls = k8x800_add_controls,
133b9cce374STakashi Iwai 		.eeprom_size = sizeof(k8x800_eeprom),
13409f9a891STakashi Iwai 		.eeprom_data = sn25p_eeprom,
135b9cce374STakashi Iwai 	},
1361da177e4SLinus Torvalds 	{ } /* terminator */
1371da177e4SLinus Torvalds };
1381da177e4SLinus Torvalds 
139