Lines Matching +full:0 +full:xca00

37 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
42 static unsigned int dmaio = 0x7a00; /* DDMA i/o address */
63 #define SV_REG_CONTROL 0x00 /* R/W: CODEC/Mixer control register */
64 #define SV_ENHANCED 0x01 /* audio mode select - enhanced mode */
65 #define SV_TEST 0x02 /* test bit */
66 #define SV_REVERB 0x04 /* reverb enable */
67 #define SV_WAVETABLE 0x08 /* wavetable active / FM active if not set */
68 #define SV_INTA 0x20 /* INTA driving - should be always 1 */
69 #define SV_RESET 0x80 /* reset chip */
70 #define SV_REG_IRQMASK 0x01 /* R/W: CODEC/Mixer interrupt mask register */
71 #define SV_DMAA_MASK 0x01 /* mask DMA-A interrupt */
72 #define SV_DMAC_MASK 0x04 /* mask DMA-C interrupt */
73 #define SV_SPEC_MASK 0x08 /* special interrupt mask - should be always masked */
74 #define SV_UD_MASK 0x40 /* Up/Down button interrupt mask */
75 #define SV_MIDI_MASK 0x80 /* mask MIDI interrupt */
76 #define SV_REG_STATUS 0x02 /* R/O: CODEC/Mixer status register */
77 #define SV_DMAA_IRQ 0x01 /* DMA-A interrupt */
78 #define SV_DMAC_IRQ 0x04 /* DMA-C interrupt */
79 #define SV_SPEC_IRQ 0x08 /* special interrupt */
80 #define SV_UD_IRQ 0x40 /* Up/Down interrupt */
81 #define SV_MIDI_IRQ 0x80 /* MIDI interrupt */
82 #define SV_REG_INDEX 0x04 /* R/W: CODEC/Mixer index address register */
83 #define SV_MCE 0x40 /* mode change enable */
84 #define SV_TRD 0x80 /* DMA transfer request disabled */
85 #define SV_REG_DATA 0x05 /* R/W: CODEC/Mixer index data register */
91 #define SV_IREG_LEFT_ADC 0x00 /* Left ADC Input Control */
92 #define SV_IREG_RIGHT_ADC 0x01 /* Right ADC Input Control */
93 #define SV_IREG_LEFT_AUX1 0x02 /* Left AUX1 Input Control */
94 #define SV_IREG_RIGHT_AUX1 0x03 /* Right AUX1 Input Control */
95 #define SV_IREG_LEFT_CD 0x04 /* Left CD Input Control */
96 #define SV_IREG_RIGHT_CD 0x05 /* Right CD Input Control */
97 #define SV_IREG_LEFT_LINE 0x06 /* Left Line Input Control */
98 #define SV_IREG_RIGHT_LINE 0x07 /* Right Line Input Control */
99 #define SV_IREG_MIC 0x08 /* MIC Input Control */
100 #define SV_IREG_GAME_PORT 0x09 /* Game Port Control */
101 #define SV_IREG_LEFT_SYNTH 0x0a /* Left Synth Input Control */
102 #define SV_IREG_RIGHT_SYNTH 0x0b /* Right Synth Input Control */
103 #define SV_IREG_LEFT_AUX2 0x0c /* Left AUX2 Input Control */
104 #define SV_IREG_RIGHT_AUX2 0x0d /* Right AUX2 Input Control */
105 #define SV_IREG_LEFT_ANALOG 0x0e /* Left Analog Mixer Output Control */
106 #define SV_IREG_RIGHT_ANALOG 0x0f /* Right Analog Mixer Output Control */
107 #define SV_IREG_LEFT_PCM 0x10 /* Left PCM Input Control */
108 #define SV_IREG_RIGHT_PCM 0x11 /* Right PCM Input Control */
109 #define SV_IREG_DMA_DATA_FMT 0x12 /* DMA Data Format */
110 #define SV_IREG_PC_ENABLE 0x13 /* Playback/Capture Enable Register */
111 #define SV_IREG_UD_BUTTON 0x14 /* Up/Down Button Register */
112 #define SV_IREG_REVISION 0x15 /* Revision */
113 #define SV_IREG_ADC_OUTPUT_CTRL 0x16 /* ADC Output Control */
114 #define SV_IREG_DMA_A_UPPER 0x18 /* DMA A Upper Base Count */
115 #define SV_IREG_DMA_A_LOWER 0x19 /* DMA A Lower Base Count */
116 #define SV_IREG_DMA_C_UPPER 0x1c /* DMA C Upper Base Count */
117 #define SV_IREG_DMA_C_LOWER 0x1d /* DMA C Lower Base Count */
118 #define SV_IREG_PCM_RATE_LOW 0x1e /* PCM Sampling Rate Low Byte */
119 #define SV_IREG_PCM_RATE_HIGH 0x1f /* PCM Sampling Rate High Byte */
120 #define SV_IREG_SYNTH_RATE_LOW 0x20 /* Synthesizer Sampling Rate Low Byte */
121 #define SV_IREG_SYNTH_RATE_HIGH 0x21 /* Synthesizer Sampling Rate High Byte */
122 #define SV_IREG_ADC_CLOCK 0x22 /* ADC Clock Source Selection */
123 #define SV_IREG_ADC_ALT_RATE 0x23 /* ADC Alternative Sampling Rate Selection */
124 #define SV_IREG_ADC_PLL_M 0x24 /* ADC PLL M Register */
125 #define SV_IREG_ADC_PLL_N 0x25 /* ADC PLL N Register */
126 #define SV_IREG_SYNTH_PLL_M 0x26 /* Synthesizer PLL M Register */
127 #define SV_IREG_SYNTH_PLL_N 0x27 /* Synthesizer PLL N Register */
128 #define SV_IREG_MPU401 0x2a /* MPU-401 UART Operation */
129 #define SV_IREG_DRIVE_CTRL 0x2b /* Drive Control */
130 #define SV_IREG_SRS_SPACE 0x2c /* SRS Space Control */
131 #define SV_IREG_SRS_CENTER 0x2d /* SRS Center Control */
132 #define SV_IREG_WAVE_SOURCE 0x2e /* Wavetable Sample Source Select */
133 #define SV_IREG_ANALOG_POWER 0x30 /* Analog Power Down Control */
134 #define SV_IREG_DIGITAL_POWER 0x31 /* Digital Power Down Control */
143 #define SV_DMA_ADDR0 0x00
144 #define SV_DMA_ADDR1 0x01
145 #define SV_DMA_ADDR2 0x02
146 #define SV_DMA_ADDR3 0x03
147 #define SV_DMA_COUNT0 0x04
148 #define SV_DMA_COUNT1 0x05
149 #define SV_DMA_COUNT2 0x06
150 #define SV_DMA_MODE 0x0b
151 #define SV_DMA_RESET 0x0d
152 #define SV_DMA_MASK 0x0f
158 #define SV_RECSRC_RESERVED (0x00<<5)
159 #define SV_RECSRC_CD (0x01<<5)
160 #define SV_RECSRC_DAC (0x02<<5)
161 #define SV_RECSRC_AUX2 (0x03<<5)
162 #define SV_RECSRC_LINE (0x04<<5)
163 #define SV_RECSRC_AUX1 (0x05<<5)
164 #define SV_RECSRC_MIC (0x06<<5)
165 #define SV_RECSRC_OUT (0x07<<5)
230 { PCI_VDEVICE(S3, 0xca00), 0, },
231 { 0, }
258 outb(0x18, sonic->dmaa_port + SV_DMA_MODE);
259 #if 0
260 dev_dbg(sonic->card->dev, "program dmaa: addr = 0x%x, paddr = 0x%x\n",
274 outb(0x14, sonic->dmac_port + SV_DMA_MODE);
275 #if 0
276 dev_dbg(sonic->card->dev, "program dmac: addr = 0x%x, paddr = 0x%x\n",
283 return (inl(sonic->dmaa_port + SV_DMA_COUNT0) & 0xffffff) + 1;
289 return ((inl(sonic->dmac_port + SV_DMA_COUNT0) & 0xffffff) + 1) << 1;
336 #if 0
340 "SV REGS: INDEX = 0x%02x STATUS = 0x%02x\n",
343 " 0x00: left input = 0x%02x 0x20: synth rate low = 0x%02x\n",
344 snd_sonicvibes_in(sonic, 0x00), snd_sonicvibes_in(sonic, 0x20));
346 " 0x01: right input = 0x%02x 0x21: synth rate high = 0x%02x\n",
347 snd_sonicvibes_in(sonic, 0x01), snd_sonicvibes_in(sonic, 0x21));
349 " 0x02: left AUX1 = 0x%02x 0x22: ADC clock = 0x%02x\n",
350 snd_sonicvibes_in(sonic, 0x02), snd_sonicvibes_in(sonic, 0x22));
352 " 0x03: right AUX1 = 0x%02x 0x23: ADC alt rate = 0x%02x\n",
353 snd_sonicvibes_in(sonic, 0x03), snd_sonicvibes_in(sonic, 0x23));
355 " 0x04: left CD = 0x%02x 0x24: ADC pll M = 0x%02x\n",
356 snd_sonicvibes_in(sonic, 0x04), snd_sonicvibes_in(sonic, 0x24));
358 " 0x05: right CD = 0x%02x 0x25: ADC pll N = 0x%02x\n",
359 snd_sonicvibes_in(sonic, 0x05), snd_sonicvibes_in(sonic, 0x25));
361 " 0x06: left line = 0x%02x 0x26: Synth pll M = 0x%02x\n",
362 snd_sonicvibes_in(sonic, 0x06), snd_sonicvibes_in(sonic, 0x26));
364 " 0x07: right line = 0x%02x 0x27: Synth pll N = 0x%02x\n",
365 snd_sonicvibes_in(sonic, 0x07), snd_sonicvibes_in(sonic, 0x27));
367 " 0x08: MIC = 0x%02x 0x28: --- = 0x%02x\n",
368 snd_sonicvibes_in(sonic, 0x08), snd_sonicvibes_in(sonic, 0x28));
370 " 0x09: Game port = 0x%02x 0x29: --- = 0x%02x\n",
371 snd_sonicvibes_in(sonic, 0x09), snd_sonicvibes_in(sonic, 0x29));
373 " 0x0a: left synth = 0x%02x 0x2a: MPU401 = 0x%02x\n",
374 snd_sonicvibes_in(sonic, 0x0a), snd_sonicvibes_in(sonic, 0x2a));
376 " 0x0b: right synth = 0x%02x 0x2b: drive ctrl = 0x%02x\n",
377 snd_sonicvibes_in(sonic, 0x0b), snd_sonicvibes_in(sonic, 0x2b));
379 " 0x0c: left AUX2 = 0x%02x 0x2c: SRS space = 0x%02x\n",
380 snd_sonicvibes_in(sonic, 0x0c), snd_sonicvibes_in(sonic, 0x2c));
382 " 0x0d: right AUX2 = 0x%02x 0x2d: SRS center = 0x%02x\n",
383 snd_sonicvibes_in(sonic, 0x0d), snd_sonicvibes_in(sonic, 0x2d));
385 " 0x0e: left analog = 0x%02x 0x2e: wave source = 0x%02x\n",
386 snd_sonicvibes_in(sonic, 0x0e), snd_sonicvibes_in(sonic, 0x2e));
388 " 0x0f: right analog = 0x%02x 0x2f: --- = 0x%02x\n",
389 snd_sonicvibes_in(sonic, 0x0f), snd_sonicvibes_in(sonic, 0x2f));
391 " 0x10: left PCM = 0x%02x 0x30: analog power = 0x%02x\n",
392 snd_sonicvibes_in(sonic, 0x10), snd_sonicvibes_in(sonic, 0x30));
394 " 0x11: right PCM = 0x%02x 0x31: analog power = 0x%02x\n",
395 snd_sonicvibes_in(sonic, 0x11), snd_sonicvibes_in(sonic, 0x31));
397 " 0x12: DMA data format = 0x%02x 0x32: --- = 0x%02x\n",
398 snd_sonicvibes_in(sonic, 0x12), snd_sonicvibes_in(sonic, 0x32));
400 " 0x13: P/C enable = 0x%02x 0x33: --- = 0x%02x\n",
401 snd_sonicvibes_in(sonic, 0x13), snd_sonicvibes_in(sonic, 0x33));
403 " 0x14: U/D button = 0x%02x 0x34: --- = 0x%02x\n",
404 snd_sonicvibes_in(sonic, 0x14), snd_sonicvibes_in(sonic, 0x34));
406 " 0x15: revision = 0x%02x 0x35: --- = 0x%02x\n",
407 snd_sonicvibes_in(sonic, 0x15), snd_sonicvibes_in(sonic, 0x35));
409 " 0x16: ADC output ctrl = 0x%02x 0x36: --- = 0x%02x\n",
410 snd_sonicvibes_in(sonic, 0x16), snd_sonicvibes_in(sonic, 0x36));
412 " 0x17: --- = 0x%02x 0x37: --- = 0x%02x\n",
413 snd_sonicvibes_in(sonic, 0x17), snd_sonicvibes_in(sonic, 0x37));
415 " 0x18: DMA A upper cnt = 0x%02x 0x38: --- = 0x%02x\n",
416 snd_sonicvibes_in(sonic, 0x18), snd_sonicvibes_in(sonic, 0x38));
418 " 0x19: DMA A lower cnt = 0x%02x 0x39: --- = 0x%02x\n",
419 snd_sonicvibes_in(sonic, 0x19), snd_sonicvibes_in(sonic, 0x39));
421 " 0x1a: --- = 0x%02x 0x3a: --- = 0x%02x\n",
422 snd_sonicvibes_in(sonic, 0x1a), snd_sonicvibes_in(sonic, 0x3a));
424 " 0x1b: --- = 0x%02x 0x3b: --- = 0x%02x\n",
425 snd_sonicvibes_in(sonic, 0x1b), snd_sonicvibes_in(sonic, 0x3b));
427 " 0x1c: DMA C upper cnt = 0x%02x 0x3c: --- = 0x%02x\n",
428 snd_sonicvibes_in(sonic, 0x1c), snd_sonicvibes_in(sonic, 0x3c));
430 " 0x1d: DMA C upper cnt = 0x%02x 0x3d: --- = 0x%02x\n",
431 snd_sonicvibes_in(sonic, 0x1d), snd_sonicvibes_in(sonic, 0x3d));
433 " 0x1e: PCM rate low = 0x%02x 0x3e: --- = 0x%02x\n",
434 snd_sonicvibes_in(sonic, 0x1e), snd_sonicvibes_in(sonic, 0x3e));
436 " 0x1f: PCM rate high = 0x%02x 0x3f: --- = 0x%02x\n",
437 snd_sonicvibes_in(sonic, 0x1f), snd_sonicvibes_in(sonic, 0x3f));
455 outb(0, SV_REG(sonic, INDEX));
464 unsigned int r, m = 0, n = 0;
465 unsigned int xm, xn, xr, xd, metric = ~0U;
472 for (r = 0; rate < 75000000 / SV_ADCMULT; r += 0x20, rate <<= 1);
489 #if 0
493 "pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n);
520 clock = 0x10;
522 clock = 0x00;
552 return 0;
583 return 0;
594 if (status == 0xff) { /* failure */
595 outb(sonic->irqmask = ~0, SV_REG(sonic, IRQMASK));
616 vol = udreg & 0x3f;
617 if (!(udreg & 0x40))
621 oleft &= 0x1f;
622 oright &= 0x1f;
624 if (oleft < 0)
625 oleft = 0;
626 if (oleft > 0x1f)
627 oleft = 0x1f;
629 if (oright < 0)
630 oright = 0;
631 if (oright > 0x1f)
632 oright = 0x1f;
633 if (udreg & 0x80) {
634 mleft ^= 0x80;
635 mright ^= 0x80;
637 oleft |= mleft & 0x80;
638 oright |= mright & 0x80;
670 unsigned char fmt = 0;
686 return 0;
693 unsigned char fmt = 0;
701 fmt |= 0x10;
703 fmt |= 0x20;
704 snd_sonicvibes_setfmt(sonic, ~0x30, fmt);
710 return 0;
719 return 0;
729 return 0;
750 .fifo_size = 0,
769 .fifo_size = 0,
780 snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_sonicvibes_hw_constraint_dac_rate, NULL, SNDRV_PCM_HW_PARAM_RATE, -1);
781 return 0;
792 snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
794 return 0;
803 return 0;
812 return 0;
837 if (err < 0)
846 pcm->info_flags = 0;
853 return 0;
879 ucontrol->value.enumerated.item[0] = ((snd_sonicvibes_in1(sonic, SV_IREG_LEFT_ADC) & SV_RECSRC_OUT) >> 5) - 1;
881 return 0;
890 if (ucontrol->value.enumerated.item[0] >= 7 ||
893 left = (ucontrol->value.enumerated.item[0] + 1) << 5;
914 int mask = (kcontrol->private_value >> 16) & 0xff;
918 uinfo->value.integer.min = 0;
920 return 0;
926 int reg = kcontrol->private_value & 0xff;
927 int shift = (kcontrol->private_value >> 8) & 0xff;
928 int mask = (kcontrol->private_value >> 16) & 0xff;
929 int invert = (kcontrol->private_value >> 24) & 0xff;
932 ucontrol->value.integer.value[0] = (snd_sonicvibes_in1(sonic, reg)>> shift) & mask;
934 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
935 return 0;
941 int reg = kcontrol->private_value & 0xff;
942 int shift = (kcontrol->private_value >> 8) & 0xff;
943 int mask = (kcontrol->private_value >> 16) & 0xff;
944 int invert = (kcontrol->private_value >> 24) & 0xff;
948 val = (ucontrol->value.integer.value[0] & mask);
968 int mask = (kcontrol->private_value >> 24) & 0xff;
972 uinfo->value.integer.min = 0;
974 return 0;
980 int left_reg = kcontrol->private_value & 0xff;
981 int right_reg = (kcontrol->private_value >> 8) & 0xff;
982 int shift_left = (kcontrol->private_value >> 16) & 0x07;
983 int shift_right = (kcontrol->private_value >> 19) & 0x07;
984 int mask = (kcontrol->private_value >> 24) & 0xff;
988 ucontrol->value.integer.value[0] = (snd_sonicvibes_in1(sonic, left_reg) >> shift_left) & mask;
991 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
994 return 0;
1000 int left_reg = kcontrol->private_value & 0xff;
1001 int right_reg = (kcontrol->private_value >> 8) & 0xff;
1002 int shift_left = (kcontrol->private_value >> 16) & 0x07;
1003 int shift_right = (kcontrol->private_value >> 19) & 0x07;
1004 int mask = (kcontrol->private_value >> 24) & 0xff;
1009 val1 = ucontrol->value.integer.value[0] & mask;
1029 SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0),
1030 SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1),
1031 SONICVIBES_DOUBLE("Aux Playback Volume", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 0, 0, 31, 1),
1032 SONICVIBES_DOUBLE("CD Playback Switch", 0, SV_IREG_LEFT_CD, SV_IREG_RIGHT_CD, 7, 7, 1, 1),
1033 SONICVIBES_DOUBLE("CD Playback Volume", 0, SV_IREG_LEFT_CD, SV_IREG_RIGHT_CD, 0, 0, 31, 1),
1034 SONICVIBES_DOUBLE("Line Playback Switch", 0, SV_IREG_LEFT_LINE, SV_IREG_RIGHT_LINE, 7, 7, 1, 1),
1035 SONICVIBES_DOUBLE("Line Playback Volume", 0, SV_IREG_LEFT_LINE, SV_IREG_RIGHT_LINE, 0, 0, 31, 1),
1036 SONICVIBES_SINGLE("Mic Playback Switch", 0, SV_IREG_MIC, 7, 1, 1),
1037 SONICVIBES_SINGLE("Mic Playback Volume", 0, SV_IREG_MIC, 0, 15, 1),
1038 SONICVIBES_SINGLE("Mic Boost", 0, SV_IREG_LEFT_ADC, 4, 1, 0),
1039 SONICVIBES_DOUBLE("Synth Playback Switch", 0, SV_IREG_LEFT_SYNTH, SV_IREG_RIGHT_SYNTH, 7, 7, 1, 1),
1040 SONICVIBES_DOUBLE("Synth Playback Volume", 0, SV_IREG_LEFT_SYNTH, SV_IREG_RIGHT_SYNTH, 0, 0, 31, 1),
1042 SONICVIBES_DOUBLE("Aux Playback Volume", 1, SV_IREG_LEFT_AUX2, SV_IREG_RIGHT_AUX2, 0, 0, 31, 1),
1043 SONICVIBES_DOUBLE("Master Playback Switch", 0, SV_IREG_LEFT_ANALOG, SV_IREG_RIGHT_ANALOG, 7, 7, 1, 1),
1044 SONICVIBES_DOUBLE("Master Playback Volume", 0, SV_IREG_LEFT_ANALOG, SV_IREG_RIGHT_ANALOG, 0, 0, 31, 1),
1045 SONICVIBES_DOUBLE("PCM Playback Switch", 0, SV_IREG_LEFT_PCM, SV_IREG_RIGHT_PCM, 7, 7, 1, 1),
1046 SONICVIBES_DOUBLE("PCM Playback Volume", 0, SV_IREG_LEFT_PCM, SV_IREG_RIGHT_PCM, 0, 0, 63, 1),
1047 SONICVIBES_SINGLE("Loopback Capture Switch", 0, SV_IREG_ADC_OUTPUT_CTRL, 0, 1, 0),
1048 SONICVIBES_SINGLE("Loopback Capture Volume", 0, SV_IREG_ADC_OUTPUT_CTRL, 2, 63, 1),
1049 SONICVIBES_MUX("Capture Source", 0)
1071 for (idx = 0; idx < ARRAY_SIZE(snd_sonicvibes_controls); idx++) {
1074 if (err < 0)
1077 case 0:
1081 return 0;
1094 tmp = sonic->srs_space & 0x0f;
1096 str_off_on(sonic->srs_space & 0x80));
1098 tmp == 0x00 ? "100%" :
1099 tmp == 0x01 ? "75%" :
1100 tmp == 0x02 ? "50%" :
1101 tmp == 0x03 ? "25%" : "0%");
1102 tmp = sonic->srs_center & 0x0f;
1104 tmp == 0x00 ? "100%" :
1105 tmp == 0x01 ? "75%" :
1106 tmp == 0x02 ? "50%" :
1107 tmp == 0x03 ? "25%" : "0%");
1108 tmp = sonic->wave_source & 0x03;
1110 tmp == 0x00 ? "on-board ROM" :
1111 tmp == 0x01 ? "PCI bus" : "on-board ROM + PCI bus");
1113 snd_iprintf(buffer, "Onboard synth : %s\n", str_on_off(tmp & 0x01));
1114 snd_iprintf(buffer, "Ext. Rx to synth : %s\n", str_on_off(tmp & 0x02));
1115 snd_iprintf(buffer, "MIDI to ext. Tx : %s\n", str_on_off(tmp & 0x04));
1130 SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0);
1153 if (err < 0)
1156 return 0;
1176 pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port);
1177 pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
1191 if (err < 0)
1206 if (err < 0)
1209 sonic->sb_port = pci_resource_start(pci, 0);
1224 pci_read_config_dword(pci, 0x40, &dmaa);
1225 pci_read_config_dword(pci, 0x48, &dmac);
1226 dmaio &= ~0x0f;
1227 dmaa &= ~0x0f;
1228 dmac &= ~0x0f;
1231 dmaio += 0x10;
1233 "BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n",
1238 dmaio += 0x10;
1240 "BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n",
1243 pci_write_config_dword(pci, 0x40, dmaa);
1244 pci_write_config_dword(pci, 0x48, dmac);
1246 sonic->res_dmaa = devm_request_region(&pci->dev, dmaa, 0x10,
1250 "unable to grab DDMA-A port at 0x%x-0x%x\n",
1251 dmaa, dmaa + 0x10 - 1);
1254 sonic->res_dmac = devm_request_region(&pci->dev, dmac, 0x10,
1258 "unable to grab DDMA-C port at 0x%x-0x%x\n",
1259 dmac, dmac + 0x10 - 1);
1263 pci_read_config_dword(pci, 0x40, &sonic->dmaa_port);
1264 pci_read_config_dword(pci, 0x48, &sonic->dmac_port);
1265 sonic->dmaa_port &= ~0x0f;
1266 sonic->dmac_port &= ~0x0f;
1267 pci_write_config_dword(pci, 0x40, sonic->dmaa_port | 9); /* enable + enhanced */
1268 pci_write_config_dword(pci, 0x48, sonic->dmac_port | 9); /* enable */
1272 outb(0, SV_REG(sonic, CONTROL)); /* release reset */
1274 outb(SV_ENHANCED | SV_INTA | (reverb ? SV_REVERB : 0), SV_REG(sonic, CONTROL));
1277 snd_sonicvibes_out(sonic, SV_IREG_DRIVE_CTRL, 0); /* drive current 16mA */
1279 snd_sonicvibes_out(sonic, SV_IREG_DRIVE_CTRL, 0x40); /* drive current 8mA */
1281 snd_sonicvibes_out(sonic, SV_IREG_PC_ENABLE, sonic->enable = 0); /* disable playback & capture */
1284 snd_sonicvibes_out(sonic, SV_IREG_ADC_CLOCK, 0); /* use PLL as clock source */
1285 snd_sonicvibes_out(sonic, SV_IREG_ANALOG_POWER, 0); /* power up analog parts */
1286 snd_sonicvibes_out(sonic, SV_IREG_DIGITAL_POWER, 0); /* power up digital parts */
1288 snd_sonicvibes_out(sonic, SV_IREG_SRS_SPACE, sonic->srs_space = 0x80); /* SRS space off */
1289 snd_sonicvibes_out(sonic, SV_IREG_SRS_CENTER, sonic->srs_center = 0x00);/* SRS center off */
1290 snd_sonicvibes_out(sonic, SV_IREG_MPU401, sonic->mpu_switch = 0x05); /* MPU-401 switch */
1291 snd_sonicvibes_out(sonic, SV_IREG_WAVE_SOURCE, sonic->wave_source = 0x00); /* onboard ROM */
1292 snd_sonicvibes_out(sonic, SV_IREG_PCM_RATE_LOW, (8000 * 65536 / SV_FULLRATE) & 0xff);
1293 snd_sonicvibes_out(sonic, SV_IREG_PCM_RATE_HIGH, ((8000 * 65536 / SV_FULLRATE) >> 8) & 0xff);
1294 snd_sonicvibes_out(sonic, SV_IREG_LEFT_ADC, mge ? 0xd0 : 0xc0);
1295 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_ADC, 0xc0);
1296 snd_sonicvibes_out(sonic, SV_IREG_LEFT_AUX1, 0x9f);
1297 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_AUX1, 0x9f);
1298 snd_sonicvibes_out(sonic, SV_IREG_LEFT_CD, 0x9f);
1299 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_CD, 0x9f);
1300 snd_sonicvibes_out(sonic, SV_IREG_LEFT_LINE, 0x9f);
1301 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_LINE, 0x9f);
1302 snd_sonicvibes_out(sonic, SV_IREG_MIC, 0x8f);
1303 snd_sonicvibes_out(sonic, SV_IREG_LEFT_SYNTH, 0x9f);
1304 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_SYNTH, 0x9f);
1305 snd_sonicvibes_out(sonic, SV_IREG_LEFT_AUX2, 0x9f);
1306 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_AUX2, 0x9f);
1307 snd_sonicvibes_out(sonic, SV_IREG_LEFT_ANALOG, 0x9f);
1308 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_ANALOG, 0x9f);
1309 snd_sonicvibes_out(sonic, SV_IREG_LEFT_PCM, 0xbf);
1310 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_PCM, 0xbf);
1311 snd_sonicvibes_out(sonic, SV_IREG_ADC_OUTPUT_CTRL, 0xfc);
1312 #if 0
1318 return 0;
1326 SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0),
1327 SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0),
1328 SONICVIBES_SINGLE("SonicVibes Onboard Synth", 0, SV_IREG_MPU401, 0, 1, 0),
1329 SONICVIBES_SINGLE("SonicVibes External Rx to Synth", 0, SV_IREG_MPU401, 1, 1, 0),
1330 SONICVIBES_SINGLE("SonicVibes External Tx", 0, SV_IREG_MPU401, 2, 1, 0)
1337 return 0;
1357 for (idx = 0; idx < ARRAY_SIZE(snd_sonicvibes_midi_controls); idx++) {
1359 if (err < 0)
1362 return 0;
1384 if (err < 0)
1388 reverb[dev] ? 1 : 0,
1389 mge[dev] ? 1 : 0);
1390 if (err < 0)
1395 sprintf(card->longname, "%s rev %i at 0x%llx, irq %i",
1401 err = snd_sonicvibes_pcm(sonic, 0);
1402 if (err < 0)
1405 if (err < 0)
1407 err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
1412 if (err < 0)
1418 if (err < 0)
1420 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
1421 if (err < 0)
1425 if (err < 0)
1429 if (err < 0)
1434 return 0;