aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/cmipci.c173
1 files changed, 109 insertions, 64 deletions
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 751ff00bfeca..2d8d3331bb96 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -95,30 +95,34 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
95#define CM_CHADC0 0x00000001 /* ch0, 0:playback, 1:record */ 95#define CM_CHADC0 0x00000001 /* ch0, 0:playback, 1:record */
96 96
97#define CM_REG_FUNCTRL1 0x04 97#define CM_REG_FUNCTRL1 0x04
98#define CM_ASFC_MASK 0x0000E000 /* ADC sampling frequency */ 98#define CM_DSFC_MASK 0x0000E000 /* channel 1 (DAC?) sampling frequency */
99#define CM_ASFC_SHIFT 13 99#define CM_DSFC_SHIFT 13
100#define CM_DSFC_MASK 0x00001C00 /* DAC sampling frequency */ 100#define CM_ASFC_MASK 0x00001C00 /* channel 0 (ADC?) sampling frequency */
101#define CM_DSFC_SHIFT 10 101#define CM_ASFC_SHIFT 10
102#define CM_SPDF_1 0x00000200 /* SPDIF IN/OUT at channel B */ 102#define CM_SPDF_1 0x00000200 /* SPDIF IN/OUT at channel B */
103#define CM_SPDF_0 0x00000100 /* SPDIF OUT only channel A */ 103#define CM_SPDF_0 0x00000100 /* SPDIF OUT only channel A */
104#define CM_SPDFLOOP 0x00000080 /* ext. SPDIIF/OUT -> IN loopback */ 104#define CM_SPDFLOOP 0x00000080 /* ext. SPDIIF/IN -> OUT loopback */
105#define CM_SPDO2DAC 0x00000040 /* SPDIF/OUT can be heard from internal DAC */ 105#define CM_SPDO2DAC 0x00000040 /* SPDIF/OUT can be heard from internal DAC */
106#define CM_INTRM 0x00000020 /* master control block (MCB) interrupt enabled */ 106#define CM_INTRM 0x00000020 /* master control block (MCB) interrupt enabled */
107#define CM_BREQ 0x00000010 /* bus master enabled */ 107#define CM_BREQ 0x00000010 /* bus master enabled */
108#define CM_VOICE_EN 0x00000008 /* legacy voice (SB16,FM) */ 108#define CM_VOICE_EN 0x00000008 /* legacy voice (SB16,FM) */
109#define CM_UART_EN 0x00000004 /* UART */ 109#define CM_UART_EN 0x00000004 /* legacy UART */
110#define CM_JYSTK_EN 0x00000002 /* joy stick */ 110#define CM_JYSTK_EN 0x00000002 /* legacy joystick */
111#define CM_ZVPORT 0x00000001 /* ZVPORT */
111 112
112#define CM_REG_CHFORMAT 0x08 113#define CM_REG_CHFORMAT 0x08
113 114
114#define CM_CHB3D5C 0x80000000 /* 5,6 channels */ 115#define CM_CHB3D5C 0x80000000 /* 5,6 channels */
116#define CM_FMOFFSET2 0x40000000 /* initial FM PCM offset 2 when Fmute=1 */
115#define CM_CHB3D 0x20000000 /* 4 channels */ 117#define CM_CHB3D 0x20000000 /* 4 channels */
116 118
117#define CM_CHIP_MASK1 0x1f000000 119#define CM_CHIP_MASK1 0x1f000000
118#define CM_CHIP_037 0x01000000 120#define CM_CHIP_037 0x01000000
119 121#define CM_SETLAT48 0x00800000 /* set latency timer 48h */
120#define CM_SPDIF_SELECT1 0x00080000 /* for model <= 037 ? */ 122#define CM_EDGEIRQ 0x00400000 /* emulated edge trigger legacy IRQ */
123#define CM_SPD24SEL39 0x00200000 /* 24-bit spdif: model 039 */
121#define CM_AC3EN1 0x00100000 /* enable AC3: model 037 */ 124#define CM_AC3EN1 0x00100000 /* enable AC3: model 037 */
125#define CM_SPDIF_SELECT1 0x00080000 /* for model <= 037 ? */
122#define CM_SPD24SEL 0x00020000 /* 24bit spdif: model 037 */ 126#define CM_SPD24SEL 0x00020000 /* 24bit spdif: model 037 */
123/* #define CM_SPDIF_INVERSE 0x00010000 */ /* ??? */ 127/* #define CM_SPDIF_INVERSE 0x00010000 */ /* ??? */
124 128
@@ -128,12 +132,18 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
128#define CM_ADCBITLEN_14 0x00008000 132#define CM_ADCBITLEN_14 0x00008000
129#define CM_ADCBITLEN_13 0x0000C000 133#define CM_ADCBITLEN_13 0x0000C000
130 134
131#define CM_ADCDACLEN_MASK 0x00003000 135#define CM_ADCDACLEN_MASK 0x00003000 /* model 037 */
132#define CM_ADCDACLEN_060 0x00000000 136#define CM_ADCDACLEN_060 0x00000000
133#define CM_ADCDACLEN_066 0x00001000 137#define CM_ADCDACLEN_066 0x00001000
134#define CM_ADCDACLEN_130 0x00002000 138#define CM_ADCDACLEN_130 0x00002000
135#define CM_ADCDACLEN_280 0x00003000 139#define CM_ADCDACLEN_280 0x00003000
136 140
141#define CM_ADCDLEN_MASK 0x00003000 /* model 039 */
142#define CM_ADCDLEN_ORIGINAL 0x00000000
143#define CM_ADCDLEN_EXTRA 0x00001000
144#define CM_ADCDLEN_24K 0x00002000
145#define CM_ADCDLEN_WEIGHT 0x00003000
146
137#define CM_CH1_SRATE_176K 0x00000800 147#define CM_CH1_SRATE_176K 0x00000800
138#define CM_CH1_SRATE_96K 0x00000800 /* model 055? */ 148#define CM_CH1_SRATE_96K 0x00000800 /* model 055? */
139#define CM_CH1_SRATE_88K 0x00000400 149#define CM_CH1_SRATE_88K 0x00000400
@@ -142,24 +152,25 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
142#define CM_CH0_SRATE_88K 0x00000100 152#define CM_CH0_SRATE_88K 0x00000100
143 153
144#define CM_SPDIF_INVERSE2 0x00000080 /* model 055? */ 154#define CM_SPDIF_INVERSE2 0x00000080 /* model 055? */
145#define CM_DBLSPDS 0x00000040 155#define CM_DBLSPDS 0x00000040 /* double SPDIF sample rate 88.2/96 */
156#define CM_POLVALID 0x00000020 /* inverse SPDIF/IN valid bit */
157#define CM_SPDLOCKED 0x00000010
146 158
147#define CM_CH1FMT_MASK 0x0000000C 159#define CM_CH1FMT_MASK 0x0000000C /* bit 3: 16 bits, bit 2: stereo */
148#define CM_CH1FMT_SHIFT 2 160#define CM_CH1FMT_SHIFT 2
149#define CM_CH0FMT_MASK 0x00000003 161#define CM_CH0FMT_MASK 0x00000003 /* bit 1: 16 bits, bit 0: stereo */
150#define CM_CH0FMT_SHIFT 0 162#define CM_CH0FMT_SHIFT 0
151 163
152#define CM_REG_INT_HLDCLR 0x0C 164#define CM_REG_INT_HLDCLR 0x0C
153#define CM_CHIP_MASK2 0xff000000 165#define CM_CHIP_MASK2 0xff000000
166#define CM_CHIP_8768 0x20000000
167#define CM_CHIP_055 0x08000000
154#define CM_CHIP_039 0x04000000 168#define CM_CHIP_039 0x04000000
155#define CM_CHIP_039_6CH 0x01000000 169#define CM_CHIP_039_6CH 0x01000000
156#define CM_CHIP_055 0x08000000 170#define CM_UNKNOWN_INT_EN 0x00080000 /* ? */
157#define CM_CHIP_8768 0x20000000
158#define CM_TDMA_INT_EN 0x00040000 171#define CM_TDMA_INT_EN 0x00040000
159#define CM_CH1_INT_EN 0x00020000 172#define CM_CH1_INT_EN 0x00020000
160#define CM_CH0_INT_EN 0x00010000 173#define CM_CH0_INT_EN 0x00010000
161#define CM_INT_HOLD 0x00000002
162#define CM_INT_CLEAR 0x00000001
163 174
164#define CM_REG_INT_STATUS 0x10 175#define CM_REG_INT_STATUS 0x10
165#define CM_INTR 0x80000000 176#define CM_INTR 0x80000000
@@ -178,12 +189,13 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
178#define CM_CHINT0 0x00000001 189#define CM_CHINT0 0x00000001
179 190
180#define CM_REG_LEGACY_CTRL 0x14 191#define CM_REG_LEGACY_CTRL 0x14
181#define CM_NXCHG 0x80000000 /* h/w multi channels? */ 192#define CM_NXCHG 0x80000000 /* don't map base reg dword->sample */
182#define CM_VMPU_MASK 0x60000000 /* MPU401 i/o port address */ 193#define CM_VMPU_MASK 0x60000000 /* MPU401 i/o port address */
183#define CM_VMPU_330 0x00000000 194#define CM_VMPU_330 0x00000000
184#define CM_VMPU_320 0x20000000 195#define CM_VMPU_320 0x20000000
185#define CM_VMPU_310 0x40000000 196#define CM_VMPU_310 0x40000000
186#define CM_VMPU_300 0x60000000 197#define CM_VMPU_300 0x60000000
198#define CM_ENWR8237 0x10000000 /* enable bus master to write 8237 base reg */
187#define CM_VSBSEL_MASK 0x0C000000 /* SB16 base address */ 199#define CM_VSBSEL_MASK 0x0C000000 /* SB16 base address */
188#define CM_VSBSEL_220 0x00000000 200#define CM_VSBSEL_220 0x00000000
189#define CM_VSBSEL_240 0x04000000 201#define CM_VSBSEL_240 0x04000000
@@ -194,44 +206,74 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
194#define CM_FMSEL_3C8 0x01000000 206#define CM_FMSEL_3C8 0x01000000
195#define CM_FMSEL_3E0 0x02000000 207#define CM_FMSEL_3E0 0x02000000
196#define CM_FMSEL_3E8 0x03000000 208#define CM_FMSEL_3E8 0x03000000
197#define CM_ENSPDOUT 0x00800000 /* enable XPDIF/OUT to I/O interface */ 209#define CM_ENSPDOUT 0x00800000 /* enable XSPDIF/OUT to I/O interface */
198#define CM_SPDCOPYRHT 0x00400000 /* set copyright spdif in/out */ 210#define CM_SPDCOPYRHT 0x00400000 /* spdif in/out copyright bit */
199#define CM_DAC2SPDO 0x00200000 /* enable wave+fm_midi -> SPDIF/OUT */ 211#define CM_DAC2SPDO 0x00200000 /* enable wave+fm_midi -> SPDIF/OUT */
200#define CM_SETRETRY 0x00010000 /* 0: legacy i/o wait (default), 1: legacy i/o bus retry */ 212#define CM_INVIDWEN 0x00100000 /* internal vendor ID write enable, model 039? */
213#define CM_SETRETRY 0x00100000 /* 0: legacy i/o wait (default), 1: legacy i/o bus retry */
214#define CM_C_EEACCESS 0x00080000 /* direct programming eeprom regs */
215#define CM_C_EECS 0x00040000
216#define CM_C_EEDI46 0x00020000
217#define CM_C_EECK46 0x00010000
201#define CM_CHB3D6C 0x00008000 /* 5.1 channels support */ 218#define CM_CHB3D6C 0x00008000 /* 5.1 channels support */
202#define CM_LINE_AS_BASS 0x00006000 /* use line-in as bass */ 219#define CM_CENTR2LIN 0x00004000 /* line-in as center out */
220#define CM_BASE2LIN 0x00002000 /* line-in as bass out */
221#define CM_EXBASEN 0x00001000 /* external bass input enable */
203 222
204#define CM_REG_MISC_CTRL 0x18 223#define CM_REG_MISC_CTRL 0x18
205#define CM_PWD 0x80000000 224#define CM_PWD 0x80000000 /* power down */
206#define CM_RESET 0x40000000 225#define CM_RESET 0x40000000
207#define CM_SFIL_MASK 0x30000000 226#define CM_SFIL_MASK 0x30000000 /* filter control at front end DAC, model 037? */
208#define CM_TXVX 0x08000000 227#define CM_VMGAIN 0x10000000 /* analog master amp +6dB, model 039? */
209#define CM_N4SPK3D 0x04000000 /* 4ch output */ 228#define CM_TXVX 0x08000000 /* model 037? */
229#define CM_N4SPK3D 0x04000000 /* copy front to rear */
210#define CM_SPDO5V 0x02000000 /* 5V spdif output (1 = 0.5v (coax)) */ 230#define CM_SPDO5V 0x02000000 /* 5V spdif output (1 = 0.5v (coax)) */
211#define CM_SPDIF48K 0x01000000 /* write */ 231#define CM_SPDIF48K 0x01000000 /* write */
212#define CM_SPATUS48K 0x01000000 /* read */ 232#define CM_SPATUS48K 0x01000000 /* read */
213#define CM_ENDBDAC 0x00800000 /* enable dual dac */ 233#define CM_ENDBDAC 0x00800000 /* enable double dac */
214#define CM_XCHGDAC 0x00400000 /* 0: front=ch0, 1: front=ch1 */ 234#define CM_XCHGDAC 0x00400000 /* 0: front=ch0, 1: front=ch1 */
215#define CM_SPD32SEL 0x00200000 /* 0: 16bit SPDIF, 1: 32bit */ 235#define CM_SPD32SEL 0x00200000 /* 0: 16bit SPDIF, 1: 32bit */
216#define CM_SPDFLOOPI 0x00100000 /* int. SPDIF-IN -> int. OUT */ 236#define CM_SPDFLOOPI 0x00100000 /* int. SPDIF-OUT -> int. IN */
217#define CM_FM_EN 0x00080000 /* enalbe FM */ 237#define CM_FM_EN 0x00080000 /* enable legacy FM */
218#define CM_AC3EN2 0x00040000 /* enable AC3: model 039 */ 238#define CM_AC3EN2 0x00040000 /* enable AC3: model 039 */
219#define CM_VIDWPDSB 0x00010000 239#define CM_ENWRASID 0x00010000 /* choose writable internal SUBID (audio) */
240#define CM_VIDWPDSB 0x00010000 /* model 037? */
220#define CM_SPDF_AC97 0x00008000 /* 0: SPDIF/OUT 44.1K, 1: 48K */ 241#define CM_SPDF_AC97 0x00008000 /* 0: SPDIF/OUT 44.1K, 1: 48K */
221#define CM_MASK_EN 0x00004000 242#define CM_MASK_EN 0x00004000 /* activate channel mask on legacy DMA */
222#define CM_VIDWPPRT 0x00002000 243#define CM_ENWRMSID 0x00002000 /* choose writable internal SUBID (modem) */
223#define CM_SFILENB 0x00001000 244#define CM_VIDWPPRT 0x00002000 /* model 037? */
224#define CM_MMODE_MASK 0x00000E00 245#define CM_SFILENB 0x00001000 /* filter stepping at front end DAC, model 037? */
246#define CM_MMODE_MASK 0x00000E00 /* model DAA interface mode */
225#define CM_SPDIF_SELECT2 0x00000100 /* for model > 039 ? */ 247#define CM_SPDIF_SELECT2 0x00000100 /* for model > 039 ? */
226#define CM_ENCENTER 0x00000080 248#define CM_ENCENTER 0x00000080
227#define CM_FLINKON 0x00000040 249#define CM_FLINKON 0x00000080 /* force modem link detection on, model 037 */
228#define CM_FLINKOFF 0x00000020 250#define CM_MUTECH1 0x00000040 /* mute PCI ch1 to DAC */
229#define CM_MIDSMP 0x00000010 251#define CM_FLINKOFF 0x00000040 /* force modem link detection off, model 037 */
230#define CM_UPDDMA_MASK 0x0000000C 252#define CM_UNKNOWN_18_5 0x00000020 /* ? */
231#define CM_TWAIT_MASK 0x00000003 253#define CM_MIDSMP 0x00000010 /* 1/2 interpolation at front end DAC */
254#define CM_UPDDMA_MASK 0x0000000C /* TDMA position update notification */
255#define CM_UPDDMA_2048 0x00000000
256#define CM_UPDDMA_1024 0x00000004
257#define CM_UPDDMA_512 0x00000008
258#define CM_UPDDMA_256 0x0000000C
259#define CM_TWAIT_MASK 0x00000003 /* model 037 */
260#define CM_TWAIT1 0x00000002 /* FM i/o cycle, 0: 48, 1: 64 PCICLKs */
261#define CM_TWAIT0 0x00000001 /* i/o cycle, 0: 4, 1: 6 PCICLKs */
262
263#define CM_REG_TDMA_POSITION 0x1C
264#define CM_TDMA_CNT_MASK 0xFFFF0000 /* current byte/word count */
265#define CM_TDMA_ADR_MASK 0x0000FFFF /* current address */
232 266
233 /* byte */ 267 /* byte */
234#define CM_REG_MIXER0 0x20 268#define CM_REG_MIXER0 0x20
269#define CM_REG_SBVR 0x20 /* write: sb16 version */
270#define CM_REG_DEV 0x20 /* read: hardware device version */
271
272#define CM_REG_MIXER21 0x21
273#define CM_UNKNOWN_21_MASK 0x78 /* ? */
274#define CM_X_ADPCM 0x04 /* SB16 ADPCM enable */
275#define CM_PROINV 0x02 /* SBPro left/right channel switching */
276#define CM_X_SB16 0x01 /* SB16 compatible */
235 277
236#define CM_REG_SB16_DATA 0x22 278#define CM_REG_SB16_DATA 0x22
237#define CM_REG_SB16_ADDR 0x23 279#define CM_REG_SB16_ADDR 0x23
@@ -246,8 +288,8 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
246#define CM_FMMUTE_SHIFT 7 288#define CM_FMMUTE_SHIFT 7
247#define CM_WSMUTE 0x40 /* mute PCM */ 289#define CM_WSMUTE 0x40 /* mute PCM */
248#define CM_WSMUTE_SHIFT 6 290#define CM_WSMUTE_SHIFT 6
249#define CM_SPK4 0x20 /* lin-in -> rear line out */ 291#define CM_REAR2LIN 0x20 /* lin-in -> rear line out */
250#define CM_SPK4_SHIFT 5 292#define CM_REAR2LIN_SHIFT 5
251#define CM_REAR2FRONT 0x10 /* exchange rear/front */ 293#define CM_REAR2FRONT 0x10 /* exchange rear/front */
252#define CM_REAR2FRONT_SHIFT 4 294#define CM_REAR2FRONT_SHIFT 4
253#define CM_WAVEINL 0x08 /* digital wave rec. left chan */ 295#define CM_WAVEINL 0x08 /* digital wave rec. left chan */
@@ -279,12 +321,13 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
279#define CM_VAUXR_MASK 0x0f 321#define CM_VAUXR_MASK 0x0f
280 322
281#define CM_REG_MISC 0x27 323#define CM_REG_MISC 0x27
324#define CM_UNKNOWN_27_MASK 0xd8 /* ? */
282#define CM_XGPO1 0x20 325#define CM_XGPO1 0x20
283// #define CM_XGPBIO 0x04 326// #define CM_XGPBIO 0x04
284#define CM_MIC_CENTER_LFE 0x04 /* mic as center/lfe out? (model 039 or later?) */ 327#define CM_MIC_CENTER_LFE 0x04 /* mic as center/lfe out? (model 039 or later?) */
285#define CM_SPDIF_INVERSE 0x04 /* spdif input phase inverse (model 037) */ 328#define CM_SPDIF_INVERSE 0x04 /* spdif input phase inverse (model 037) */
286#define CM_SPDVALID 0x02 /* spdif input valid check */ 329#define CM_SPDVALID 0x02 /* spdif input valid check */
287#define CM_DMAUTO 0x01 330#define CM_DMAUTO 0x01 /* SB16 DMA auto detect */
288 331
289#define CM_REG_AC97 0x28 /* hmmm.. do we have ac97 link? */ 332#define CM_REG_AC97 0x28 /* hmmm.. do we have ac97 link? */
290/* 333/*
@@ -325,18 +368,20 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
325/* 368/*
326 * extended registers 369 * extended registers
327 */ 370 */
328#define CM_REG_CH0_FRAME1 0x80 /* base address */ 371#define CM_REG_CH0_FRAME1 0x80 /* write: base address */
329#define CM_REG_CH0_FRAME2 0x84 372#define CM_REG_CH0_FRAME2 0x84 /* read: current address */
330#define CM_REG_CH1_FRAME1 0x88 /* 0-15: count of samples at bus master; buffer size */ 373#define CM_REG_CH1_FRAME1 0x88 /* 0-15: count of samples at bus master; buffer size */
331#define CM_REG_CH1_FRAME2 0x8C /* 16-31: count of samples at codec; fragment size */ 374#define CM_REG_CH1_FRAME2 0x8C /* 16-31: count of samples at codec; fragment size */
375
332#define CM_REG_EXT_MISC 0x90 376#define CM_REG_EXT_MISC 0x90
333#define CM_REG_MISC_CTRL_8768 0x92 /* reg. name the same as 0x18 */ 377#define CM_ADC48K44K 0x10000000 /* ADC parameters group, 0: 44k, 1: 48k */
334#define CM_CHB3D8C 0x20 /* 7.1 channels support */ 378#define CM_CHB3D8C 0x00200000 /* 7.1 channels support */
335#define CM_SPD32FMT 0x10 /* SPDIF/IN 32k */ 379#define CM_SPD32FMT 0x00100000 /* SPDIF/IN 32k sample rate */
336#define CM_ADC2SPDIF 0x08 /* ADC output to SPDIF/OUT */ 380#define CM_ADC2SPDIF 0x00080000 /* ADC output to SPDIF/OUT */
337#define CM_SHAREADC 0x04 /* DAC in ADC as Center/LFE */ 381#define CM_SHAREADC 0x00040000 /* DAC in ADC as Center/LFE */
338#define CM_REALTCMP 0x02 /* monitor the CMPL/CMPR of ADC */ 382#define CM_REALTCMP 0x00020000 /* monitor the CMPL/CMPR of ADC */
339#define CM_INVLRCK 0x01 /* invert ZVPORT's LRCK */ 383#define CM_INVLRCK 0x00010000 /* invert ZVPORT's LRCK */
384#define CM_UNKNOWN_90_MASK 0x0000FFFF /* ? */
340 385
341/* 386/*
342 * size of i/o region 387 * size of i/o region
@@ -717,9 +762,9 @@ static int set_dac_channels(struct cmipci *cm, struct cmipci_pcm *rec, int chann
717 } 762 }
718 if (cm->chip_version == 68) { 763 if (cm->chip_version == 68) {
719 if (channels == 8) { 764 if (channels == 8) {
720 snd_cmipci_set_bit(cm, CM_REG_MISC_CTRL_8768, CM_CHB3D8C); 765 snd_cmipci_set_bit(cm, CM_REG_EXT_MISC, CM_CHB3D8C);
721 } else { 766 } else {
722 snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL_8768, CM_CHB3D8C); 767 snd_cmipci_clear_bit(cm, CM_REG_EXT_MISC, CM_CHB3D8C);
723 } 768 }
724 } 769 }
725 spin_unlock_irq(&cm->reg_lock); 770 spin_unlock_irq(&cm->reg_lock);
@@ -797,11 +842,11 @@ static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec,
797 freq = snd_cmipci_rate_freq(runtime->rate); 842 freq = snd_cmipci_rate_freq(runtime->rate);
798 val = snd_cmipci_read(cm, CM_REG_FUNCTRL1); 843 val = snd_cmipci_read(cm, CM_REG_FUNCTRL1);
799 if (rec->ch) { 844 if (rec->ch) {
800 val &= ~CM_ASFC_MASK;
801 val |= (freq << CM_ASFC_SHIFT) & CM_ASFC_MASK;
802 } else {
803 val &= ~CM_DSFC_MASK; 845 val &= ~CM_DSFC_MASK;
804 val |= (freq << CM_DSFC_SHIFT) & CM_DSFC_MASK; 846 val |= (freq << CM_DSFC_SHIFT) & CM_DSFC_MASK;
847 } else {
848 val &= ~CM_ASFC_MASK;
849 val |= (freq << CM_ASFC_SHIFT) & CM_ASFC_MASK;
805 } 850 }
806 snd_cmipci_write(cm, CM_REG_FUNCTRL1, val); 851 snd_cmipci_write(cm, CM_REG_FUNCTRL1, val);
807 //snd_printd("cmipci: functrl1 = %08x\n", val); 852 //snd_printd("cmipci: functrl1 = %08x\n", val);
@@ -2284,8 +2329,8 @@ DEFINE_SWITCH_ARG(exchange_dac, CM_REG_MISC_CTRL, CM_XCHGDAC, 0, 0, 0); /* rever
2284DEFINE_SWITCH_ARG(exchange_dac, CM_REG_MISC_CTRL, CM_XCHGDAC, CM_XCHGDAC, 0, 0); 2329DEFINE_SWITCH_ARG(exchange_dac, CM_REG_MISC_CTRL, CM_XCHGDAC, CM_XCHGDAC, 0, 0);
2285#endif 2330#endif
2286DEFINE_BIT_SWITCH_ARG(fourch, CM_REG_MISC_CTRL, CM_N4SPK3D, 0, 0); 2331DEFINE_BIT_SWITCH_ARG(fourch, CM_REG_MISC_CTRL, CM_N4SPK3D, 0, 0);
2287// DEFINE_BIT_SWITCH_ARG(line_rear, CM_REG_MIXER1, CM_SPK4, 1, 0); 2332// DEFINE_BIT_SWITCH_ARG(line_rear, CM_REG_MIXER1, CM_REAR2LIN, 1, 0);
2288// DEFINE_BIT_SWITCH_ARG(line_bass, CM_REG_LEGACY_CTRL, CM_LINE_AS_BASS, 0, 0); 2333// DEFINE_BIT_SWITCH_ARG(line_bass, CM_REG_LEGACY_CTRL, CM_CENTR2LIN|CM_BASE2LIN, 0, 0);
2289// DEFINE_BIT_SWITCH_ARG(joystick, CM_REG_FUNCTRL1, CM_JYSTK_EN, 0, 0); /* now module option */ 2334// DEFINE_BIT_SWITCH_ARG(joystick, CM_REG_FUNCTRL1, CM_JYSTK_EN, 0, 0); /* now module option */
2290DEFINE_SWITCH_ARG(modem, CM_REG_MISC_CTRL, CM_FLINKON|CM_FLINKOFF, CM_FLINKON, 0, 0); 2335DEFINE_SWITCH_ARG(modem, CM_REG_MISC_CTRL, CM_FLINKON|CM_FLINKOFF, CM_FLINKON, 0, 0);
2291 2336
@@ -2355,11 +2400,11 @@ static inline unsigned int get_line_in_mode(struct cmipci *cm)
2355 unsigned int val; 2400 unsigned int val;
2356 if (cm->chip_version >= 39) { 2401 if (cm->chip_version >= 39) {
2357 val = snd_cmipci_read(cm, CM_REG_LEGACY_CTRL); 2402 val = snd_cmipci_read(cm, CM_REG_LEGACY_CTRL);
2358 if (val & CM_LINE_AS_BASS) 2403 if (val & (CM_CENTR2LIN | CM_BASE2LIN))
2359 return 2; 2404 return 2;
2360 } 2405 }
2361 val = snd_cmipci_read_b(cm, CM_REG_MIXER1); 2406 val = snd_cmipci_read_b(cm, CM_REG_MIXER1);
2362 if (val & CM_SPK4) 2407 if (val & CM_REAR2LIN)
2363 return 1; 2408 return 1;
2364 return 0; 2409 return 0;
2365} 2410}
@@ -2383,13 +2428,13 @@ static int snd_cmipci_line_in_mode_put(struct snd_kcontrol *kcontrol,
2383 2428
2384 spin_lock_irq(&cm->reg_lock); 2429 spin_lock_irq(&cm->reg_lock);
2385 if (ucontrol->value.enumerated.item[0] == 2) 2430 if (ucontrol->value.enumerated.item[0] == 2)
2386 change = snd_cmipci_set_bit(cm, CM_REG_LEGACY_CTRL, CM_LINE_AS_BASS); 2431 change = snd_cmipci_set_bit(cm, CM_REG_LEGACY_CTRL, CM_CENTR2LIN | CM_BASE2LIN);
2387 else 2432 else
2388 change = snd_cmipci_clear_bit(cm, CM_REG_LEGACY_CTRL, CM_LINE_AS_BASS); 2433 change = snd_cmipci_clear_bit(cm, CM_REG_LEGACY_CTRL, CM_CENTR2LIN | CM_BASE2LIN);
2389 if (ucontrol->value.enumerated.item[0] == 1) 2434 if (ucontrol->value.enumerated.item[0] == 1)
2390 change |= snd_cmipci_set_bit_b(cm, CM_REG_MIXER1, CM_SPK4); 2435 change |= snd_cmipci_set_bit_b(cm, CM_REG_MIXER1, CM_REAR2LIN);
2391 else 2436 else
2392 change |= snd_cmipci_clear_bit_b(cm, CM_REG_MIXER1, CM_SPK4); 2437 change |= snd_cmipci_clear_bit_b(cm, CM_REG_MIXER1, CM_REAR2LIN);
2393 spin_unlock_irq(&cm->reg_lock); 2438 spin_unlock_irq(&cm->reg_lock);
2394 return change; 2439 return change;
2395} 2440}