xref: /openbmc/linux/sound/pci/ice1712/vt1720_mobo.c (revision 64c70b1c)
1 /*
2  *   ALSA driver for VT1720/VT1724 (Envy24PT/Envy24HT)
3  *
4  *   Lowlevel functions for VT1720-based motherboards
5  *
6  *	Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
7  *
8  *   This program is free software; you can redistribute it and/or modify
9  *   it under the terms of the GNU General Public License as published by
10  *   the Free Software Foundation; either version 2 of the License, or
11  *   (at your option) any later version.
12  *
13  *   This program is distributed in the hope that it will be useful,
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *   GNU General Public License for more details.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with this program; if not, write to the Free Software
20  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21  *
22  */
23 
24 #include <sound/driver.h>
25 #include <asm/io.h>
26 #include <linux/delay.h>
27 #include <linux/interrupt.h>
28 #include <linux/init.h>
29 #include <linux/slab.h>
30 #include <sound/core.h>
31 
32 #include "ice1712.h"
33 #include "envy24ht.h"
34 #include "vt1720_mobo.h"
35 
36 
37 static int __devinit k8x800_init(struct snd_ice1712 *ice)
38 {
39 	ice->vt1720 = 1;
40 
41 	/* VT1616 codec */
42 	ice->num_total_dacs = 6;
43 	ice->num_total_adcs = 2;
44 
45 	/* WM8728 codec */
46 	/* FIXME: TODO */
47 
48 	return 0;
49 }
50 
51 static int __devinit k8x800_add_controls(struct snd_ice1712 *ice)
52 {
53 	/* FIXME: needs some quirks for VT1616? */
54 	return 0;
55 }
56 
57 /* EEPROM image */
58 
59 static unsigned char k8x800_eeprom[] __devinitdata = {
60 	[ICE_EEP2_SYSCONF]     = 0x01,	/* clock 256, 1ADC, 2DACs */
61 	[ICE_EEP2_ACLINK]      = 0x02,	/* ACLINK, packed */
62 	[ICE_EEP2_I2S]         = 0x00,	/* - */
63 	[ICE_EEP2_SPDIF]       = 0x00,	/* - */
64 	[ICE_EEP2_GPIO_DIR]    = 0xff,
65 	[ICE_EEP2_GPIO_DIR1]   = 0xff,
66 	[ICE_EEP2_GPIO_DIR2]   = 0x00,	/* - */
67 	[ICE_EEP2_GPIO_MASK]   = 0xff,
68 	[ICE_EEP2_GPIO_MASK1]  = 0xff,
69 	[ICE_EEP2_GPIO_MASK2]  = 0x00,	/* - */
70 	[ICE_EEP2_GPIO_STATE]  = 0x00,
71 	[ICE_EEP2_GPIO_STATE1] = 0x00,
72 	[ICE_EEP2_GPIO_STATE2] = 0x00,	/* - */
73 };
74 
75 static unsigned char sn25p_eeprom[] __devinitdata = {
76 	[ICE_EEP2_SYSCONF]     = 0x01,	/* clock 256, 1ADC, 2DACs */
77 	[ICE_EEP2_ACLINK]      = 0x02,	/* ACLINK, packed */
78 	[ICE_EEP2_I2S]         = 0x00,	/* - */
79 	[ICE_EEP2_SPDIF]       = 0x41,	/* - */
80 	[ICE_EEP2_GPIO_DIR]    = 0xff,
81 	[ICE_EEP2_GPIO_DIR1]   = 0xff,
82 	[ICE_EEP2_GPIO_DIR2]   = 0x00,	/* - */
83 	[ICE_EEP2_GPIO_MASK]   = 0xff,
84 	[ICE_EEP2_GPIO_MASK1]  = 0xff,
85 	[ICE_EEP2_GPIO_MASK2]  = 0x00,	/* - */
86 	[ICE_EEP2_GPIO_STATE]  = 0x00,
87 	[ICE_EEP2_GPIO_STATE1] = 0x00,
88 	[ICE_EEP2_GPIO_STATE2] = 0x00,	/* - */
89 };
90 
91 
92 /* entry point */
93 struct snd_ice1712_card_info snd_vt1720_mobo_cards[] __devinitdata = {
94 	{
95 		.subvendor = VT1720_SUBDEVICE_K8X800,
96 		.name = "Albatron K8X800 Pro II",
97 		.model = "k8x800",
98 		.chip_init = k8x800_init,
99 		.build_controls = k8x800_add_controls,
100 		.eeprom_size = sizeof(k8x800_eeprom),
101 		.eeprom_data = k8x800_eeprom,
102 	},
103 	{
104 		.subvendor = VT1720_SUBDEVICE_ZNF3_150,
105 		.name = "Chaintech ZNF3-150",
106 		/* identical with k8x800 */
107 		.chip_init = k8x800_init,
108 		.build_controls = k8x800_add_controls,
109 		.eeprom_size = sizeof(k8x800_eeprom),
110 		.eeprom_data = k8x800_eeprom,
111 	},
112 	{
113 		.subvendor = VT1720_SUBDEVICE_ZNF3_250,
114 		.name = "Chaintech ZNF3-250",
115 		/* identical with k8x800 */
116 		.chip_init = k8x800_init,
117 		.build_controls = k8x800_add_controls,
118 		.eeprom_size = sizeof(k8x800_eeprom),
119 		.eeprom_data = k8x800_eeprom,
120 	},
121 	{
122 		.subvendor = VT1720_SUBDEVICE_9CJS,
123 		.name = "Chaintech 9CJS",
124 		/* identical with k8x800 */
125 		.chip_init = k8x800_init,
126 		.build_controls = k8x800_add_controls,
127 		.eeprom_size = sizeof(k8x800_eeprom),
128 		.eeprom_data = k8x800_eeprom,
129 	},
130 	{
131 		.subvendor = VT1720_SUBDEVICE_SN25P,
132 		.name = "Shuttle SN25P",
133 		.model = "sn25p",
134 		.chip_init = k8x800_init,
135 		.build_controls = k8x800_add_controls,
136 		.eeprom_size = sizeof(k8x800_eeprom),
137 		.eeprom_data = sn25p_eeprom,
138 	},
139 	{ } /* terminator */
140 };
141 
142