diff options
Diffstat (limited to 'sound/isa/wss/wss_lib.c')
| -rw-r--r-- | sound/isa/wss/wss_lib.c | 163 |
1 files changed, 44 insertions, 119 deletions
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 5d2ba1b749ab..9191b32d9130 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c | |||
| @@ -1682,7 +1682,7 @@ static void snd_wss_resume(struct snd_wss *chip) | |||
| 1682 | } | 1682 | } |
| 1683 | #endif /* CONFIG_PM */ | 1683 | #endif /* CONFIG_PM */ |
| 1684 | 1684 | ||
| 1685 | int snd_wss_free(struct snd_wss *chip) | 1685 | static int snd_wss_free(struct snd_wss *chip) |
| 1686 | { | 1686 | { |
| 1687 | release_and_free_resource(chip->res_port); | 1687 | release_and_free_resource(chip->res_port); |
| 1688 | release_and_free_resource(chip->res_cport); | 1688 | release_and_free_resource(chip->res_cport); |
| @@ -1705,7 +1705,6 @@ int snd_wss_free(struct snd_wss *chip) | |||
| 1705 | kfree(chip); | 1705 | kfree(chip); |
| 1706 | return 0; | 1706 | return 0; |
| 1707 | } | 1707 | } |
| 1708 | EXPORT_SYMBOL(snd_wss_free); | ||
| 1709 | 1708 | ||
| 1710 | static int snd_wss_dev_free(struct snd_device *device) | 1709 | static int snd_wss_dev_free(struct snd_device *device) |
| 1711 | { | 1710 | { |
| @@ -2015,6 +2014,7 @@ static int snd_wss_info_mux(struct snd_kcontrol *kcontrol, | |||
| 2015 | case WSS_HW_INTERWAVE: | 2014 | case WSS_HW_INTERWAVE: |
| 2016 | ptexts = gusmax_texts; | 2015 | ptexts = gusmax_texts; |
| 2017 | break; | 2016 | break; |
| 2017 | case WSS_HW_OPTI93X: | ||
| 2018 | case WSS_HW_OPL3SA2: | 2018 | case WSS_HW_OPL3SA2: |
| 2019 | ptexts = opl3sa_texts; | 2019 | ptexts = opl3sa_texts; |
| 2020 | break; | 2020 | break; |
| @@ -2198,64 +2198,26 @@ EXPORT_SYMBOL(snd_wss_put_double); | |||
| 2198 | static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0); | 2198 | static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0); |
| 2199 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); | 2199 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); |
| 2200 | static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); | 2200 | static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); |
| 2201 | 2201 | static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); | |
| 2202 | static struct snd_kcontrol_new snd_ad1848_controls[] = { | ||
| 2203 | WSS_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, | ||
| 2204 | 7, 7, 1, 1), | ||
| 2205 | WSS_DOUBLE_TLV("PCM Playback Volume", 0, | ||
| 2206 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, | ||
| 2207 | db_scale_6bit), | ||
| 2208 | WSS_DOUBLE("Aux Playback Switch", 0, | ||
| 2209 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | ||
| 2210 | WSS_DOUBLE_TLV("Aux Playback Volume", 0, | ||
| 2211 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, | ||
| 2212 | db_scale_5bit_12db_max), | ||
| 2213 | WSS_DOUBLE("Aux Playback Switch", 1, | ||
| 2214 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | ||
| 2215 | WSS_DOUBLE_TLV("Aux Playback Volume", 1, | ||
| 2216 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, | ||
| 2217 | db_scale_5bit_12db_max), | ||
| 2218 | WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, | ||
| 2219 | 0, 0, 15, 0, db_scale_rec_gain), | ||
| 2220 | { | ||
| 2221 | .name = "Capture Source", | ||
| 2222 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 2223 | .info = snd_wss_info_mux, | ||
| 2224 | .get = snd_wss_get_mux, | ||
| 2225 | .put = snd_wss_put_mux, | ||
| 2226 | }, | ||
| 2227 | WSS_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), | ||
| 2228 | WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 1, 63, 0, | ||
| 2229 | db_scale_6bit), | ||
| 2230 | }; | ||
| 2231 | 2202 | ||
| 2232 | static struct snd_kcontrol_new snd_wss_controls[] = { | 2203 | static struct snd_kcontrol_new snd_wss_controls[] = { |
| 2233 | WSS_DOUBLE("PCM Playback Switch", 0, | 2204 | WSS_DOUBLE("PCM Playback Switch", 0, |
| 2234 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 2205 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
| 2235 | WSS_DOUBLE("PCM Playback Volume", 0, | 2206 | WSS_DOUBLE_TLV("PCM Playback Volume", 0, |
| 2236 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | 2207 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, |
| 2237 | WSS_DOUBLE("Line Playback Switch", 0, | 2208 | db_scale_6bit), |
| 2238 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | ||
| 2239 | WSS_DOUBLE("Line Playback Volume", 0, | ||
| 2240 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | ||
| 2241 | WSS_DOUBLE("Aux Playback Switch", 0, | 2209 | WSS_DOUBLE("Aux Playback Switch", 0, |
| 2242 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 2210 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
| 2243 | WSS_DOUBLE("Aux Playback Volume", 0, | 2211 | WSS_DOUBLE_TLV("Aux Playback Volume", 0, |
| 2244 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | 2212 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1, |
| 2213 | db_scale_5bit_12db_max), | ||
| 2245 | WSS_DOUBLE("Aux Playback Switch", 1, | 2214 | WSS_DOUBLE("Aux Playback Switch", 1, |
| 2246 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 2215 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), |
| 2247 | WSS_DOUBLE("Aux Playback Volume", 1, | 2216 | WSS_DOUBLE_TLV("Aux Playback Volume", 1, |
| 2248 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | 2217 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1, |
| 2249 | WSS_SINGLE("Mono Playback Switch", 0, | 2218 | db_scale_5bit_12db_max), |
| 2250 | CS4231_MONO_CTRL, 7, 1, 1), | 2219 | WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, |
| 2251 | WSS_SINGLE("Mono Playback Volume", 0, | 2220 | 0, 0, 15, 0, db_scale_rec_gain), |
| 2252 | CS4231_MONO_CTRL, 0, 15, 1), | ||
| 2253 | WSS_SINGLE("Mono Output Playback Switch", 0, | ||
| 2254 | CS4231_MONO_CTRL, 6, 1, 1), | ||
| 2255 | WSS_SINGLE("Mono Output Playback Bypass", 0, | ||
| 2256 | CS4231_MONO_CTRL, 5, 1, 0), | ||
| 2257 | WSS_DOUBLE("Capture Volume", 0, | ||
| 2258 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | ||
| 2259 | { | 2221 | { |
| 2260 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2222 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2261 | .name = "Capture Source", | 2223 | .name = "Capture Source", |
| @@ -2263,54 +2225,26 @@ WSS_DOUBLE("Capture Volume", 0, | |||
| 2263 | .get = snd_wss_get_mux, | 2225 | .get = snd_wss_get_mux, |
| 2264 | .put = snd_wss_put_mux, | 2226 | .put = snd_wss_put_mux, |
| 2265 | }, | 2227 | }, |
| 2266 | WSS_DOUBLE("Mic Boost", 0, | 2228 | WSS_DOUBLE("Mic Boost (+20dB)", 0, |
| 2267 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | 2229 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), |
| 2268 | WSS_SINGLE("Loopback Capture Switch", 0, | 2230 | WSS_SINGLE("Loopback Capture Switch", 0, |
| 2269 | CS4231_LOOPBACK, 0, 1, 0), | 2231 | CS4231_LOOPBACK, 0, 1, 0), |
| 2270 | WSS_SINGLE("Loopback Capture Volume", 0, | 2232 | WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1, |
| 2271 | CS4231_LOOPBACK, 2, 63, 1) | 2233 | db_scale_6bit), |
| 2272 | }; | ||
| 2273 | |||
| 2274 | static struct snd_kcontrol_new snd_opti93x_controls[] = { | ||
| 2275 | WSS_DOUBLE("Master Playback Switch", 0, | ||
| 2276 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), | ||
| 2277 | WSS_DOUBLE("Master Playback Volume", 0, | ||
| 2278 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), | ||
| 2279 | WSS_DOUBLE("PCM Playback Switch", 0, | ||
| 2280 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | ||
| 2281 | WSS_DOUBLE("PCM Playback Volume", 0, | ||
| 2282 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 31, 1), | ||
| 2283 | WSS_DOUBLE("FM Playback Switch", 0, | ||
| 2284 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | ||
| 2285 | WSS_DOUBLE("FM Playback Volume", 0, | ||
| 2286 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 1, 1, 15, 1), | ||
| 2287 | WSS_DOUBLE("Line Playback Switch", 0, | 2234 | WSS_DOUBLE("Line Playback Switch", 0, |
| 2288 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 2235 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
| 2289 | WSS_DOUBLE("Line Playback Volume", 0, | 2236 | WSS_DOUBLE_TLV("Line Playback Volume", 0, |
| 2290 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 15, 1), | 2237 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, |
| 2291 | WSS_DOUBLE("Mic Playback Switch", 0, | 2238 | db_scale_5bit_12db_max), |
| 2292 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1), | 2239 | WSS_SINGLE("Beep Playback Switch", 0, |
| 2293 | WSS_DOUBLE("Mic Playback Volume", 0, | 2240 | CS4231_MONO_CTRL, 7, 1, 1), |
| 2294 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1), | 2241 | WSS_SINGLE_TLV("Beep Playback Volume", 0, |
| 2295 | WSS_DOUBLE("Mic Boost", 0, | 2242 | CS4231_MONO_CTRL, 0, 15, 1, |
| 2296 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | 2243 | db_scale_4bit), |
| 2297 | WSS_DOUBLE("CD Playback Switch", 0, | 2244 | WSS_SINGLE("Mono Output Playback Switch", 0, |
| 2298 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 2245 | CS4231_MONO_CTRL, 6, 1, 1), |
| 2299 | WSS_DOUBLE("CD Playback Volume", 0, | 2246 | WSS_SINGLE("Beep Bypass Playback Switch", 0, |
| 2300 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 1, 1, 15, 1), | 2247 | CS4231_MONO_CTRL, 5, 1, 0), |
| 2301 | WSS_DOUBLE("Aux Playback Switch", 0, | ||
| 2302 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1), | ||
| 2303 | WSS_DOUBLE("Aux Playback Volume", 0, | ||
| 2304 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1), | ||
| 2305 | WSS_DOUBLE("Capture Volume", 0, | ||
| 2306 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | ||
| 2307 | { | ||
| 2308 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 2309 | .name = "Capture Source", | ||
| 2310 | .info = snd_wss_info_mux, | ||
| 2311 | .get = snd_wss_get_mux, | ||
| 2312 | .put = snd_wss_put_mux, | ||
| 2313 | } | ||
| 2314 | }; | 2248 | }; |
| 2315 | 2249 | ||
| 2316 | int snd_wss_mixer(struct snd_wss *chip) | 2250 | int snd_wss_mixer(struct snd_wss *chip) |
| @@ -2318,6 +2252,7 @@ int snd_wss_mixer(struct snd_wss *chip) | |||
| 2318 | struct snd_card *card; | 2252 | struct snd_card *card; |
| 2319 | unsigned int idx; | 2253 | unsigned int idx; |
| 2320 | int err; | 2254 | int err; |
| 2255 | int count = ARRAY_SIZE(snd_wss_controls); | ||
| 2321 | 2256 | ||
| 2322 | if (snd_BUG_ON(!chip || !chip->pcm)) | 2257 | if (snd_BUG_ON(!chip || !chip->pcm)) |
| 2323 | return -EINVAL; | 2258 | return -EINVAL; |
| @@ -2326,30 +2261,20 @@ int snd_wss_mixer(struct snd_wss *chip) | |||
| 2326 | 2261 | ||
| 2327 | strcpy(card->mixername, chip->pcm->name); | 2262 | strcpy(card->mixername, chip->pcm->name); |
| 2328 | 2263 | ||
| 2329 | if (chip->hardware == WSS_HW_OPTI93X) | 2264 | /* Use only the first 11 entries on AD1848 */ |
| 2330 | for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) { | 2265 | if (chip->hardware & WSS_HW_AD1848_MASK) |
| 2331 | err = snd_ctl_add(card, | 2266 | count = 11; |
| 2332 | snd_ctl_new1(&snd_opti93x_controls[idx], | 2267 | /* There is no loopback on OPTI93X */ |
| 2333 | chip)); | 2268 | else if (chip->hardware == WSS_HW_OPTI93X) |
| 2334 | if (err < 0) | 2269 | count = 9; |
| 2335 | return err; | 2270 | |
| 2336 | } | 2271 | for (idx = 0; idx < count; idx++) { |
| 2337 | else if (chip->hardware & WSS_HW_AD1848_MASK) | 2272 | err = snd_ctl_add(card, |
| 2338 | for (idx = 0; idx < ARRAY_SIZE(snd_ad1848_controls); idx++) { | 2273 | snd_ctl_new1(&snd_wss_controls[idx], |
| 2339 | err = snd_ctl_add(card, | 2274 | chip)); |
| 2340 | snd_ctl_new1(&snd_ad1848_controls[idx], | 2275 | if (err < 0) |
| 2341 | chip)); | 2276 | return err; |
| 2342 | if (err < 0) | 2277 | } |
| 2343 | return err; | ||
| 2344 | } | ||
| 2345 | else | ||
| 2346 | for (idx = 0; idx < ARRAY_SIZE(snd_wss_controls); idx++) { | ||
| 2347 | err = snd_ctl_add(card, | ||
| 2348 | snd_ctl_new1(&snd_wss_controls[idx], | ||
| 2349 | chip)); | ||
| 2350 | if (err < 0) | ||
| 2351 | return err; | ||
| 2352 | } | ||
| 2353 | return 0; | 2278 | return 0; |
| 2354 | } | 2279 | } |
| 2355 | EXPORT_SYMBOL(snd_wss_mixer); | 2280 | EXPORT_SYMBOL(snd_wss_mixer); |
