diff options
-rw-r--r-- | include/sound/wss.h | 172 | ||||
-rw-r--r-- | sound/isa/azt2320.c | 27 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4231.c | 16 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4236.c | 47 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4236_lib.c | 344 | ||||
-rw-r--r-- | sound/isa/gus/gusmax.c | 48 | ||||
-rw-r--r-- | sound/isa/gus/interwave.c | 65 | ||||
-rw-r--r-- | sound/isa/opl3sa2.c | 34 | ||||
-rw-r--r-- | sound/isa/opti9xx/miro.c | 23 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 36 | ||||
-rw-r--r-- | sound/isa/sscape.c | 61 | ||||
-rw-r--r-- | sound/isa/wavefront/wavefront.c | 61 | ||||
-rw-r--r-- | sound/isa/wss/wss_lib.c | 1247 |
13 files changed, 1225 insertions, 956 deletions
diff --git a/include/sound/wss.h b/include/sound/wss.h index f0785f9f4ae4..3b53973f96a7 100644 --- a/include/sound/wss.h +++ b/include/sound/wss.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef __SOUND_CS4231_H | 1 | #ifndef __SOUND_WSS_H |
2 | #define __SOUND_CS4231_H | 2 | #define __SOUND_WSS_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> | 5 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
@@ -30,42 +30,42 @@ | |||
30 | 30 | ||
31 | /* defines for codec.mode */ | 31 | /* defines for codec.mode */ |
32 | 32 | ||
33 | #define CS4231_MODE_NONE 0x0000 | 33 | #define WSS_MODE_NONE 0x0000 |
34 | #define CS4231_MODE_PLAY 0x0001 | 34 | #define WSS_MODE_PLAY 0x0001 |
35 | #define CS4231_MODE_RECORD 0x0002 | 35 | #define WSS_MODE_RECORD 0x0002 |
36 | #define CS4231_MODE_TIMER 0x0004 | 36 | #define WSS_MODE_TIMER 0x0004 |
37 | #define CS4231_MODE_OPEN (CS4231_MODE_PLAY|CS4231_MODE_RECORD|CS4231_MODE_TIMER) | 37 | #define WSS_MODE_OPEN (WSS_MODE_PLAY|WSS_MODE_RECORD|WSS_MODE_TIMER) |
38 | 38 | ||
39 | /* defines for codec.hardware */ | 39 | /* defines for codec.hardware */ |
40 | 40 | ||
41 | #define CS4231_HW_DETECT 0x0000 /* let CS4231 driver detect chip */ | 41 | #define WSS_HW_DETECT 0x0000 /* let CS4231 driver detect chip */ |
42 | #define CS4231_HW_DETECT3 0x0001 /* allow mode 3 */ | 42 | #define WSS_HW_DETECT3 0x0001 /* allow mode 3 */ |
43 | #define CS4231_HW_TYPE_MASK 0xff00 /* type mask */ | 43 | #define WSS_HW_TYPE_MASK 0xff00 /* type mask */ |
44 | #define CS4231_HW_CS4231_MASK 0x0100 /* CS4231 serie */ | 44 | #define WSS_HW_CS4231_MASK 0x0100 /* CS4231 serie */ |
45 | #define CS4231_HW_CS4231 0x0100 /* CS4231 chip */ | 45 | #define WSS_HW_CS4231 0x0100 /* CS4231 chip */ |
46 | #define CS4231_HW_CS4231A 0x0101 /* CS4231A chip */ | 46 | #define WSS_HW_CS4231A 0x0101 /* CS4231A chip */ |
47 | #define CS4231_HW_AD1845 0x0102 /* AD1845 chip */ | 47 | #define WSS_HW_AD1845 0x0102 /* AD1845 chip */ |
48 | #define CS4231_HW_CS4232_MASK 0x0200 /* CS4232 serie (has control ports) */ | 48 | #define WSS_HW_CS4232_MASK 0x0200 /* CS4232 serie (has control ports) */ |
49 | #define CS4231_HW_CS4232 0x0200 /* CS4232 */ | 49 | #define WSS_HW_CS4232 0x0200 /* CS4232 */ |
50 | #define CS4231_HW_CS4232A 0x0201 /* CS4232A */ | 50 | #define WSS_HW_CS4232A 0x0201 /* CS4232A */ |
51 | #define CS4231_HW_CS4236 0x0202 /* CS4236 */ | 51 | #define WSS_HW_CS4236 0x0202 /* CS4236 */ |
52 | #define CS4231_HW_CS4236B_MASK 0x0400 /* CS4236B serie (has extended control regs) */ | 52 | #define WSS_HW_CS4236B_MASK 0x0400 /* CS4236B serie (has extended control regs) */ |
53 | #define CS4231_HW_CS4235 0x0400 /* CS4235 - Crystal Clear (tm) stereo enhancement */ | 53 | #define WSS_HW_CS4235 0x0400 /* CS4235 - Crystal Clear (tm) stereo enhancement */ |
54 | #define CS4231_HW_CS4236B 0x0401 /* CS4236B */ | 54 | #define WSS_HW_CS4236B 0x0401 /* CS4236B */ |
55 | #define CS4231_HW_CS4237B 0x0402 /* CS4237B - SRS 3D */ | 55 | #define WSS_HW_CS4237B 0x0402 /* CS4237B - SRS 3D */ |
56 | #define CS4231_HW_CS4238B 0x0403 /* CS4238B - QSOUND 3D */ | 56 | #define WSS_HW_CS4238B 0x0403 /* CS4238B - QSOUND 3D */ |
57 | #define CS4231_HW_CS4239 0x0404 /* CS4239 - Crystal Clear (tm) stereo enhancement */ | 57 | #define WSS_HW_CS4239 0x0404 /* CS4239 - Crystal Clear (tm) stereo enhancement */ |
58 | /* compatible, but clones */ | 58 | /* compatible, but clones */ |
59 | #define CS4231_HW_INTERWAVE 0x1000 /* InterWave chip */ | 59 | #define WSS_HW_INTERWAVE 0x1000 /* InterWave chip */ |
60 | #define CS4231_HW_OPL3SA2 0x1101 /* OPL3-SA2 chip, similar to cs4231 */ | 60 | #define WSS_HW_OPL3SA2 0x1101 /* OPL3-SA2 chip, similar to cs4231 */ |
61 | #define CS4231_HW_OPTI93X 0x1102 /* Opti 930/931/933 */ | 61 | #define WSS_HW_OPTI93X 0x1102 /* Opti 930/931/933 */ |
62 | 62 | ||
63 | /* defines for codec.hwshare */ | 63 | /* defines for codec.hwshare */ |
64 | #define CS4231_HWSHARE_IRQ (1<<0) | 64 | #define WSS_HWSHARE_IRQ (1<<0) |
65 | #define CS4231_HWSHARE_DMA1 (1<<1) | 65 | #define WSS_HWSHARE_DMA1 (1<<1) |
66 | #define CS4231_HWSHARE_DMA2 (1<<2) | 66 | #define WSS_HWSHARE_DMA2 (1<<2) |
67 | 67 | ||
68 | struct snd_cs4231 { | 68 | struct snd_wss { |
69 | unsigned long port; /* base i/o port */ | 69 | unsigned long port; /* base i/o port */ |
70 | struct resource *res_port; | 70 | struct resource *res_port; |
71 | unsigned long cport; /* control base i/o port (CS4236) */ | 71 | unsigned long cport; /* control base i/o port (CS4236) */ |
@@ -74,8 +74,8 @@ struct snd_cs4231 { | |||
74 | int dma1; /* playback DMA */ | 74 | int dma1; /* playback DMA */ |
75 | int dma2; /* record DMA */ | 75 | int dma2; /* record DMA */ |
76 | unsigned short version; /* version of CODEC chip */ | 76 | unsigned short version; /* version of CODEC chip */ |
77 | unsigned short mode; /* see to CS4231_MODE_XXXX */ | 77 | unsigned short mode; /* see to WSS_MODE_XXXX */ |
78 | unsigned short hardware; /* see to CS4231_HW_XXXX */ | 78 | unsigned short hardware; /* see to WSS_HW_XXXX */ |
79 | unsigned short hwshare; /* shared resources */ | 79 | unsigned short hwshare; /* shared resources */ |
80 | unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ | 80 | unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ |
81 | ebus_flag:1; /* SPARC: EBUS present */ | 81 | ebus_flag:1; /* SPARC: EBUS present */ |
@@ -100,43 +100,50 @@ struct snd_cs4231 { | |||
100 | struct mutex open_mutex; | 100 | struct mutex open_mutex; |
101 | 101 | ||
102 | int (*rate_constraint) (struct snd_pcm_runtime *runtime); | 102 | int (*rate_constraint) (struct snd_pcm_runtime *runtime); |
103 | void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr); | 103 | void (*set_playback_format) (struct snd_wss *chip, |
104 | void (*set_capture_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char cdfr); | 104 | struct snd_pcm_hw_params *hw_params, |
105 | void (*trigger) (struct snd_cs4231 *chip, unsigned int what, int start); | 105 | unsigned char pdfr); |
106 | void (*set_capture_format) (struct snd_wss *chip, | ||
107 | struct snd_pcm_hw_params *hw_params, | ||
108 | unsigned char cdfr); | ||
109 | void (*trigger) (struct snd_wss *chip, unsigned int what, int start); | ||
106 | #ifdef CONFIG_PM | 110 | #ifdef CONFIG_PM |
107 | void (*suspend) (struct snd_cs4231 *chip); | 111 | void (*suspend) (struct snd_wss *chip); |
108 | void (*resume) (struct snd_cs4231 *chip); | 112 | void (*resume) (struct snd_wss *chip); |
109 | #endif | 113 | #endif |
110 | void *dma_private_data; | 114 | void *dma_private_data; |
111 | int (*claim_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma); | 115 | int (*claim_dma) (struct snd_wss *chip, |
112 | int (*release_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma); | 116 | void *dma_private_data, int dma); |
117 | int (*release_dma) (struct snd_wss *chip, | ||
118 | void *dma_private_data, int dma); | ||
113 | }; | 119 | }; |
114 | 120 | ||
115 | /* exported functions */ | 121 | /* exported functions */ |
116 | 122 | ||
117 | void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val); | 123 | void snd_wss_out(struct snd_wss *chip, unsigned char reg, unsigned char val); |
118 | unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg); | 124 | unsigned char snd_wss_in(struct snd_wss *chip, unsigned char reg); |
119 | void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val); | 125 | void snd_cs4236_ext_out(struct snd_wss *chip, |
120 | unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg); | 126 | unsigned char reg, unsigned char val); |
121 | void snd_cs4231_mce_up(struct snd_cs4231 *chip); | 127 | unsigned char snd_cs4236_ext_in(struct snd_wss *chip, unsigned char reg); |
122 | void snd_cs4231_mce_down(struct snd_cs4231 *chip); | 128 | void snd_wss_mce_up(struct snd_wss *chip); |
129 | void snd_wss_mce_down(struct snd_wss *chip); | ||
123 | 130 | ||
124 | void snd_cs4231_overrange(struct snd_cs4231 *chip); | 131 | void snd_wss_overrange(struct snd_wss *chip); |
125 | 132 | ||
126 | irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id); | 133 | irqreturn_t snd_wss_interrupt(int irq, void *dev_id); |
127 | 134 | ||
128 | const char *snd_cs4231_chip_id(struct snd_cs4231 *chip); | 135 | const char *snd_wss_chip_id(struct snd_wss *chip); |
129 | 136 | ||
130 | int snd_cs4231_create(struct snd_card *card, | 137 | int snd_wss_create(struct snd_card *card, |
131 | unsigned long port, | 138 | unsigned long port, |
132 | unsigned long cport, | 139 | unsigned long cport, |
133 | int irq, int dma1, int dma2, | 140 | int irq, int dma1, int dma2, |
134 | unsigned short hardware, | 141 | unsigned short hardware, |
135 | unsigned short hwshare, | 142 | unsigned short hwshare, |
136 | struct snd_cs4231 ** rchip); | 143 | struct snd_wss **rchip); |
137 | int snd_cs4231_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm); | 144 | int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); |
138 | int snd_cs4231_timer(struct snd_cs4231 * chip, int device, struct snd_timer **rtimer); | 145 | int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer); |
139 | int snd_cs4231_mixer(struct snd_cs4231 * chip); | 146 | int snd_wss_mixer(struct snd_wss *chip); |
140 | 147 | ||
141 | int snd_cs4236_create(struct snd_card *card, | 148 | int snd_cs4236_create(struct snd_card *card, |
142 | unsigned long port, | 149 | unsigned long port, |
@@ -144,32 +151,45 @@ int snd_cs4236_create(struct snd_card *card, | |||
144 | int irq, int dma1, int dma2, | 151 | int irq, int dma1, int dma2, |
145 | unsigned short hardware, | 152 | unsigned short hardware, |
146 | unsigned short hwshare, | 153 | unsigned short hwshare, |
147 | struct snd_cs4231 ** rchip); | 154 | struct snd_wss **rchip); |
148 | int snd_cs4236_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm); | 155 | int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); |
149 | int snd_cs4236_mixer(struct snd_cs4231 * chip); | 156 | int snd_cs4236_mixer(struct snd_wss *chip); |
150 | 157 | ||
151 | /* | 158 | /* |
152 | * mixer library | 159 | * mixer library |
153 | */ | 160 | */ |
154 | 161 | ||
155 | #define CS4231_SINGLE(xname, xindex, reg, shift, mask, invert) \ | 162 | #define WSS_SINGLE(xname, xindex, reg, shift, mask, invert) \ |
156 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 163 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
157 | .info = snd_cs4231_info_single, \ | 164 | .name = xname, \ |
158 | .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \ | 165 | .index = xindex, \ |
166 | .info = snd_wss_info_single, \ | ||
167 | .get = snd_wss_get_single, \ | ||
168 | .put = snd_wss_put_single, \ | ||
159 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } | 169 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } |
160 | 170 | ||
161 | int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); | 171 | int snd_wss_info_single(struct snd_kcontrol *kcontrol, |
162 | int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); | 172 | struct snd_ctl_elem_info *uinfo); |
163 | int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); | 173 | int snd_wss_get_single(struct snd_kcontrol *kcontrol, |
164 | 174 | struct snd_ctl_elem_value *ucontrol); | |
165 | #define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ | 175 | int snd_wss_put_single(struct snd_kcontrol *kcontrol, |
166 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 176 | struct snd_ctl_elem_value *ucontrol); |
167 | .info = snd_cs4231_info_double, \ | 177 | |
168 | .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ | 178 | #define WSS_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ |
169 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } | 179 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
170 | 180 | .name = xname, \ | |
171 | int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); | 181 | .index = xindex, \ |
172 | int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); | 182 | .info = snd_wss_info_double, \ |
173 | int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); | 183 | .get = snd_wss_get_double, \ |
174 | 184 | .put = snd_wss_put_double, \ | |
175 | #endif /* __SOUND_CS4231_H */ | 185 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \ |
186 | (shift_right << 19) | (mask << 24) | (invert << 22) } | ||
187 | |||
188 | int snd_wss_info_double(struct snd_kcontrol *kcontrol, | ||
189 | struct snd_ctl_elem_info *uinfo); | ||
190 | int snd_wss_get_double(struct snd_kcontrol *kcontrol, | ||
191 | struct snd_ctl_elem_value *ucontrol); | ||
192 | int snd_wss_put_double(struct snd_kcontrol *kcontrol, | ||
193 | struct snd_ctl_elem_value *ucontrol); | ||
194 | |||
195 | #endif /* __SOUND_WSS_H */ | ||
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c index a24db091d445..3e74d1a3928e 100644 --- a/sound/isa/azt2320.c +++ b/sound/isa/azt2320.c | |||
@@ -76,7 +76,7 @@ struct snd_card_azt2320 { | |||
76 | int dev_no; | 76 | int dev_no; |
77 | struct pnp_dev *dev; | 77 | struct pnp_dev *dev; |
78 | struct pnp_dev *devmpu; | 78 | struct pnp_dev *devmpu; |
79 | struct snd_cs4231 *chip; | 79 | struct snd_wss *chip; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static struct pnp_card_device_id snd_azt2320_pnpids[] = { | 82 | static struct pnp_card_device_id snd_azt2320_pnpids[] = { |
@@ -181,7 +181,7 @@ static int __devinit snd_card_azt2320_probe(int dev, | |||
181 | int error; | 181 | int error; |
182 | struct snd_card *card; | 182 | struct snd_card *card; |
183 | struct snd_card_azt2320 *acard; | 183 | struct snd_card_azt2320 *acard; |
184 | struct snd_cs4231 *chip; | 184 | struct snd_wss *chip; |
185 | struct snd_opl3 *opl3; | 185 | struct snd_opl3 *opl3; |
186 | 186 | ||
187 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 187 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, |
@@ -200,11 +200,11 @@ static int __devinit snd_card_azt2320_probe(int dev, | |||
200 | return error; | 200 | return error; |
201 | } | 201 | } |
202 | 202 | ||
203 | if ((error = snd_cs4231_create(card, wss_port[dev], -1, | 203 | error = snd_wss_create(card, wss_port[dev], -1, |
204 | irq[dev], | 204 | irq[dev], |
205 | dma1[dev], | 205 | dma1[dev], dma2[dev], |
206 | dma2[dev], | 206 | WSS_HW_DETECT, 0, &chip); |
207 | CS4231_HW_DETECT, 0, &chip)) < 0) { | 207 | if (error < 0) { |
208 | snd_card_free(card); | 208 | snd_card_free(card); |
209 | return error; | 209 | return error; |
210 | } | 210 | } |
@@ -214,15 +214,18 @@ static int __devinit snd_card_azt2320_probe(int dev, | |||
214 | sprintf(card->longname, "%s, WSS at 0x%lx, irq %i, dma %i&%i", | 214 | sprintf(card->longname, "%s, WSS at 0x%lx, irq %i, dma %i&%i", |
215 | card->shortname, chip->port, irq[dev], dma1[dev], dma2[dev]); | 215 | card->shortname, chip->port, irq[dev], dma1[dev], dma2[dev]); |
216 | 216 | ||
217 | if ((error = snd_cs4231_pcm(chip, 0, NULL)) < 0) { | 217 | error = snd_wss_pcm(chip, 0, NULL); |
218 | if (error < 0) { | ||
218 | snd_card_free(card); | 219 | snd_card_free(card); |
219 | return error; | 220 | return error; |
220 | } | 221 | } |
221 | if ((error = snd_cs4231_mixer(chip)) < 0) { | 222 | error = snd_wss_mixer(chip); |
223 | if (error < 0) { | ||
222 | snd_card_free(card); | 224 | snd_card_free(card); |
223 | return error; | 225 | return error; |
224 | } | 226 | } |
225 | if ((error = snd_cs4231_timer(chip, 0, NULL)) < 0) { | 227 | error = snd_wss_timer(chip, 0, NULL); |
228 | if (error < 0) { | ||
226 | snd_card_free(card); | 229 | snd_card_free(card); |
227 | return error; | 230 | return error; |
228 | } | 231 | } |
@@ -293,7 +296,7 @@ static int snd_azt2320_pnp_suspend(struct pnp_card_link *pcard, pm_message_t sta | |||
293 | { | 296 | { |
294 | struct snd_card *card = pnp_get_card_drvdata(pcard); | 297 | struct snd_card *card = pnp_get_card_drvdata(pcard); |
295 | struct snd_card_azt2320 *acard = card->private_data; | 298 | struct snd_card_azt2320 *acard = card->private_data; |
296 | struct snd_cs4231 *chip = acard->chip; | 299 | struct snd_wss *chip = acard->chip; |
297 | 300 | ||
298 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 301 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
299 | chip->suspend(chip); | 302 | chip->suspend(chip); |
@@ -304,7 +307,7 @@ static int snd_azt2320_pnp_resume(struct pnp_card_link *pcard) | |||
304 | { | 307 | { |
305 | struct snd_card *card = pnp_get_card_drvdata(pcard); | 308 | struct snd_card *card = pnp_get_card_drvdata(pcard); |
306 | struct snd_card_azt2320 *acard = card->private_data; | 309 | struct snd_card_azt2320 *acard = card->private_data; |
307 | struct snd_cs4231 *chip = acard->chip; | 310 | struct snd_wss *chip = acard->chip; |
308 | 311 | ||
309 | chip->resume(chip); | 312 | chip->resume(chip); |
310 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 313 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index 7da28e7c0322..ddd289120aa8 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c | |||
@@ -91,7 +91,7 @@ static int __devinit snd_cs4231_match(struct device *dev, unsigned int n) | |||
91 | static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n) | 91 | static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n) |
92 | { | 92 | { |
93 | struct snd_card *card; | 93 | struct snd_card *card; |
94 | struct snd_cs4231 *chip; | 94 | struct snd_wss *chip; |
95 | struct snd_pcm *pcm; | 95 | struct snd_pcm *pcm; |
96 | int error; | 96 | int error; |
97 | 97 | ||
@@ -99,14 +99,14 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n) | |||
99 | if (!card) | 99 | if (!card) |
100 | return -EINVAL; | 100 | return -EINVAL; |
101 | 101 | ||
102 | error = snd_cs4231_create(card, port[n], -1, irq[n], dma1[n], dma2[n], | 102 | error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n], |
103 | CS4231_HW_DETECT, 0, &chip); | 103 | WSS_HW_DETECT, 0, &chip); |
104 | if (error < 0) | 104 | if (error < 0) |
105 | goto out; | 105 | goto out; |
106 | 106 | ||
107 | card->private_data = chip; | 107 | card->private_data = chip; |
108 | 108 | ||
109 | error = snd_cs4231_pcm(chip, 0, &pcm); | 109 | error = snd_wss_pcm(chip, 0, &pcm); |
110 | if (error < 0) | 110 | if (error < 0) |
111 | goto out; | 111 | goto out; |
112 | 112 | ||
@@ -118,11 +118,11 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n) | |||
118 | if (dma2[n] >= 0) | 118 | if (dma2[n] >= 0) |
119 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]); | 119 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]); |
120 | 120 | ||
121 | error = snd_cs4231_mixer(chip); | 121 | error = snd_wss_mixer(chip); |
122 | if (error < 0) | 122 | if (error < 0) |
123 | goto out; | 123 | goto out; |
124 | 124 | ||
125 | error = snd_cs4231_timer(chip, 0, NULL); | 125 | error = snd_wss_timer(chip, 0, NULL); |
126 | if (error < 0) | 126 | if (error < 0) |
127 | goto out; | 127 | goto out; |
128 | 128 | ||
@@ -160,7 +160,7 @@ static int __devexit snd_cs4231_remove(struct device *dev, unsigned int n) | |||
160 | static int snd_cs4231_suspend(struct device *dev, unsigned int n, pm_message_t state) | 160 | static int snd_cs4231_suspend(struct device *dev, unsigned int n, pm_message_t state) |
161 | { | 161 | { |
162 | struct snd_card *card = dev_get_drvdata(dev); | 162 | struct snd_card *card = dev_get_drvdata(dev); |
163 | struct snd_cs4231 *chip = card->private_data; | 163 | struct snd_wss *chip = card->private_data; |
164 | 164 | ||
165 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 165 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
166 | chip->suspend(chip); | 166 | chip->suspend(chip); |
@@ -170,7 +170,7 @@ static int snd_cs4231_suspend(struct device *dev, unsigned int n, pm_message_t s | |||
170 | static int snd_cs4231_resume(struct device *dev, unsigned int n) | 170 | static int snd_cs4231_resume(struct device *dev, unsigned int n) |
171 | { | 171 | { |
172 | struct snd_card *card = dev_get_drvdata(dev); | 172 | struct snd_card *card = dev_get_drvdata(dev); |
173 | struct snd_cs4231 *chip = card->private_data; | 173 | struct snd_wss *chip = card->private_data; |
174 | 174 | ||
175 | chip->resume(chip); | 175 | chip->resume(chip); |
176 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 176 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 246c221556e3..3ff0f1229910 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -134,7 +134,7 @@ static int pnp_registered; | |||
134 | #endif /* CONFIG_PNP */ | 134 | #endif /* CONFIG_PNP */ |
135 | 135 | ||
136 | struct snd_card_cs4236 { | 136 | struct snd_card_cs4236 { |
137 | struct snd_cs4231 *chip; | 137 | struct snd_wss *chip; |
138 | struct resource *res_sb_port; | 138 | struct resource *res_sb_port; |
139 | #ifdef CONFIG_PNP | 139 | #ifdef CONFIG_PNP |
140 | struct pnp_dev *wss; | 140 | struct pnp_dev *wss; |
@@ -396,7 +396,7 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) | |||
396 | { | 396 | { |
397 | struct snd_card_cs4236 *acard; | 397 | struct snd_card_cs4236 *acard; |
398 | struct snd_pcm *pcm; | 398 | struct snd_pcm *pcm; |
399 | struct snd_cs4231 *chip; | 399 | struct snd_wss *chip; |
400 | struct snd_opl3 *opl3; | 400 | struct snd_opl3 *opl3; |
401 | int err; | 401 | int err; |
402 | 402 | ||
@@ -408,41 +408,37 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) | |||
408 | } | 408 | } |
409 | 409 | ||
410 | #ifdef CS4232 | 410 | #ifdef CS4232 |
411 | if ((err = snd_cs4231_create(card, | 411 | err = snd_wss_create(card, port[dev], cport[dev], |
412 | port[dev], | 412 | irq[dev], |
413 | cport[dev], | 413 | dma1[dev], dma2[dev], |
414 | irq[dev], | 414 | WSS_HW_DETECT, 0, &chip); |
415 | dma1[dev], | 415 | if (err < 0) |
416 | dma2[dev], | ||
417 | CS4231_HW_DETECT, | ||
418 | 0, | ||
419 | &chip)) < 0) | ||
420 | return err; | 416 | return err; |
421 | acard->chip = chip; | 417 | acard->chip = chip; |
422 | 418 | ||
423 | if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) | 419 | err = snd_wss_pcm(chip, 0, &pcm); |
420 | if (err < 0) | ||
424 | return err; | 421 | return err; |
425 | 422 | ||
426 | if ((err = snd_cs4231_mixer(chip)) < 0) | 423 | err = snd_wss_mixer(chip); |
424 | if (err < 0) | ||
427 | return err; | 425 | return err; |
428 | 426 | ||
429 | #else /* CS4236 */ | 427 | #else /* CS4236 */ |
430 | if ((err = snd_cs4236_create(card, | 428 | err = snd_cs4236_create(card, |
431 | port[dev], | 429 | port[dev], cport[dev], |
432 | cport[dev], | 430 | irq[dev], dma1[dev], dma2[dev], |
433 | irq[dev], | 431 | WSS_HW_DETECT, 0, &chip); |
434 | dma1[dev], | 432 | if (err < 0) |
435 | dma2[dev], | ||
436 | CS4231_HW_DETECT, | ||
437 | 0, | ||
438 | &chip)) < 0) | ||
439 | return err; | 433 | return err; |
440 | acard->chip = chip; | 434 | acard->chip = chip; |
441 | 435 | ||
442 | if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) | 436 | err = snd_cs4236_pcm(chip, 0, &pcm); |
437 | if (err < 0) | ||
443 | return err; | 438 | return err; |
444 | 439 | ||
445 | if ((err = snd_cs4236_mixer(chip)) < 0) | 440 | err = snd_cs4236_mixer(chip); |
441 | if (err < 0) | ||
446 | return err; | 442 | return err; |
447 | #endif | 443 | #endif |
448 | strcpy(card->driver, pcm->name); | 444 | strcpy(card->driver, pcm->name); |
@@ -455,7 +451,8 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) | |||
455 | if (dma2[dev] >= 0) | 451 | if (dma2[dev] >= 0) |
456 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); | 452 | sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); |
457 | 453 | ||
458 | if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) | 454 | err = snd_wss_timer(chip, 0, NULL); |
455 | if (err < 0) | ||
459 | return err; | 456 | return err; |
460 | 457 | ||
461 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { | 458 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { |
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index eb227d856d1e..33e9cf178b8b 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c | |||
@@ -121,13 +121,14 @@ static unsigned char snd_cs4236_ext_map[18] = { | |||
121 | * | 121 | * |
122 | */ | 122 | */ |
123 | 123 | ||
124 | static void snd_cs4236_ctrl_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val) | 124 | static void snd_cs4236_ctrl_out(struct snd_wss *chip, |
125 | unsigned char reg, unsigned char val) | ||
125 | { | 126 | { |
126 | outb(reg, chip->cport + 3); | 127 | outb(reg, chip->cport + 3); |
127 | outb(chip->cimage[reg] = val, chip->cport + 4); | 128 | outb(chip->cimage[reg] = val, chip->cport + 4); |
128 | } | 129 | } |
129 | 130 | ||
130 | static unsigned char snd_cs4236_ctrl_in(struct snd_cs4231 *chip, unsigned char reg) | 131 | static unsigned char snd_cs4236_ctrl_in(struct snd_wss *chip, unsigned char reg) |
131 | { | 132 | { |
132 | outb(reg, chip->cport + 3); | 133 | outb(reg, chip->cport + 3); |
133 | return inb(chip->cport + 4); | 134 | return inb(chip->cport + 4); |
@@ -180,44 +181,52 @@ static unsigned char divisor_to_rate_register(unsigned int divisor) | |||
180 | } | 181 | } |
181 | } | 182 | } |
182 | 183 | ||
183 | static void snd_cs4236_playback_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, unsigned char pdfr) | 184 | static void snd_cs4236_playback_format(struct snd_wss *chip, |
185 | struct snd_pcm_hw_params *params, | ||
186 | unsigned char pdfr) | ||
184 | { | 187 | { |
185 | unsigned long flags; | 188 | unsigned long flags; |
186 | unsigned char rate = divisor_to_rate_register(params->rate_den); | 189 | unsigned char rate = divisor_to_rate_register(params->rate_den); |
187 | 190 | ||
188 | spin_lock_irqsave(&chip->reg_lock, flags); | 191 | spin_lock_irqsave(&chip->reg_lock, flags); |
189 | /* set fast playback format change and clean playback FIFO */ | 192 | /* set fast playback format change and clean playback FIFO */ |
190 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x10); | 193 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, |
191 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0); | 194 | chip->image[CS4231_ALT_FEATURE_1] | 0x10); |
192 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] & ~0x10); | 195 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0); |
196 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
197 | chip->image[CS4231_ALT_FEATURE_1] & ~0x10); | ||
193 | snd_cs4236_ext_out(chip, CS4236_DAC_RATE, rate); | 198 | snd_cs4236_ext_out(chip, CS4236_DAC_RATE, rate); |
194 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 199 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
195 | } | 200 | } |
196 | 201 | ||
197 | static void snd_cs4236_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, unsigned char cdfr) | 202 | static void snd_cs4236_capture_format(struct snd_wss *chip, |
203 | struct snd_pcm_hw_params *params, | ||
204 | unsigned char cdfr) | ||
198 | { | 205 | { |
199 | unsigned long flags; | 206 | unsigned long flags; |
200 | unsigned char rate = divisor_to_rate_register(params->rate_den); | 207 | unsigned char rate = divisor_to_rate_register(params->rate_den); |
201 | 208 | ||
202 | spin_lock_irqsave(&chip->reg_lock, flags); | 209 | spin_lock_irqsave(&chip->reg_lock, flags); |
203 | /* set fast capture format change and clean capture FIFO */ | 210 | /* set fast capture format change and clean capture FIFO */ |
204 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x20); | 211 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, |
205 | snd_cs4231_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0); | 212 | chip->image[CS4231_ALT_FEATURE_1] | 0x20); |
206 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] & ~0x20); | 213 | snd_wss_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0); |
214 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
215 | chip->image[CS4231_ALT_FEATURE_1] & ~0x20); | ||
207 | snd_cs4236_ext_out(chip, CS4236_ADC_RATE, rate); | 216 | snd_cs4236_ext_out(chip, CS4236_ADC_RATE, rate); |
208 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 217 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
209 | } | 218 | } |
210 | 219 | ||
211 | #ifdef CONFIG_PM | 220 | #ifdef CONFIG_PM |
212 | 221 | ||
213 | static void snd_cs4236_suspend(struct snd_cs4231 *chip) | 222 | static void snd_cs4236_suspend(struct snd_wss *chip) |
214 | { | 223 | { |
215 | int reg; | 224 | int reg; |
216 | unsigned long flags; | 225 | unsigned long flags; |
217 | 226 | ||
218 | spin_lock_irqsave(&chip->reg_lock, flags); | 227 | spin_lock_irqsave(&chip->reg_lock, flags); |
219 | for (reg = 0; reg < 32; reg++) | 228 | for (reg = 0; reg < 32; reg++) |
220 | chip->image[reg] = snd_cs4231_in(chip, reg); | 229 | chip->image[reg] = snd_wss_in(chip, reg); |
221 | for (reg = 0; reg < 18; reg++) | 230 | for (reg = 0; reg < 18; reg++) |
222 | chip->eimage[reg] = snd_cs4236_ext_in(chip, CS4236_I23VAL(reg)); | 231 | chip->eimage[reg] = snd_cs4236_ext_in(chip, CS4236_I23VAL(reg)); |
223 | for (reg = 2; reg < 9; reg++) | 232 | for (reg = 2; reg < 9; reg++) |
@@ -225,12 +234,12 @@ static void snd_cs4236_suspend(struct snd_cs4231 *chip) | |||
225 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 234 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
226 | } | 235 | } |
227 | 236 | ||
228 | static void snd_cs4236_resume(struct snd_cs4231 *chip) | 237 | static void snd_cs4236_resume(struct snd_wss *chip) |
229 | { | 238 | { |
230 | int reg; | 239 | int reg; |
231 | unsigned long flags; | 240 | unsigned long flags; |
232 | 241 | ||
233 | snd_cs4231_mce_up(chip); | 242 | snd_wss_mce_up(chip); |
234 | spin_lock_irqsave(&chip->reg_lock, flags); | 243 | spin_lock_irqsave(&chip->reg_lock, flags); |
235 | for (reg = 0; reg < 32; reg++) { | 244 | for (reg = 0; reg < 32; reg++) { |
236 | switch (reg) { | 245 | switch (reg) { |
@@ -240,7 +249,7 @@ static void snd_cs4236_resume(struct snd_cs4231 *chip) | |||
240 | case 29: /* why? CS4235 - master right */ | 249 | case 29: /* why? CS4235 - master right */ |
241 | break; | 250 | break; |
242 | default: | 251 | default: |
243 | snd_cs4231_out(chip, reg, chip->image[reg]); | 252 | snd_wss_out(chip, reg, chip->image[reg]); |
244 | break; | 253 | break; |
245 | } | 254 | } |
246 | } | 255 | } |
@@ -255,7 +264,7 @@ static void snd_cs4236_resume(struct snd_cs4231 *chip) | |||
255 | } | 264 | } |
256 | } | 265 | } |
257 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 266 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
258 | snd_cs4231_mce_down(chip); | 267 | snd_wss_mce_down(chip); |
259 | } | 268 | } |
260 | 269 | ||
261 | #endif /* CONFIG_PM */ | 270 | #endif /* CONFIG_PM */ |
@@ -266,24 +275,26 @@ int snd_cs4236_create(struct snd_card *card, | |||
266 | int irq, int dma1, int dma2, | 275 | int irq, int dma1, int dma2, |
267 | unsigned short hardware, | 276 | unsigned short hardware, |
268 | unsigned short hwshare, | 277 | unsigned short hwshare, |
269 | struct snd_cs4231 ** rchip) | 278 | struct snd_wss **rchip) |
270 | { | 279 | { |
271 | struct snd_cs4231 *chip; | 280 | struct snd_wss *chip; |
272 | unsigned char ver1, ver2; | 281 | unsigned char ver1, ver2; |
273 | unsigned int reg; | 282 | unsigned int reg; |
274 | int err; | 283 | int err; |
275 | 284 | ||
276 | *rchip = NULL; | 285 | *rchip = NULL; |
277 | if (hardware == CS4231_HW_DETECT) | 286 | if (hardware == WSS_HW_DETECT) |
278 | hardware = CS4231_HW_DETECT3; | 287 | hardware = WSS_HW_DETECT3; |
279 | if (cport < 0x100) { | 288 | if (cport < 0x100) { |
280 | snd_printk("please, specify control port for CS4236+ chips\n"); | 289 | snd_printk("please, specify control port for CS4236+ chips\n"); |
281 | return -ENODEV; | 290 | return -ENODEV; |
282 | } | 291 | } |
283 | if ((err = snd_cs4231_create(card, port, cport, irq, dma1, dma2, hardware, hwshare, &chip)) < 0) | 292 | err = snd_wss_create(card, port, cport, |
293 | irq, dma1, dma2, hardware, hwshare, &chip); | ||
294 | if (err < 0) | ||
284 | return err; | 295 | return err; |
285 | 296 | ||
286 | if (!(chip->hardware & CS4231_HW_CS4236B_MASK)) { | 297 | if (!(chip->hardware & WSS_HW_CS4236B_MASK)) { |
287 | snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%x\n",chip->hardware); | 298 | snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%x\n",chip->hardware); |
288 | snd_device_free(card, chip); | 299 | snd_device_free(card, chip); |
289 | return -ENODEV; | 300 | return -ENODEV; |
@@ -330,20 +341,20 @@ int snd_cs4236_create(struct snd_card *card, | |||
330 | snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), snd_cs4236_ext_map[reg]); | 341 | snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), snd_cs4236_ext_map[reg]); |
331 | 342 | ||
332 | /* initialize compatible but more featured registers */ | 343 | /* initialize compatible but more featured registers */ |
333 | snd_cs4231_out(chip, CS4231_LEFT_INPUT, 0x40); | 344 | snd_wss_out(chip, CS4231_LEFT_INPUT, 0x40); |
334 | snd_cs4231_out(chip, CS4231_RIGHT_INPUT, 0x40); | 345 | snd_wss_out(chip, CS4231_RIGHT_INPUT, 0x40); |
335 | snd_cs4231_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff); | 346 | snd_wss_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff); |
336 | snd_cs4231_out(chip, CS4231_AUX1_RIGHT_INPUT, 0xff); | 347 | snd_wss_out(chip, CS4231_AUX1_RIGHT_INPUT, 0xff); |
337 | snd_cs4231_out(chip, CS4231_AUX2_LEFT_INPUT, 0xdf); | 348 | snd_wss_out(chip, CS4231_AUX2_LEFT_INPUT, 0xdf); |
338 | snd_cs4231_out(chip, CS4231_AUX2_RIGHT_INPUT, 0xdf); | 349 | snd_wss_out(chip, CS4231_AUX2_RIGHT_INPUT, 0xdf); |
339 | snd_cs4231_out(chip, CS4231_RIGHT_LINE_IN, 0xff); | 350 | snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff); |
340 | snd_cs4231_out(chip, CS4231_LEFT_LINE_IN, 0xff); | 351 | snd_wss_out(chip, CS4231_LEFT_LINE_IN, 0xff); |
341 | snd_cs4231_out(chip, CS4231_RIGHT_LINE_IN, 0xff); | 352 | snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff); |
342 | switch (chip->hardware) { | 353 | switch (chip->hardware) { |
343 | case CS4231_HW_CS4235: | 354 | case WSS_HW_CS4235: |
344 | case CS4231_HW_CS4239: | 355 | case WSS_HW_CS4239: |
345 | snd_cs4231_out(chip, CS4235_LEFT_MASTER, 0xff); | 356 | snd_wss_out(chip, CS4235_LEFT_MASTER, 0xff); |
346 | snd_cs4231_out(chip, CS4235_RIGHT_MASTER, 0xff); | 357 | snd_wss_out(chip, CS4235_RIGHT_MASTER, 0xff); |
347 | break; | 358 | break; |
348 | } | 359 | } |
349 | 360 | ||
@@ -351,12 +362,13 @@ int snd_cs4236_create(struct snd_card *card, | |||
351 | return 0; | 362 | return 0; |
352 | } | 363 | } |
353 | 364 | ||
354 | int snd_cs4236_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) | 365 | int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm) |
355 | { | 366 | { |
356 | struct snd_pcm *pcm; | 367 | struct snd_pcm *pcm; |
357 | int err; | 368 | int err; |
358 | 369 | ||
359 | if ((err = snd_cs4231_pcm(chip, device, &pcm)) < 0) | 370 | err = snd_wss_pcm(chip, device, &pcm); |
371 | if (err < 0) | ||
360 | return err; | 372 | return err; |
361 | pcm->info_flags &= ~SNDRV_PCM_INFO_JOINT_DUPLEX; | 373 | pcm->info_flags &= ~SNDRV_PCM_INFO_JOINT_DUPLEX; |
362 | if (rpcm) | 374 | if (rpcm) |
@@ -387,7 +399,7 @@ static int snd_cs4236_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
387 | 399 | ||
388 | static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 400 | static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
389 | { | 401 | { |
390 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 402 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
391 | unsigned long flags; | 403 | unsigned long flags; |
392 | int reg = kcontrol->private_value & 0xff; | 404 | int reg = kcontrol->private_value & 0xff; |
393 | int shift = (kcontrol->private_value >> 8) & 0xff; | 405 | int shift = (kcontrol->private_value >> 8) & 0xff; |
@@ -404,7 +416,7 @@ static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
404 | 416 | ||
405 | static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 417 | static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
406 | { | 418 | { |
407 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 419 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
408 | unsigned long flags; | 420 | unsigned long flags; |
409 | int reg = kcontrol->private_value & 0xff; | 421 | int reg = kcontrol->private_value & 0xff; |
410 | int shift = (kcontrol->private_value >> 8) & 0xff; | 422 | int shift = (kcontrol->private_value >> 8) & 0xff; |
@@ -433,7 +445,7 @@ static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
433 | 445 | ||
434 | static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 446 | static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
435 | { | 447 | { |
436 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 448 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
437 | unsigned long flags; | 449 | unsigned long flags; |
438 | int reg = kcontrol->private_value & 0xff; | 450 | int reg = kcontrol->private_value & 0xff; |
439 | int shift = (kcontrol->private_value >> 8) & 0xff; | 451 | int shift = (kcontrol->private_value >> 8) & 0xff; |
@@ -450,7 +462,7 @@ static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
450 | 462 | ||
451 | static int snd_cs4236_put_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 463 | static int snd_cs4236_put_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
452 | { | 464 | { |
453 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 465 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
454 | unsigned long flags; | 466 | unsigned long flags; |
455 | int reg = kcontrol->private_value & 0xff; | 467 | int reg = kcontrol->private_value & 0xff; |
456 | int shift = (kcontrol->private_value >> 8) & 0xff; | 468 | int shift = (kcontrol->private_value >> 8) & 0xff; |
@@ -490,7 +502,7 @@ static int snd_cs4236_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
490 | 502 | ||
491 | static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 503 | static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
492 | { | 504 | { |
493 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 505 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
494 | unsigned long flags; | 506 | unsigned long flags; |
495 | int left_reg = kcontrol->private_value & 0xff; | 507 | int left_reg = kcontrol->private_value & 0xff; |
496 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | 508 | int right_reg = (kcontrol->private_value >> 8) & 0xff; |
@@ -512,7 +524,7 @@ static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
512 | 524 | ||
513 | static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 525 | static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
514 | { | 526 | { |
515 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 527 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
516 | unsigned long flags; | 528 | unsigned long flags; |
517 | int left_reg = kcontrol->private_value & 0xff; | 529 | int left_reg = kcontrol->private_value & 0xff; |
518 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | 530 | int right_reg = (kcontrol->private_value >> 8) & 0xff; |
@@ -555,7 +567,7 @@ static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
555 | 567 | ||
556 | static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 568 | static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
557 | { | 569 | { |
558 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 570 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
559 | unsigned long flags; | 571 | unsigned long flags; |
560 | int left_reg = kcontrol->private_value & 0xff; | 572 | int left_reg = kcontrol->private_value & 0xff; |
561 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | 573 | int right_reg = (kcontrol->private_value >> 8) & 0xff; |
@@ -577,7 +589,7 @@ static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
577 | 589 | ||
578 | static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 590 | static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
579 | { | 591 | { |
580 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 592 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
581 | unsigned long flags; | 593 | unsigned long flags; |
582 | int left_reg = kcontrol->private_value & 0xff; | 594 | int left_reg = kcontrol->private_value & 0xff; |
583 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | 595 | int right_reg = (kcontrol->private_value >> 8) & 0xff; |
@@ -600,7 +612,7 @@ static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
600 | val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; | 612 | val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; |
601 | val2 = (chip->eimage[CS4236_REG(right_reg)] & ~(mask << shift_right)) | val2; | 613 | val2 = (chip->eimage[CS4236_REG(right_reg)] & ~(mask << shift_right)) | val2; |
602 | change = val1 != chip->image[left_reg] || val2 != chip->eimage[CS4236_REG(right_reg)]; | 614 | change = val1 != chip->image[left_reg] || val2 != chip->eimage[CS4236_REG(right_reg)]; |
603 | snd_cs4231_out(chip, left_reg, val1); | 615 | snd_wss_out(chip, left_reg, val1); |
604 | snd_cs4236_ext_out(chip, right_reg, val2); | 616 | snd_cs4236_ext_out(chip, right_reg, val2); |
605 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 617 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
606 | return change; | 618 | return change; |
@@ -619,7 +631,7 @@ static inline int snd_cs4236_mixer_master_digital_invert_volume(int vol) | |||
619 | 631 | ||
620 | static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 632 | static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
621 | { | 633 | { |
622 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 634 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
623 | unsigned long flags; | 635 | unsigned long flags; |
624 | 636 | ||
625 | spin_lock_irqsave(&chip->reg_lock, flags); | 637 | spin_lock_irqsave(&chip->reg_lock, flags); |
@@ -631,7 +643,7 @@ static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct s | |||
631 | 643 | ||
632 | static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 644 | static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
633 | { | 645 | { |
634 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 646 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
635 | unsigned long flags; | 647 | unsigned long flags; |
636 | int change; | 648 | int change; |
637 | unsigned short val1, val2; | 649 | unsigned short val1, val2; |
@@ -678,7 +690,7 @@ static inline int snd_cs4235_mixer_output_accu_set_volume(int vol) | |||
678 | 690 | ||
679 | static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 691 | static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
680 | { | 692 | { |
681 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 693 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
682 | unsigned long flags; | 694 | unsigned long flags; |
683 | 695 | ||
684 | spin_lock_irqsave(&chip->reg_lock, flags); | 696 | spin_lock_irqsave(&chip->reg_lock, flags); |
@@ -690,7 +702,7 @@ static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_ | |||
690 | 702 | ||
691 | static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 703 | static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
692 | { | 704 | { |
693 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 705 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
694 | unsigned long flags; | 706 | unsigned long flags; |
695 | int change; | 707 | int change; |
696 | unsigned short val1, val2; | 708 | unsigned short val1, val2; |
@@ -701,108 +713,160 @@ static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_ | |||
701 | val1 = (chip->image[CS4235_LEFT_MASTER] & ~(3 << 5)) | val1; | 713 | val1 = (chip->image[CS4235_LEFT_MASTER] & ~(3 << 5)) | val1; |
702 | val2 = (chip->image[CS4235_RIGHT_MASTER] & ~(3 << 5)) | val2; | 714 | val2 = (chip->image[CS4235_RIGHT_MASTER] & ~(3 << 5)) | val2; |
703 | change = val1 != chip->image[CS4235_LEFT_MASTER] || val2 != chip->image[CS4235_RIGHT_MASTER]; | 715 | change = val1 != chip->image[CS4235_LEFT_MASTER] || val2 != chip->image[CS4235_RIGHT_MASTER]; |
704 | snd_cs4231_out(chip, CS4235_LEFT_MASTER, val1); | 716 | snd_wss_out(chip, CS4235_LEFT_MASTER, val1); |
705 | snd_cs4231_out(chip, CS4235_RIGHT_MASTER, val2); | 717 | snd_wss_out(chip, CS4235_RIGHT_MASTER, val2); |
706 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 718 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
707 | return change; | 719 | return change; |
708 | } | 720 | } |
709 | 721 | ||
710 | static struct snd_kcontrol_new snd_cs4236_controls[] = { | 722 | static struct snd_kcontrol_new snd_cs4236_controls[] = { |
711 | 723 | ||
712 | CS4236_DOUBLE("Master Digital Playback Switch", 0, CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), | 724 | CS4236_DOUBLE("Master Digital Playback Switch", 0, |
713 | CS4236_DOUBLE("Master Digital Capture Switch", 0, CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), | 725 | CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), |
726 | CS4236_DOUBLE("Master Digital Capture Switch", 0, | ||
727 | CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), | ||
714 | CS4236_MASTER_DIGITAL("Master Digital Volume", 0), | 728 | CS4236_MASTER_DIGITAL("Master Digital Volume", 0), |
715 | 729 | ||
716 | CS4236_DOUBLE("Capture Boost Volume", 0, CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), | 730 | CS4236_DOUBLE("Capture Boost Volume", 0, |
717 | 731 | CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), | |
718 | CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 732 | |
719 | CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | 733 | WSS_DOUBLE("PCM Playback Switch", 0, |
720 | 734 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | |
721 | CS4236_DOUBLE("DSP Playback Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), | 735 | WSS_DOUBLE("PCM Playback Volume", 0, |
722 | CS4236_DOUBLE("DSP Playback Volume", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1), | 736 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), |
723 | 737 | ||
724 | CS4236_DOUBLE("FM Playback Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1), | 738 | CS4236_DOUBLE("DSP Playback Switch", 0, |
725 | CS4236_DOUBLE("FM Playback Volume", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1), | 739 | CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), |
726 | 740 | CS4236_DOUBLE("DSP Playback Volume", 0, | |
727 | CS4236_DOUBLE("Wavetable Playback Switch", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1), | 741 | CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1), |
728 | CS4236_DOUBLE("Wavetable Playback Volume", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1), | 742 | |
729 | 743 | CS4236_DOUBLE("FM Playback Switch", 0, | |
730 | CS4231_DOUBLE("Synth Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 744 | CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1), |
731 | CS4231_DOUBLE("Synth Volume", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | 745 | CS4236_DOUBLE("FM Playback Volume", 0, |
732 | CS4231_DOUBLE("Synth Capture Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), | 746 | CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1), |
733 | CS4231_DOUBLE("Synth Capture Bypass", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 5, 5, 1, 1), | 747 | |
734 | 748 | CS4236_DOUBLE("Wavetable Playback Switch", 0, | |
735 | CS4236_DOUBLE("Mic Playback Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), | 749 | CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1), |
736 | CS4236_DOUBLE("Mic Capture Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), | 750 | CS4236_DOUBLE("Wavetable Playback Volume", 0, |
751 | CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1), | ||
752 | |||
753 | WSS_DOUBLE("Synth Playback Switch", 0, | ||
754 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | ||
755 | WSS_DOUBLE("Synth Volume", 0, | ||
756 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | ||
757 | WSS_DOUBLE("Synth Capture Switch", 0, | ||
758 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), | ||
759 | WSS_DOUBLE("Synth Capture Bypass", 0, | ||
760 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 5, 5, 1, 1), | ||
761 | |||
762 | CS4236_DOUBLE("Mic Playback Switch", 0, | ||
763 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), | ||
764 | CS4236_DOUBLE("Mic Capture Switch", 0, | ||
765 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), | ||
737 | CS4236_DOUBLE("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 0, 0, 31, 1), | 766 | CS4236_DOUBLE("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 0, 0, 31, 1), |
738 | CS4236_DOUBLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0), | 767 | CS4236_DOUBLE("Mic Playback Boost", 0, |
739 | 768 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0), | |
740 | CS4231_DOUBLE("Line Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 769 | |
741 | CS4231_DOUBLE("Line Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | 770 | WSS_DOUBLE("Line Playback Switch", 0, |
742 | CS4231_DOUBLE("Line Capture Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), | 771 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
743 | CS4231_DOUBLE("Line Capture Bypass", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 5, 5, 1, 1), | 772 | WSS_DOUBLE("Line Volume", 0, |
744 | 773 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | |
745 | CS4231_DOUBLE("CD Playback Switch", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 774 | WSS_DOUBLE("Line Capture Switch", 0, |
746 | CS4231_DOUBLE("CD Volume", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | 775 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), |
747 | CS4231_DOUBLE("CD Capture Switch", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), | 776 | WSS_DOUBLE("Line Capture Bypass", 0, |
748 | 777 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 5, 5, 1, 1), | |
749 | CS4236_DOUBLE1("Mono Output Playback Switch", 0, CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), | 778 | |
750 | CS4236_DOUBLE1("Mono Playback Switch", 0, CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), | 779 | WSS_DOUBLE("CD Playback Switch", 0, |
751 | CS4231_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), | 780 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), |
752 | CS4231_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), | 781 | WSS_DOUBLE("CD Volume", 0, |
753 | 782 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | |
754 | CS4231_DOUBLE("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | 783 | WSS_DOUBLE("CD Capture Switch", 0, |
755 | CS4231_DOUBLE("Analog Loopback Capture Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), | 784 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), |
756 | 785 | ||
757 | CS4231_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0), | 786 | CS4236_DOUBLE1("Mono Output Playback Switch", 0, |
758 | CS4236_DOUBLE1("Digital Loopback Playback Volume", 0, CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1) | 787 | CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), |
788 | CS4236_DOUBLE1("Mono Playback Switch", 0, | ||
789 | CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), | ||
790 | WSS_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), | ||
791 | WSS_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), | ||
792 | |||
793 | WSS_DOUBLE("Capture Volume", 0, | ||
794 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | ||
795 | WSS_DOUBLE("Analog Loopback Capture Switch", 0, | ||
796 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), | ||
797 | |||
798 | WSS_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0), | ||
799 | CS4236_DOUBLE1("Digital Loopback Playback Volume", 0, | ||
800 | CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1) | ||
759 | }; | 801 | }; |
760 | 802 | ||
761 | static struct snd_kcontrol_new snd_cs4235_controls[] = { | 803 | static struct snd_kcontrol_new snd_cs4235_controls[] = { |
762 | 804 | ||
763 | CS4231_DOUBLE("Master Switch", 0, CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1), | 805 | WSS_DOUBLE("Master Switch", 0, |
764 | CS4231_DOUBLE("Master Volume", 0, CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1), | 806 | CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1), |
807 | WSS_DOUBLE("Master Volume", 0, | ||
808 | CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1), | ||
765 | 809 | ||
766 | CS4235_OUTPUT_ACCU("Playback Volume", 0), | 810 | CS4235_OUTPUT_ACCU("Playback Volume", 0), |
767 | 811 | ||
768 | CS4236_DOUBLE("Master Digital Playback Switch", 0, CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), | 812 | CS4236_DOUBLE("Master Digital Playback Switch", 0, |
769 | CS4236_DOUBLE("Master Digital Capture Switch", 0, CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), | 813 | CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), |
814 | CS4236_DOUBLE("Master Digital Capture Switch", 0, | ||
815 | CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), | ||
770 | CS4236_MASTER_DIGITAL("Master Digital Volume", 0), | 816 | CS4236_MASTER_DIGITAL("Master Digital Volume", 0), |
771 | 817 | ||
772 | CS4231_DOUBLE("Master Digital Playback Switch", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 818 | WSS_DOUBLE("Master Digital Playback Switch", 1, |
773 | CS4231_DOUBLE("Master Digital Capture Switch", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), | 819 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
774 | CS4231_DOUBLE("Master Digital Volume", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | 820 | WSS_DOUBLE("Master Digital Capture Switch", 1, |
821 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), | ||
822 | WSS_DOUBLE("Master Digital Volume", 1, | ||
823 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | ||
775 | 824 | ||
776 | CS4236_DOUBLE("Capture Volume", 0, CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), | 825 | CS4236_DOUBLE("Capture Volume", 0, |
826 | CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), | ||
777 | 827 | ||
778 | CS4231_DOUBLE("PCM Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 828 | WSS_DOUBLE("PCM Switch", 0, |
779 | CS4231_DOUBLE("PCM Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | 829 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
830 | WSS_DOUBLE("PCM Volume", 0, | ||
831 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | ||
780 | 832 | ||
781 | CS4236_DOUBLE("DSP Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), | 833 | CS4236_DOUBLE("DSP Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), |
782 | 834 | ||
783 | CS4236_DOUBLE("FM Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1), | 835 | CS4236_DOUBLE("FM Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1), |
784 | 836 | ||
785 | CS4236_DOUBLE("Wavetable Switch", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1), | 837 | CS4236_DOUBLE("Wavetable Switch", 0, |
838 | CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1), | ||
786 | 839 | ||
787 | CS4236_DOUBLE("Mic Capture Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), | 840 | CS4236_DOUBLE("Mic Capture Switch", 0, |
788 | CS4236_DOUBLE("Mic Playback Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), | 841 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), |
842 | CS4236_DOUBLE("Mic Playback Switch", 0, | ||
843 | CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), | ||
789 | CS4236_SINGLE("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1), | 844 | CS4236_SINGLE("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1), |
790 | CS4236_SINGLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, 5, 1, 0), | 845 | CS4236_SINGLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, 5, 1, 0), |
791 | 846 | ||
792 | CS4231_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 847 | WSS_DOUBLE("Aux Playback Switch", 0, |
793 | CS4231_DOUBLE("Aux Capture Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), | 848 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
794 | CS4231_DOUBLE("Aux Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | 849 | WSS_DOUBLE("Aux Capture Switch", 0, |
795 | 850 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), | |
796 | CS4231_DOUBLE("Aux Playback Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 851 | WSS_DOUBLE("Aux Volume", 0, |
797 | CS4231_DOUBLE("Aux Capture Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), | 852 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), |
798 | CS4231_DOUBLE("Aux Volume", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | 853 | |
799 | 854 | WSS_DOUBLE("Aux Playback Switch", 1, | |
800 | CS4236_DOUBLE1("Master Mono Switch", 0, CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), | 855 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), |
801 | 856 | WSS_DOUBLE("Aux Capture Switch", 1, | |
802 | CS4236_DOUBLE1("Mono Switch", 0, CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), | 857 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), |
803 | CS4231_SINGLE("Mono Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), | 858 | WSS_DOUBLE("Aux Volume", 1, |
804 | 859 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | |
805 | CS4231_DOUBLE("Analog Loopback Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), | 860 | |
861 | CS4236_DOUBLE1("Master Mono Switch", 0, | ||
862 | CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), | ||
863 | |||
864 | CS4236_DOUBLE1("Mono Switch", 0, | ||
865 | CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), | ||
866 | WSS_SINGLE("Mono Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), | ||
867 | |||
868 | WSS_DOUBLE("Analog Loopback Switch", 0, | ||
869 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), | ||
806 | }; | 870 | }; |
807 | 871 | ||
808 | #define CS4236_IEC958_ENABLE(xname, xindex) \ | 872 | #define CS4236_IEC958_ENABLE(xname, xindex) \ |
@@ -813,14 +877,14 @@ CS4231_DOUBLE("Analog Loopback Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT | |||
813 | 877 | ||
814 | static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 878 | static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
815 | { | 879 | { |
816 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 880 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
817 | unsigned long flags; | 881 | unsigned long flags; |
818 | 882 | ||
819 | spin_lock_irqsave(&chip->reg_lock, flags); | 883 | spin_lock_irqsave(&chip->reg_lock, flags); |
820 | ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0; | 884 | ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0; |
821 | #if 0 | 885 | #if 0 |
822 | printk("get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", | 886 | printk("get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", |
823 | snd_cs4231_in(chip, CS4231_ALT_FEATURE_1), | 887 | snd_wss_in(chip, CS4231_ALT_FEATURE_1), |
824 | snd_cs4236_ctrl_in(chip, 3), | 888 | snd_cs4236_ctrl_in(chip, 3), |
825 | snd_cs4236_ctrl_in(chip, 4), | 889 | snd_cs4236_ctrl_in(chip, 4), |
826 | snd_cs4236_ctrl_in(chip, 5), | 890 | snd_cs4236_ctrl_in(chip, 5), |
@@ -833,7 +897,7 @@ static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct sn | |||
833 | 897 | ||
834 | static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 898 | static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
835 | { | 899 | { |
836 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 900 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
837 | unsigned long flags; | 901 | unsigned long flags; |
838 | int change; | 902 | int change; |
839 | unsigned short enable, val; | 903 | unsigned short enable, val; |
@@ -841,23 +905,23 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn | |||
841 | enable = ucontrol->value.integer.value[0] & 1; | 905 | enable = ucontrol->value.integer.value[0] & 1; |
842 | 906 | ||
843 | mutex_lock(&chip->mce_mutex); | 907 | mutex_lock(&chip->mce_mutex); |
844 | snd_cs4231_mce_up(chip); | 908 | snd_wss_mce_up(chip); |
845 | spin_lock_irqsave(&chip->reg_lock, flags); | 909 | spin_lock_irqsave(&chip->reg_lock, flags); |
846 | val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1); | 910 | val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1); |
847 | change = val != chip->image[CS4231_ALT_FEATURE_1]; | 911 | change = val != chip->image[CS4231_ALT_FEATURE_1]; |
848 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, val); | 912 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, val); |
849 | val = snd_cs4236_ctrl_in(chip, 4) | 0xc0; | 913 | val = snd_cs4236_ctrl_in(chip, 4) | 0xc0; |
850 | snd_cs4236_ctrl_out(chip, 4, val); | 914 | snd_cs4236_ctrl_out(chip, 4, val); |
851 | udelay(100); | 915 | udelay(100); |
852 | val &= ~0x40; | 916 | val &= ~0x40; |
853 | snd_cs4236_ctrl_out(chip, 4, val); | 917 | snd_cs4236_ctrl_out(chip, 4, val); |
854 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 918 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
855 | snd_cs4231_mce_down(chip); | 919 | snd_wss_mce_down(chip); |
856 | mutex_unlock(&chip->mce_mutex); | 920 | mutex_unlock(&chip->mce_mutex); |
857 | 921 | ||
858 | #if 0 | 922 | #if 0 |
859 | printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", | 923 | printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", |
860 | snd_cs4231_in(chip, CS4231_ALT_FEATURE_1), | 924 | snd_wss_in(chip, CS4231_ALT_FEATURE_1), |
861 | snd_cs4236_ctrl_in(chip, 3), | 925 | snd_cs4236_ctrl_in(chip, 3), |
862 | snd_cs4236_ctrl_in(chip, 4), | 926 | snd_cs4236_ctrl_in(chip, 4), |
863 | snd_cs4236_ctrl_in(chip, 5), | 927 | snd_cs4236_ctrl_in(chip, 5), |
@@ -896,7 +960,7 @@ CS4236_SINGLEC("3D Control - Volume", 0, 2, 0, 15, 1), | |||
896 | CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0) | 960 | CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0) |
897 | }; | 961 | }; |
898 | 962 | ||
899 | int snd_cs4236_mixer(struct snd_cs4231 *chip) | 963 | int snd_cs4236_mixer(struct snd_wss *chip) |
900 | { | 964 | { |
901 | struct snd_card *card; | 965 | struct snd_card *card; |
902 | unsigned int idx, count; | 966 | unsigned int idx, count; |
@@ -905,10 +969,10 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip) | |||
905 | 969 | ||
906 | snd_assert(chip != NULL && chip->card != NULL, return -EINVAL); | 970 | snd_assert(chip != NULL && chip->card != NULL, return -EINVAL); |
907 | card = chip->card; | 971 | card = chip->card; |
908 | strcpy(card->mixername, snd_cs4231_chip_id(chip)); | 972 | strcpy(card->mixername, snd_wss_chip_id(chip)); |
909 | 973 | ||
910 | if (chip->hardware == CS4231_HW_CS4235 || | 974 | if (chip->hardware == WSS_HW_CS4235 || |
911 | chip->hardware == CS4231_HW_CS4239) { | 975 | chip->hardware == WSS_HW_CS4239) { |
912 | for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) { | 976 | for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) { |
913 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0) | 977 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0) |
914 | return err; | 978 | return err; |
@@ -920,16 +984,16 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip) | |||
920 | } | 984 | } |
921 | } | 985 | } |
922 | switch (chip->hardware) { | 986 | switch (chip->hardware) { |
923 | case CS4231_HW_CS4235: | 987 | case WSS_HW_CS4235: |
924 | case CS4231_HW_CS4239: | 988 | case WSS_HW_CS4239: |
925 | count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4235); | 989 | count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4235); |
926 | kcontrol = snd_cs4236_3d_controls_cs4235; | 990 | kcontrol = snd_cs4236_3d_controls_cs4235; |
927 | break; | 991 | break; |
928 | case CS4231_HW_CS4237B: | 992 | case WSS_HW_CS4237B: |
929 | count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4237); | 993 | count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4237); |
930 | kcontrol = snd_cs4236_3d_controls_cs4237; | 994 | kcontrol = snd_cs4236_3d_controls_cs4237; |
931 | break; | 995 | break; |
932 | case CS4231_HW_CS4238B: | 996 | case WSS_HW_CS4238B: |
933 | count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4238); | 997 | count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4238); |
934 | kcontrol = snd_cs4236_3d_controls_cs4238; | 998 | kcontrol = snd_cs4236_3d_controls_cs4238; |
935 | break; | 999 | break; |
@@ -941,8 +1005,8 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip) | |||
941 | if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0) | 1005 | if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0) |
942 | return err; | 1006 | return err; |
943 | } | 1007 | } |
944 | if (chip->hardware == CS4231_HW_CS4237B || | 1008 | if (chip->hardware == WSS_HW_CS4237B || |
945 | chip->hardware == CS4231_HW_CS4238B) { | 1009 | chip->hardware == WSS_HW_CS4238B) { |
946 | for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) { | 1010 | for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) { |
947 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0) | 1011 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0) |
948 | return err; | 1012 | return err; |
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index cd82891db80a..f94c1976e632 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c | |||
@@ -75,7 +75,7 @@ struct snd_gusmax { | |||
75 | int irq; | 75 | int irq; |
76 | struct snd_card *card; | 76 | struct snd_card *card; |
77 | struct snd_gus_card *gus; | 77 | struct snd_gus_card *gus; |
78 | struct snd_cs4231 *cs4231; | 78 | struct snd_wss *wss; |
79 | unsigned short gus_status_reg; | 79 | unsigned short gus_status_reg; |
80 | unsigned short pcm_status_reg; | 80 | unsigned short pcm_status_reg; |
81 | }; | 81 | }; |
@@ -117,7 +117,7 @@ static irqreturn_t snd_gusmax_interrupt(int irq, void *dev_id) | |||
117 | } | 117 | } |
118 | if (inb(maxcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */ | 118 | if (inb(maxcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */ |
119 | handled = 1; | 119 | handled = 1; |
120 | snd_cs4231_interrupt(irq, maxcard->cs4231); | 120 | snd_wss_interrupt(irq, maxcard->wss); |
121 | loop++; | 121 | loop++; |
122 | } | 122 | } |
123 | } while (loop && --max > 0); | 123 | } while (loop && --max > 0); |
@@ -140,10 +140,7 @@ static void __devinit snd_gusmax_init(int dev, struct snd_card *card, | |||
140 | outb(gus->max_cntrl_val, GUSP(gus, MAXCNTRLPORT)); | 140 | outb(gus->max_cntrl_val, GUSP(gus, MAXCNTRLPORT)); |
141 | } | 141 | } |
142 | 142 | ||
143 | #define CS4231_PRIVATE( left, right, shift, mute ) \ | 143 | static int __devinit snd_gusmax_mixer(struct snd_wss *chip) |
144 | ((left << 24)|(right << 16)|(shift<<8)|mute) | ||
145 | |||
146 | static int __devinit snd_gusmax_mixer(struct snd_cs4231 *chip) | ||
147 | { | 144 | { |
148 | struct snd_card *card = chip->card; | 145 | struct snd_card *card = chip->card; |
149 | struct snd_ctl_elem_id id1, id2; | 146 | struct snd_ctl_elem_id id1, id2; |
@@ -214,7 +211,7 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev) | |||
214 | int xirq, xdma1, xdma2, err; | 211 | int xirq, xdma1, xdma2, err; |
215 | struct snd_card *card; | 212 | struct snd_card *card; |
216 | struct snd_gus_card *gus = NULL; | 213 | struct snd_gus_card *gus = NULL; |
217 | struct snd_cs4231 *cs4231; | 214 | struct snd_wss *wss; |
218 | struct snd_gusmax *maxcard; | 215 | struct snd_gusmax *maxcard; |
219 | 216 | ||
220 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 217 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, |
@@ -301,33 +298,39 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev) | |||
301 | } | 298 | } |
302 | maxcard->irq = xirq; | 299 | maxcard->irq = xirq; |
303 | 300 | ||
304 | if ((err = snd_cs4231_create(card, | 301 | err = snd_wss_create(card, |
305 | gus->gf1.port + 0x10c, -1, xirq, | 302 | gus->gf1.port + 0x10c, -1, xirq, |
306 | xdma2 < 0 ? xdma1 : xdma2, xdma1, | 303 | xdma2 < 0 ? xdma1 : xdma2, xdma1, |
307 | CS4231_HW_DETECT, | 304 | WSS_HW_DETECT, |
308 | CS4231_HWSHARE_IRQ | | 305 | WSS_HWSHARE_IRQ | |
309 | CS4231_HWSHARE_DMA1 | | 306 | WSS_HWSHARE_DMA1 | |
310 | CS4231_HWSHARE_DMA2, | 307 | WSS_HWSHARE_DMA2, |
311 | &cs4231)) < 0) | 308 | &wss); |
309 | if (err < 0) | ||
312 | goto _err; | 310 | goto _err; |
313 | 311 | ||
314 | if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) | 312 | err = snd_wss_pcm(wss, 0, NULL); |
313 | if (err < 0) | ||
315 | goto _err; | 314 | goto _err; |
316 | 315 | ||
317 | if ((err = snd_cs4231_mixer(cs4231)) < 0) | 316 | err = snd_wss_mixer(wss); |
317 | if (err < 0) | ||
318 | goto _err; | 318 | goto _err; |
319 | 319 | ||
320 | if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) | 320 | err = snd_wss_timer(wss, 2, NULL); |
321 | if (err < 0) | ||
321 | goto _err; | 322 | goto _err; |
322 | 323 | ||
323 | if (pcm_channels[dev] > 0) { | 324 | if (pcm_channels[dev] > 0) { |
324 | if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) | 325 | if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) |
325 | goto _err; | 326 | goto _err; |
326 | } | 327 | } |
327 | if ((err = snd_gusmax_mixer(cs4231)) < 0) | 328 | err = snd_gusmax_mixer(wss); |
329 | if (err < 0) | ||
328 | goto _err; | 330 | goto _err; |
329 | 331 | ||
330 | if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) | 332 | err = snd_gf1_rawmidi_new(gus, 0, NULL); |
333 | if (err < 0) | ||
331 | goto _err; | 334 | goto _err; |
332 | 335 | ||
333 | sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1); | 336 | sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1); |
@@ -336,11 +339,12 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev) | |||
336 | 339 | ||
337 | snd_card_set_dev(card, pdev); | 340 | snd_card_set_dev(card, pdev); |
338 | 341 | ||
339 | if ((err = snd_card_register(card)) < 0) | 342 | err = snd_card_register(card); |
343 | if (err < 0) | ||
340 | goto _err; | 344 | goto _err; |
341 | 345 | ||
342 | maxcard->gus = gus; | 346 | maxcard->gus = gus; |
343 | maxcard->cs4231 = cs4231; | 347 | maxcard->wss = wss; |
344 | 348 | ||
345 | dev_set_drvdata(pdev, card); | 349 | dev_set_drvdata(pdev, card); |
346 | return 0; | 350 | return 0; |
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index eac8cc77e338..5faecfb602d3 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c | |||
@@ -118,7 +118,7 @@ struct snd_interwave { | |||
118 | int irq; | 118 | int irq; |
119 | struct snd_card *card; | 119 | struct snd_card *card; |
120 | struct snd_gus_card *gus; | 120 | struct snd_gus_card *gus; |
121 | struct snd_cs4231 *cs4231; | 121 | struct snd_wss *wss; |
122 | #ifdef SNDRV_STB | 122 | #ifdef SNDRV_STB |
123 | struct resource *i2c_res; | 123 | struct resource *i2c_res; |
124 | #endif | 124 | #endif |
@@ -312,7 +312,7 @@ static irqreturn_t snd_interwave_interrupt(int irq, void *dev_id) | |||
312 | } | 312 | } |
313 | if (inb(iwcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */ | 313 | if (inb(iwcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */ |
314 | handled = 1; | 314 | handled = 1; |
315 | snd_cs4231_interrupt(irq, iwcard->cs4231); | 315 | snd_wss_interrupt(irq, iwcard->wss); |
316 | loop++; | 316 | loop++; |
317 | } | 317 | } |
318 | } while (loop && --max > 0); | 318 | } while (loop && --max > 0); |
@@ -498,13 +498,17 @@ static void __devinit snd_interwave_init(int dev, struct snd_gus_card * gus) | |||
498 | } | 498 | } |
499 | 499 | ||
500 | static struct snd_kcontrol_new snd_interwave_controls[] = { | 500 | static struct snd_kcontrol_new snd_interwave_controls[] = { |
501 | CS4231_DOUBLE("Master Playback Switch", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1), | 501 | WSS_DOUBLE("Master Playback Switch", 0, |
502 | CS4231_DOUBLE("Master Playback Volume", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 0, 0, 31, 1), | 502 | CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1), |
503 | CS4231_DOUBLE("Mic Playback Switch", 0, CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 7, 7, 1, 1), | 503 | WSS_DOUBLE("Master Playback Volume", 0, |
504 | CS4231_DOUBLE("Mic Playback Volume", 0, CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 0, 0, 31, 1) | 504 | CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 0, 0, 31, 1), |
505 | WSS_DOUBLE("Mic Playback Switch", 0, | ||
506 | CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 7, 7, 1, 1), | ||
507 | WSS_DOUBLE("Mic Playback Volume", 0, | ||
508 | CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 0, 0, 31, 1) | ||
505 | }; | 509 | }; |
506 | 510 | ||
507 | static int __devinit snd_interwave_mixer(struct snd_cs4231 *chip) | 511 | static int __devinit snd_interwave_mixer(struct snd_wss *chip) |
508 | { | 512 | { |
509 | struct snd_card *card = chip->card; | 513 | struct snd_card *card = chip->card; |
510 | struct snd_ctl_elem_id id1, id2; | 514 | struct snd_ctl_elem_id id1, id2; |
@@ -527,10 +531,10 @@ static int __devinit snd_interwave_mixer(struct snd_cs4231 *chip) | |||
527 | for (idx = 0; idx < ARRAY_SIZE(snd_interwave_controls); idx++) | 531 | for (idx = 0; idx < ARRAY_SIZE(snd_interwave_controls); idx++) |
528 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_interwave_controls[idx], chip))) < 0) | 532 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_interwave_controls[idx], chip))) < 0) |
529 | return err; | 533 | return err; |
530 | snd_cs4231_out(chip, CS4231_LINE_LEFT_OUTPUT, 0x9f); | 534 | snd_wss_out(chip, CS4231_LINE_LEFT_OUTPUT, 0x9f); |
531 | snd_cs4231_out(chip, CS4231_LINE_RIGHT_OUTPUT, 0x9f); | 535 | snd_wss_out(chip, CS4231_LINE_RIGHT_OUTPUT, 0x9f); |
532 | snd_cs4231_out(chip, CS4231_LEFT_MIC_INPUT, 0x9f); | 536 | snd_wss_out(chip, CS4231_LEFT_MIC_INPUT, 0x9f); |
533 | snd_cs4231_out(chip, CS4231_RIGHT_MIC_INPUT, 0x9f); | 537 | snd_wss_out(chip, CS4231_RIGHT_MIC_INPUT, 0x9f); |
534 | /* reassign AUXA to SYNTHESIZER */ | 538 | /* reassign AUXA to SYNTHESIZER */ |
535 | strcpy(id1.name, "Aux Playback Switch"); | 539 | strcpy(id1.name, "Aux Playback Switch"); |
536 | strcpy(id2.name, "Synth Playback Switch"); | 540 | strcpy(id2.name, "Synth Playback Switch"); |
@@ -642,7 +646,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev) | |||
642 | { | 646 | { |
643 | int xirq, xdma1, xdma2; | 647 | int xirq, xdma1, xdma2; |
644 | struct snd_interwave *iwcard = card->private_data; | 648 | struct snd_interwave *iwcard = card->private_data; |
645 | struct snd_cs4231 *cs4231; | 649 | struct snd_wss *wss; |
646 | struct snd_gus_card *gus; | 650 | struct snd_gus_card *gus; |
647 | #ifdef SNDRV_STB | 651 | #ifdef SNDRV_STB |
648 | struct snd_i2c_bus *i2c_bus; | 652 | struct snd_i2c_bus *i2c_bus; |
@@ -684,33 +688,39 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev) | |||
684 | } | 688 | } |
685 | iwcard->irq = xirq; | 689 | iwcard->irq = xirq; |
686 | 690 | ||
687 | if ((err = snd_cs4231_create(card, | 691 | err = snd_wss_create(card, |
688 | gus->gf1.port + 0x10c, -1, xirq, | 692 | gus->gf1.port + 0x10c, -1, xirq, |
689 | xdma2 < 0 ? xdma1 : xdma2, xdma1, | 693 | xdma2 < 0 ? xdma1 : xdma2, xdma1, |
690 | CS4231_HW_INTERWAVE, | 694 | WSS_HW_INTERWAVE, |
691 | CS4231_HWSHARE_IRQ | | 695 | WSS_HWSHARE_IRQ | |
692 | CS4231_HWSHARE_DMA1 | | 696 | WSS_HWSHARE_DMA1 | |
693 | CS4231_HWSHARE_DMA2, | 697 | WSS_HWSHARE_DMA2, |
694 | &cs4231)) < 0) | 698 | &wss); |
699 | if (err < 0) | ||
695 | return err; | 700 | return err; |
696 | 701 | ||
697 | if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0) | 702 | err = snd_wss_pcm(wss, 0, &pcm); |
703 | if (err < 0) | ||
698 | return err; | 704 | return err; |
699 | 705 | ||
700 | sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A'); | 706 | sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A'); |
701 | strcat(pcm->name, " (codec)"); | 707 | strcat(pcm->name, " (codec)"); |
702 | 708 | ||
703 | if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) | 709 | err = snd_wss_timer(wss, 2, NULL); |
710 | if (err < 0) | ||
704 | return err; | 711 | return err; |
705 | 712 | ||
706 | if ((err = snd_cs4231_mixer(cs4231)) < 0) | 713 | err = snd_wss_mixer(wss); |
714 | if (err < 0) | ||
707 | return err; | 715 | return err; |
708 | 716 | ||
709 | if (pcm_channels[dev] > 0) { | 717 | if (pcm_channels[dev] > 0) { |
710 | if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) | 718 | err = snd_gf1_pcm_new(gus, 1, 1, NULL); |
719 | if (err < 0) | ||
711 | return err; | 720 | return err; |
712 | } | 721 | } |
713 | if ((err = snd_interwave_mixer(cs4231)) < 0) | 722 | err = snd_interwave_mixer(wss); |
723 | if (err < 0) | ||
714 | return err; | 724 | return err; |
715 | 725 | ||
716 | #ifdef SNDRV_STB | 726 | #ifdef SNDRV_STB |
@@ -754,10 +764,11 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev) | |||
754 | if (xdma2 >= 0) | 764 | if (xdma2 >= 0) |
755 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); | 765 | sprintf(card->longname + strlen(card->longname), "&%d", xdma2); |
756 | 766 | ||
757 | if ((err = snd_card_register(card)) < 0) | 767 | err = snd_card_register(card); |
768 | if (err < 0) | ||
758 | return err; | 769 | return err; |
759 | 770 | ||
760 | iwcard->cs4231 = cs4231; | 771 | iwcard->wss = wss; |
761 | iwcard->gus = gus; | 772 | iwcard->gus = gus; |
762 | return 0; | 773 | return 0; |
763 | } | 774 | } |
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index e81cbe86823a..949fee5cd070 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -133,7 +133,7 @@ struct snd_opl3sa2 { | |||
133 | spinlock_t reg_lock; | 133 | spinlock_t reg_lock; |
134 | struct snd_hwdep *synth; | 134 | struct snd_hwdep *synth; |
135 | struct snd_rawmidi *rmidi; | 135 | struct snd_rawmidi *rmidi; |
136 | struct snd_cs4231 *cs4231; | 136 | struct snd_wss *wss; |
137 | unsigned char ctlregs[0x20]; | 137 | unsigned char ctlregs[0x20]; |
138 | int ymode; /* SL added */ | 138 | int ymode; /* SL added */ |
139 | struct snd_kcontrol *master_switch; | 139 | struct snd_kcontrol *master_switch; |
@@ -318,7 +318,7 @@ static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id) | |||
318 | 318 | ||
319 | if (status & 0x07) { /* TI,CI,PI */ | 319 | if (status & 0x07) { /* TI,CI,PI */ |
320 | handled = 1; | 320 | handled = 1; |
321 | snd_cs4231_interrupt(irq, chip->cs4231); | 321 | snd_wss_interrupt(irq, chip->wss); |
322 | } | 322 | } |
323 | 323 | ||
324 | if (status & 0x40) { /* hardware volume change */ | 324 | if (status & 0x40) { /* hardware volume change */ |
@@ -573,7 +573,7 @@ static int snd_opl3sa2_suspend(struct snd_card *card, pm_message_t state) | |||
573 | struct snd_opl3sa2 *chip = card->private_data; | 573 | struct snd_opl3sa2 *chip = card->private_data; |
574 | 574 | ||
575 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 575 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
576 | chip->cs4231->suspend(chip->cs4231); | 576 | chip->wss->suspend(chip->wss); |
577 | /* power down */ | 577 | /* power down */ |
578 | snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3); | 578 | snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3); |
579 | 579 | ||
@@ -597,8 +597,8 @@ static int snd_opl3sa2_resume(struct snd_card *card) | |||
597 | for (i = 0x12; i <= 0x16; i++) | 597 | for (i = 0x12; i <= 0x16; i++) |
598 | snd_opl3sa2_write(chip, i, chip->ctlregs[i]); | 598 | snd_opl3sa2_write(chip, i, chip->ctlregs[i]); |
599 | } | 599 | } |
600 | /* restore cs4231 */ | 600 | /* restore wss */ |
601 | chip->cs4231->resume(chip->cs4231); | 601 | chip->wss->resume(chip->wss); |
602 | 602 | ||
603 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 603 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
604 | return 0; | 604 | return 0; |
@@ -659,7 +659,7 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) | |||
659 | { | 659 | { |
660 | int xirq, xdma1, xdma2; | 660 | int xirq, xdma1, xdma2; |
661 | struct snd_opl3sa2 *chip; | 661 | struct snd_opl3sa2 *chip; |
662 | struct snd_cs4231 *cs4231; | 662 | struct snd_wss *wss; |
663 | struct snd_opl3 *opl3; | 663 | struct snd_opl3 *opl3; |
664 | int err; | 664 | int err; |
665 | 665 | ||
@@ -679,23 +679,25 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) | |||
679 | return -ENODEV; | 679 | return -ENODEV; |
680 | } | 680 | } |
681 | chip->irq = xirq; | 681 | chip->irq = xirq; |
682 | if ((err = snd_cs4231_create(card, | 682 | err = snd_wss_create(card, |
683 | wss_port[dev] + 4, -1, | 683 | wss_port[dev] + 4, -1, |
684 | xirq, xdma1, xdma2, | 684 | xirq, xdma1, xdma2, |
685 | CS4231_HW_OPL3SA2, | 685 | WSS_HW_OPL3SA2, WSS_HWSHARE_IRQ, &wss); |
686 | CS4231_HWSHARE_IRQ, | 686 | if (err < 0) { |
687 | &cs4231)) < 0) { | ||
688 | snd_printd("Oops, WSS not detected at 0x%lx\n", wss_port[dev] + 4); | 687 | snd_printd("Oops, WSS not detected at 0x%lx\n", wss_port[dev] + 4); |
689 | return err; | 688 | return err; |
690 | } | 689 | } |
691 | chip->cs4231 = cs4231; | 690 | chip->wss = wss; |
692 | if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) | 691 | err = snd_wss_pcm(wss, 0, NULL); |
692 | if (err < 0) | ||
693 | return err; | 693 | return err; |
694 | if ((err = snd_cs4231_mixer(cs4231)) < 0) | 694 | err = snd_wss_mixer(wss); |
695 | if (err < 0) | ||
695 | return err; | 696 | return err; |
696 | if ((err = snd_opl3sa2_mixer(chip)) < 0) | 697 | if ((err = snd_opl3sa2_mixer(chip)) < 0) |
697 | return err; | 698 | return err; |
698 | if ((err = snd_cs4231_timer(cs4231, 0, NULL)) < 0) | 699 | err = snd_wss_timer(wss, 0, NULL); |
700 | if (err < 0) | ||
699 | return err; | 701 | return err; |
700 | if (fm_port[dev] >= 0x340 && fm_port[dev] < 0x400) { | 702 | if (fm_port[dev] >= 0x340 && fm_port[dev] < 0x400) { |
701 | if ((err = snd_opl3_create(card, fm_port[dev], | 703 | if ((err = snd_opl3_create(card, fm_port[dev], |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 59f7c55baf30..4641daa7844d 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -1221,7 +1221,7 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | |||
1221 | 1221 | ||
1222 | int error; | 1222 | int error; |
1223 | struct snd_miro *miro; | 1223 | struct snd_miro *miro; |
1224 | struct snd_cs4231 *codec; | 1224 | struct snd_wss *codec; |
1225 | struct snd_timer *timer; | 1225 | struct snd_timer *timer; |
1226 | struct snd_card *card; | 1226 | struct snd_card *card; |
1227 | struct snd_pcm *pcm; | 1227 | struct snd_pcm *pcm; |
@@ -1310,29 +1310,32 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | |||
1310 | } | 1310 | } |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | if ((error = snd_miro_configure(miro))) { | 1313 | error = snd_miro_configure(miro); |
1314 | if (error) { | ||
1314 | snd_card_free(card); | 1315 | snd_card_free(card); |
1315 | return error; | 1316 | return error; |
1316 | } | 1317 | } |
1317 | 1318 | ||
1318 | if ((error = snd_cs4231_create(card, miro->wss_base + 4, -1, | 1319 | error = snd_wss_create(card, miro->wss_base + 4, -1, |
1319 | miro->irq, miro->dma1, miro->dma2, | 1320 | miro->irq, miro->dma1, miro->dma2, |
1320 | CS4231_HW_AD1845, | 1321 | WSS_HW_AD1845, 0, &codec); |
1321 | 0, | 1322 | if (error < 0) { |
1322 | &codec)) < 0) { | ||
1323 | snd_card_free(card); | 1323 | snd_card_free(card); |
1324 | return error; | 1324 | return error; |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0) { | 1327 | error = snd_wss_pcm(codec, 0, &pcm); |
1328 | if (error < 0) { | ||
1328 | snd_card_free(card); | 1329 | snd_card_free(card); |
1329 | return error; | 1330 | return error; |
1330 | } | 1331 | } |
1331 | if ((error = snd_cs4231_mixer(codec)) < 0) { | 1332 | error = snd_wss_mixer(codec); |
1333 | if (error < 0) { | ||
1332 | snd_card_free(card); | 1334 | snd_card_free(card); |
1333 | return error; | 1335 | return error; |
1334 | } | 1336 | } |
1335 | if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0) { | 1337 | error = snd_wss_timer(codec, 0, &timer); |
1338 | if (error < 0) { | ||
1336 | snd_card_free(card); | 1339 | snd_card_free(card); |
1337 | return error; | 1340 | return error; |
1338 | } | 1341 | } |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 93a03d9c7a95..fefb8597717c 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -139,7 +139,7 @@ struct snd_opti9xx { | |||
139 | unsigned long mc_base_size; | 139 | unsigned long mc_base_size; |
140 | #ifdef OPTi93X | 140 | #ifdef OPTi93X |
141 | unsigned long mc_indir_index; | 141 | unsigned long mc_indir_index; |
142 | struct snd_cs4231 *codec; | 142 | struct snd_wss *codec; |
143 | #endif /* OPTi93X */ | 143 | #endif /* OPTi93X */ |
144 | unsigned long pwd_reg; | 144 | unsigned long pwd_reg; |
145 | 145 | ||
@@ -562,7 +562,7 @@ __skip_mpu: | |||
562 | 562 | ||
563 | static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) | 563 | static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) |
564 | { | 564 | { |
565 | struct snd_cs4231 *codec = dev_id; | 565 | struct snd_wss *codec = dev_id; |
566 | struct snd_opti9xx *chip = codec->card->private_data; | 566 | struct snd_opti9xx *chip = codec->card->private_data; |
567 | unsigned char status; | 567 | unsigned char status; |
568 | 568 | ||
@@ -570,7 +570,7 @@ static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) | |||
570 | if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream) | 570 | if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream) |
571 | snd_pcm_period_elapsed(codec->playback_substream); | 571 | snd_pcm_period_elapsed(codec->playback_substream); |
572 | if ((status & OPTi93X_IRQ_CAPTURE) && codec->capture_substream) { | 572 | if ((status & OPTi93X_IRQ_CAPTURE) && codec->capture_substream) { |
573 | snd_cs4231_overrange(codec); | 573 | snd_wss_overrange(codec); |
574 | snd_pcm_period_elapsed(codec->capture_substream); | 574 | snd_pcm_period_elapsed(codec->capture_substream); |
575 | } | 575 | } |
576 | outb(0x00, OPTi93X_PORT(codec, STATUS)); | 576 | outb(0x00, OPTi93X_PORT(codec, STATUS)); |
@@ -691,7 +691,7 @@ static void snd_card_opti9xx_free(struct snd_card *card) | |||
691 | 691 | ||
692 | if (chip) { | 692 | if (chip) { |
693 | #ifdef OPTi93X | 693 | #ifdef OPTi93X |
694 | struct snd_cs4231 *codec = chip->codec; | 694 | struct snd_wss *codec = chip->codec; |
695 | if (codec && codec->irq > 0) { | 695 | if (codec && codec->irq > 0) { |
696 | disable_irq(codec->irq); | 696 | disable_irq(codec->irq); |
697 | free_irq(codec->irq, codec); | 697 | free_irq(codec->irq, codec); |
@@ -707,7 +707,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
707 | int error; | 707 | int error; |
708 | struct snd_opti9xx *chip = card->private_data; | 708 | struct snd_opti9xx *chip = card->private_data; |
709 | #if defined(CS4231) || defined(OPTi93X) | 709 | #if defined(CS4231) || defined(OPTi93X) |
710 | struct snd_cs4231 *codec; | 710 | struct snd_wss *codec; |
711 | #ifdef CS4231 | 711 | #ifdef CS4231 |
712 | struct snd_timer *timer; | 712 | struct snd_timer *timer; |
713 | #endif | 713 | #endif |
@@ -734,33 +734,39 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
734 | #endif | 734 | #endif |
735 | 735 | ||
736 | if (chip->wss_base == SNDRV_AUTO_PORT) { | 736 | if (chip->wss_base == SNDRV_AUTO_PORT) { |
737 | if ((chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4)) < 0) { | 737 | chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4); |
738 | if (chip->wss_base < 0) { | ||
738 | snd_printk("unable to find a free WSS port\n"); | 739 | snd_printk("unable to find a free WSS port\n"); |
739 | return -EBUSY; | 740 | return -EBUSY; |
740 | } | 741 | } |
741 | } | 742 | } |
742 | if ((error = snd_opti9xx_configure(chip))) | 743 | error = snd_opti9xx_configure(chip); |
744 | if (error) | ||
743 | return error; | 745 | return error; |
744 | 746 | ||
745 | #if defined(CS4231) || defined(OPTi93X) | 747 | #if defined(CS4231) || defined(OPTi93X) |
746 | if ((error = snd_cs4231_create(card, chip->wss_base + 4, -1, | 748 | error = snd_wss_create(card, chip->wss_base + 4, -1, |
747 | chip->irq, chip->dma1, chip->dma2, | 749 | chip->irq, chip->dma1, chip->dma2, |
748 | #ifdef CS4231 | 750 | #ifdef CS4231 |
749 | CS4231_HW_DETECT, 0, | 751 | WSS_HW_DETECT, 0, |
750 | #else /* OPTi93x */ | 752 | #else /* OPTi93x */ |
751 | CS4231_HW_OPTI93X, CS4231_HWSHARE_IRQ, | 753 | WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, |
752 | #endif | 754 | #endif |
753 | &codec)) < 0) | 755 | &codec); |
756 | if (error < 0) | ||
754 | return error; | 757 | return error; |
755 | #ifdef OPTi93X | 758 | #ifdef OPTi93X |
756 | chip->codec = codec; | 759 | chip->codec = codec; |
757 | #endif | 760 | #endif |
758 | if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0) | 761 | error = snd_wss_pcm(codec, 0, &pcm); |
762 | if (error < 0) | ||
759 | return error; | 763 | return error; |
760 | if ((error = snd_cs4231_mixer(codec)) < 0) | 764 | error = snd_wss_mixer(codec); |
765 | if (error < 0) | ||
761 | return error; | 766 | return error; |
762 | #ifdef CS4231 | 767 | #ifdef CS4231 |
763 | if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0) | 768 | error = snd_wss_timer(codec, 0, &timer); |
769 | if (error < 0) | ||
764 | return error; | 770 | return error; |
765 | #else /* OPTI93X */ | 771 | #else /* OPTI93X */ |
766 | error = request_irq(chip->irq, snd_opti93x_interrupt, | 772 | error = request_irq(chip->irq, snd_opti93x_interrupt, |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 1dc4224b3207..48a16d865834 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -147,7 +147,7 @@ struct soundscape { | |||
147 | enum card_type type; | 147 | enum card_type type; |
148 | struct resource *io_res; | 148 | struct resource *io_res; |
149 | struct resource *wss_res; | 149 | struct resource *wss_res; |
150 | struct snd_cs4231 *chip; | 150 | struct snd_wss *chip; |
151 | struct snd_mpu401 *mpu; | 151 | struct snd_mpu401 *mpu; |
152 | struct snd_hwdep *hw; | 152 | struct snd_hwdep *hw; |
153 | 153 | ||
@@ -726,7 +726,7 @@ static int sscape_midi_info(struct snd_kcontrol *ctl, | |||
726 | static int sscape_midi_get(struct snd_kcontrol *kctl, | 726 | static int sscape_midi_get(struct snd_kcontrol *kctl, |
727 | struct snd_ctl_elem_value *uctl) | 727 | struct snd_ctl_elem_value *uctl) |
728 | { | 728 | { |
729 | struct snd_cs4231 *chip = snd_kcontrol_chip(kctl); | 729 | struct snd_wss *chip = snd_kcontrol_chip(kctl); |
730 | struct snd_card *card = chip->card; | 730 | struct snd_card *card = chip->card; |
731 | register struct soundscape *s = get_card_soundscape(card); | 731 | register struct soundscape *s = get_card_soundscape(card); |
732 | unsigned long flags; | 732 | unsigned long flags; |
@@ -746,7 +746,7 @@ static int sscape_midi_get(struct snd_kcontrol *kctl, | |||
746 | static int sscape_midi_put(struct snd_kcontrol *kctl, | 746 | static int sscape_midi_put(struct snd_kcontrol *kctl, |
747 | struct snd_ctl_elem_value *uctl) | 747 | struct snd_ctl_elem_value *uctl) |
748 | { | 748 | { |
749 | struct snd_cs4231 *chip = snd_kcontrol_chip(kctl); | 749 | struct snd_wss *chip = snd_kcontrol_chip(kctl); |
750 | struct snd_card *card = chip->card; | 750 | struct snd_card *card = chip->card; |
751 | register struct soundscape *s = get_card_soundscape(card); | 751 | register struct soundscape *s = get_card_soundscape(card); |
752 | unsigned long flags; | 752 | unsigned long flags; |
@@ -958,7 +958,9 @@ static int __devinit create_mpu401(struct snd_card *card, int devnum, unsigned l | |||
958 | * Override for the CS4231 playback format function. | 958 | * Override for the CS4231 playback format function. |
959 | * The AD1845 has much simpler format and rate selection. | 959 | * The AD1845 has much simpler format and rate selection. |
960 | */ | 960 | */ |
961 | static void ad1845_playback_format(struct snd_cs4231 * chip, struct snd_pcm_hw_params *params, unsigned char format) | 961 | static void ad1845_playback_format(struct snd_wss *chip, |
962 | struct snd_pcm_hw_params *params, | ||
963 | unsigned char format) | ||
962 | { | 964 | { |
963 | unsigned long flags; | 965 | unsigned long flags; |
964 | unsigned rate = params_rate(params); | 966 | unsigned rate = params_rate(params); |
@@ -983,9 +985,9 @@ static void ad1845_playback_format(struct snd_cs4231 * chip, struct snd_pcm_hw_p | |||
983 | * NOTE: We seem to need to write to the MSB before the LSB | 985 | * NOTE: We seem to need to write to the MSB before the LSB |
984 | * to get the correct sample frequency. | 986 | * to get the correct sample frequency. |
985 | */ | 987 | */ |
986 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, (format & 0xf0)); | 988 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, (format & 0xf0)); |
987 | snd_cs4231_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8)); | 989 | snd_wss_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8)); |
988 | snd_cs4231_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate); | 990 | snd_wss_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate); |
989 | 991 | ||
990 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 992 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
991 | } | 993 | } |
@@ -994,7 +996,9 @@ static void ad1845_playback_format(struct snd_cs4231 * chip, struct snd_pcm_hw_p | |||
994 | * Override for the CS4231 capture format function. | 996 | * Override for the CS4231 capture format function. |
995 | * The AD1845 has much simpler format and rate selection. | 997 | * The AD1845 has much simpler format and rate selection. |
996 | */ | 998 | */ |
997 | static void ad1845_capture_format(struct snd_cs4231 * chip, struct snd_pcm_hw_params *params, unsigned char format) | 999 | static void ad1845_capture_format(struct snd_wss *chip, |
1000 | struct snd_pcm_hw_params *params, | ||
1001 | unsigned char format) | ||
998 | { | 1002 | { |
999 | unsigned long flags; | 1003 | unsigned long flags; |
1000 | unsigned rate = params_rate(params); | 1004 | unsigned rate = params_rate(params); |
@@ -1019,9 +1023,9 @@ static void ad1845_capture_format(struct snd_cs4231 * chip, struct snd_pcm_hw_pa | |||
1019 | * NOTE: We seem to need to write to the MSB before the LSB | 1023 | * NOTE: We seem to need to write to the MSB before the LSB |
1020 | * to get the correct sample frequency. | 1024 | * to get the correct sample frequency. |
1021 | */ | 1025 | */ |
1022 | snd_cs4231_out(chip, CS4231_REC_FORMAT, (format & 0xf0)); | 1026 | snd_wss_out(chip, CS4231_REC_FORMAT, (format & 0xf0)); |
1023 | snd_cs4231_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8)); | 1027 | snd_wss_out(chip, AD1845_FREQ_SEL_MSB, (unsigned char) (rate >> 8)); |
1024 | snd_cs4231_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate); | 1028 | snd_wss_out(chip, AD1845_FREQ_SEL_LSB, (unsigned char) rate); |
1025 | 1029 | ||
1026 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1030 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1027 | } | 1031 | } |
@@ -1036,7 +1040,7 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, | |||
1036 | int irq, int dma1, int dma2) | 1040 | int irq, int dma1, int dma2) |
1037 | { | 1041 | { |
1038 | register struct soundscape *sscape = get_card_soundscape(card); | 1042 | register struct soundscape *sscape = get_card_soundscape(card); |
1039 | struct snd_cs4231 *chip; | 1043 | struct snd_wss *chip; |
1040 | int err; | 1044 | int err; |
1041 | 1045 | ||
1042 | if (sscape->type == SSCAPE_VIVO) | 1046 | if (sscape->type == SSCAPE_VIVO) |
@@ -1045,9 +1049,8 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, | |||
1045 | if (dma1 == dma2) | 1049 | if (dma1 == dma2) |
1046 | dma2 = -1; | 1050 | dma2 = -1; |
1047 | 1051 | ||
1048 | err = snd_cs4231_create(card, | 1052 | err = snd_wss_create(card, port, -1, irq, dma1, dma2, |
1049 | port, -1, irq, dma1, dma2, | 1053 | WSS_HW_DETECT, WSS_HWSHARE_DMA1, &chip); |
1050 | CS4231_HW_DETECT, CS4231_HWSHARE_DMA1, &chip); | ||
1051 | if (!err) { | 1054 | if (!err) { |
1052 | unsigned long flags; | 1055 | unsigned long flags; |
1053 | struct snd_pcm *pcm; | 1056 | struct snd_pcm *pcm; |
@@ -1063,11 +1066,11 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, | |||
1063 | * | 1066 | * |
1064 | #define AD1845_IFACE_CONFIG \ | 1067 | #define AD1845_IFACE_CONFIG \ |
1065 | (CS4231_AUTOCALIB | CS4231_RECORD_ENABLE | CS4231_PLAYBACK_ENABLE) | 1068 | (CS4231_AUTOCALIB | CS4231_RECORD_ENABLE | CS4231_PLAYBACK_ENABLE) |
1066 | snd_cs4231_mce_up(chip); | 1069 | snd_wss_mce_up(chip); |
1067 | spin_lock_irqsave(&chip->reg_lock, flags); | 1070 | spin_lock_irqsave(&chip->reg_lock, flags); |
1068 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, AD1845_IFACE_CONFIG); | 1071 | snd_wss_out(chip, CS4231_IFACE_CTRL, AD1845_IFACE_CONFIG); |
1069 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1072 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1070 | snd_cs4231_mce_down(chip); | 1073 | snd_wss_mce_down(chip); |
1071 | */ | 1074 | */ |
1072 | 1075 | ||
1073 | if (sscape->type != SSCAPE_VIVO) { | 1076 | if (sscape->type != SSCAPE_VIVO) { |
@@ -1077,11 +1080,11 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, | |||
1077 | * be 14.31818 MHz, because we must set this register | 1080 | * be 14.31818 MHz, because we must set this register |
1078 | * to get the playback to sound correct ... | 1081 | * to get the playback to sound correct ... |
1079 | */ | 1082 | */ |
1080 | snd_cs4231_mce_up(chip); | 1083 | snd_wss_mce_up(chip); |
1081 | spin_lock_irqsave(&chip->reg_lock, flags); | 1084 | spin_lock_irqsave(&chip->reg_lock, flags); |
1082 | snd_cs4231_out(chip, AD1845_CRYS_CLOCK_SEL, 0x20); | 1085 | snd_wss_out(chip, AD1845_CRYS_CLOCK_SEL, 0x20); |
1083 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1086 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1084 | snd_cs4231_mce_down(chip); | 1087 | snd_wss_mce_down(chip); |
1085 | 1088 | ||
1086 | /* | 1089 | /* |
1087 | * More custom configuration: | 1090 | * More custom configuration: |
@@ -1089,28 +1092,28 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, | |||
1089 | * b) enable frequency selection (for capture/playback) | 1092 | * b) enable frequency selection (for capture/playback) |
1090 | */ | 1093 | */ |
1091 | spin_lock_irqsave(&chip->reg_lock, flags); | 1094 | spin_lock_irqsave(&chip->reg_lock, flags); |
1092 | snd_cs4231_out(chip, CS4231_MISC_INFO, | 1095 | snd_wss_out(chip, CS4231_MISC_INFO, |
1093 | CS4231_MODE2 | 0x10); | 1096 | CS4231_MODE2 | 0x10); |
1094 | val = snd_cs4231_in(chip, AD1845_PWR_DOWN_CTRL); | 1097 | val = snd_wss_in(chip, AD1845_PWR_DOWN_CTRL); |
1095 | snd_cs4231_out(chip, AD1845_PWR_DOWN_CTRL, | 1098 | snd_wss_out(chip, AD1845_PWR_DOWN_CTRL, |
1096 | val | AD1845_FREQ_SEL_ENABLE); | 1099 | val | AD1845_FREQ_SEL_ENABLE); |
1097 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1100 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1098 | } | 1101 | } |
1099 | 1102 | ||
1100 | err = snd_cs4231_pcm(chip, 0, &pcm); | 1103 | err = snd_wss_pcm(chip, 0, &pcm); |
1101 | if (err < 0) { | 1104 | if (err < 0) { |
1102 | snd_printk(KERN_ERR "sscape: No PCM device " | 1105 | snd_printk(KERN_ERR "sscape: No PCM device " |
1103 | "for AD1845 chip\n"); | 1106 | "for AD1845 chip\n"); |
1104 | goto _error; | 1107 | goto _error; |
1105 | } | 1108 | } |
1106 | 1109 | ||
1107 | err = snd_cs4231_mixer(chip); | 1110 | err = snd_wss_mixer(chip); |
1108 | if (err < 0) { | 1111 | if (err < 0) { |
1109 | snd_printk(KERN_ERR "sscape: No mixer device " | 1112 | snd_printk(KERN_ERR "sscape: No mixer device " |
1110 | "for AD1845 chip\n"); | 1113 | "for AD1845 chip\n"); |
1111 | goto _error; | 1114 | goto _error; |
1112 | } | 1115 | } |
1113 | err = snd_cs4231_timer(chip, 0, NULL); | 1116 | err = snd_wss_timer(chip, 0, NULL); |
1114 | if (err < 0) { | 1117 | if (err < 0) { |
1115 | snd_printk(KERN_ERR "sscape: No timer device " | 1118 | snd_printk(KERN_ERR "sscape: No timer device " |
1116 | "for AD1845 chip\n"); | 1119 | "for AD1845 chip\n"); |
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 2fb058b5a45f..4c095bc7c729 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ALSA card-level driver for Turtle Beach Wavefront cards | 2 | * ALSA card-level driver for Turtle Beach Wavefront cards |
3 | * (Maui,Tropez,Tropez+) | 3 | * (Maui,Tropez,Tropez+) |
4 | * | 4 | * |
5 | * Copyright (c) 1997-1999 by Paul Barton-Davis <pbd@op.net> | 5 | * Copyright (c) 1997-1999 by Paul Barton-Davis <pbd@op.net> |
6 | * | 6 | * |
@@ -320,8 +320,8 @@ snd_wavefront_new_midi (struct snd_card *card, | |||
320 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_wavefront_midi_input); | 320 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_wavefront_midi_input); |
321 | 321 | ||
322 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | | 322 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | |
323 | SNDRV_RAWMIDI_INFO_INPUT | | 323 | SNDRV_RAWMIDI_INFO_INPUT | |
324 | SNDRV_RAWMIDI_INFO_DUPLEX; | 324 | SNDRV_RAWMIDI_INFO_DUPLEX; |
325 | 325 | ||
326 | return rmidi; | 326 | return rmidi; |
327 | } | 327 | } |
@@ -364,7 +364,7 @@ static int __devinit | |||
364 | snd_wavefront_probe (struct snd_card *card, int dev) | 364 | snd_wavefront_probe (struct snd_card *card, int dev) |
365 | { | 365 | { |
366 | snd_wavefront_card_t *acard = card->private_data; | 366 | snd_wavefront_card_t *acard = card->private_data; |
367 | struct snd_cs4231 *chip; | 367 | struct snd_wss *chip; |
368 | struct snd_hwdep *wavefront_synth; | 368 | struct snd_hwdep *wavefront_synth; |
369 | struct snd_rawmidi *ics2115_internal_rmidi = NULL; | 369 | struct snd_rawmidi *ics2115_internal_rmidi = NULL; |
370 | struct snd_rawmidi *ics2115_external_rmidi = NULL; | 370 | struct snd_rawmidi *ics2115_external_rmidi = NULL; |
@@ -373,21 +373,20 @@ snd_wavefront_probe (struct snd_card *card, int dev) | |||
373 | 373 | ||
374 | /* --------- PCM --------------- */ | 374 | /* --------- PCM --------------- */ |
375 | 375 | ||
376 | if ((err = snd_cs4231_create (card, | 376 | err = snd_wss_create(card, cs4232_pcm_port[dev], -1, |
377 | cs4232_pcm_port[dev], | 377 | cs4232_pcm_irq[dev], dma1[dev], dma2[dev], |
378 | -1, | 378 | WSS_HW_DETECT, 0, &chip); |
379 | cs4232_pcm_irq[dev], | 379 | if (err < 0) { |
380 | dma1[dev], | 380 | snd_printk(KERN_ERR "can't allocate WSS device\n"); |
381 | dma2[dev], | ||
382 | CS4231_HW_DETECT, 0, &chip)) < 0) { | ||
383 | snd_printk (KERN_ERR "can't allocate CS4231 device\n"); | ||
384 | return err; | 381 | return err; |
385 | } | 382 | } |
386 | 383 | ||
387 | if ((err = snd_cs4231_pcm (chip, 0, NULL)) < 0) | 384 | err = snd_wss_pcm(chip, 0, NULL); |
385 | if (err < 0) | ||
388 | return err; | 386 | return err; |
389 | 387 | ||
390 | if ((err = snd_cs4231_timer (chip, 0, NULL)) < 0) | 388 | err = snd_wss_timer(chip, 0, NULL); |
389 | if (err < 0) | ||
391 | return err; | 390 | return err; |
392 | 391 | ||
393 | /* ---------- OPL3 synth --------- */ | 392 | /* ---------- OPL3 synth --------- */ |
@@ -395,24 +394,24 @@ snd_wavefront_probe (struct snd_card *card, int dev) | |||
395 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { | 394 | if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { |
396 | struct snd_opl3 *opl3; | 395 | struct snd_opl3 *opl3; |
397 | 396 | ||
398 | if ((err = snd_opl3_create(card, | 397 | err = snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2, |
399 | fm_port[dev], | 398 | OPL3_HW_OPL3_CS, 0, &opl3); |
400 | fm_port[dev] + 2, | 399 | if (err < 0) { |
401 | OPL3_HW_OPL3_CS, | ||
402 | 0, &opl3)) < 0) { | ||
403 | snd_printk (KERN_ERR "can't allocate or detect OPL3 synth\n"); | 400 | snd_printk (KERN_ERR "can't allocate or detect OPL3 synth\n"); |
404 | return err; | 401 | return err; |
405 | } | 402 | } |
406 | 403 | ||
407 | if ((err = snd_opl3_hwdep_new(opl3, hw_dev, 1, NULL)) < 0) | 404 | err = snd_opl3_hwdep_new(opl3, hw_dev, 1, NULL); |
405 | if (err < 0) | ||
408 | return err; | 406 | return err; |
409 | hw_dev++; | 407 | hw_dev++; |
410 | } | 408 | } |
411 | 409 | ||
412 | /* ------- ICS2115 Wavetable synth ------- */ | 410 | /* ------- ICS2115 Wavetable synth ------- */ |
413 | 411 | ||
414 | if ((acard->wavefront.res_base = request_region(ics2115_port[dev], 16, | 412 | acard->wavefront.res_base = request_region(ics2115_port[dev], 16, |
415 | "ICS2115")) == NULL) { | 413 | "ICS2115"); |
414 | if (acard->wavefront.res_base == NULL) { | ||
416 | snd_printk(KERN_ERR "unable to grab ICS2115 i/o region 0x%lx-0x%lx\n", | 415 | snd_printk(KERN_ERR "unable to grab ICS2115 i/o region 0x%lx-0x%lx\n", |
417 | ics2115_port[dev], ics2115_port[dev] + 16 - 1); | 416 | ics2115_port[dev], ics2115_port[dev] + 16 - 1); |
418 | return -EBUSY; | 417 | return -EBUSY; |
@@ -426,7 +425,8 @@ snd_wavefront_probe (struct snd_card *card, int dev) | |||
426 | acard->wavefront.irq = ics2115_irq[dev]; | 425 | acard->wavefront.irq = ics2115_irq[dev]; |
427 | acard->wavefront.base = ics2115_port[dev]; | 426 | acard->wavefront.base = ics2115_port[dev]; |
428 | 427 | ||
429 | if ((wavefront_synth = snd_wavefront_new_synth (card, hw_dev, acard)) == NULL) { | 428 | wavefront_synth = snd_wavefront_new_synth(card, hw_dev, acard); |
429 | if (wavefront_synth == NULL) { | ||
430 | snd_printk (KERN_ERR "can't create WaveFront synth device\n"); | 430 | snd_printk (KERN_ERR "can't create WaveFront synth device\n"); |
431 | return -ENOMEM; | 431 | return -ENOMEM; |
432 | } | 432 | } |
@@ -437,7 +437,8 @@ snd_wavefront_probe (struct snd_card *card, int dev) | |||
437 | 437 | ||
438 | /* --------- Mixer ------------ */ | 438 | /* --------- Mixer ------------ */ |
439 | 439 | ||
440 | if ((err = snd_cs4231_mixer(chip)) < 0) { | 440 | err = snd_wss_mixer(chip); |
441 | if (err < 0) { | ||
441 | snd_printk (KERN_ERR "can't allocate mixer device\n"); | 442 | snd_printk (KERN_ERR "can't allocate mixer device\n"); |
442 | return err; | 443 | return err; |
443 | } | 444 | } |
@@ -445,11 +446,11 @@ snd_wavefront_probe (struct snd_card *card, int dev) | |||
445 | /* -------- CS4232 MPU-401 interface -------- */ | 446 | /* -------- CS4232 MPU-401 interface -------- */ |
446 | 447 | ||
447 | if (cs4232_mpu_port[dev] > 0 && cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) { | 448 | if (cs4232_mpu_port[dev] > 0 && cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) { |
448 | if ((err = snd_mpu401_uart_new(card, midi_dev, MPU401_HW_CS4232, | 449 | err = snd_mpu401_uart_new(card, midi_dev, MPU401_HW_CS4232, |
449 | cs4232_mpu_port[dev], 0, | 450 | cs4232_mpu_port[dev], 0, |
450 | cs4232_mpu_irq[dev], | 451 | cs4232_mpu_irq[dev], IRQF_DISABLED, |
451 | IRQF_DISABLED, | 452 | NULL); |
452 | NULL)) < 0) { | 453 | if (err < 0) { |
453 | snd_printk (KERN_ERR "can't allocate CS4232 MPU-401 device\n"); | 454 | snd_printk (KERN_ERR "can't allocate CS4232 MPU-401 device\n"); |
454 | return err; | 455 | return err; |
455 | } | 456 | } |
@@ -602,7 +603,7 @@ static struct isa_driver snd_wavefront_driver = { | |||
602 | 603 | ||
603 | #ifdef CONFIG_PNP | 604 | #ifdef CONFIG_PNP |
604 | static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, | 605 | static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, |
605 | const struct pnp_card_device_id *pid) | 606 | const struct pnp_card_device_id *pid) |
606 | { | 607 | { |
607 | static int dev; | 608 | static int dev; |
608 | struct snd_card *card; | 609 | struct snd_card *card; |
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 549e6ab34b03..a982997805c4 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * - sometimes record brokes playback with WSS portion of | 6 | * - sometimes record brokes playback with WSS portion of |
7 | * Yamaha OPL3-SA3 chip | 7 | * Yamaha OPL3-SA3 chip |
8 | * - CS4231 (GUS MAX) - still trouble with occasional noises | 8 | * - CS4231 (GUS MAX) - still trouble with occasional noises |
9 | * - broken initialization? | 9 | * - broken initialization? |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
@@ -78,12 +78,13 @@ static struct snd_pcm_hw_constraint_list hw_constraints_rates = { | |||
78 | .mask = 0, | 78 | .mask = 0, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static int snd_cs4231_xrate(struct snd_pcm_runtime *runtime) | 81 | static int snd_wss_xrate(struct snd_pcm_runtime *runtime) |
82 | { | 82 | { |
83 | return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); | 83 | return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, |
84 | &hw_constraints_rates); | ||
84 | } | 85 | } |
85 | 86 | ||
86 | static unsigned char snd_cs4231_original_image[32] = | 87 | static unsigned char snd_wss_original_image[32] = |
87 | { | 88 | { |
88 | 0x00, /* 00/00 - lic */ | 89 | 0x00, /* 00/00 - lic */ |
89 | 0x00, /* 01/01 - ric */ | 90 | 0x00, /* 01/01 - ric */ |
@@ -159,150 +160,209 @@ static unsigned char snd_opti93x_original_image[32] = | |||
159 | * Basic I/O functions | 160 | * Basic I/O functions |
160 | */ | 161 | */ |
161 | 162 | ||
162 | static inline void cs4231_outb(struct snd_cs4231 *chip, u8 offset, u8 val) | 163 | static inline void wss_outb(struct snd_wss *chip, u8 offset, u8 val) |
163 | { | 164 | { |
164 | outb(val, chip->port + offset); | 165 | outb(val, chip->port + offset); |
165 | } | 166 | } |
166 | 167 | ||
167 | static inline u8 cs4231_inb(struct snd_cs4231 *chip, u8 offset) | 168 | static inline u8 wss_inb(struct snd_wss *chip, u8 offset) |
168 | { | 169 | { |
169 | return inb(chip->port + offset); | 170 | return inb(chip->port + offset); |
170 | } | 171 | } |
171 | 172 | ||
172 | static void snd_cs4231_wait(struct snd_cs4231 *chip) | 173 | static void snd_wss_wait(struct snd_wss *chip) |
173 | { | 174 | { |
174 | int timeout; | 175 | int timeout; |
175 | 176 | ||
176 | for (timeout = 250; | 177 | for (timeout = 250; |
177 | timeout > 0 && (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); | 178 | timeout > 0 && (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); |
178 | timeout--) | 179 | timeout--) |
179 | udelay(100); | 180 | udelay(100); |
180 | } | 181 | } |
181 | 182 | ||
182 | static void snd_cs4231_outm(struct snd_cs4231 *chip, unsigned char reg, | 183 | static void snd_wss_outm(struct snd_wss *chip, unsigned char reg, |
183 | unsigned char mask, unsigned char value) | 184 | unsigned char mask, unsigned char value) |
184 | { | 185 | { |
185 | unsigned char tmp = (chip->image[reg] & mask) | value; | 186 | unsigned char tmp = (chip->image[reg] & mask) | value; |
186 | 187 | ||
187 | snd_cs4231_wait(chip); | 188 | snd_wss_wait(chip); |
188 | #ifdef CONFIG_SND_DEBUG | 189 | #ifdef CONFIG_SND_DEBUG |
189 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 190 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
190 | snd_printk("outm: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); | 191 | snd_printk("outm: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); |
191 | #endif | 192 | #endif |
192 | chip->image[reg] = tmp; | 193 | chip->image[reg] = tmp; |
193 | if (!chip->calibrate_mute) { | 194 | if (!chip->calibrate_mute) { |
194 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); | 195 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); |
195 | wmb(); | 196 | wmb(); |
196 | cs4231_outb(chip, CS4231P(REG), tmp); | 197 | wss_outb(chip, CS4231P(REG), tmp); |
197 | mb(); | 198 | mb(); |
198 | } | 199 | } |
199 | } | 200 | } |
200 | 201 | ||
201 | static void snd_cs4231_dout(struct snd_cs4231 *chip, unsigned char reg, unsigned char value) | 202 | static void snd_wss_dout(struct snd_wss *chip, unsigned char reg, |
203 | unsigned char value) | ||
202 | { | 204 | { |
203 | int timeout; | 205 | int timeout; |
204 | 206 | ||
205 | for (timeout = 250; | 207 | for (timeout = 250; |
206 | timeout > 0 && (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); | 208 | timeout > 0 && (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); |
207 | timeout--) | 209 | timeout--) |
208 | udelay(10); | 210 | udelay(10); |
209 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); | 211 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); |
210 | cs4231_outb(chip, CS4231P(REG), value); | 212 | wss_outb(chip, CS4231P(REG), value); |
211 | mb(); | 213 | mb(); |
212 | } | 214 | } |
213 | 215 | ||
214 | void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char value) | 216 | void snd_wss_out(struct snd_wss *chip, unsigned char reg, unsigned char value) |
215 | { | 217 | { |
216 | snd_cs4231_wait(chip); | 218 | snd_wss_wait(chip); |
217 | #ifdef CONFIG_SND_DEBUG | 219 | #ifdef CONFIG_SND_DEBUG |
218 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 220 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
219 | snd_printk("out: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); | 221 | snd_printk("out: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); |
220 | #endif | 222 | #endif |
221 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); | 223 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); |
222 | cs4231_outb(chip, CS4231P(REG), value); | 224 | wss_outb(chip, CS4231P(REG), value); |
223 | chip->image[reg] = value; | 225 | chip->image[reg] = value; |
224 | mb(); | 226 | mb(); |
225 | snd_printdd("codec out - reg 0x%x = 0x%x\n", | 227 | snd_printdd("codec out - reg 0x%x = 0x%x\n", |
226 | chip->mce_bit | reg, value); | 228 | chip->mce_bit | reg, value); |
227 | } | 229 | } |
230 | EXPORT_SYMBOL(snd_wss_out); | ||
228 | 231 | ||
229 | unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg) | 232 | unsigned char snd_wss_in(struct snd_wss *chip, unsigned char reg) |
230 | { | 233 | { |
231 | snd_cs4231_wait(chip); | 234 | snd_wss_wait(chip); |
232 | #ifdef CONFIG_SND_DEBUG | 235 | #ifdef CONFIG_SND_DEBUG |
233 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 236 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
234 | snd_printk("in: auto calibration time out - reg = 0x%x\n", reg); | 237 | snd_printk("in: auto calibration time out - reg = 0x%x\n", reg); |
235 | #endif | 238 | #endif |
236 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); | 239 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); |
237 | mb(); | 240 | mb(); |
238 | return cs4231_inb(chip, CS4231P(REG)); | 241 | return wss_inb(chip, CS4231P(REG)); |
239 | } | 242 | } |
243 | EXPORT_SYMBOL(snd_wss_in); | ||
240 | 244 | ||
241 | void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val) | 245 | void snd_cs4236_ext_out(struct snd_wss *chip, unsigned char reg, |
246 | unsigned char val) | ||
242 | { | 247 | { |
243 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); | 248 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); |
244 | cs4231_outb(chip, CS4231P(REG), reg | (chip->image[CS4236_EXT_REG] & 0x01)); | 249 | wss_outb(chip, CS4231P(REG), |
245 | cs4231_outb(chip, CS4231P(REG), val); | 250 | reg | (chip->image[CS4236_EXT_REG] & 0x01)); |
251 | wss_outb(chip, CS4231P(REG), val); | ||
246 | chip->eimage[CS4236_REG(reg)] = val; | 252 | chip->eimage[CS4236_REG(reg)] = val; |
247 | #if 0 | 253 | #if 0 |
248 | printk("ext out : reg = 0x%x, val = 0x%x\n", reg, val); | 254 | printk("ext out : reg = 0x%x, val = 0x%x\n", reg, val); |
249 | #endif | 255 | #endif |
250 | } | 256 | } |
257 | EXPORT_SYMBOL(snd_cs4236_ext_out); | ||
251 | 258 | ||
252 | unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg) | 259 | unsigned char snd_cs4236_ext_in(struct snd_wss *chip, unsigned char reg) |
253 | { | 260 | { |
254 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); | 261 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); |
255 | cs4231_outb(chip, CS4231P(REG), reg | (chip->image[CS4236_EXT_REG] & 0x01)); | 262 | wss_outb(chip, CS4231P(REG), |
263 | reg | (chip->image[CS4236_EXT_REG] & 0x01)); | ||
256 | #if 1 | 264 | #if 1 |
257 | return cs4231_inb(chip, CS4231P(REG)); | 265 | return wss_inb(chip, CS4231P(REG)); |
258 | #else | 266 | #else |
259 | { | 267 | { |
260 | unsigned char res; | 268 | unsigned char res; |
261 | res = cs4231_inb(chip, CS4231P(REG)); | 269 | res = wss_inb(chip, CS4231P(REG)); |
262 | printk("ext in : reg = 0x%x, val = 0x%x\n", reg, res); | 270 | printk("ext in : reg = 0x%x, val = 0x%x\n", reg, res); |
263 | return res; | 271 | return res; |
264 | } | 272 | } |
265 | #endif | 273 | #endif |
266 | } | 274 | } |
275 | EXPORT_SYMBOL(snd_cs4236_ext_in); | ||
267 | 276 | ||
268 | #if 0 | 277 | #if 0 |
269 | 278 | ||
270 | static void snd_cs4231_debug(struct snd_cs4231 *chip) | 279 | static void snd_wss_debug(struct snd_wss *chip) |
271 | { | 280 | { |
272 | printk("CS4231 REGS: INDEX = 0x%02x ", cs4231_inb(chip, CS4231P(REGSEL))); | 281 | printk(KERN_DEBUG |
273 | printk(" STATUS = 0x%02x\n", cs4231_inb(chip, CS4231P(STATUS))); | 282 | "CS4231 REGS: INDEX = 0x%02x " |
274 | printk(" 0x00: left input = 0x%02x ", snd_cs4231_in(chip, 0x00)); | 283 | " STATUS = 0x%02x\n", |
275 | printk(" 0x10: alt 1 (CFIG 2) = 0x%02x\n", snd_cs4231_in(chip, 0x10)); | 284 | wss_inb(chip, CS4231P(REGSEL), |
276 | printk(" 0x01: right input = 0x%02x ", snd_cs4231_in(chip, 0x01)); | 285 | wss_inb(chip, CS4231P(STATUS))); |
277 | printk(" 0x11: alt 2 (CFIG 3) = 0x%02x\n", snd_cs4231_in(chip, 0x11)); | 286 | printk(KERN_DEBUG |
278 | printk(" 0x02: GF1 left input = 0x%02x ", snd_cs4231_in(chip, 0x02)); | 287 | " 0x00: left input = 0x%02x " |
279 | printk(" 0x12: left line in = 0x%02x\n", snd_cs4231_in(chip, 0x12)); | 288 | " 0x10: alt 1 (CFIG 2) = 0x%02x\n", |
280 | printk(" 0x03: GF1 right input = 0x%02x ", snd_cs4231_in(chip, 0x03)); | 289 | snd_wss_in(chip, 0x00), |
281 | printk(" 0x13: right line in = 0x%02x\n", snd_cs4231_in(chip, 0x13)); | 290 | snd_wss_in(chip, 0x10)); |
282 | printk(" 0x04: CD left input = 0x%02x ", snd_cs4231_in(chip, 0x04)); | 291 | printk(KERN_DEBUG |
283 | printk(" 0x14: timer low = 0x%02x\n", snd_cs4231_in(chip, 0x14)); | 292 | " 0x01: right input = 0x%02x " |
284 | printk(" 0x05: CD right input = 0x%02x ", snd_cs4231_in(chip, 0x05)); | 293 | " 0x11: alt 2 (CFIG 3) = 0x%02x\n", |
285 | printk(" 0x15: timer high = 0x%02x\n", snd_cs4231_in(chip, 0x15)); | 294 | snd_wss_in(chip, 0x01), |
286 | printk(" 0x06: left output = 0x%02x ", snd_cs4231_in(chip, 0x06)); | 295 | snd_wss_in(chip, 0x11)); |
287 | printk(" 0x16: left MIC (PnP) = 0x%02x\n", snd_cs4231_in(chip, 0x16)); | 296 | printk(KERN_DEBUG |
288 | printk(" 0x07: right output = 0x%02x ", snd_cs4231_in(chip, 0x07)); | 297 | " 0x02: GF1 left input = 0x%02x " |
289 | printk(" 0x17: right MIC (PnP) = 0x%02x\n", snd_cs4231_in(chip, 0x17)); | 298 | " 0x12: left line in = 0x%02x\n", |
290 | printk(" 0x08: playback format = 0x%02x ", snd_cs4231_in(chip, 0x08)); | 299 | snd_wss_in(chip, 0x02), |
291 | printk(" 0x18: IRQ status = 0x%02x\n", snd_cs4231_in(chip, 0x18)); | 300 | snd_wss_in(chip, 0x12)); |
292 | printk(" 0x09: iface (CFIG 1) = 0x%02x ", snd_cs4231_in(chip, 0x09)); | 301 | printk(KERN_DEBUG |
293 | printk(" 0x19: left line out = 0x%02x\n", snd_cs4231_in(chip, 0x19)); | 302 | " 0x03: GF1 right input = 0x%02x " |
294 | printk(" 0x0a: pin control = 0x%02x ", snd_cs4231_in(chip, 0x0a)); | 303 | " 0x13: right line in = 0x%02x\n", |
295 | printk(" 0x1a: mono control = 0x%02x\n", snd_cs4231_in(chip, 0x1a)); | 304 | snd_wss_in(chip, 0x03), |
296 | printk(" 0x0b: init & status = 0x%02x ", snd_cs4231_in(chip, 0x0b)); | 305 | snd_wss_in(chip, 0x13)); |
297 | printk(" 0x1b: right line out = 0x%02x\n", snd_cs4231_in(chip, 0x1b)); | 306 | printk(KERN_DEBUG |
298 | printk(" 0x0c: revision & mode = 0x%02x ", snd_cs4231_in(chip, 0x0c)); | 307 | " 0x04: CD left input = 0x%02x " |
299 | printk(" 0x1c: record format = 0x%02x\n", snd_cs4231_in(chip, 0x1c)); | 308 | " 0x14: timer low = 0x%02x\n", |
300 | printk(" 0x0d: loopback = 0x%02x ", snd_cs4231_in(chip, 0x0d)); | 309 | snd_wss_in(chip, 0x04), |
301 | printk(" 0x1d: var freq (PnP) = 0x%02x\n", snd_cs4231_in(chip, 0x1d)); | 310 | snd_wss_in(chip, 0x14)); |
302 | printk(" 0x0e: ply upr count = 0x%02x ", snd_cs4231_in(chip, 0x0e)); | 311 | printk(KERN_DEBUG |
303 | printk(" 0x1e: ply lwr count = 0x%02x\n", snd_cs4231_in(chip, 0x1e)); | 312 | " 0x05: CD right input = 0x%02x " |
304 | printk(" 0x0f: rec upr count = 0x%02x ", snd_cs4231_in(chip, 0x0f)); | 313 | " 0x15: timer high = 0x%02x\n", |
305 | printk(" 0x1f: rec lwr count = 0x%02x\n", snd_cs4231_in(chip, 0x1f)); | 314 | snd_wss_in(chip, 0x05), |
315 | snd_wss_in(chip, 0x15)); | ||
316 | printk(KERN_DEBUG | ||
317 | " 0x06: left output = 0x%02x " | ||
318 | " 0x16: left MIC (PnP) = 0x%02x\n", | ||
319 | snd_wss_in(chip, 0x06), | ||
320 | snd_wss_in(chip, 0x16)); | ||
321 | printk(KERN_DEBUG | ||
322 | " 0x07: right output = 0x%02x " | ||
323 | " 0x17: right MIC (PnP) = 0x%02x\n", | ||
324 | snd_wss_in(chip, 0x07), | ||
325 | snd_wss_in(chip, 0x17)); | ||
326 | printk(KERN_DEBUG | ||
327 | " 0x08: playback format = 0x%02x " | ||
328 | " 0x18: IRQ status = 0x%02x\n", | ||
329 | snd_wss_in(chip, 0x08), | ||
330 | snd_wss_in(chip, 0x18)); | ||
331 | printk(KERN_DEBUG | ||
332 | " 0x09: iface (CFIG 1) = 0x%02x " | ||
333 | " 0x19: left line out = 0x%02x\n", | ||
334 | snd_wss_in(chip, 0x09), | ||
335 | snd_wss_in(chip, 0x19)); | ||
336 | printk(KERN_DEBUG | ||
337 | " 0x0a: pin control = 0x%02x " | ||
338 | " 0x1a: mono control = 0x%02x\n", | ||
339 | snd_wss_in(chip, 0x0a), | ||
340 | snd_wss_in(chip, 0x1a)); | ||
341 | printk(KERN_DEBUG | ||
342 | " 0x0b: init & status = 0x%02x " | ||
343 | " 0x1b: right line out = 0x%02x\n", | ||
344 | snd_wss_in(chip, 0x0b), | ||
345 | snd_wss_in(chip, 0x1b)); | ||
346 | printk(KERN_DEBUG | ||
347 | " 0x0c: revision & mode = 0x%02x " | ||
348 | " 0x1c: record format = 0x%02x\n", | ||
349 | snd_wss_in(chip, 0x0c), | ||
350 | snd_wss_in(chip, 0x1c)); | ||
351 | printk(KERN_DEBUG | ||
352 | " 0x0d: loopback = 0x%02x " | ||
353 | " 0x1d: var freq (PnP) = 0x%02x\n", | ||
354 | snd_wss_in(chip, 0x0d), | ||
355 | snd_wss_in(chip, 0x1d)); | ||
356 | printk(KERN_DEBUG | ||
357 | " 0x0e: ply upr count = 0x%02x " | ||
358 | " 0x1e: ply lwr count = 0x%02x\n", | ||
359 | snd_wss_in(chip, 0x0e), | ||
360 | snd_wss_in(chip, 0x1e)); | ||
361 | printk(KERN_DEBUG | ||
362 | " 0x0f: rec upr count = 0x%02x " | ||
363 | " 0x1f: rec lwr count = 0x%02x\n", | ||
364 | snd_wss_in(chip, 0x0f), | ||
365 | snd_wss_in(chip, 0x1f)); | ||
306 | } | 366 | } |
307 | 367 | ||
308 | #endif | 368 | #endif |
@@ -311,61 +371,63 @@ static void snd_cs4231_debug(struct snd_cs4231 *chip) | |||
311 | * CS4231 detection / MCE routines | 371 | * CS4231 detection / MCE routines |
312 | */ | 372 | */ |
313 | 373 | ||
314 | static void snd_cs4231_busy_wait(struct snd_cs4231 *chip) | 374 | static void snd_wss_busy_wait(struct snd_wss *chip) |
315 | { | 375 | { |
316 | int timeout; | 376 | int timeout; |
317 | 377 | ||
318 | /* huh.. looks like this sequence is proper for CS4231A chip (GUS MAX) */ | 378 | /* huh.. looks like this sequence is proper for CS4231A chip (GUS MAX) */ |
319 | for (timeout = 5; timeout > 0; timeout--) | 379 | for (timeout = 5; timeout > 0; timeout--) |
320 | cs4231_inb(chip, CS4231P(REGSEL)); | 380 | wss_inb(chip, CS4231P(REGSEL)); |
321 | /* end of cleanup sequence */ | 381 | /* end of cleanup sequence */ |
322 | for (timeout = 250; | 382 | for (timeout = 250; |
323 | timeout > 0 && (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); | 383 | timeout > 0 && (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); |
324 | timeout--) | 384 | timeout--) |
325 | udelay(10); | 385 | udelay(10); |
326 | } | 386 | } |
327 | 387 | ||
328 | void snd_cs4231_mce_up(struct snd_cs4231 *chip) | 388 | void snd_wss_mce_up(struct snd_wss *chip) |
329 | { | 389 | { |
330 | unsigned long flags; | 390 | unsigned long flags; |
331 | int timeout; | 391 | int timeout; |
332 | 392 | ||
333 | snd_cs4231_wait(chip); | 393 | snd_wss_wait(chip); |
334 | #ifdef CONFIG_SND_DEBUG | 394 | #ifdef CONFIG_SND_DEBUG |
335 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 395 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
336 | snd_printk("mce_up - auto calibration time out (0)\n"); | 396 | snd_printk("mce_up - auto calibration time out (0)\n"); |
337 | #endif | 397 | #endif |
338 | spin_lock_irqsave(&chip->reg_lock, flags); | 398 | spin_lock_irqsave(&chip->reg_lock, flags); |
339 | chip->mce_bit |= CS4231_MCE; | 399 | chip->mce_bit |= CS4231_MCE; |
340 | timeout = cs4231_inb(chip, CS4231P(REGSEL)); | 400 | timeout = wss_inb(chip, CS4231P(REGSEL)); |
341 | if (timeout == 0x80) | 401 | if (timeout == 0x80) |
342 | snd_printk("mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port); | 402 | snd_printk("mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port); |
343 | if (!(timeout & CS4231_MCE)) | 403 | if (!(timeout & CS4231_MCE)) |
344 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); | 404 | wss_outb(chip, CS4231P(REGSEL), |
405 | chip->mce_bit | (timeout & 0x1f)); | ||
345 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 406 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
346 | } | 407 | } |
408 | EXPORT_SYMBOL(snd_wss_mce_up); | ||
347 | 409 | ||
348 | void snd_cs4231_mce_down(struct snd_cs4231 *chip) | 410 | void snd_wss_mce_down(struct snd_wss *chip) |
349 | { | 411 | { |
350 | unsigned long flags; | 412 | unsigned long flags; |
351 | unsigned long end_time; | 413 | unsigned long end_time; |
352 | int timeout; | 414 | int timeout; |
353 | 415 | ||
354 | snd_cs4231_busy_wait(chip); | 416 | snd_wss_busy_wait(chip); |
355 | 417 | ||
356 | #ifdef CONFIG_SND_DEBUG | 418 | #ifdef CONFIG_SND_DEBUG |
357 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 419 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
358 | snd_printk("mce_down [0x%lx] - auto calibration time out (0)\n", (long)CS4231P(REGSEL)); | 420 | snd_printk("mce_down [0x%lx] - auto calibration time out (0)\n", (long)CS4231P(REGSEL)); |
359 | #endif | 421 | #endif |
360 | spin_lock_irqsave(&chip->reg_lock, flags); | 422 | spin_lock_irqsave(&chip->reg_lock, flags); |
361 | chip->mce_bit &= ~CS4231_MCE; | 423 | chip->mce_bit &= ~CS4231_MCE; |
362 | timeout = cs4231_inb(chip, CS4231P(REGSEL)); | 424 | timeout = wss_inb(chip, CS4231P(REGSEL)); |
363 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); | 425 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); |
364 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 426 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
365 | if (timeout == 0x80) | 427 | if (timeout == 0x80) |
366 | snd_printk("mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port); | 428 | snd_printk("mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port); |
367 | if ((timeout & CS4231_MCE) == 0 || | 429 | if ((timeout & CS4231_MCE) == 0 || |
368 | !(chip->hardware & (CS4231_HW_CS4231_MASK | CS4231_HW_CS4232_MASK))) { | 430 | !(chip->hardware & (WSS_HW_CS4231_MASK | WSS_HW_CS4232_MASK))) { |
369 | return; | 431 | return; |
370 | } | 432 | } |
371 | 433 | ||
@@ -380,7 +442,7 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
380 | 442 | ||
381 | /* check condition up to 250 ms */ | 443 | /* check condition up to 250 ms */ |
382 | end_time = jiffies + msecs_to_jiffies(250); | 444 | end_time = jiffies + msecs_to_jiffies(250); |
383 | while (snd_cs4231_in(chip, CS4231_TEST_INIT) & | 445 | while (snd_wss_in(chip, CS4231_TEST_INIT) & |
384 | CS4231_CALIB_IN_PROGRESS) { | 446 | CS4231_CALIB_IN_PROGRESS) { |
385 | 447 | ||
386 | if (time_after(jiffies, end_time)) { | 448 | if (time_after(jiffies, end_time)) { |
@@ -395,7 +457,7 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
395 | 457 | ||
396 | /* check condition up to 100 ms */ | 458 | /* check condition up to 100 ms */ |
397 | end_time = jiffies + msecs_to_jiffies(100); | 459 | end_time = jiffies + msecs_to_jiffies(100); |
398 | while (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) { | 460 | while (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) { |
399 | if (time_after(jiffies, end_time)) { | 461 | if (time_after(jiffies, end_time)) { |
400 | snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); | 462 | snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); |
401 | return; | 463 | return; |
@@ -404,10 +466,11 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
404 | } | 466 | } |
405 | 467 | ||
406 | snd_printdd("(3) jiffies = %lu\n", jiffies); | 468 | snd_printdd("(3) jiffies = %lu\n", jiffies); |
407 | snd_printd("mce_down - exit = 0x%x\n", cs4231_inb(chip, CS4231P(REGSEL))); | 469 | snd_printd("mce_down - exit = 0x%x\n", wss_inb(chip, CS4231P(REGSEL))); |
408 | } | 470 | } |
471 | EXPORT_SYMBOL(snd_wss_mce_down); | ||
409 | 472 | ||
410 | static unsigned int snd_cs4231_get_count(unsigned char format, unsigned int size) | 473 | static unsigned int snd_wss_get_count(unsigned char format, unsigned int size) |
411 | { | 474 | { |
412 | switch (format & 0xe0) { | 475 | switch (format & 0xe0) { |
413 | case CS4231_LINEAR_16: | 476 | case CS4231_LINEAR_16: |
@@ -422,19 +485,15 @@ static unsigned int snd_cs4231_get_count(unsigned char format, unsigned int size | |||
422 | return size; | 485 | return size; |
423 | } | 486 | } |
424 | 487 | ||
425 | static int snd_cs4231_trigger(struct snd_pcm_substream *substream, | 488 | static int snd_wss_trigger(struct snd_pcm_substream *substream, |
426 | int cmd) | 489 | int cmd) |
427 | { | 490 | { |
428 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 491 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
429 | int result = 0; | 492 | int result = 0; |
430 | unsigned int what; | 493 | unsigned int what; |
431 | struct snd_pcm_substream *s; | 494 | struct snd_pcm_substream *s; |
432 | int do_start; | 495 | int do_start; |
433 | 496 | ||
434 | #if 0 | ||
435 | printk("codec trigger!!! - what = %i, enable = %i, status = 0x%x\n", what, enable, cs4231_inb(chip, CS4231P(STATUS))); | ||
436 | #endif | ||
437 | |||
438 | switch (cmd) { | 497 | switch (cmd) { |
439 | case SNDRV_PCM_TRIGGER_START: | 498 | case SNDRV_PCM_TRIGGER_START: |
440 | case SNDRV_PCM_TRIGGER_RESUME: | 499 | case SNDRV_PCM_TRIGGER_RESUME: |
@@ -466,10 +525,10 @@ static int snd_cs4231_trigger(struct snd_pcm_substream *substream, | |||
466 | if (chip->trigger) | 525 | if (chip->trigger) |
467 | chip->trigger(chip, what, 0); | 526 | chip->trigger(chip, what, 0); |
468 | } | 527 | } |
469 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); | 528 | snd_wss_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); |
470 | spin_unlock(&chip->reg_lock); | 529 | spin_unlock(&chip->reg_lock); |
471 | #if 0 | 530 | #if 0 |
472 | snd_cs4231_debug(chip); | 531 | snd_wss_debug(chip); |
473 | #endif | 532 | #endif |
474 | return result; | 533 | return result; |
475 | } | 534 | } |
@@ -478,7 +537,7 @@ static int snd_cs4231_trigger(struct snd_pcm_substream *substream, | |||
478 | * CODEC I/O | 537 | * CODEC I/O |
479 | */ | 538 | */ |
480 | 539 | ||
481 | static unsigned char snd_cs4231_get_rate(unsigned int rate) | 540 | static unsigned char snd_wss_get_rate(unsigned int rate) |
482 | { | 541 | { |
483 | int i; | 542 | int i; |
484 | 543 | ||
@@ -489,9 +548,9 @@ static unsigned char snd_cs4231_get_rate(unsigned int rate) | |||
489 | return freq_bits[ARRAY_SIZE(rates) - 1]; | 548 | return freq_bits[ARRAY_SIZE(rates) - 1]; |
490 | } | 549 | } |
491 | 550 | ||
492 | static unsigned char snd_cs4231_get_format(struct snd_cs4231 *chip, | 551 | static unsigned char snd_wss_get_format(struct snd_wss *chip, |
493 | int format, | 552 | int format, |
494 | int channels) | 553 | int channels) |
495 | { | 554 | { |
496 | unsigned char rformat; | 555 | unsigned char rformat; |
497 | 556 | ||
@@ -511,7 +570,7 @@ static unsigned char snd_cs4231_get_format(struct snd_cs4231 *chip, | |||
511 | return rformat; | 570 | return rformat; |
512 | } | 571 | } |
513 | 572 | ||
514 | static void snd_cs4231_calibrate_mute(struct snd_cs4231 *chip, int mute) | 573 | static void snd_wss_calibrate_mute(struct snd_wss *chip, int mute) |
515 | { | 574 | { |
516 | unsigned long flags; | 575 | unsigned long flags; |
517 | 576 | ||
@@ -522,30 +581,46 @@ static void snd_cs4231_calibrate_mute(struct snd_cs4231 *chip, int mute) | |||
522 | return; | 581 | return; |
523 | } | 582 | } |
524 | if (!mute) { | 583 | if (!mute) { |
525 | snd_cs4231_dout(chip, CS4231_LEFT_INPUT, chip->image[CS4231_LEFT_INPUT]); | 584 | snd_wss_dout(chip, CS4231_LEFT_INPUT, |
526 | snd_cs4231_dout(chip, CS4231_RIGHT_INPUT, chip->image[CS4231_RIGHT_INPUT]); | 585 | chip->image[CS4231_LEFT_INPUT]); |
527 | snd_cs4231_dout(chip, CS4231_LOOPBACK, chip->image[CS4231_LOOPBACK]); | 586 | snd_wss_dout(chip, CS4231_RIGHT_INPUT, |
587 | chip->image[CS4231_RIGHT_INPUT]); | ||
588 | snd_wss_dout(chip, CS4231_LOOPBACK, | ||
589 | chip->image[CS4231_LOOPBACK]); | ||
528 | } | 590 | } |
529 | snd_cs4231_dout(chip, CS4231_AUX1_LEFT_INPUT, mute ? 0x80 : chip->image[CS4231_AUX1_LEFT_INPUT]); | 591 | snd_wss_dout(chip, CS4231_AUX1_LEFT_INPUT, |
530 | snd_cs4231_dout(chip, CS4231_AUX1_RIGHT_INPUT, mute ? 0x80 : chip->image[CS4231_AUX1_RIGHT_INPUT]); | 592 | mute ? 0x80 : chip->image[CS4231_AUX1_LEFT_INPUT]); |
531 | snd_cs4231_dout(chip, CS4231_AUX2_LEFT_INPUT, mute ? 0x80 : chip->image[CS4231_AUX2_LEFT_INPUT]); | 593 | snd_wss_dout(chip, CS4231_AUX1_RIGHT_INPUT, |
532 | snd_cs4231_dout(chip, CS4231_AUX2_RIGHT_INPUT, mute ? 0x80 : chip->image[CS4231_AUX2_RIGHT_INPUT]); | 594 | mute ? 0x80 : chip->image[CS4231_AUX1_RIGHT_INPUT]); |
533 | snd_cs4231_dout(chip, CS4231_LEFT_OUTPUT, mute ? 0x80 : chip->image[CS4231_LEFT_OUTPUT]); | 595 | snd_wss_dout(chip, CS4231_AUX2_LEFT_INPUT, |
534 | snd_cs4231_dout(chip, CS4231_RIGHT_OUTPUT, mute ? 0x80 : chip->image[CS4231_RIGHT_OUTPUT]); | 596 | mute ? 0x80 : chip->image[CS4231_AUX2_LEFT_INPUT]); |
535 | snd_cs4231_dout(chip, CS4231_LEFT_LINE_IN, mute ? 0x80 : chip->image[CS4231_LEFT_LINE_IN]); | 597 | snd_wss_dout(chip, CS4231_AUX2_RIGHT_INPUT, |
536 | snd_cs4231_dout(chip, CS4231_RIGHT_LINE_IN, mute ? 0x80 : chip->image[CS4231_RIGHT_LINE_IN]); | 598 | mute ? 0x80 : chip->image[CS4231_AUX2_RIGHT_INPUT]); |
537 | snd_cs4231_dout(chip, CS4231_MONO_CTRL, mute ? 0xc0 : chip->image[CS4231_MONO_CTRL]); | 599 | snd_wss_dout(chip, CS4231_LEFT_OUTPUT, |
538 | if (chip->hardware == CS4231_HW_INTERWAVE) { | 600 | mute ? 0x80 : chip->image[CS4231_LEFT_OUTPUT]); |
539 | snd_cs4231_dout(chip, CS4231_LEFT_MIC_INPUT, mute ? 0x80 : chip->image[CS4231_LEFT_MIC_INPUT]); | 601 | snd_wss_dout(chip, CS4231_RIGHT_OUTPUT, |
540 | snd_cs4231_dout(chip, CS4231_RIGHT_MIC_INPUT, mute ? 0x80 : chip->image[CS4231_RIGHT_MIC_INPUT]); | 602 | mute ? 0x80 : chip->image[CS4231_RIGHT_OUTPUT]); |
541 | snd_cs4231_dout(chip, CS4231_LINE_LEFT_OUTPUT, mute ? 0x80 : chip->image[CS4231_LINE_LEFT_OUTPUT]); | 603 | snd_wss_dout(chip, CS4231_LEFT_LINE_IN, |
542 | snd_cs4231_dout(chip, CS4231_LINE_RIGHT_OUTPUT, mute ? 0x80 : chip->image[CS4231_LINE_RIGHT_OUTPUT]); | 604 | mute ? 0x80 : chip->image[CS4231_LEFT_LINE_IN]); |
605 | snd_wss_dout(chip, CS4231_RIGHT_LINE_IN, | ||
606 | mute ? 0x80 : chip->image[CS4231_RIGHT_LINE_IN]); | ||
607 | snd_wss_dout(chip, CS4231_MONO_CTRL, | ||
608 | mute ? 0xc0 : chip->image[CS4231_MONO_CTRL]); | ||
609 | if (chip->hardware == WSS_HW_INTERWAVE) { | ||
610 | snd_wss_dout(chip, CS4231_LEFT_MIC_INPUT, | ||
611 | mute ? 0x80 : chip->image[CS4231_LEFT_MIC_INPUT]); | ||
612 | snd_wss_dout(chip, CS4231_RIGHT_MIC_INPUT, | ||
613 | mute ? 0x80 : chip->image[CS4231_RIGHT_MIC_INPUT]); | ||
614 | snd_wss_dout(chip, CS4231_LINE_LEFT_OUTPUT, | ||
615 | mute ? 0x80 : chip->image[CS4231_LINE_LEFT_OUTPUT]); | ||
616 | snd_wss_dout(chip, CS4231_LINE_RIGHT_OUTPUT, | ||
617 | mute ? 0x80 : chip->image[CS4231_LINE_RIGHT_OUTPUT]); | ||
543 | } | 618 | } |
544 | chip->calibrate_mute = mute; | 619 | chip->calibrate_mute = mute; |
545 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 620 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
546 | } | 621 | } |
547 | 622 | ||
548 | static void snd_cs4231_playback_format(struct snd_cs4231 *chip, | 623 | static void snd_wss_playback_format(struct snd_wss *chip, |
549 | struct snd_pcm_hw_params *params, | 624 | struct snd_pcm_hw_params *params, |
550 | unsigned char pdfr) | 625 | unsigned char pdfr) |
551 | { | 626 | { |
@@ -553,79 +628,88 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, | |||
553 | int full_calib = 1; | 628 | int full_calib = 1; |
554 | 629 | ||
555 | mutex_lock(&chip->mce_mutex); | 630 | mutex_lock(&chip->mce_mutex); |
556 | snd_cs4231_calibrate_mute(chip, 1); | 631 | snd_wss_calibrate_mute(chip, 1); |
557 | if (chip->hardware == CS4231_HW_CS4231A || | 632 | if (chip->hardware == WSS_HW_CS4231A || |
558 | (chip->hardware & CS4231_HW_CS4232_MASK)) { | 633 | (chip->hardware & WSS_HW_CS4232_MASK)) { |
559 | spin_lock_irqsave(&chip->reg_lock, flags); | 634 | spin_lock_irqsave(&chip->reg_lock, flags); |
560 | if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (pdfr & 0x0f)) { /* rate is same? */ | 635 | if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (pdfr & 0x0f)) { /* rate is same? */ |
561 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x10); | 636 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, |
562 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT] = pdfr); | 637 | chip->image[CS4231_ALT_FEATURE_1] | 0x10); |
563 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] &= ~0x10); | 638 | chip->image[CS4231_PLAYBK_FORMAT] = pdfr; |
639 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, | ||
640 | chip->image[CS4231_PLAYBK_FORMAT]); | ||
641 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
642 | chip->image[CS4231_ALT_FEATURE_1] &= ~0x10); | ||
564 | udelay(100); /* Fixes audible clicks at least on GUS MAX */ | 643 | udelay(100); /* Fixes audible clicks at least on GUS MAX */ |
565 | full_calib = 0; | 644 | full_calib = 0; |
566 | } | 645 | } |
567 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 646 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
568 | } | 647 | } |
569 | if (full_calib) { | 648 | if (full_calib) { |
570 | snd_cs4231_mce_up(chip); | 649 | snd_wss_mce_up(chip); |
571 | spin_lock_irqsave(&chip->reg_lock, flags); | 650 | spin_lock_irqsave(&chip->reg_lock, flags); |
572 | if (chip->hardware != CS4231_HW_INTERWAVE && !chip->single_dma) { | 651 | if (chip->hardware != WSS_HW_INTERWAVE && !chip->single_dma) { |
573 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, | 652 | if (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) |
574 | (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) ? | 653 | pdfr = (pdfr & 0xf0) | |
575 | (pdfr & 0xf0) | (chip->image[CS4231_REC_FORMAT] & 0x0f) : | 654 | (chip->image[CS4231_REC_FORMAT] & 0x0f); |
576 | pdfr); | ||
577 | } else { | 655 | } else { |
578 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT] = pdfr); | 656 | chip->image[CS4231_PLAYBK_FORMAT] = pdfr; |
579 | } | 657 | } |
658 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, pdfr); | ||
580 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 659 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
581 | if (chip->hardware == CS4231_HW_OPL3SA2) | 660 | if (chip->hardware == WSS_HW_OPL3SA2) |
582 | udelay(100); /* this seems to help */ | 661 | udelay(100); /* this seems to help */ |
583 | snd_cs4231_mce_down(chip); | 662 | snd_wss_mce_down(chip); |
584 | } | 663 | } |
585 | snd_cs4231_calibrate_mute(chip, 0); | 664 | snd_wss_calibrate_mute(chip, 0); |
586 | mutex_unlock(&chip->mce_mutex); | 665 | mutex_unlock(&chip->mce_mutex); |
587 | } | 666 | } |
588 | 667 | ||
589 | static void snd_cs4231_capture_format(struct snd_cs4231 *chip, | 668 | static void snd_wss_capture_format(struct snd_wss *chip, |
590 | struct snd_pcm_hw_params *params, | 669 | struct snd_pcm_hw_params *params, |
591 | unsigned char cdfr) | 670 | unsigned char cdfr) |
592 | { | 671 | { |
593 | unsigned long flags; | 672 | unsigned long flags; |
594 | int full_calib = 1; | 673 | int full_calib = 1; |
595 | 674 | ||
596 | mutex_lock(&chip->mce_mutex); | 675 | mutex_lock(&chip->mce_mutex); |
597 | snd_cs4231_calibrate_mute(chip, 1); | 676 | snd_wss_calibrate_mute(chip, 1); |
598 | if (chip->hardware == CS4231_HW_CS4231A || | 677 | if (chip->hardware == WSS_HW_CS4231A || |
599 | (chip->hardware & CS4231_HW_CS4232_MASK)) { | 678 | (chip->hardware & WSS_HW_CS4232_MASK)) { |
600 | spin_lock_irqsave(&chip->reg_lock, flags); | 679 | spin_lock_irqsave(&chip->reg_lock, flags); |
601 | if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (cdfr & 0x0f) || /* rate is same? */ | 680 | if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (cdfr & 0x0f) || /* rate is same? */ |
602 | (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { | 681 | (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { |
603 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x20); | 682 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, |
604 | snd_cs4231_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT] = cdfr); | 683 | chip->image[CS4231_ALT_FEATURE_1] | 0x20); |
605 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] &= ~0x20); | 684 | snd_wss_out(chip, CS4231_REC_FORMAT, |
685 | chip->image[CS4231_REC_FORMAT] = cdfr); | ||
686 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
687 | chip->image[CS4231_ALT_FEATURE_1] &= ~0x20); | ||
606 | full_calib = 0; | 688 | full_calib = 0; |
607 | } | 689 | } |
608 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 690 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
609 | } | 691 | } |
610 | if (full_calib) { | 692 | if (full_calib) { |
611 | snd_cs4231_mce_up(chip); | 693 | snd_wss_mce_up(chip); |
612 | spin_lock_irqsave(&chip->reg_lock, flags); | 694 | spin_lock_irqsave(&chip->reg_lock, flags); |
613 | if (chip->hardware != CS4231_HW_INTERWAVE) { | 695 | if (chip->hardware != WSS_HW_INTERWAVE && |
614 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { | 696 | !(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { |
615 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, | 697 | if (chip->single_dma) |
616 | ((chip->single_dma ? cdfr : chip->image[CS4231_PLAYBK_FORMAT]) & 0xf0) | | 698 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, cdfr); |
617 | (cdfr & 0x0f)); | 699 | else |
618 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 700 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, |
619 | snd_cs4231_mce_down(chip); | 701 | (chip->image[CS4231_PLAYBK_FORMAT] & 0xf0) | |
620 | snd_cs4231_mce_up(chip); | 702 | (cdfr & 0x0f)); |
621 | spin_lock_irqsave(&chip->reg_lock, flags); | 703 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
622 | } | 704 | snd_wss_mce_down(chip); |
705 | snd_wss_mce_up(chip); | ||
706 | spin_lock_irqsave(&chip->reg_lock, flags); | ||
623 | } | 707 | } |
624 | snd_cs4231_out(chip, CS4231_REC_FORMAT, cdfr); | 708 | snd_wss_out(chip, CS4231_REC_FORMAT, cdfr); |
625 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 709 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
626 | snd_cs4231_mce_down(chip); | 710 | snd_wss_mce_down(chip); |
627 | } | 711 | } |
628 | snd_cs4231_calibrate_mute(chip, 0); | 712 | snd_wss_calibrate_mute(chip, 0); |
629 | mutex_unlock(&chip->mce_mutex); | 713 | mutex_unlock(&chip->mce_mutex); |
630 | } | 714 | } |
631 | 715 | ||
@@ -633,130 +717,146 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, | |||
633 | * Timer interface | 717 | * Timer interface |
634 | */ | 718 | */ |
635 | 719 | ||
636 | static unsigned long snd_cs4231_timer_resolution(struct snd_timer * timer) | 720 | static unsigned long snd_wss_timer_resolution(struct snd_timer *timer) |
637 | { | 721 | { |
638 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 722 | struct snd_wss *chip = snd_timer_chip(timer); |
639 | if (chip->hardware & CS4231_HW_CS4236B_MASK) | 723 | if (chip->hardware & WSS_HW_CS4236B_MASK) |
640 | return 14467; | 724 | return 14467; |
641 | else | 725 | else |
642 | return chip->image[CS4231_PLAYBK_FORMAT] & 1 ? 9969 : 9920; | 726 | return chip->image[CS4231_PLAYBK_FORMAT] & 1 ? 9969 : 9920; |
643 | } | 727 | } |
644 | 728 | ||
645 | static int snd_cs4231_timer_start(struct snd_timer * timer) | 729 | static int snd_wss_timer_start(struct snd_timer *timer) |
646 | { | 730 | { |
647 | unsigned long flags; | 731 | unsigned long flags; |
648 | unsigned int ticks; | 732 | unsigned int ticks; |
649 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 733 | struct snd_wss *chip = snd_timer_chip(timer); |
650 | spin_lock_irqsave(&chip->reg_lock, flags); | 734 | spin_lock_irqsave(&chip->reg_lock, flags); |
651 | ticks = timer->sticks; | 735 | ticks = timer->sticks; |
652 | if ((chip->image[CS4231_ALT_FEATURE_1] & CS4231_TIMER_ENABLE) == 0 || | 736 | if ((chip->image[CS4231_ALT_FEATURE_1] & CS4231_TIMER_ENABLE) == 0 || |
653 | (unsigned char)(ticks >> 8) != chip->image[CS4231_TIMER_HIGH] || | 737 | (unsigned char)(ticks >> 8) != chip->image[CS4231_TIMER_HIGH] || |
654 | (unsigned char)ticks != chip->image[CS4231_TIMER_LOW]) { | 738 | (unsigned char)ticks != chip->image[CS4231_TIMER_LOW]) { |
655 | snd_cs4231_out(chip, CS4231_TIMER_HIGH, chip->image[CS4231_TIMER_HIGH] = (unsigned char) (ticks >> 8)); | 739 | chip->image[CS4231_TIMER_HIGH] = (unsigned char) (ticks >> 8); |
656 | snd_cs4231_out(chip, CS4231_TIMER_LOW, chip->image[CS4231_TIMER_LOW] = (unsigned char) ticks); | 740 | snd_wss_out(chip, CS4231_TIMER_HIGH, |
657 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | CS4231_TIMER_ENABLE); | 741 | chip->image[CS4231_TIMER_HIGH]); |
742 | chip->image[CS4231_TIMER_LOW] = (unsigned char) ticks; | ||
743 | snd_wss_out(chip, CS4231_TIMER_LOW, | ||
744 | chip->image[CS4231_TIMER_LOW]); | ||
745 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
746 | chip->image[CS4231_ALT_FEATURE_1] | | ||
747 | CS4231_TIMER_ENABLE); | ||
658 | } | 748 | } |
659 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 749 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
660 | return 0; | 750 | return 0; |
661 | } | 751 | } |
662 | 752 | ||
663 | static int snd_cs4231_timer_stop(struct snd_timer * timer) | 753 | static int snd_wss_timer_stop(struct snd_timer *timer) |
664 | { | 754 | { |
665 | unsigned long flags; | 755 | unsigned long flags; |
666 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 756 | struct snd_wss *chip = snd_timer_chip(timer); |
667 | spin_lock_irqsave(&chip->reg_lock, flags); | 757 | spin_lock_irqsave(&chip->reg_lock, flags); |
668 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] &= ~CS4231_TIMER_ENABLE); | 758 | chip->image[CS4231_ALT_FEATURE_1] &= ~CS4231_TIMER_ENABLE; |
759 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
760 | chip->image[CS4231_ALT_FEATURE_1]); | ||
669 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 761 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
670 | return 0; | 762 | return 0; |
671 | } | 763 | } |
672 | 764 | ||
673 | static void snd_cs4231_init(struct snd_cs4231 *chip) | 765 | static void snd_wss_init(struct snd_wss *chip) |
674 | { | 766 | { |
675 | unsigned long flags; | 767 | unsigned long flags; |
676 | 768 | ||
677 | snd_cs4231_mce_down(chip); | 769 | snd_wss_mce_down(chip); |
678 | 770 | ||
679 | #ifdef SNDRV_DEBUG_MCE | 771 | #ifdef SNDRV_DEBUG_MCE |
680 | snd_printk("init: (1)\n"); | 772 | snd_printk("init: (1)\n"); |
681 | #endif | 773 | #endif |
682 | snd_cs4231_mce_up(chip); | 774 | snd_wss_mce_up(chip); |
683 | spin_lock_irqsave(&chip->reg_lock, flags); | 775 | spin_lock_irqsave(&chip->reg_lock, flags); |
684 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | | 776 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | |
685 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO | | 777 | CS4231_PLAYBACK_PIO | |
686 | CS4231_CALIB_MODE); | 778 | CS4231_RECORD_ENABLE | |
779 | CS4231_RECORD_PIO | | ||
780 | CS4231_CALIB_MODE); | ||
687 | chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB; | 781 | chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB; |
688 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); | 782 | snd_wss_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); |
689 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 783 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
690 | snd_cs4231_mce_down(chip); | 784 | snd_wss_mce_down(chip); |
691 | 785 | ||
692 | #ifdef SNDRV_DEBUG_MCE | 786 | #ifdef SNDRV_DEBUG_MCE |
693 | snd_printk("init: (2)\n"); | 787 | snd_printk("init: (2)\n"); |
694 | #endif | 788 | #endif |
695 | 789 | ||
696 | snd_cs4231_mce_up(chip); | 790 | snd_wss_mce_up(chip); |
697 | spin_lock_irqsave(&chip->reg_lock, flags); | 791 | spin_lock_irqsave(&chip->reg_lock, flags); |
698 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]); | 792 | snd_wss_out(chip, |
793 | CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]); | ||
699 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 794 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
700 | snd_cs4231_mce_down(chip); | 795 | snd_wss_mce_down(chip); |
701 | 796 | ||
702 | #ifdef SNDRV_DEBUG_MCE | 797 | #ifdef SNDRV_DEBUG_MCE |
703 | snd_printk("init: (3) - afei = 0x%x\n", chip->image[CS4231_ALT_FEATURE_1]); | 798 | snd_printk("init: (3) - afei = 0x%x\n", |
799 | chip->image[CS4231_ALT_FEATURE_1]); | ||
704 | #endif | 800 | #endif |
705 | 801 | ||
706 | spin_lock_irqsave(&chip->reg_lock, flags); | 802 | spin_lock_irqsave(&chip->reg_lock, flags); |
707 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_2, chip->image[CS4231_ALT_FEATURE_2]); | 803 | snd_wss_out(chip, CS4231_ALT_FEATURE_2, |
804 | chip->image[CS4231_ALT_FEATURE_2]); | ||
708 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 805 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
709 | 806 | ||
710 | snd_cs4231_mce_up(chip); | 807 | snd_wss_mce_up(chip); |
711 | spin_lock_irqsave(&chip->reg_lock, flags); | 808 | spin_lock_irqsave(&chip->reg_lock, flags); |
712 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT]); | 809 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, |
810 | chip->image[CS4231_PLAYBK_FORMAT]); | ||
713 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 811 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
714 | snd_cs4231_mce_down(chip); | 812 | snd_wss_mce_down(chip); |
715 | 813 | ||
716 | #ifdef SNDRV_DEBUG_MCE | 814 | #ifdef SNDRV_DEBUG_MCE |
717 | snd_printk("init: (4)\n"); | 815 | snd_printk("init: (4)\n"); |
718 | #endif | 816 | #endif |
719 | 817 | ||
720 | snd_cs4231_mce_up(chip); | 818 | snd_wss_mce_up(chip); |
721 | spin_lock_irqsave(&chip->reg_lock, flags); | 819 | spin_lock_irqsave(&chip->reg_lock, flags); |
722 | snd_cs4231_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT]); | 820 | snd_wss_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT]); |
723 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 821 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
724 | snd_cs4231_mce_down(chip); | 822 | snd_wss_mce_down(chip); |
725 | 823 | ||
726 | #ifdef SNDRV_DEBUG_MCE | 824 | #ifdef SNDRV_DEBUG_MCE |
727 | snd_printk("init: (5)\n"); | 825 | snd_printk("init: (5)\n"); |
728 | #endif | 826 | #endif |
729 | } | 827 | } |
730 | 828 | ||
731 | static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode) | 829 | static int snd_wss_open(struct snd_wss *chip, unsigned int mode) |
732 | { | 830 | { |
733 | unsigned long flags; | 831 | unsigned long flags; |
734 | 832 | ||
735 | mutex_lock(&chip->open_mutex); | 833 | mutex_lock(&chip->open_mutex); |
736 | if ((chip->mode & mode) || | 834 | if ((chip->mode & mode) || |
737 | ((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) { | 835 | ((chip->mode & WSS_MODE_OPEN) && chip->single_dma)) { |
738 | mutex_unlock(&chip->open_mutex); | 836 | mutex_unlock(&chip->open_mutex); |
739 | return -EAGAIN; | 837 | return -EAGAIN; |
740 | } | 838 | } |
741 | if (chip->mode & CS4231_MODE_OPEN) { | 839 | if (chip->mode & WSS_MODE_OPEN) { |
742 | chip->mode |= mode; | 840 | chip->mode |= mode; |
743 | mutex_unlock(&chip->open_mutex); | 841 | mutex_unlock(&chip->open_mutex); |
744 | return 0; | 842 | return 0; |
745 | } | 843 | } |
746 | /* ok. now enable and ack CODEC IRQ */ | 844 | /* ok. now enable and ack CODEC IRQ */ |
747 | spin_lock_irqsave(&chip->reg_lock, flags); | 845 | spin_lock_irqsave(&chip->reg_lock, flags); |
748 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, CS4231_PLAYBACK_IRQ | | 846 | snd_wss_out(chip, CS4231_IRQ_STATUS, |
749 | CS4231_RECORD_IRQ | | 847 | CS4231_PLAYBACK_IRQ | |
750 | CS4231_TIMER_IRQ); | 848 | CS4231_RECORD_IRQ | |
751 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); | 849 | CS4231_TIMER_IRQ); |
752 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 850 | snd_wss_out(chip, CS4231_IRQ_STATUS, 0); |
753 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 851 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
852 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | ||
754 | chip->image[CS4231_PIN_CTRL] |= CS4231_IRQ_ENABLE; | 853 | chip->image[CS4231_PIN_CTRL] |= CS4231_IRQ_ENABLE; |
755 | snd_cs4231_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); | 854 | snd_wss_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); |
756 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, CS4231_PLAYBACK_IRQ | | 855 | snd_wss_out(chip, CS4231_IRQ_STATUS, |
757 | CS4231_RECORD_IRQ | | 856 | CS4231_PLAYBACK_IRQ | |
758 | CS4231_TIMER_IRQ); | 857 | CS4231_RECORD_IRQ | |
759 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); | 858 | CS4231_TIMER_IRQ); |
859 | snd_wss_out(chip, CS4231_IRQ_STATUS, 0); | ||
760 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 860 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
761 | 861 | ||
762 | chip->mode = mode; | 862 | chip->mode = mode; |
@@ -764,48 +864,49 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode) | |||
764 | return 0; | 864 | return 0; |
765 | } | 865 | } |
766 | 866 | ||
767 | static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) | 867 | static void snd_wss_close(struct snd_wss *chip, unsigned int mode) |
768 | { | 868 | { |
769 | unsigned long flags; | 869 | unsigned long flags; |
770 | 870 | ||
771 | mutex_lock(&chip->open_mutex); | 871 | mutex_lock(&chip->open_mutex); |
772 | chip->mode &= ~mode; | 872 | chip->mode &= ~mode; |
773 | if (chip->mode & CS4231_MODE_OPEN) { | 873 | if (chip->mode & WSS_MODE_OPEN) { |
774 | mutex_unlock(&chip->open_mutex); | 874 | mutex_unlock(&chip->open_mutex); |
775 | return; | 875 | return; |
776 | } | 876 | } |
777 | snd_cs4231_calibrate_mute(chip, 1); | 877 | snd_wss_calibrate_mute(chip, 1); |
778 | 878 | ||
779 | /* disable IRQ */ | 879 | /* disable IRQ */ |
780 | spin_lock_irqsave(&chip->reg_lock, flags); | 880 | spin_lock_irqsave(&chip->reg_lock, flags); |
781 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); | 881 | snd_wss_out(chip, CS4231_IRQ_STATUS, 0); |
782 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 882 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
783 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 883 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
784 | chip->image[CS4231_PIN_CTRL] &= ~CS4231_IRQ_ENABLE; | 884 | chip->image[CS4231_PIN_CTRL] &= ~CS4231_IRQ_ENABLE; |
785 | snd_cs4231_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); | 885 | snd_wss_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); |
786 | 886 | ||
787 | /* now disable record & playback */ | 887 | /* now disable record & playback */ |
788 | 888 | ||
789 | if (chip->image[CS4231_IFACE_CTRL] & (CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | | 889 | if (chip->image[CS4231_IFACE_CTRL] & (CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | |
790 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO)) { | 890 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO)) { |
791 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 891 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
792 | snd_cs4231_mce_up(chip); | 892 | snd_wss_mce_up(chip); |
793 | spin_lock_irqsave(&chip->reg_lock, flags); | 893 | spin_lock_irqsave(&chip->reg_lock, flags); |
794 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | | 894 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | |
795 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); | 895 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); |
796 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); | 896 | snd_wss_out(chip, CS4231_IFACE_CTRL, |
897 | chip->image[CS4231_IFACE_CTRL]); | ||
797 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 898 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
798 | snd_cs4231_mce_down(chip); | 899 | snd_wss_mce_down(chip); |
799 | spin_lock_irqsave(&chip->reg_lock, flags); | 900 | spin_lock_irqsave(&chip->reg_lock, flags); |
800 | } | 901 | } |
801 | 902 | ||
802 | /* clear IRQ again */ | 903 | /* clear IRQ again */ |
803 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); | 904 | snd_wss_out(chip, CS4231_IRQ_STATUS, 0); |
804 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 905 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
805 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 906 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
806 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 907 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
807 | 908 | ||
808 | snd_cs4231_calibrate_mute(chip, 0); | 909 | snd_wss_calibrate_mute(chip, 0); |
809 | 910 | ||
810 | chip->mode = 0; | 911 | chip->mode = 0; |
811 | mutex_unlock(&chip->open_mutex); | 912 | mutex_unlock(&chip->open_mutex); |
@@ -815,59 +916,60 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) | |||
815 | * timer open/close | 916 | * timer open/close |
816 | */ | 917 | */ |
817 | 918 | ||
818 | static int snd_cs4231_timer_open(struct snd_timer * timer) | 919 | static int snd_wss_timer_open(struct snd_timer *timer) |
819 | { | 920 | { |
820 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 921 | struct snd_wss *chip = snd_timer_chip(timer); |
821 | snd_cs4231_open(chip, CS4231_MODE_TIMER); | 922 | snd_wss_open(chip, WSS_MODE_TIMER); |
822 | return 0; | 923 | return 0; |
823 | } | 924 | } |
824 | 925 | ||
825 | static int snd_cs4231_timer_close(struct snd_timer * timer) | 926 | static int snd_wss_timer_close(struct snd_timer *timer) |
826 | { | 927 | { |
827 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 928 | struct snd_wss *chip = snd_timer_chip(timer); |
828 | snd_cs4231_close(chip, CS4231_MODE_TIMER); | 929 | snd_wss_close(chip, WSS_MODE_TIMER); |
829 | return 0; | 930 | return 0; |
830 | } | 931 | } |
831 | 932 | ||
832 | static struct snd_timer_hardware snd_cs4231_timer_table = | 933 | static struct snd_timer_hardware snd_wss_timer_table = |
833 | { | 934 | { |
834 | .flags = SNDRV_TIMER_HW_AUTO, | 935 | .flags = SNDRV_TIMER_HW_AUTO, |
835 | .resolution = 9945, | 936 | .resolution = 9945, |
836 | .ticks = 65535, | 937 | .ticks = 65535, |
837 | .open = snd_cs4231_timer_open, | 938 | .open = snd_wss_timer_open, |
838 | .close = snd_cs4231_timer_close, | 939 | .close = snd_wss_timer_close, |
839 | .c_resolution = snd_cs4231_timer_resolution, | 940 | .c_resolution = snd_wss_timer_resolution, |
840 | .start = snd_cs4231_timer_start, | 941 | .start = snd_wss_timer_start, |
841 | .stop = snd_cs4231_timer_stop, | 942 | .stop = snd_wss_timer_stop, |
842 | }; | 943 | }; |
843 | 944 | ||
844 | /* | 945 | /* |
845 | * ok.. exported functions.. | 946 | * ok.. exported functions.. |
846 | */ | 947 | */ |
847 | 948 | ||
848 | static int snd_cs4231_playback_hw_params(struct snd_pcm_substream *substream, | 949 | static int snd_wss_playback_hw_params(struct snd_pcm_substream *substream, |
849 | struct snd_pcm_hw_params *hw_params) | 950 | struct snd_pcm_hw_params *hw_params) |
850 | { | 951 | { |
851 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 952 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
852 | unsigned char new_pdfr; | 953 | unsigned char new_pdfr; |
853 | int err; | 954 | int err; |
854 | 955 | ||
855 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) | 956 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) |
856 | return err; | 957 | return err; |
857 | new_pdfr = snd_cs4231_get_format(chip, params_format(hw_params), params_channels(hw_params)) | | 958 | new_pdfr = snd_wss_get_format(chip, params_format(hw_params), |
858 | snd_cs4231_get_rate(params_rate(hw_params)); | 959 | params_channels(hw_params)) | |
960 | snd_wss_get_rate(params_rate(hw_params)); | ||
859 | chip->set_playback_format(chip, hw_params, new_pdfr); | 961 | chip->set_playback_format(chip, hw_params, new_pdfr); |
860 | return 0; | 962 | return 0; |
861 | } | 963 | } |
862 | 964 | ||
863 | static int snd_cs4231_playback_hw_free(struct snd_pcm_substream *substream) | 965 | static int snd_wss_playback_hw_free(struct snd_pcm_substream *substream) |
864 | { | 966 | { |
865 | return snd_pcm_lib_free_pages(substream); | 967 | return snd_pcm_lib_free_pages(substream); |
866 | } | 968 | } |
867 | 969 | ||
868 | static int snd_cs4231_playback_prepare(struct snd_pcm_substream *substream) | 970 | static int snd_wss_playback_prepare(struct snd_pcm_substream *substream) |
869 | { | 971 | { |
870 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 972 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
871 | struct snd_pcm_runtime *runtime = substream->runtime; | 973 | struct snd_pcm_runtime *runtime = substream->runtime; |
872 | unsigned long flags; | 974 | unsigned long flags; |
873 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | 975 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); |
@@ -877,39 +979,40 @@ static int snd_cs4231_playback_prepare(struct snd_pcm_substream *substream) | |||
877 | chip->p_dma_size = size; | 979 | chip->p_dma_size = size; |
878 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO); | 980 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO); |
879 | snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); | 981 | snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); |
880 | count = snd_cs4231_get_count(chip->image[CS4231_PLAYBK_FORMAT], count) - 1; | 982 | count = snd_wss_get_count(chip->image[CS4231_PLAYBK_FORMAT], count) - 1; |
881 | snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); | 983 | snd_wss_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); |
882 | snd_cs4231_out(chip, CS4231_PLY_UPR_CNT, (unsigned char) (count >> 8)); | 984 | snd_wss_out(chip, CS4231_PLY_UPR_CNT, (unsigned char) (count >> 8)); |
883 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 985 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
884 | #if 0 | 986 | #if 0 |
885 | snd_cs4231_debug(chip); | 987 | snd_wss_debug(chip); |
886 | #endif | 988 | #endif |
887 | return 0; | 989 | return 0; |
888 | } | 990 | } |
889 | 991 | ||
890 | static int snd_cs4231_capture_hw_params(struct snd_pcm_substream *substream, | 992 | static int snd_wss_capture_hw_params(struct snd_pcm_substream *substream, |
891 | struct snd_pcm_hw_params *hw_params) | 993 | struct snd_pcm_hw_params *hw_params) |
892 | { | 994 | { |
893 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 995 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
894 | unsigned char new_cdfr; | 996 | unsigned char new_cdfr; |
895 | int err; | 997 | int err; |
896 | 998 | ||
897 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) | 999 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) |
898 | return err; | 1000 | return err; |
899 | new_cdfr = snd_cs4231_get_format(chip, params_format(hw_params), params_channels(hw_params)) | | 1001 | new_cdfr = snd_wss_get_format(chip, params_format(hw_params), |
900 | snd_cs4231_get_rate(params_rate(hw_params)); | 1002 | params_channels(hw_params)) | |
1003 | snd_wss_get_rate(params_rate(hw_params)); | ||
901 | chip->set_capture_format(chip, hw_params, new_cdfr); | 1004 | chip->set_capture_format(chip, hw_params, new_cdfr); |
902 | return 0; | 1005 | return 0; |
903 | } | 1006 | } |
904 | 1007 | ||
905 | static int snd_cs4231_capture_hw_free(struct snd_pcm_substream *substream) | 1008 | static int snd_wss_capture_hw_free(struct snd_pcm_substream *substream) |
906 | { | 1009 | { |
907 | return snd_pcm_lib_free_pages(substream); | 1010 | return snd_pcm_lib_free_pages(substream); |
908 | } | 1011 | } |
909 | 1012 | ||
910 | static int snd_cs4231_capture_prepare(struct snd_pcm_substream *substream) | 1013 | static int snd_wss_capture_prepare(struct snd_pcm_substream *substream) |
911 | { | 1014 | { |
912 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1015 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
913 | struct snd_pcm_runtime *runtime = substream->runtime; | 1016 | struct snd_pcm_runtime *runtime = substream->runtime; |
914 | unsigned long flags; | 1017 | unsigned long flags; |
915 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | 1018 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); |
@@ -919,49 +1022,52 @@ static int snd_cs4231_capture_prepare(struct snd_pcm_substream *substream) | |||
919 | chip->c_dma_size = size; | 1022 | chip->c_dma_size = size; |
920 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); | 1023 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); |
921 | snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); | 1024 | snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); |
922 | count = snd_cs4231_get_count(chip->image[CS4231_REC_FORMAT], count) - 1; | 1025 | count = snd_wss_get_count(chip->image[CS4231_REC_FORMAT], count) - 1; |
923 | if (chip->single_dma && chip->hardware != CS4231_HW_INTERWAVE) { | 1026 | if (chip->single_dma && chip->hardware != WSS_HW_INTERWAVE) { |
924 | snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); | 1027 | snd_wss_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); |
925 | snd_cs4231_out(chip, CS4231_PLY_UPR_CNT, (unsigned char) (count >> 8)); | 1028 | snd_wss_out(chip, CS4231_PLY_UPR_CNT, |
1029 | (unsigned char) (count >> 8)); | ||
926 | } else { | 1030 | } else { |
927 | snd_cs4231_out(chip, CS4231_REC_LWR_CNT, (unsigned char) count); | 1031 | snd_wss_out(chip, CS4231_REC_LWR_CNT, (unsigned char) count); |
928 | snd_cs4231_out(chip, CS4231_REC_UPR_CNT, (unsigned char) (count >> 8)); | 1032 | snd_wss_out(chip, CS4231_REC_UPR_CNT, |
1033 | (unsigned char) (count >> 8)); | ||
929 | } | 1034 | } |
930 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1035 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
931 | return 0; | 1036 | return 0; |
932 | } | 1037 | } |
933 | 1038 | ||
934 | void snd_cs4231_overrange(struct snd_cs4231 *chip) | 1039 | void snd_wss_overrange(struct snd_wss *chip) |
935 | { | 1040 | { |
936 | unsigned long flags; | 1041 | unsigned long flags; |
937 | unsigned char res; | 1042 | unsigned char res; |
938 | 1043 | ||
939 | spin_lock_irqsave(&chip->reg_lock, flags); | 1044 | spin_lock_irqsave(&chip->reg_lock, flags); |
940 | res = snd_cs4231_in(chip, CS4231_TEST_INIT); | 1045 | res = snd_wss_in(chip, CS4231_TEST_INIT); |
941 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1046 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
942 | if (res & (0x08 | 0x02)) /* detect overrange only above 0dB; may be user selectable? */ | 1047 | if (res & (0x08 | 0x02)) /* detect overrange only above 0dB; may be user selectable? */ |
943 | chip->capture_substream->runtime->overrange++; | 1048 | chip->capture_substream->runtime->overrange++; |
944 | } | 1049 | } |
1050 | EXPORT_SYMBOL(snd_wss_overrange); | ||
945 | 1051 | ||
946 | irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id) | 1052 | irqreturn_t snd_wss_interrupt(int irq, void *dev_id) |
947 | { | 1053 | { |
948 | struct snd_cs4231 *chip = dev_id; | 1054 | struct snd_wss *chip = dev_id; |
949 | unsigned char status; | 1055 | unsigned char status; |
950 | 1056 | ||
951 | status = snd_cs4231_in(chip, CS4231_IRQ_STATUS); | 1057 | status = snd_wss_in(chip, CS4231_IRQ_STATUS); |
952 | if (status & CS4231_TIMER_IRQ) { | 1058 | if (status & CS4231_TIMER_IRQ) { |
953 | if (chip->timer) | 1059 | if (chip->timer) |
954 | snd_timer_interrupt(chip->timer, chip->timer->sticks); | 1060 | snd_timer_interrupt(chip->timer, chip->timer->sticks); |
955 | } | 1061 | } |
956 | if (chip->single_dma && chip->hardware != CS4231_HW_INTERWAVE) { | 1062 | if (chip->single_dma && chip->hardware != WSS_HW_INTERWAVE) { |
957 | if (status & CS4231_PLAYBACK_IRQ) { | 1063 | if (status & CS4231_PLAYBACK_IRQ) { |
958 | if (chip->mode & CS4231_MODE_PLAY) { | 1064 | if (chip->mode & WSS_MODE_PLAY) { |
959 | if (chip->playback_substream) | 1065 | if (chip->playback_substream) |
960 | snd_pcm_period_elapsed(chip->playback_substream); | 1066 | snd_pcm_period_elapsed(chip->playback_substream); |
961 | } | 1067 | } |
962 | if (chip->mode & CS4231_MODE_RECORD) { | 1068 | if (chip->mode & WSS_MODE_RECORD) { |
963 | if (chip->capture_substream) { | 1069 | if (chip->capture_substream) { |
964 | snd_cs4231_overrange(chip); | 1070 | snd_wss_overrange(chip); |
965 | snd_pcm_period_elapsed(chip->capture_substream); | 1071 | snd_pcm_period_elapsed(chip->capture_substream); |
966 | } | 1072 | } |
967 | } | 1073 | } |
@@ -973,21 +1079,22 @@ irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id) | |||
973 | } | 1079 | } |
974 | if (status & CS4231_RECORD_IRQ) { | 1080 | if (status & CS4231_RECORD_IRQ) { |
975 | if (chip->capture_substream) { | 1081 | if (chip->capture_substream) { |
976 | snd_cs4231_overrange(chip); | 1082 | snd_wss_overrange(chip); |
977 | snd_pcm_period_elapsed(chip->capture_substream); | 1083 | snd_pcm_period_elapsed(chip->capture_substream); |
978 | } | 1084 | } |
979 | } | 1085 | } |
980 | } | 1086 | } |
981 | 1087 | ||
982 | spin_lock(&chip->reg_lock); | 1088 | spin_lock(&chip->reg_lock); |
983 | snd_cs4231_outm(chip, CS4231_IRQ_STATUS, ~CS4231_ALL_IRQS | ~status, 0); | 1089 | snd_wss_outm(chip, CS4231_IRQ_STATUS, ~CS4231_ALL_IRQS | ~status, 0); |
984 | spin_unlock(&chip->reg_lock); | 1090 | spin_unlock(&chip->reg_lock); |
985 | return IRQ_HANDLED; | 1091 | return IRQ_HANDLED; |
986 | } | 1092 | } |
1093 | EXPORT_SYMBOL(snd_wss_interrupt); | ||
987 | 1094 | ||
988 | static snd_pcm_uframes_t snd_cs4231_playback_pointer(struct snd_pcm_substream *substream) | 1095 | static snd_pcm_uframes_t snd_wss_playback_pointer(struct snd_pcm_substream *substream) |
989 | { | 1096 | { |
990 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1097 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
991 | size_t ptr; | 1098 | size_t ptr; |
992 | 1099 | ||
993 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) | 1100 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) |
@@ -996,9 +1103,9 @@ static snd_pcm_uframes_t snd_cs4231_playback_pointer(struct snd_pcm_substream *s | |||
996 | return bytes_to_frames(substream->runtime, ptr); | 1103 | return bytes_to_frames(substream->runtime, ptr); |
997 | } | 1104 | } |
998 | 1105 | ||
999 | static snd_pcm_uframes_t snd_cs4231_capture_pointer(struct snd_pcm_substream *substream) | 1106 | static snd_pcm_uframes_t snd_wss_capture_pointer(struct snd_pcm_substream *substream) |
1000 | { | 1107 | { |
1001 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1108 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1002 | size_t ptr; | 1109 | size_t ptr; |
1003 | 1110 | ||
1004 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE)) | 1111 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE)) |
@@ -1011,7 +1118,7 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer(struct snd_pcm_substream *su | |||
1011 | 1118 | ||
1012 | */ | 1119 | */ |
1013 | 1120 | ||
1014 | static int snd_cs4231_probe(struct snd_cs4231 *chip) | 1121 | static int snd_wss_probe(struct snd_wss *chip) |
1015 | { | 1122 | { |
1016 | unsigned long flags; | 1123 | unsigned long flags; |
1017 | int i, id, rev; | 1124 | int i, id, rev; |
@@ -1019,103 +1126,104 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1019 | unsigned int hw; | 1126 | unsigned int hw; |
1020 | 1127 | ||
1021 | #if 0 | 1128 | #if 0 |
1022 | snd_cs4231_debug(chip); | 1129 | snd_wss_debug(chip); |
1023 | #endif | 1130 | #endif |
1024 | id = 0; | 1131 | id = 0; |
1025 | for (i = 0; i < 50; i++) { | 1132 | for (i = 0; i < 50; i++) { |
1026 | mb(); | 1133 | mb(); |
1027 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 1134 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
1028 | udelay(2000); | 1135 | udelay(2000); |
1029 | else { | 1136 | else { |
1030 | spin_lock_irqsave(&chip->reg_lock, flags); | 1137 | spin_lock_irqsave(&chip->reg_lock, flags); |
1031 | snd_cs4231_out(chip, CS4231_MISC_INFO, CS4231_MODE2); | 1138 | snd_wss_out(chip, CS4231_MISC_INFO, CS4231_MODE2); |
1032 | id = snd_cs4231_in(chip, CS4231_MISC_INFO) & 0x0f; | 1139 | id = snd_wss_in(chip, CS4231_MISC_INFO) & 0x0f; |
1033 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1140 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1034 | if (id == 0x0a) | 1141 | if (id == 0x0a) |
1035 | break; /* this is valid value */ | 1142 | break; /* this is valid value */ |
1036 | } | 1143 | } |
1037 | } | 1144 | } |
1038 | snd_printdd("cs4231: port = 0x%lx, id = 0x%x\n", chip->port, id); | 1145 | snd_printdd("wss: port = 0x%lx, id = 0x%x\n", chip->port, id); |
1039 | if (id != 0x0a) | 1146 | if (id != 0x0a) |
1040 | return -ENODEV; /* no valid device found */ | 1147 | return -ENODEV; /* no valid device found */ |
1041 | 1148 | ||
1042 | if (((hw = chip->hardware) & CS4231_HW_TYPE_MASK) == CS4231_HW_DETECT) { | 1149 | hw = chip->hardware; |
1043 | rev = snd_cs4231_in(chip, CS4231_VERSION) & 0xe7; | 1150 | if ((hw & WSS_HW_TYPE_MASK) == WSS_HW_DETECT) { |
1151 | rev = snd_wss_in(chip, CS4231_VERSION) & 0xe7; | ||
1044 | snd_printdd("CS4231: VERSION (I25) = 0x%x\n", rev); | 1152 | snd_printdd("CS4231: VERSION (I25) = 0x%x\n", rev); |
1045 | if (rev == 0x80) { | 1153 | if (rev == 0x80) { |
1046 | unsigned char tmp = snd_cs4231_in(chip, 23); | 1154 | unsigned char tmp = snd_wss_in(chip, 23); |
1047 | snd_cs4231_out(chip, 23, ~tmp); | 1155 | snd_wss_out(chip, 23, ~tmp); |
1048 | if (snd_cs4231_in(chip, 23) != tmp) | 1156 | if (snd_wss_in(chip, 23) != tmp) |
1049 | chip->hardware = CS4231_HW_AD1845; | 1157 | chip->hardware = WSS_HW_AD1845; |
1050 | else | 1158 | else |
1051 | chip->hardware = CS4231_HW_CS4231; | 1159 | chip->hardware = WSS_HW_CS4231; |
1052 | } else if (rev == 0xa0) { | 1160 | } else if (rev == 0xa0) { |
1053 | chip->hardware = CS4231_HW_CS4231A; | 1161 | chip->hardware = WSS_HW_CS4231A; |
1054 | } else if (rev == 0xa2) { | 1162 | } else if (rev == 0xa2) { |
1055 | chip->hardware = CS4231_HW_CS4232; | 1163 | chip->hardware = WSS_HW_CS4232; |
1056 | } else if (rev == 0xb2) { | 1164 | } else if (rev == 0xb2) { |
1057 | chip->hardware = CS4231_HW_CS4232A; | 1165 | chip->hardware = WSS_HW_CS4232A; |
1058 | } else if (rev == 0x83) { | 1166 | } else if (rev == 0x83) { |
1059 | chip->hardware = CS4231_HW_CS4236; | 1167 | chip->hardware = WSS_HW_CS4236; |
1060 | } else if (rev == 0x03) { | 1168 | } else if (rev == 0x03) { |
1061 | chip->hardware = CS4231_HW_CS4236B; | 1169 | chip->hardware = WSS_HW_CS4236B; |
1062 | } else { | 1170 | } else { |
1063 | snd_printk("unknown CS chip with version 0x%x\n", rev); | 1171 | snd_printk("unknown CS chip with version 0x%x\n", rev); |
1064 | return -ENODEV; /* unknown CS4231 chip? */ | 1172 | return -ENODEV; /* unknown CS4231 chip? */ |
1065 | } | 1173 | } |
1066 | } | 1174 | } |
1067 | spin_lock_irqsave(&chip->reg_lock, flags); | 1175 | spin_lock_irqsave(&chip->reg_lock, flags); |
1068 | cs4231_inb(chip, CS4231P(STATUS)); /* clear any pendings IRQ */ | 1176 | wss_inb(chip, CS4231P(STATUS)); /* clear any pendings IRQ */ |
1069 | cs4231_outb(chip, CS4231P(STATUS), 0); | 1177 | wss_outb(chip, CS4231P(STATUS), 0); |
1070 | mb(); | 1178 | mb(); |
1071 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1179 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1072 | 1180 | ||
1073 | chip->image[CS4231_MISC_INFO] = CS4231_MODE2; | 1181 | chip->image[CS4231_MISC_INFO] = CS4231_MODE2; |
1074 | switch (chip->hardware) { | 1182 | switch (chip->hardware) { |
1075 | case CS4231_HW_INTERWAVE: | 1183 | case WSS_HW_INTERWAVE: |
1076 | chip->image[CS4231_MISC_INFO] = CS4231_IW_MODE3; | 1184 | chip->image[CS4231_MISC_INFO] = CS4231_IW_MODE3; |
1077 | break; | 1185 | break; |
1078 | case CS4231_HW_CS4235: | 1186 | case WSS_HW_CS4235: |
1079 | case CS4231_HW_CS4236B: | 1187 | case WSS_HW_CS4236B: |
1080 | case CS4231_HW_CS4237B: | 1188 | case WSS_HW_CS4237B: |
1081 | case CS4231_HW_CS4238B: | 1189 | case WSS_HW_CS4238B: |
1082 | case CS4231_HW_CS4239: | 1190 | case WSS_HW_CS4239: |
1083 | if (hw == CS4231_HW_DETECT3) | 1191 | if (hw == WSS_HW_DETECT3) |
1084 | chip->image[CS4231_MISC_INFO] = CS4231_4236_MODE3; | 1192 | chip->image[CS4231_MISC_INFO] = CS4231_4236_MODE3; |
1085 | else | 1193 | else |
1086 | chip->hardware = CS4231_HW_CS4236; | 1194 | chip->hardware = WSS_HW_CS4236; |
1087 | break; | 1195 | break; |
1088 | } | 1196 | } |
1089 | 1197 | ||
1090 | chip->image[CS4231_IFACE_CTRL] = | 1198 | chip->image[CS4231_IFACE_CTRL] = |
1091 | (chip->image[CS4231_IFACE_CTRL] & ~CS4231_SINGLE_DMA) | | 1199 | (chip->image[CS4231_IFACE_CTRL] & ~CS4231_SINGLE_DMA) | |
1092 | (chip->single_dma ? CS4231_SINGLE_DMA : 0); | 1200 | (chip->single_dma ? CS4231_SINGLE_DMA : 0); |
1093 | if (chip->hardware != CS4231_HW_OPTI93X) { | 1201 | if (chip->hardware != WSS_HW_OPTI93X) { |
1094 | chip->image[CS4231_ALT_FEATURE_1] = 0x80; | 1202 | chip->image[CS4231_ALT_FEATURE_1] = 0x80; |
1095 | chip->image[CS4231_ALT_FEATURE_2] = | 1203 | chip->image[CS4231_ALT_FEATURE_2] = |
1096 | chip->hardware == CS4231_HW_INTERWAVE ? 0xc2 : 0x01; | 1204 | chip->hardware == WSS_HW_INTERWAVE ? 0xc2 : 0x01; |
1097 | } | 1205 | } |
1098 | ptr = (unsigned char *) &chip->image; | 1206 | ptr = (unsigned char *) &chip->image; |
1099 | snd_cs4231_mce_down(chip); | 1207 | snd_wss_mce_down(chip); |
1100 | spin_lock_irqsave(&chip->reg_lock, flags); | 1208 | spin_lock_irqsave(&chip->reg_lock, flags); |
1101 | for (i = 0; i < 32; i++) /* ok.. fill all CS4231 registers */ | 1209 | for (i = 0; i < 32; i++) /* ok.. fill all CS4231 registers */ |
1102 | snd_cs4231_out(chip, i, *ptr++); | 1210 | snd_wss_out(chip, i, *ptr++); |
1103 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1211 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1104 | snd_cs4231_mce_up(chip); | 1212 | snd_wss_mce_up(chip); |
1105 | snd_cs4231_mce_down(chip); | 1213 | snd_wss_mce_down(chip); |
1106 | 1214 | ||
1107 | mdelay(2); | 1215 | mdelay(2); |
1108 | 1216 | ||
1109 | /* ok.. try check hardware version for CS4236+ chips */ | 1217 | /* ok.. try check hardware version for CS4236+ chips */ |
1110 | if ((hw & CS4231_HW_TYPE_MASK) == CS4231_HW_DETECT) { | 1218 | if ((hw & WSS_HW_TYPE_MASK) == WSS_HW_DETECT) { |
1111 | if (chip->hardware == CS4231_HW_CS4236B) { | 1219 | if (chip->hardware == WSS_HW_CS4236B) { |
1112 | rev = snd_cs4236_ext_in(chip, CS4236_VERSION); | 1220 | rev = snd_cs4236_ext_in(chip, CS4236_VERSION); |
1113 | snd_cs4236_ext_out(chip, CS4236_VERSION, 0xff); | 1221 | snd_cs4236_ext_out(chip, CS4236_VERSION, 0xff); |
1114 | id = snd_cs4236_ext_in(chip, CS4236_VERSION); | 1222 | id = snd_cs4236_ext_in(chip, CS4236_VERSION); |
1115 | snd_cs4236_ext_out(chip, CS4236_VERSION, rev); | 1223 | snd_cs4236_ext_out(chip, CS4236_VERSION, rev); |
1116 | snd_printdd("CS4231: ext version; rev = 0x%x, id = 0x%x\n", rev, id); | 1224 | snd_printdd("CS4231: ext version; rev = 0x%x, id = 0x%x\n", rev, id); |
1117 | if ((id & 0x1f) == 0x1d) { /* CS4235 */ | 1225 | if ((id & 0x1f) == 0x1d) { /* CS4235 */ |
1118 | chip->hardware = CS4231_HW_CS4235; | 1226 | chip->hardware = WSS_HW_CS4235; |
1119 | switch (id >> 5) { | 1227 | switch (id >> 5) { |
1120 | case 4: | 1228 | case 4: |
1121 | case 5: | 1229 | case 5: |
@@ -1130,13 +1238,13 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1130 | case 5: | 1238 | case 5: |
1131 | case 6: | 1239 | case 6: |
1132 | case 7: | 1240 | case 7: |
1133 | chip->hardware = CS4231_HW_CS4236B; | 1241 | chip->hardware = WSS_HW_CS4236B; |
1134 | break; | 1242 | break; |
1135 | default: | 1243 | default: |
1136 | snd_printk("unknown CS4236 chip (enhanced version = 0x%x)\n", id); | 1244 | snd_printk("unknown CS4236 chip (enhanced version = 0x%x)\n", id); |
1137 | } | 1245 | } |
1138 | } else if ((id & 0x1f) == 0x08) { /* CS4237B */ | 1246 | } else if ((id & 0x1f) == 0x08) { /* CS4237B */ |
1139 | chip->hardware = CS4231_HW_CS4237B; | 1247 | chip->hardware = WSS_HW_CS4237B; |
1140 | switch (id >> 5) { | 1248 | switch (id >> 5) { |
1141 | case 4: | 1249 | case 4: |
1142 | case 5: | 1250 | case 5: |
@@ -1147,7 +1255,7 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1147 | snd_printk("unknown CS4237B chip (enhanced version = 0x%x)\n", id); | 1255 | snd_printk("unknown CS4237B chip (enhanced version = 0x%x)\n", id); |
1148 | } | 1256 | } |
1149 | } else if ((id & 0x1f) == 0x09) { /* CS4238B */ | 1257 | } else if ((id & 0x1f) == 0x09) { /* CS4238B */ |
1150 | chip->hardware = CS4231_HW_CS4238B; | 1258 | chip->hardware = WSS_HW_CS4238B; |
1151 | switch (id >> 5) { | 1259 | switch (id >> 5) { |
1152 | case 5: | 1260 | case 5: |
1153 | case 6: | 1261 | case 6: |
@@ -1157,7 +1265,7 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1157 | snd_printk("unknown CS4238B chip (enhanced version = 0x%x)\n", id); | 1265 | snd_printk("unknown CS4238B chip (enhanced version = 0x%x)\n", id); |
1158 | } | 1266 | } |
1159 | } else if ((id & 0x1f) == 0x1e) { /* CS4239 */ | 1267 | } else if ((id & 0x1f) == 0x1e) { /* CS4239 */ |
1160 | chip->hardware = CS4231_HW_CS4239; | 1268 | chip->hardware = WSS_HW_CS4239; |
1161 | switch (id >> 5) { | 1269 | switch (id >> 5) { |
1162 | case 4: | 1270 | case 4: |
1163 | case 5: | 1271 | case 5: |
@@ -1178,7 +1286,7 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1178 | 1286 | ||
1179 | */ | 1287 | */ |
1180 | 1288 | ||
1181 | static struct snd_pcm_hardware snd_cs4231_playback = | 1289 | static struct snd_pcm_hardware snd_wss_playback = |
1182 | { | 1290 | { |
1183 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1291 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1184 | SNDRV_PCM_INFO_MMAP_VALID | | 1292 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -1199,7 +1307,7 @@ static struct snd_pcm_hardware snd_cs4231_playback = | |||
1199 | .fifo_size = 0, | 1307 | .fifo_size = 0, |
1200 | }; | 1308 | }; |
1201 | 1309 | ||
1202 | static struct snd_pcm_hardware snd_cs4231_capture = | 1310 | static struct snd_pcm_hardware snd_wss_capture = |
1203 | { | 1311 | { |
1204 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1312 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1205 | SNDRV_PCM_INFO_MMAP_VALID | | 1313 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -1224,21 +1332,21 @@ static struct snd_pcm_hardware snd_cs4231_capture = | |||
1224 | 1332 | ||
1225 | */ | 1333 | */ |
1226 | 1334 | ||
1227 | static int snd_cs4231_playback_open(struct snd_pcm_substream *substream) | 1335 | static int snd_wss_playback_open(struct snd_pcm_substream *substream) |
1228 | { | 1336 | { |
1229 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1337 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1230 | struct snd_pcm_runtime *runtime = substream->runtime; | 1338 | struct snd_pcm_runtime *runtime = substream->runtime; |
1231 | int err; | 1339 | int err; |
1232 | 1340 | ||
1233 | runtime->hw = snd_cs4231_playback; | 1341 | runtime->hw = snd_wss_playback; |
1234 | 1342 | ||
1235 | /* hardware bug in InterWave chipset */ | 1343 | /* hardware bug in InterWave chipset */ |
1236 | if (chip->hardware == CS4231_HW_INTERWAVE && chip->dma1 > 3) | 1344 | if (chip->hardware == WSS_HW_INTERWAVE && chip->dma1 > 3) |
1237 | runtime->hw.formats &= ~SNDRV_PCM_FMTBIT_MU_LAW; | 1345 | runtime->hw.formats &= ~SNDRV_PCM_FMTBIT_MU_LAW; |
1238 | 1346 | ||
1239 | /* hardware limitation of cheap chips */ | 1347 | /* hardware limitation of cheap chips */ |
1240 | if (chip->hardware == CS4231_HW_CS4235 || | 1348 | if (chip->hardware == WSS_HW_CS4235 || |
1241 | chip->hardware == CS4231_HW_CS4239) | 1349 | chip->hardware == WSS_HW_CS4239) |
1242 | runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; | 1350 | runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; |
1243 | 1351 | ||
1244 | snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max); | 1352 | snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max); |
@@ -1249,7 +1357,8 @@ static int snd_cs4231_playback_open(struct snd_pcm_substream *substream) | |||
1249 | return err; | 1357 | return err; |
1250 | } | 1358 | } |
1251 | 1359 | ||
1252 | if ((err = snd_cs4231_open(chip, CS4231_MODE_PLAY)) < 0) { | 1360 | err = snd_wss_open(chip, WSS_MODE_PLAY); |
1361 | if (err < 0) { | ||
1253 | if (chip->release_dma) | 1362 | if (chip->release_dma) |
1254 | chip->release_dma(chip, chip->dma_private_data, chip->dma1); | 1363 | chip->release_dma(chip, chip->dma_private_data, chip->dma1); |
1255 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); | 1364 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); |
@@ -1261,17 +1370,17 @@ static int snd_cs4231_playback_open(struct snd_pcm_substream *substream) | |||
1261 | return 0; | 1370 | return 0; |
1262 | } | 1371 | } |
1263 | 1372 | ||
1264 | static int snd_cs4231_capture_open(struct snd_pcm_substream *substream) | 1373 | static int snd_wss_capture_open(struct snd_pcm_substream *substream) |
1265 | { | 1374 | { |
1266 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1375 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1267 | struct snd_pcm_runtime *runtime = substream->runtime; | 1376 | struct snd_pcm_runtime *runtime = substream->runtime; |
1268 | int err; | 1377 | int err; |
1269 | 1378 | ||
1270 | runtime->hw = snd_cs4231_capture; | 1379 | runtime->hw = snd_wss_capture; |
1271 | 1380 | ||
1272 | /* hardware limitation of cheap chips */ | 1381 | /* hardware limitation of cheap chips */ |
1273 | if (chip->hardware == CS4231_HW_CS4235 || | 1382 | if (chip->hardware == WSS_HW_CS4235 || |
1274 | chip->hardware == CS4231_HW_CS4239) | 1383 | chip->hardware == WSS_HW_CS4239) |
1275 | runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; | 1384 | runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; |
1276 | 1385 | ||
1277 | snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max); | 1386 | snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max); |
@@ -1282,7 +1391,8 @@ static int snd_cs4231_capture_open(struct snd_pcm_substream *substream) | |||
1282 | return err; | 1391 | return err; |
1283 | } | 1392 | } |
1284 | 1393 | ||
1285 | if ((err = snd_cs4231_open(chip, CS4231_MODE_RECORD)) < 0) { | 1394 | err = snd_wss_open(chip, WSS_MODE_RECORD); |
1395 | if (err < 0) { | ||
1286 | if (chip->release_dma) | 1396 | if (chip->release_dma) |
1287 | chip->release_dma(chip, chip->dma_private_data, chip->dma2); | 1397 | chip->release_dma(chip, chip->dma_private_data, chip->dma2); |
1288 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); | 1398 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); |
@@ -1294,28 +1404,28 @@ static int snd_cs4231_capture_open(struct snd_pcm_substream *substream) | |||
1294 | return 0; | 1404 | return 0; |
1295 | } | 1405 | } |
1296 | 1406 | ||
1297 | static int snd_cs4231_playback_close(struct snd_pcm_substream *substream) | 1407 | static int snd_wss_playback_close(struct snd_pcm_substream *substream) |
1298 | { | 1408 | { |
1299 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1409 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1300 | 1410 | ||
1301 | chip->playback_substream = NULL; | 1411 | chip->playback_substream = NULL; |
1302 | snd_cs4231_close(chip, CS4231_MODE_PLAY); | 1412 | snd_wss_close(chip, WSS_MODE_PLAY); |
1303 | return 0; | 1413 | return 0; |
1304 | } | 1414 | } |
1305 | 1415 | ||
1306 | static int snd_cs4231_capture_close(struct snd_pcm_substream *substream) | 1416 | static int snd_wss_capture_close(struct snd_pcm_substream *substream) |
1307 | { | 1417 | { |
1308 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1418 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1309 | 1419 | ||
1310 | chip->capture_substream = NULL; | 1420 | chip->capture_substream = NULL; |
1311 | snd_cs4231_close(chip, CS4231_MODE_RECORD); | 1421 | snd_wss_close(chip, WSS_MODE_RECORD); |
1312 | return 0; | 1422 | return 0; |
1313 | } | 1423 | } |
1314 | 1424 | ||
1315 | #ifdef CONFIG_PM | 1425 | #ifdef CONFIG_PM |
1316 | 1426 | ||
1317 | /* lowlevel suspend callback for CS4231 */ | 1427 | /* lowlevel suspend callback for CS4231 */ |
1318 | static void snd_cs4231_suspend(struct snd_cs4231 *chip) | 1428 | static void snd_wss_suspend(struct snd_wss *chip) |
1319 | { | 1429 | { |
1320 | int reg; | 1430 | int reg; |
1321 | unsigned long flags; | 1431 | unsigned long flags; |
@@ -1323,67 +1433,68 @@ static void snd_cs4231_suspend(struct snd_cs4231 *chip) | |||
1323 | snd_pcm_suspend_all(chip->pcm); | 1433 | snd_pcm_suspend_all(chip->pcm); |
1324 | spin_lock_irqsave(&chip->reg_lock, flags); | 1434 | spin_lock_irqsave(&chip->reg_lock, flags); |
1325 | for (reg = 0; reg < 32; reg++) | 1435 | for (reg = 0; reg < 32; reg++) |
1326 | chip->image[reg] = snd_cs4231_in(chip, reg); | 1436 | chip->image[reg] = snd_wss_in(chip, reg); |
1327 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1437 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1328 | } | 1438 | } |
1329 | 1439 | ||
1330 | /* lowlevel resume callback for CS4231 */ | 1440 | /* lowlevel resume callback for CS4231 */ |
1331 | static void snd_cs4231_resume(struct snd_cs4231 *chip) | 1441 | static void snd_wss_resume(struct snd_wss *chip) |
1332 | { | 1442 | { |
1333 | int reg; | 1443 | int reg; |
1334 | unsigned long flags; | 1444 | unsigned long flags; |
1335 | /* int timeout; */ | 1445 | /* int timeout; */ |
1336 | 1446 | ||
1337 | snd_cs4231_mce_up(chip); | 1447 | snd_wss_mce_up(chip); |
1338 | spin_lock_irqsave(&chip->reg_lock, flags); | 1448 | spin_lock_irqsave(&chip->reg_lock, flags); |
1339 | for (reg = 0; reg < 32; reg++) { | 1449 | for (reg = 0; reg < 32; reg++) { |
1340 | switch (reg) { | 1450 | switch (reg) { |
1341 | case CS4231_VERSION: | 1451 | case CS4231_VERSION: |
1342 | break; | 1452 | break; |
1343 | default: | 1453 | default: |
1344 | snd_cs4231_out(chip, reg, chip->image[reg]); | 1454 | snd_wss_out(chip, reg, chip->image[reg]); |
1345 | break; | 1455 | break; |
1346 | } | 1456 | } |
1347 | } | 1457 | } |
1348 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1458 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1349 | #if 1 | 1459 | #if 1 |
1350 | snd_cs4231_mce_down(chip); | 1460 | snd_wss_mce_down(chip); |
1351 | #else | 1461 | #else |
1352 | /* The following is a workaround to avoid freeze after resume on TP600E. | 1462 | /* The following is a workaround to avoid freeze after resume on TP600E. |
1353 | This is the first half of copy of snd_cs4231_mce_down(), but doesn't | 1463 | This is the first half of copy of snd_wss_mce_down(), but doesn't |
1354 | include rescheduling. -- iwai | 1464 | include rescheduling. -- iwai |
1355 | */ | 1465 | */ |
1356 | snd_cs4231_busy_wait(chip); | 1466 | snd_wss_busy_wait(chip); |
1357 | spin_lock_irqsave(&chip->reg_lock, flags); | 1467 | spin_lock_irqsave(&chip->reg_lock, flags); |
1358 | chip->mce_bit &= ~CS4231_MCE; | 1468 | chip->mce_bit &= ~CS4231_MCE; |
1359 | timeout = cs4231_inb(chip, CS4231P(REGSEL)); | 1469 | timeout = wss_inb(chip, CS4231P(REGSEL)); |
1360 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); | 1470 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); |
1361 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1471 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1362 | if (timeout == 0x80) | 1472 | if (timeout == 0x80) |
1363 | snd_printk("down [0x%lx]: serious init problem - codec still busy\n", chip->port); | 1473 | snd_printk("down [0x%lx]: serious init problem - codec still busy\n", chip->port); |
1364 | if ((timeout & CS4231_MCE) == 0 || | 1474 | if ((timeout & CS4231_MCE) == 0 || |
1365 | !(chip->hardware & (CS4231_HW_CS4231_MASK | CS4231_HW_CS4232_MASK))) { | 1475 | !(chip->hardware & (WSS_HW_CS4231_MASK | WSS_HW_CS4232_MASK))) { |
1366 | return; | 1476 | return; |
1367 | } | 1477 | } |
1368 | snd_cs4231_busy_wait(chip); | 1478 | snd_wss_busy_wait(chip); |
1369 | #endif | 1479 | #endif |
1370 | } | 1480 | } |
1371 | #endif /* CONFIG_PM */ | 1481 | #endif /* CONFIG_PM */ |
1372 | 1482 | ||
1373 | static int snd_cs4231_free(struct snd_cs4231 *chip) | 1483 | static int snd_wss_free(struct snd_wss *chip) |
1374 | { | 1484 | { |
1375 | release_and_free_resource(chip->res_port); | 1485 | release_and_free_resource(chip->res_port); |
1376 | release_and_free_resource(chip->res_cport); | 1486 | release_and_free_resource(chip->res_cport); |
1377 | if (chip->irq >= 0) { | 1487 | if (chip->irq >= 0) { |
1378 | disable_irq(chip->irq); | 1488 | disable_irq(chip->irq); |
1379 | if (!(chip->hwshare & CS4231_HWSHARE_IRQ)) | 1489 | if (!(chip->hwshare & WSS_HWSHARE_IRQ)) |
1380 | free_irq(chip->irq, (void *) chip); | 1490 | free_irq(chip->irq, (void *) chip); |
1381 | } | 1491 | } |
1382 | if (!(chip->hwshare & CS4231_HWSHARE_DMA1) && chip->dma1 >= 0) { | 1492 | if (!(chip->hwshare & WSS_HWSHARE_DMA1) && chip->dma1 >= 0) { |
1383 | snd_dma_disable(chip->dma1); | 1493 | snd_dma_disable(chip->dma1); |
1384 | free_dma(chip->dma1); | 1494 | free_dma(chip->dma1); |
1385 | } | 1495 | } |
1386 | if (!(chip->hwshare & CS4231_HWSHARE_DMA2) && chip->dma2 >= 0 && chip->dma2 != chip->dma1) { | 1496 | if (!(chip->hwshare & WSS_HWSHARE_DMA2) && |
1497 | chip->dma2 >= 0 && chip->dma2 != chip->dma1) { | ||
1387 | snd_dma_disable(chip->dma2); | 1498 | snd_dma_disable(chip->dma2); |
1388 | free_dma(chip->dma2); | 1499 | free_dma(chip->dma2); |
1389 | } | 1500 | } |
@@ -1393,39 +1504,55 @@ static int snd_cs4231_free(struct snd_cs4231 *chip) | |||
1393 | return 0; | 1504 | return 0; |
1394 | } | 1505 | } |
1395 | 1506 | ||
1396 | static int snd_cs4231_dev_free(struct snd_device *device) | 1507 | static int snd_wss_dev_free(struct snd_device *device) |
1397 | { | 1508 | { |
1398 | struct snd_cs4231 *chip = device->device_data; | 1509 | struct snd_wss *chip = device->device_data; |
1399 | return snd_cs4231_free(chip); | 1510 | return snd_wss_free(chip); |
1400 | } | 1511 | } |
1401 | 1512 | ||
1402 | const char *snd_cs4231_chip_id(struct snd_cs4231 *chip) | 1513 | const char *snd_wss_chip_id(struct snd_wss *chip) |
1403 | { | 1514 | { |
1404 | switch (chip->hardware) { | 1515 | switch (chip->hardware) { |
1405 | case CS4231_HW_CS4231: return "CS4231"; | 1516 | case WSS_HW_CS4231: |
1406 | case CS4231_HW_CS4231A: return "CS4231A"; | 1517 | return "CS4231"; |
1407 | case CS4231_HW_CS4232: return "CS4232"; | 1518 | case WSS_HW_CS4231A: |
1408 | case CS4231_HW_CS4232A: return "CS4232A"; | 1519 | return "CS4231A"; |
1409 | case CS4231_HW_CS4235: return "CS4235"; | 1520 | case WSS_HW_CS4232: |
1410 | case CS4231_HW_CS4236: return "CS4236"; | 1521 | return "CS4232"; |
1411 | case CS4231_HW_CS4236B: return "CS4236B"; | 1522 | case WSS_HW_CS4232A: |
1412 | case CS4231_HW_CS4237B: return "CS4237B"; | 1523 | return "CS4232A"; |
1413 | case CS4231_HW_CS4238B: return "CS4238B"; | 1524 | case WSS_HW_CS4235: |
1414 | case CS4231_HW_CS4239: return "CS4239"; | 1525 | return "CS4235"; |
1415 | case CS4231_HW_INTERWAVE: return "AMD InterWave"; | 1526 | case WSS_HW_CS4236: |
1416 | case CS4231_HW_OPL3SA2: return chip->card->shortname; | 1527 | return "CS4236"; |
1417 | case CS4231_HW_AD1845: return "AD1845"; | 1528 | case WSS_HW_CS4236B: |
1418 | case CS4231_HW_OPTI93X: return "OPTi 93x"; | 1529 | return "CS4236B"; |
1419 | default: return "???"; | 1530 | case WSS_HW_CS4237B: |
1531 | return "CS4237B"; | ||
1532 | case WSS_HW_CS4238B: | ||
1533 | return "CS4238B"; | ||
1534 | case WSS_HW_CS4239: | ||
1535 | return "CS4239"; | ||
1536 | case WSS_HW_INTERWAVE: | ||
1537 | return "AMD InterWave"; | ||
1538 | case WSS_HW_OPL3SA2: | ||
1539 | return chip->card->shortname; | ||
1540 | case WSS_HW_AD1845: | ||
1541 | return "AD1845"; | ||
1542 | case WSS_HW_OPTI93X: | ||
1543 | return "OPTi 93x"; | ||
1544 | default: | ||
1545 | return "???"; | ||
1420 | } | 1546 | } |
1421 | } | 1547 | } |
1548 | EXPORT_SYMBOL(snd_wss_chip_id); | ||
1422 | 1549 | ||
1423 | static int snd_cs4231_new(struct snd_card *card, | 1550 | static int snd_wss_new(struct snd_card *card, |
1424 | unsigned short hardware, | 1551 | unsigned short hardware, |
1425 | unsigned short hwshare, | 1552 | unsigned short hwshare, |
1426 | struct snd_cs4231 ** rchip) | 1553 | struct snd_wss **rchip) |
1427 | { | 1554 | { |
1428 | struct snd_cs4231 *chip; | 1555 | struct snd_wss *chip; |
1429 | 1556 | ||
1430 | *rchip = NULL; | 1557 | *rchip = NULL; |
1431 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1558 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
@@ -1438,35 +1565,35 @@ static int snd_cs4231_new(struct snd_card *card, | |||
1438 | mutex_init(&chip->mce_mutex); | 1565 | mutex_init(&chip->mce_mutex); |
1439 | mutex_init(&chip->open_mutex); | 1566 | mutex_init(&chip->open_mutex); |
1440 | chip->card = card; | 1567 | chip->card = card; |
1441 | chip->rate_constraint = snd_cs4231_xrate; | 1568 | chip->rate_constraint = snd_wss_xrate; |
1442 | chip->set_playback_format = snd_cs4231_playback_format; | 1569 | chip->set_playback_format = snd_wss_playback_format; |
1443 | chip->set_capture_format = snd_cs4231_capture_format; | 1570 | chip->set_capture_format = snd_wss_capture_format; |
1444 | if (chip->hardware == CS4231_HW_OPTI93X) | 1571 | if (chip->hardware == WSS_HW_OPTI93X) |
1445 | memcpy(&chip->image, &snd_opti93x_original_image, | 1572 | memcpy(&chip->image, &snd_opti93x_original_image, |
1446 | sizeof(snd_opti93x_original_image)); | 1573 | sizeof(snd_opti93x_original_image)); |
1447 | else | 1574 | else |
1448 | memcpy(&chip->image, &snd_cs4231_original_image, | 1575 | memcpy(&chip->image, &snd_wss_original_image, |
1449 | sizeof(snd_cs4231_original_image)); | 1576 | sizeof(snd_wss_original_image)); |
1450 | 1577 | ||
1451 | *rchip = chip; | 1578 | *rchip = chip; |
1452 | return 0; | 1579 | return 0; |
1453 | } | 1580 | } |
1454 | 1581 | ||
1455 | int snd_cs4231_create(struct snd_card *card, | 1582 | int snd_wss_create(struct snd_card *card, |
1456 | unsigned long port, | 1583 | unsigned long port, |
1457 | unsigned long cport, | 1584 | unsigned long cport, |
1458 | int irq, int dma1, int dma2, | 1585 | int irq, int dma1, int dma2, |
1459 | unsigned short hardware, | 1586 | unsigned short hardware, |
1460 | unsigned short hwshare, | 1587 | unsigned short hwshare, |
1461 | struct snd_cs4231 ** rchip) | 1588 | struct snd_wss **rchip) |
1462 | { | 1589 | { |
1463 | static struct snd_device_ops ops = { | 1590 | static struct snd_device_ops ops = { |
1464 | .dev_free = snd_cs4231_dev_free, | 1591 | .dev_free = snd_wss_dev_free, |
1465 | }; | 1592 | }; |
1466 | struct snd_cs4231 *chip; | 1593 | struct snd_wss *chip; |
1467 | int err; | 1594 | int err; |
1468 | 1595 | ||
1469 | err = snd_cs4231_new(card, hardware, hwshare, &chip); | 1596 | err = snd_wss_new(card, hardware, hwshare, &chip); |
1470 | if (err < 0) | 1597 | if (err < 0) |
1471 | return err; | 1598 | return err; |
1472 | 1599 | ||
@@ -1474,33 +1601,41 @@ int snd_cs4231_create(struct snd_card *card, | |||
1474 | chip->dma1 = -1; | 1601 | chip->dma1 = -1; |
1475 | chip->dma2 = -1; | 1602 | chip->dma2 = -1; |
1476 | 1603 | ||
1477 | if ((chip->res_port = request_region(port, 4, "CS4231")) == NULL) { | 1604 | chip->res_port = request_region(port, 4, "CS4231"); |
1478 | snd_printk(KERN_ERR "cs4231: can't grab port 0x%lx\n", port); | 1605 | if (!chip->res_port) { |
1479 | snd_cs4231_free(chip); | 1606 | snd_printk(KERN_ERR "wss: can't grab port 0x%lx\n", port); |
1607 | snd_wss_free(chip); | ||
1480 | return -EBUSY; | 1608 | return -EBUSY; |
1481 | } | 1609 | } |
1482 | chip->port = port; | 1610 | chip->port = port; |
1483 | if ((long)cport >= 0 && (chip->res_cport = request_region(cport, 8, "CS4232 Control")) == NULL) { | 1611 | if ((long)cport >= 0) { |
1484 | snd_printk(KERN_ERR "cs4231: can't grab control port 0x%lx\n", cport); | 1612 | chip->res_cport = request_region(cport, 8, "CS4232 Control"); |
1485 | snd_cs4231_free(chip); | 1613 | if (!chip->res_cport) { |
1486 | return -ENODEV; | 1614 | snd_printk(KERN_ERR |
1615 | "wss: can't grab control port 0x%lx\n", cport); | ||
1616 | snd_wss_free(chip); | ||
1617 | return -ENODEV; | ||
1618 | } | ||
1487 | } | 1619 | } |
1488 | chip->cport = cport; | 1620 | chip->cport = cport; |
1489 | if (!(hwshare & CS4231_HWSHARE_IRQ) && request_irq(irq, snd_cs4231_interrupt, IRQF_DISABLED, "CS4231", (void *) chip)) { | 1621 | if (!(hwshare & WSS_HWSHARE_IRQ)) |
1490 | snd_printk(KERN_ERR "cs4231: can't grab IRQ %d\n", irq); | 1622 | if (request_irq(irq, snd_wss_interrupt, IRQF_DISABLED, |
1491 | snd_cs4231_free(chip); | 1623 | "CS4231", (void *) chip)) { |
1492 | return -EBUSY; | 1624 | snd_printk(KERN_ERR "wss: can't grab IRQ %d\n", irq); |
1493 | } | 1625 | snd_wss_free(chip); |
1626 | return -EBUSY; | ||
1627 | } | ||
1494 | chip->irq = irq; | 1628 | chip->irq = irq; |
1495 | if (!(hwshare & CS4231_HWSHARE_DMA1) && request_dma(dma1, "CS4231 - 1")) { | 1629 | if (!(hwshare & WSS_HWSHARE_DMA1) && request_dma(dma1, "CS4231 - 1")) { |
1496 | snd_printk(KERN_ERR "cs4231: can't grab DMA1 %d\n", dma1); | 1630 | snd_printk(KERN_ERR "wss: can't grab DMA1 %d\n", dma1); |
1497 | snd_cs4231_free(chip); | 1631 | snd_wss_free(chip); |
1498 | return -EBUSY; | 1632 | return -EBUSY; |
1499 | } | 1633 | } |
1500 | chip->dma1 = dma1; | 1634 | chip->dma1 = dma1; |
1501 | if (!(hwshare & CS4231_HWSHARE_DMA2) && dma1 != dma2 && dma2 >= 0 && request_dma(dma2, "CS4231 - 2")) { | 1635 | if (!(hwshare & WSS_HWSHARE_DMA2) && dma1 != dma2 && |
1502 | snd_printk(KERN_ERR "cs4231: can't grab DMA2 %d\n", dma2); | 1636 | dma2 >= 0 && request_dma(dma2, "CS4231 - 2")) { |
1503 | snd_cs4231_free(chip); | 1637 | snd_printk(KERN_ERR "wss: can't grab DMA2 %d\n", dma2); |
1638 | snd_wss_free(chip); | ||
1504 | return -EBUSY; | 1639 | return -EBUSY; |
1505 | } | 1640 | } |
1506 | if (dma1 == dma2 || dma2 < 0) { | 1641 | if (dma1 == dma2 || dma2 < 0) { |
@@ -1510,58 +1645,60 @@ int snd_cs4231_create(struct snd_card *card, | |||
1510 | chip->dma2 = dma2; | 1645 | chip->dma2 = dma2; |
1511 | 1646 | ||
1512 | /* global setup */ | 1647 | /* global setup */ |
1513 | if (snd_cs4231_probe(chip) < 0) { | 1648 | if (snd_wss_probe(chip) < 0) { |
1514 | snd_cs4231_free(chip); | 1649 | snd_wss_free(chip); |
1515 | return -ENODEV; | 1650 | return -ENODEV; |
1516 | } | 1651 | } |
1517 | snd_cs4231_init(chip); | 1652 | snd_wss_init(chip); |
1518 | 1653 | ||
1519 | #if 0 | 1654 | #if 0 |
1520 | if (chip->hardware & CS4231_HW_CS4232_MASK) { | 1655 | if (chip->hardware & WSS_HW_CS4232_MASK) { |
1521 | if (chip->res_cport == NULL) | 1656 | if (chip->res_cport == NULL) |
1522 | snd_printk("CS4232 control port features are not accessible\n"); | 1657 | snd_printk("CS4232 control port features are not accessible\n"); |
1523 | } | 1658 | } |
1524 | #endif | 1659 | #endif |
1525 | 1660 | ||
1526 | /* Register device */ | 1661 | /* Register device */ |
1527 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 1662 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
1528 | snd_cs4231_free(chip); | 1663 | if (err < 0) { |
1664 | snd_wss_free(chip); | ||
1529 | return err; | 1665 | return err; |
1530 | } | 1666 | } |
1531 | 1667 | ||
1532 | #ifdef CONFIG_PM | 1668 | #ifdef CONFIG_PM |
1533 | /* Power Management */ | 1669 | /* Power Management */ |
1534 | chip->suspend = snd_cs4231_suspend; | 1670 | chip->suspend = snd_wss_suspend; |
1535 | chip->resume = snd_cs4231_resume; | 1671 | chip->resume = snd_wss_resume; |
1536 | #endif | 1672 | #endif |
1537 | 1673 | ||
1538 | *rchip = chip; | 1674 | *rchip = chip; |
1539 | return 0; | 1675 | return 0; |
1540 | } | 1676 | } |
1677 | EXPORT_SYMBOL(snd_wss_create); | ||
1541 | 1678 | ||
1542 | static struct snd_pcm_ops snd_cs4231_playback_ops = { | 1679 | static struct snd_pcm_ops snd_wss_playback_ops = { |
1543 | .open = snd_cs4231_playback_open, | 1680 | .open = snd_wss_playback_open, |
1544 | .close = snd_cs4231_playback_close, | 1681 | .close = snd_wss_playback_close, |
1545 | .ioctl = snd_pcm_lib_ioctl, | 1682 | .ioctl = snd_pcm_lib_ioctl, |
1546 | .hw_params = snd_cs4231_playback_hw_params, | 1683 | .hw_params = snd_wss_playback_hw_params, |
1547 | .hw_free = snd_cs4231_playback_hw_free, | 1684 | .hw_free = snd_wss_playback_hw_free, |
1548 | .prepare = snd_cs4231_playback_prepare, | 1685 | .prepare = snd_wss_playback_prepare, |
1549 | .trigger = snd_cs4231_trigger, | 1686 | .trigger = snd_wss_trigger, |
1550 | .pointer = snd_cs4231_playback_pointer, | 1687 | .pointer = snd_wss_playback_pointer, |
1551 | }; | 1688 | }; |
1552 | 1689 | ||
1553 | static struct snd_pcm_ops snd_cs4231_capture_ops = { | 1690 | static struct snd_pcm_ops snd_wss_capture_ops = { |
1554 | .open = snd_cs4231_capture_open, | 1691 | .open = snd_wss_capture_open, |
1555 | .close = snd_cs4231_capture_close, | 1692 | .close = snd_wss_capture_close, |
1556 | .ioctl = snd_pcm_lib_ioctl, | 1693 | .ioctl = snd_pcm_lib_ioctl, |
1557 | .hw_params = snd_cs4231_capture_hw_params, | 1694 | .hw_params = snd_wss_capture_hw_params, |
1558 | .hw_free = snd_cs4231_capture_hw_free, | 1695 | .hw_free = snd_wss_capture_hw_free, |
1559 | .prepare = snd_cs4231_capture_prepare, | 1696 | .prepare = snd_wss_capture_prepare, |
1560 | .trigger = snd_cs4231_trigger, | 1697 | .trigger = snd_wss_trigger, |
1561 | .pointer = snd_cs4231_capture_pointer, | 1698 | .pointer = snd_wss_capture_pointer, |
1562 | }; | 1699 | }; |
1563 | 1700 | ||
1564 | int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) | 1701 | int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm) |
1565 | { | 1702 | { |
1566 | struct snd_pcm *pcm; | 1703 | struct snd_pcm *pcm; |
1567 | int err; | 1704 | int err; |
@@ -1573,17 +1710,17 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) | |||
1573 | mutex_init(&chip->mce_mutex); | 1710 | mutex_init(&chip->mce_mutex); |
1574 | mutex_init(&chip->open_mutex); | 1711 | mutex_init(&chip->open_mutex); |
1575 | 1712 | ||
1576 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops); | 1713 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_wss_playback_ops); |
1577 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops); | 1714 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_wss_capture_ops); |
1578 | 1715 | ||
1579 | /* global setup */ | 1716 | /* global setup */ |
1580 | pcm->private_data = chip; | 1717 | pcm->private_data = chip; |
1581 | pcm->info_flags = 0; | 1718 | pcm->info_flags = 0; |
1582 | if (chip->single_dma) | 1719 | if (chip->single_dma) |
1583 | pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; | 1720 | pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; |
1584 | if (chip->hardware != CS4231_HW_INTERWAVE) | 1721 | if (chip->hardware != WSS_HW_INTERWAVE) |
1585 | pcm->info_flags |= SNDRV_PCM_INFO_JOINT_DUPLEX; | 1722 | pcm->info_flags |= SNDRV_PCM_INFO_JOINT_DUPLEX; |
1586 | strcpy(pcm->name, snd_cs4231_chip_id(chip)); | 1723 | strcpy(pcm->name, snd_wss_chip_id(chip)); |
1587 | 1724 | ||
1588 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1725 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1589 | snd_dma_isa_data(), | 1726 | snd_dma_isa_data(), |
@@ -1594,14 +1731,15 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) | |||
1594 | *rpcm = pcm; | 1731 | *rpcm = pcm; |
1595 | return 0; | 1732 | return 0; |
1596 | } | 1733 | } |
1734 | EXPORT_SYMBOL(snd_wss_pcm); | ||
1597 | 1735 | ||
1598 | static void snd_cs4231_timer_free(struct snd_timer *timer) | 1736 | static void snd_wss_timer_free(struct snd_timer *timer) |
1599 | { | 1737 | { |
1600 | struct snd_cs4231 *chip = timer->private_data; | 1738 | struct snd_wss *chip = timer->private_data; |
1601 | chip->timer = NULL; | 1739 | chip->timer = NULL; |
1602 | } | 1740 | } |
1603 | 1741 | ||
1604 | int snd_cs4231_timer(struct snd_cs4231 *chip, int device, struct snd_timer **rtimer) | 1742 | int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer) |
1605 | { | 1743 | { |
1606 | struct snd_timer *timer; | 1744 | struct snd_timer *timer; |
1607 | struct snd_timer_id tid; | 1745 | struct snd_timer_id tid; |
@@ -1615,21 +1753,23 @@ int snd_cs4231_timer(struct snd_cs4231 *chip, int device, struct snd_timer **rti | |||
1615 | tid.subdevice = 0; | 1753 | tid.subdevice = 0; |
1616 | if ((err = snd_timer_new(chip->card, "CS4231", &tid, &timer)) < 0) | 1754 | if ((err = snd_timer_new(chip->card, "CS4231", &tid, &timer)) < 0) |
1617 | return err; | 1755 | return err; |
1618 | strcpy(timer->name, snd_cs4231_chip_id(chip)); | 1756 | strcpy(timer->name, snd_wss_chip_id(chip)); |
1619 | timer->private_data = chip; | 1757 | timer->private_data = chip; |
1620 | timer->private_free = snd_cs4231_timer_free; | 1758 | timer->private_free = snd_wss_timer_free; |
1621 | timer->hw = snd_cs4231_timer_table; | 1759 | timer->hw = snd_wss_timer_table; |
1622 | chip->timer = timer; | 1760 | chip->timer = timer; |
1623 | if (rtimer) | 1761 | if (rtimer) |
1624 | *rtimer = timer; | 1762 | *rtimer = timer; |
1625 | return 0; | 1763 | return 0; |
1626 | } | 1764 | } |
1765 | EXPORT_SYMBOL(snd_wss_timer); | ||
1627 | 1766 | ||
1628 | /* | 1767 | /* |
1629 | * MIXER part | 1768 | * MIXER part |
1630 | */ | 1769 | */ |
1631 | 1770 | ||
1632 | static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1771 | static int snd_wss_info_mux(struct snd_kcontrol *kcontrol, |
1772 | struct snd_ctl_elem_info *uinfo) | ||
1633 | { | 1773 | { |
1634 | static char *texts[4] = { | 1774 | static char *texts[4] = { |
1635 | "Line", "Aux", "Mic", "Mix" | 1775 | "Line", "Aux", "Mic", "Mix" |
@@ -1641,7 +1781,7 @@ static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
1641 | "Line", "Synth", "Mic", "Mix" | 1781 | "Line", "Synth", "Mic", "Mix" |
1642 | }; | 1782 | }; |
1643 | char **ptexts = texts; | 1783 | char **ptexts = texts; |
1644 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1784 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1645 | 1785 | ||
1646 | snd_assert(chip->card != NULL, return -EINVAL); | 1786 | snd_assert(chip->card != NULL, return -EINVAL); |
1647 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1787 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
@@ -1652,16 +1792,21 @@ static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
1652 | if (!strcmp(chip->card->driver, "GUS MAX")) | 1792 | if (!strcmp(chip->card->driver, "GUS MAX")) |
1653 | ptexts = gusmax_texts; | 1793 | ptexts = gusmax_texts; |
1654 | switch (chip->hardware) { | 1794 | switch (chip->hardware) { |
1655 | case CS4231_HW_INTERWAVE: ptexts = gusmax_texts; break; | 1795 | case WSS_HW_INTERWAVE: |
1656 | case CS4231_HW_OPL3SA2: ptexts = opl3sa_texts; break; | 1796 | ptexts = gusmax_texts; |
1797 | break; | ||
1798 | case WSS_HW_OPL3SA2: | ||
1799 | ptexts = opl3sa_texts; | ||
1800 | break; | ||
1657 | } | 1801 | } |
1658 | strcpy(uinfo->value.enumerated.name, ptexts[uinfo->value.enumerated.item]); | 1802 | strcpy(uinfo->value.enumerated.name, ptexts[uinfo->value.enumerated.item]); |
1659 | return 0; | 1803 | return 0; |
1660 | } | 1804 | } |
1661 | 1805 | ||
1662 | static int snd_cs4231_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1806 | static int snd_wss_get_mux(struct snd_kcontrol *kcontrol, |
1807 | struct snd_ctl_elem_value *ucontrol) | ||
1663 | { | 1808 | { |
1664 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1809 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1665 | unsigned long flags; | 1810 | unsigned long flags; |
1666 | 1811 | ||
1667 | spin_lock_irqsave(&chip->reg_lock, flags); | 1812 | spin_lock_irqsave(&chip->reg_lock, flags); |
@@ -1671,9 +1816,10 @@ static int snd_cs4231_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
1671 | return 0; | 1816 | return 0; |
1672 | } | 1817 | } |
1673 | 1818 | ||
1674 | static int snd_cs4231_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1819 | static int snd_wss_put_mux(struct snd_kcontrol *kcontrol, |
1820 | struct snd_ctl_elem_value *ucontrol) | ||
1675 | { | 1821 | { |
1676 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1822 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1677 | unsigned long flags; | 1823 | unsigned long flags; |
1678 | unsigned short left, right; | 1824 | unsigned short left, right; |
1679 | int change; | 1825 | int change; |
@@ -1687,14 +1833,15 @@ static int snd_cs4231_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
1687 | left = (chip->image[CS4231_LEFT_INPUT] & ~CS4231_MIXS_ALL) | left; | 1833 | left = (chip->image[CS4231_LEFT_INPUT] & ~CS4231_MIXS_ALL) | left; |
1688 | right = (chip->image[CS4231_RIGHT_INPUT] & ~CS4231_MIXS_ALL) | right; | 1834 | right = (chip->image[CS4231_RIGHT_INPUT] & ~CS4231_MIXS_ALL) | right; |
1689 | change = left != chip->image[CS4231_LEFT_INPUT] || | 1835 | change = left != chip->image[CS4231_LEFT_INPUT] || |
1690 | right != chip->image[CS4231_RIGHT_INPUT]; | 1836 | right != chip->image[CS4231_RIGHT_INPUT]; |
1691 | snd_cs4231_out(chip, CS4231_LEFT_INPUT, left); | 1837 | snd_wss_out(chip, CS4231_LEFT_INPUT, left); |
1692 | snd_cs4231_out(chip, CS4231_RIGHT_INPUT, right); | 1838 | snd_wss_out(chip, CS4231_RIGHT_INPUT, right); |
1693 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1839 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1694 | return change; | 1840 | return change; |
1695 | } | 1841 | } |
1696 | 1842 | ||
1697 | int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1843 | int snd_wss_info_single(struct snd_kcontrol *kcontrol, |
1844 | struct snd_ctl_elem_info *uinfo) | ||
1698 | { | 1845 | { |
1699 | int mask = (kcontrol->private_value >> 16) & 0xff; | 1846 | int mask = (kcontrol->private_value >> 16) & 0xff; |
1700 | 1847 | ||
@@ -1704,10 +1851,12 @@ int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in | |||
1704 | uinfo->value.integer.max = mask; | 1851 | uinfo->value.integer.max = mask; |
1705 | return 0; | 1852 | return 0; |
1706 | } | 1853 | } |
1854 | EXPORT_SYMBOL(snd_wss_info_single); | ||
1707 | 1855 | ||
1708 | int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1856 | int snd_wss_get_single(struct snd_kcontrol *kcontrol, |
1857 | struct snd_ctl_elem_value *ucontrol) | ||
1709 | { | 1858 | { |
1710 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1859 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1711 | unsigned long flags; | 1860 | unsigned long flags; |
1712 | int reg = kcontrol->private_value & 0xff; | 1861 | int reg = kcontrol->private_value & 0xff; |
1713 | int shift = (kcontrol->private_value >> 8) & 0xff; | 1862 | int shift = (kcontrol->private_value >> 8) & 0xff; |
@@ -1721,10 +1870,12 @@ int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
1721 | ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; | 1870 | ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; |
1722 | return 0; | 1871 | return 0; |
1723 | } | 1872 | } |
1873 | EXPORT_SYMBOL(snd_wss_get_single); | ||
1724 | 1874 | ||
1725 | int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1875 | int snd_wss_put_single(struct snd_kcontrol *kcontrol, |
1876 | struct snd_ctl_elem_value *ucontrol) | ||
1726 | { | 1877 | { |
1727 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1878 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1728 | unsigned long flags; | 1879 | unsigned long flags; |
1729 | int reg = kcontrol->private_value & 0xff; | 1880 | int reg = kcontrol->private_value & 0xff; |
1730 | int shift = (kcontrol->private_value >> 8) & 0xff; | 1881 | int shift = (kcontrol->private_value >> 8) & 0xff; |
@@ -1740,12 +1891,14 @@ int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
1740 | spin_lock_irqsave(&chip->reg_lock, flags); | 1891 | spin_lock_irqsave(&chip->reg_lock, flags); |
1741 | val = (chip->image[reg] & ~(mask << shift)) | val; | 1892 | val = (chip->image[reg] & ~(mask << shift)) | val; |
1742 | change = val != chip->image[reg]; | 1893 | change = val != chip->image[reg]; |
1743 | snd_cs4231_out(chip, reg, val); | 1894 | snd_wss_out(chip, reg, val); |
1744 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1895 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1745 | return change; | 1896 | return change; |
1746 | } | 1897 | } |
1898 | EXPORT_SYMBOL(snd_wss_put_single); | ||
1747 | 1899 | ||
1748 | int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1900 | int snd_wss_info_double(struct snd_kcontrol *kcontrol, |
1901 | struct snd_ctl_elem_info *uinfo) | ||
1749 | { | 1902 | { |
1750 | int mask = (kcontrol->private_value >> 24) & 0xff; | 1903 | int mask = (kcontrol->private_value >> 24) & 0xff; |
1751 | 1904 | ||
@@ -1755,10 +1908,12 @@ int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in | |||
1755 | uinfo->value.integer.max = mask; | 1908 | uinfo->value.integer.max = mask; |
1756 | return 0; | 1909 | return 0; |
1757 | } | 1910 | } |
1911 | EXPORT_SYMBOL(snd_wss_info_double); | ||
1758 | 1912 | ||
1759 | int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1913 | int snd_wss_get_double(struct snd_kcontrol *kcontrol, |
1914 | struct snd_ctl_elem_value *ucontrol) | ||
1760 | { | 1915 | { |
1761 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1916 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1762 | unsigned long flags; | 1917 | unsigned long flags; |
1763 | int left_reg = kcontrol->private_value & 0xff; | 1918 | int left_reg = kcontrol->private_value & 0xff; |
1764 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | 1919 | int right_reg = (kcontrol->private_value >> 8) & 0xff; |
@@ -1777,10 +1932,12 @@ int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
1777 | } | 1932 | } |
1778 | return 0; | 1933 | return 0; |
1779 | } | 1934 | } |
1935 | EXPORT_SYMBOL(snd_wss_get_double); | ||
1780 | 1936 | ||
1781 | int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1937 | int snd_wss_put_double(struct snd_kcontrol *kcontrol, |
1938 | struct snd_ctl_elem_value *ucontrol) | ||
1782 | { | 1939 | { |
1783 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1940 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1784 | unsigned long flags; | 1941 | unsigned long flags; |
1785 | int left_reg = kcontrol->private_value & 0xff; | 1942 | int left_reg = kcontrol->private_value & 0xff; |
1786 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | 1943 | int right_reg = (kcontrol->private_value >> 8) & 0xff; |
@@ -1803,81 +1960,98 @@ int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
1803 | val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; | 1960 | val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; |
1804 | val2 = (chip->image[right_reg] & ~(mask << shift_right)) | val2; | 1961 | val2 = (chip->image[right_reg] & ~(mask << shift_right)) | val2; |
1805 | change = val1 != chip->image[left_reg] || val2 != chip->image[right_reg]; | 1962 | change = val1 != chip->image[left_reg] || val2 != chip->image[right_reg]; |
1806 | snd_cs4231_out(chip, left_reg, val1); | 1963 | snd_wss_out(chip, left_reg, val1); |
1807 | snd_cs4231_out(chip, right_reg, val2); | 1964 | snd_wss_out(chip, right_reg, val2); |
1808 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1965 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1809 | return change; | 1966 | return change; |
1810 | } | 1967 | } |
1811 | 1968 | EXPORT_SYMBOL(snd_wss_put_double); | |
1812 | static struct snd_kcontrol_new snd_cs4231_controls[] = { | 1969 | |
1813 | CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 1970 | static struct snd_kcontrol_new snd_wss_controls[] = { |
1814 | CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | 1971 | WSS_DOUBLE("PCM Playback Switch", 0, |
1815 | CS4231_DOUBLE("Line Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 1972 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
1816 | CS4231_DOUBLE("Line Playback Volume", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | 1973 | WSS_DOUBLE("PCM Playback Volume", 0, |
1817 | CS4231_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 1974 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), |
1818 | CS4231_DOUBLE("Aux Playback Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | 1975 | WSS_DOUBLE("Line Playback Switch", 0, |
1819 | CS4231_DOUBLE("Aux Playback Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 1976 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
1820 | CS4231_DOUBLE("Aux Playback Volume", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | 1977 | WSS_DOUBLE("Line Playback Volume", 0, |
1821 | CS4231_SINGLE("Mono Playback Switch", 0, CS4231_MONO_CTRL, 7, 1, 1), | 1978 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), |
1822 | CS4231_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), | 1979 | WSS_DOUBLE("Aux Playback Switch", 0, |
1823 | CS4231_SINGLE("Mono Output Playback Switch", 0, CS4231_MONO_CTRL, 6, 1, 1), | 1980 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
1824 | CS4231_SINGLE("Mono Output Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), | 1981 | WSS_DOUBLE("Aux Playback Volume", 0, |
1825 | CS4231_DOUBLE("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | 1982 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), |
1983 | WSS_DOUBLE("Aux Playback Switch", 1, | ||
1984 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | ||
1985 | WSS_DOUBLE("Aux Playback Volume", 1, | ||
1986 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | ||
1987 | WSS_SINGLE("Mono Playback Switch", 0, | ||
1988 | CS4231_MONO_CTRL, 7, 1, 1), | ||
1989 | WSS_SINGLE("Mono Playback Volume", 0, | ||
1990 | CS4231_MONO_CTRL, 0, 15, 1), | ||
1991 | WSS_SINGLE("Mono Output Playback Switch", 0, | ||
1992 | CS4231_MONO_CTRL, 6, 1, 1), | ||
1993 | WSS_SINGLE("Mono Output Playback Bypass", 0, | ||
1994 | CS4231_MONO_CTRL, 5, 1, 0), | ||
1995 | WSS_DOUBLE("Capture Volume", 0, | ||
1996 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | ||
1826 | { | 1997 | { |
1827 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1828 | .name = "Capture Source", | 1999 | .name = "Capture Source", |
1829 | .info = snd_cs4231_info_mux, | 2000 | .info = snd_wss_info_mux, |
1830 | .get = snd_cs4231_get_mux, | 2001 | .get = snd_wss_get_mux, |
1831 | .put = snd_cs4231_put_mux, | 2002 | .put = snd_wss_put_mux, |
1832 | }, | 2003 | }, |
1833 | CS4231_DOUBLE("Mic Boost", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | 2004 | WSS_DOUBLE("Mic Boost", 0, |
1834 | CS4231_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), | 2005 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), |
1835 | CS4231_SINGLE("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1) | 2006 | WSS_SINGLE("Loopback Capture Switch", 0, |
2007 | CS4231_LOOPBACK, 0, 1, 0), | ||
2008 | WSS_SINGLE("Loopback Capture Volume", 0, | ||
2009 | CS4231_LOOPBACK, 2, 63, 1) | ||
1836 | }; | 2010 | }; |
1837 | 2011 | ||
1838 | static struct snd_kcontrol_new snd_opti93x_controls[] = { | 2012 | static struct snd_kcontrol_new snd_opti93x_controls[] = { |
1839 | CS4231_DOUBLE("Master Playback Switch", 0, | 2013 | WSS_DOUBLE("Master Playback Switch", 0, |
1840 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), | 2014 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), |
1841 | CS4231_DOUBLE("Master Playback Volume", 0, | 2015 | WSS_DOUBLE("Master Playback Volume", 0, |
1842 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), | 2016 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), |
1843 | CS4231_DOUBLE("PCM Playback Switch", 0, | 2017 | WSS_DOUBLE("PCM Playback Switch", 0, |
1844 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 2018 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
1845 | CS4231_DOUBLE("PCM Playback Volume", 0, | 2019 | WSS_DOUBLE("PCM Playback Volume", 0, |
1846 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 31, 1), | 2020 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 31, 1), |
1847 | CS4231_DOUBLE("FM Playback Switch", 0, | 2021 | WSS_DOUBLE("FM Playback Switch", 0, |
1848 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 2022 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), |
1849 | CS4231_DOUBLE("FM Playback Volume", 0, | 2023 | WSS_DOUBLE("FM Playback Volume", 0, |
1850 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 1, 1, 15, 1), | 2024 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 1, 1, 15, 1), |
1851 | CS4231_DOUBLE("Line Playback Switch", 0, | 2025 | WSS_DOUBLE("Line Playback Switch", 0, |
1852 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 2026 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
1853 | CS4231_DOUBLE("Line Playback Volume", 0, | 2027 | WSS_DOUBLE("Line Playback Volume", 0, |
1854 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 15, 1), | 2028 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 15, 1), |
1855 | CS4231_DOUBLE("Mic Playback Switch", 0, | 2029 | WSS_DOUBLE("Mic Playback Switch", 0, |
1856 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1), | 2030 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1), |
1857 | CS4231_DOUBLE("Mic Playback Volume", 0, | 2031 | WSS_DOUBLE("Mic Playback Volume", 0, |
1858 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1), | 2032 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1), |
1859 | CS4231_DOUBLE("Mic Boost", 0, | 2033 | WSS_DOUBLE("Mic Boost", 0, |
1860 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | 2034 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), |
1861 | CS4231_DOUBLE("CD Playback Switch", 0, | 2035 | WSS_DOUBLE("CD Playback Switch", 0, |
1862 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 2036 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
1863 | CS4231_DOUBLE("CD Playback Volume", 0, | 2037 | WSS_DOUBLE("CD Playback Volume", 0, |
1864 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 1, 1, 15, 1), | 2038 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 1, 1, 15, 1), |
1865 | CS4231_DOUBLE("Aux Playback Switch", 0, | 2039 | WSS_DOUBLE("Aux Playback Switch", 0, |
1866 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1), | 2040 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1), |
1867 | CS4231_DOUBLE("Aux Playback Volume", 0, | 2041 | WSS_DOUBLE("Aux Playback Volume", 0, |
1868 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1), | 2042 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1), |
1869 | CS4231_DOUBLE("Capture Volume", 0, | 2043 | WSS_DOUBLE("Capture Volume", 0, |
1870 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | 2044 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), |
1871 | { | 2045 | { |
1872 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2046 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1873 | .name = "Capture Source", | 2047 | .name = "Capture Source", |
1874 | .info = snd_cs4231_info_mux, | 2048 | .info = snd_wss_info_mux, |
1875 | .get = snd_cs4231_get_mux, | 2049 | .get = snd_wss_get_mux, |
1876 | .put = snd_cs4231_put_mux, | 2050 | .put = snd_wss_put_mux, |
1877 | } | 2051 | } |
1878 | }; | 2052 | }; |
1879 | 2053 | ||
1880 | int snd_cs4231_mixer(struct snd_cs4231 *chip) | 2054 | int snd_wss_mixer(struct snd_wss *chip) |
1881 | { | 2055 | { |
1882 | struct snd_card *card; | 2056 | struct snd_card *card; |
1883 | unsigned int idx; | 2057 | unsigned int idx; |
@@ -1889,7 +2063,7 @@ int snd_cs4231_mixer(struct snd_cs4231 *chip) | |||
1889 | 2063 | ||
1890 | strcpy(card->mixername, chip->pcm->name); | 2064 | strcpy(card->mixername, chip->pcm->name); |
1891 | 2065 | ||
1892 | if (chip->hardware == CS4231_HW_OPTI93X) | 2066 | if (chip->hardware == WSS_HW_OPTI93X) |
1893 | for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) { | 2067 | for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) { |
1894 | err = snd_ctl_add(card, | 2068 | err = snd_ctl_add(card, |
1895 | snd_ctl_new1(&snd_opti93x_controls[idx], | 2069 | snd_ctl_new1(&snd_opti93x_controls[idx], |
@@ -1898,48 +2072,29 @@ int snd_cs4231_mixer(struct snd_cs4231 *chip) | |||
1898 | return err; | 2072 | return err; |
1899 | } | 2073 | } |
1900 | else | 2074 | else |
1901 | for (idx = 0; idx < ARRAY_SIZE(snd_cs4231_controls); idx++) { | 2075 | for (idx = 0; idx < ARRAY_SIZE(snd_wss_controls); idx++) { |
1902 | err = snd_ctl_add(card, | 2076 | err = snd_ctl_add(card, |
1903 | snd_ctl_new1(&snd_cs4231_controls[idx], | 2077 | snd_ctl_new1(&snd_wss_controls[idx], |
1904 | chip)); | 2078 | chip)); |
1905 | if (err < 0) | 2079 | if (err < 0) |
1906 | return err; | 2080 | return err; |
1907 | } | 2081 | } |
1908 | return 0; | 2082 | return 0; |
1909 | } | 2083 | } |
1910 | 2084 | EXPORT_SYMBOL(snd_wss_mixer); | |
1911 | EXPORT_SYMBOL(snd_cs4231_out); | ||
1912 | EXPORT_SYMBOL(snd_cs4231_in); | ||
1913 | EXPORT_SYMBOL(snd_cs4236_ext_out); | ||
1914 | EXPORT_SYMBOL(snd_cs4236_ext_in); | ||
1915 | EXPORT_SYMBOL(snd_cs4231_mce_up); | ||
1916 | EXPORT_SYMBOL(snd_cs4231_mce_down); | ||
1917 | EXPORT_SYMBOL(snd_cs4231_overrange); | ||
1918 | EXPORT_SYMBOL(snd_cs4231_interrupt); | ||
1919 | EXPORT_SYMBOL(snd_cs4231_chip_id); | ||
1920 | EXPORT_SYMBOL(snd_cs4231_create); | ||
1921 | EXPORT_SYMBOL(snd_cs4231_pcm); | ||
1922 | EXPORT_SYMBOL(snd_cs4231_mixer); | ||
1923 | EXPORT_SYMBOL(snd_cs4231_timer); | ||
1924 | EXPORT_SYMBOL(snd_cs4231_info_single); | ||
1925 | EXPORT_SYMBOL(snd_cs4231_get_single); | ||
1926 | EXPORT_SYMBOL(snd_cs4231_put_single); | ||
1927 | EXPORT_SYMBOL(snd_cs4231_info_double); | ||
1928 | EXPORT_SYMBOL(snd_cs4231_get_double); | ||
1929 | EXPORT_SYMBOL(snd_cs4231_put_double); | ||
1930 | 2085 | ||
1931 | /* | 2086 | /* |
1932 | * INIT part | 2087 | * INIT part |
1933 | */ | 2088 | */ |
1934 | 2089 | ||
1935 | static int __init alsa_cs4231_init(void) | 2090 | static int __init alsa_wss_init(void) |
1936 | { | 2091 | { |
1937 | return 0; | 2092 | return 0; |
1938 | } | 2093 | } |
1939 | 2094 | ||
1940 | static void __exit alsa_cs4231_exit(void) | 2095 | static void __exit alsa_wss_exit(void) |
1941 | { | 2096 | { |
1942 | } | 2097 | } |
1943 | 2098 | ||
1944 | module_init(alsa_cs4231_init) | 2099 | module_init(alsa_wss_init); |
1945 | module_exit(alsa_cs4231_exit) | 2100 | module_exit(alsa_wss_exit); |