aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/emu10k1_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/emu10k1/emu10k1_main.c')
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c70
1 files changed, 64 insertions, 6 deletions
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 711e819e4a0b..80aa585eade4 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -46,6 +46,7 @@
46#include <linux/firmware.h> 46#include <linux/firmware.h>
47#include "p16v.h" 47#include "p16v.h"
48#include "tina2.h" 48#include "tina2.h"
49#include "p17v.h"
49 50
50 51
51/************************************************************************* 52/*************************************************************************
@@ -120,11 +121,28 @@ static unsigned int spi_dac_init[] = {
120 0x0622, 121 0x0622,
121 0x1400, 122 0x1400,
122}; 123};
124
125static unsigned int i2c_adc_init[][2] = {
126 { 0x17, 0x00 }, /* Reset */
127 { 0x07, 0x00 }, /* Timeout */
128 { 0x0b, 0x22 }, /* Interface control */
129 { 0x0c, 0x22 }, /* Master mode control */
130 { 0x0d, 0x08 }, /* Powerdown control */
131 { 0x0e, 0xcf }, /* Attenuation Left 0x01 = -103dB, 0xff = 24dB */
132 { 0x0f, 0xcf }, /* Attenuation Right 0.5dB steps */
133 { 0x10, 0x7b }, /* ALC Control 1 */
134 { 0x11, 0x00 }, /* ALC Control 2 */
135 { 0x12, 0x32 }, /* ALC Control 3 */
136 { 0x13, 0x00 }, /* Noise gate control */
137 { 0x14, 0xa6 }, /* Limiter control */
138 { 0x15, ADC_MUX_2 }, /* ADC Mixer control. Mic for Audigy 2 ZS Notebook */
139};
123 140
124static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) 141static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
125{ 142{
126 unsigned int silent_page; 143 unsigned int silent_page;
127 int ch; 144 int ch;
145 u32 tmp;
128 146
129 /* disable audio and lock cache */ 147 /* disable audio and lock cache */
130 outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, 148 outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE,
@@ -163,8 +181,6 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
163 181
164 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ 182 if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
165 /* Hacks for Alice3 to work independent of haP16V driver */ 183 /* Hacks for Alice3 to work independent of haP16V driver */
166 u32 tmp;
167
168 //Setup SRCMulti_I2S SamplingRate 184 //Setup SRCMulti_I2S SamplingRate
169 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); 185 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
170 tmp &= 0xfffff1ff; 186 tmp &= 0xfffff1ff;
@@ -184,8 +200,6 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
184 } 200 }
185 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ 201 if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
186 /* Hacks for Alice3 to work independent of haP16V driver */ 202 /* Hacks for Alice3 to work independent of haP16V driver */
187 u32 tmp;
188
189 snd_printk(KERN_INFO "Audigy2 value: Special config.\n"); 203 snd_printk(KERN_INFO "Audigy2 value: Special config.\n");
190 //Setup SRCMulti_I2S SamplingRate 204 //Setup SRCMulti_I2S SamplingRate
191 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); 205 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
@@ -231,6 +245,23 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
231 outl(0x76, emu->port + A_IOCFG); /* Windows uses 0x3f76 */ 245 outl(0x76, emu->port + A_IOCFG); /* Windows uses 0x3f76 */
232 246
233 } 247 }
248 if (emu->card_capabilities->i2c_adc) { /* Audigy 2 ZS Notebook with ADC Wolfson WM8775 */
249 int size, n;
250
251 snd_emu10k1_ptr20_write(emu, P17V_I2S_SRC_SEL, 0, 0x2020205f);
252 tmp = inl(emu->port + A_IOCFG);
253 outl(tmp | 0x4, emu->port + A_IOCFG); /* Set bit 2 for mic input */
254 tmp = inl(emu->port + A_IOCFG);
255 size = ARRAY_SIZE(i2c_adc_init);
256 for (n = 0; n < size; n++)
257 snd_emu10k1_i2c_write(emu, i2c_adc_init[n][0], i2c_adc_init[n][1]);
258 for (n=0; n < 4; n++) {
259 emu->i2c_capture_volume[n][0]= 0xcf;
260 emu->i2c_capture_volume[n][1]= 0xcf;
261 }
262
263 }
264
234 265
235 snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr); 266 snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr);
236 snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */ 267 snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */
@@ -274,6 +305,8 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
274 if (enable_ir) { /* enable IR for SB Live */ 305 if (enable_ir) { /* enable IR for SB Live */
275 if (emu->card_capabilities->emu1010) { 306 if (emu->card_capabilities->emu1010) {
276 ; /* Disable all access to A_IOCFG for the emu1010 */ 307 ; /* Disable all access to A_IOCFG for the emu1010 */
308 } else if (emu->card_capabilities->i2c_adc) {
309 ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */
277 } else if (emu->audigy) { 310 } else if (emu->audigy) {
278 unsigned int reg = inl(emu->port + A_IOCFG); 311 unsigned int reg = inl(emu->port + A_IOCFG);
279 outl(reg | A_IOCFG_GPOUT2, emu->port + A_IOCFG); 312 outl(reg | A_IOCFG_GPOUT2, emu->port + A_IOCFG);
@@ -293,6 +326,8 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
293 326
294 if (emu->card_capabilities->emu1010) { 327 if (emu->card_capabilities->emu1010) {
295 ; /* Disable all access to A_IOCFG for the emu1010 */ 328 ; /* Disable all access to A_IOCFG for the emu1010 */
329 } else if (emu->card_capabilities->i2c_adc) {
330 ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */
296 } else if (emu->audigy) { /* enable analog output */ 331 } else if (emu->audigy) { /* enable analog output */
297 unsigned int reg = inl(emu->port + A_IOCFG); 332 unsigned int reg = inl(emu->port + A_IOCFG);
298 outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG); 333 outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG);
@@ -311,6 +346,8 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
311 /* Enable analog/digital outs on audigy */ 346 /* Enable analog/digital outs on audigy */
312 if (emu->card_capabilities->emu1010) { 347 if (emu->card_capabilities->emu1010) {
313 ; /* Disable all access to A_IOCFG for the emu1010 */ 348 ; /* Disable all access to A_IOCFG for the emu1010 */
349 } else if (emu->card_capabilities->i2c_adc) {
350 ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */
314 } else if (emu->audigy) { 351 } else if (emu->audigy) {
315 outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); 352 outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG);
316 353
@@ -1139,10 +1176,11 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1139 .adc_1361t = 1, /* 24 bit capture instead of 16bit */ 1176 .adc_1361t = 1, /* 24 bit capture instead of 16bit */
1140 .ac97_chip = 1} , 1177 .ac97_chip = 1} ,
1141 /* Audigy 2 ZS Notebook Cardbus card.*/ 1178 /* Audigy 2 ZS Notebook Cardbus card.*/
1142 /* Tested by James@superbug.co.uk 22th December 2005 */ 1179 /* Tested by James@superbug.co.uk 6th November 2006 */
1143 /* Audio output 7.1/Headphones working. 1180 /* Audio output 7.1/Headphones working.
1144 * Digital output working. (AC3 not checked, only PCM) 1181 * Digital output working. (AC3 not checked, only PCM)
1145 * Audio inputs not tested. 1182 * Audio Mic/Line inputs working.
1183 * Digital input not tested.
1146 */ 1184 */
1147 /* DSP: Tina2 1185 /* DSP: Tina2
1148 * DAC: Wolfson WM8768/WM8568 1186 * DAC: Wolfson WM8768/WM8568
@@ -1150,6 +1188,25 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1150 * AC97: None 1188 * AC97: None
1151 * CA0151: None 1189 * CA0151: None
1152 */ 1190 */
1191 /* Tested by James@superbug.co.uk 4th April 2006 */
1192 /* A_IOCFG bits
1193 * Output
1194 * 0: Not Used
1195 * 1: 0 = Mute all the 7.1 channel out. 1 = unmute.
1196 * 2: Analog input 0 = line in, 1 = mic in
1197 * 3: Not Used
1198 * 4: Digital output 0 = off, 1 = on.
1199 * 5: Not Used
1200 * 6: Not Used
1201 * 7: Not Used
1202 * Input
1203 * All bits 1 (0x3fxx) means nothing plugged in.
1204 * 8-9: 0 = Line in/Mic, 2 = Optical in, 3 = Nothing.
1205 * A-B: 0 = Headphones, 2 = Optical out, 3 = Nothing.
1206 * C-D: 2 = Front/Rear/etc, 3 = nothing.
1207 * E-F: Always 0
1208 *
1209 */
1153 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, 1210 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102,
1154 .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", 1211 .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]",
1155 .id = "Audigy2", 1212 .id = "Audigy2",
@@ -1157,6 +1214,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1157 .ca0108_chip = 1, 1214 .ca0108_chip = 1,
1158 .ca_cardbus_chip = 1, 1215 .ca_cardbus_chip = 1,
1159 .spi_dac = 1, 1216 .spi_dac = 1,
1217 .i2c_adc = 1,
1160 .spk71 = 1} , 1218 .spk71 = 1} ,
1161 {.vendor = 0x1102, .device = 0x0008, 1219 {.vendor = 0x1102, .device = 0x0008,
1162 .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", 1220 .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]",