aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2009-10-11 06:38:49 -0400
committerTakashi Iwai <tiwai@suse.de>2009-10-11 12:02:58 -0400
commit633c7e92bdd54ba939f2bd3b78c72e1e1a1dd077 (patch)
treea03ec9972f1f7cc6aa42fbed8032d8015c4ecb9e /sound/isa
parentabd134db940ddccaf6a61d88cf0841a62b917ab3 (diff)
ALSA: wss: reuse CS4231 controls for AD1848
The C4231 control set is a superset of the AD1848 control set so reuse the CS4231 controls definitions for the AD1848. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/wss/wss_lib.c79
1 files changed, 23 insertions, 56 deletions
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c
index 754a2089c650..2ba18978b419 100644
--- a/sound/isa/wss/wss_lib.c
+++ b/sound/isa/wss/wss_lib.c
@@ -2200,49 +2200,12 @@ static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0);
2200static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); 2200static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0);
2201static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); 2201static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0);
2202 2202
2203static struct snd_kcontrol_new snd_ad1848_controls[] = {
2204WSS_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT,
2205 7, 7, 1, 1),
2206WSS_DOUBLE_TLV("PCM Playback Volume", 0,
2207 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1,
2208 db_scale_6bit),
2209WSS_DOUBLE("Aux Playback Switch", 0,
2210 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
2211WSS_DOUBLE_TLV("Aux Playback Volume", 0,
2212 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1,
2213 db_scale_5bit_12db_max),
2214WSS_DOUBLE("Aux Playback Switch", 1,
2215 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
2216WSS_DOUBLE_TLV("Aux Playback Volume", 1,
2217 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1,
2218 db_scale_5bit_12db_max),
2219WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT,
2220 0, 0, 15, 0, db_scale_rec_gain),
2221{
2222 .name = "Capture Source",
2223 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2224 .info = snd_wss_info_mux,
2225 .get = snd_wss_get_mux,
2226 .put = snd_wss_put_mux,
2227},
2228WSS_DOUBLE("Mic Boost", 0,
2229 CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0),
2230WSS_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0),
2231WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1,
2232 db_scale_6bit),
2233};
2234
2235static struct snd_kcontrol_new snd_wss_controls[] = { 2203static struct snd_kcontrol_new snd_wss_controls[] = {
2236WSS_DOUBLE("PCM Playback Switch", 0, 2204WSS_DOUBLE("PCM Playback Switch", 0,
2237 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 2205 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
2238WSS_DOUBLE_TLV("PCM Playback Volume", 0, 2206WSS_DOUBLE_TLV("PCM Playback Volume", 0,
2239 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1, 2207 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1,
2240 db_scale_6bit), 2208 db_scale_6bit),
2241WSS_DOUBLE("Line Playback Switch", 0,
2242 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
2243WSS_DOUBLE_TLV("Line Playback Volume", 0,
2244 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1,
2245 db_scale_5bit_12db_max),
2246WSS_DOUBLE("Aux Playback Switch", 0, 2209WSS_DOUBLE("Aux Playback Switch", 0,
2247 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),
2248WSS_DOUBLE_TLV("Aux Playback Volume", 0, 2211WSS_DOUBLE_TLV("Aux Playback Volume", 0,
@@ -2253,15 +2216,6 @@ WSS_DOUBLE("Aux Playback Switch", 1,
2253WSS_DOUBLE_TLV("Aux Playback Volume", 1, 2216WSS_DOUBLE_TLV("Aux Playback Volume", 1,
2254 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,
2255 db_scale_5bit_12db_max), 2218 db_scale_5bit_12db_max),
2256WSS_SINGLE("Mono Playback Switch", 0,
2257 CS4231_MONO_CTRL, 7, 1, 1),
2258WSS_SINGLE_TLV("Mono Playback Volume", 0,
2259 CS4231_MONO_CTRL, 0, 15, 1,
2260 db_scale_4bit),
2261WSS_SINGLE("Mono Output Playback Switch", 0,
2262 CS4231_MONO_CTRL, 6, 1, 1),
2263WSS_SINGLE("Mono Output Playback Bypass", 0,
2264 CS4231_MONO_CTRL, 5, 1, 0),
2265WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 2219WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT,
2266 0, 0, 15, 0, db_scale_rec_gain), 2220 0, 0, 15, 0, db_scale_rec_gain),
2267{ 2221{
@@ -2277,6 +2231,20 @@ WSS_SINGLE("Loopback Capture Switch", 0,
2277 CS4231_LOOPBACK, 0, 1, 0), 2231 CS4231_LOOPBACK, 0, 1, 0),
2278WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1, 2232WSS_SINGLE_TLV("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1,
2279 db_scale_6bit), 2233 db_scale_6bit),
2234WSS_DOUBLE("Line Playback Switch", 0,
2235 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
2236WSS_DOUBLE_TLV("Line Playback Volume", 0,
2237 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1,
2238 db_scale_5bit_12db_max),
2239WSS_SINGLE("Mono Playback Switch", 0,
2240 CS4231_MONO_CTRL, 7, 1, 1),
2241WSS_SINGLE_TLV("Mono Playback Volume", 0,
2242 CS4231_MONO_CTRL, 0, 15, 1,
2243 db_scale_4bit),
2244WSS_SINGLE("Mono Output Playback Switch", 0,
2245 CS4231_MONO_CTRL, 6, 1, 1),
2246WSS_SINGLE("Mono Output Playback Bypass", 0,
2247 CS4231_MONO_CTRL, 5, 1, 0),
2280}; 2248};
2281 2249
2282static struct snd_kcontrol_new snd_opti93x_controls[] = { 2250static struct snd_kcontrol_new snd_opti93x_controls[] = {
@@ -2343,22 +2311,21 @@ int snd_wss_mixer(struct snd_wss *chip)
2343 if (err < 0) 2311 if (err < 0)
2344 return err; 2312 return err;
2345 } 2313 }
2346 else if (chip->hardware & WSS_HW_AD1848_MASK) 2314 else {
2347 for (idx = 0; idx < ARRAY_SIZE(snd_ad1848_controls); idx++) { 2315 int count = ARRAY_SIZE(snd_wss_controls);
2348 err = snd_ctl_add(card, 2316
2349 snd_ctl_new1(&snd_ad1848_controls[idx], 2317 /* Use only the first 11 entries on AD1848 */
2350 chip)); 2318 if (chip->hardware & WSS_HW_AD1848_MASK)
2351 if (err < 0) 2319 count = 11;
2352 return err; 2320
2353 } 2321 for (idx = 0; idx < count; idx++) {
2354 else
2355 for (idx = 0; idx < ARRAY_SIZE(snd_wss_controls); idx++) {
2356 err = snd_ctl_add(card, 2322 err = snd_ctl_add(card,
2357 snd_ctl_new1(&snd_wss_controls[idx], 2323 snd_ctl_new1(&snd_wss_controls[idx],
2358 chip)); 2324 chip));
2359 if (err < 0) 2325 if (err < 0)
2360 return err; 2326 return err;
2361 } 2327 }
2328 }
2362 return 0; 2329 return 0;
2363} 2330}
2364EXPORT_SYMBOL(snd_wss_mixer); 2331EXPORT_SYMBOL(snd_wss_mixer);