diff options
author | Raymond Yau <superquad.vortex2@gmail.com> | 2011-02-08 06:58:25 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-02-14 11:14:35 -0500 |
commit | 2822084607c41ca3a2eb70e804aebaddcfdbe5a6 (patch) | |
tree | f79f1254636f7d9b2d30863510334c5762bf3412 | |
parent | 2b203dbbcbac731b07bd0e27c3eda26a26aecb72 (diff) |
ALSA: hda - simplify multistreaming playback model of ad1988
Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_analog.c | 117 |
1 files changed, 10 insertions, 107 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 8dabab798689..734c6ee55d8a 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -30,10 +30,10 @@ | |||
30 | #include "hda_beep.h" | 30 | #include "hda_beep.h" |
31 | 31 | ||
32 | struct ad198x_spec { | 32 | struct ad198x_spec { |
33 | struct snd_kcontrol_new *mixers[5]; | 33 | struct snd_kcontrol_new *mixers[6]; |
34 | int num_mixers; | 34 | int num_mixers; |
35 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | 35 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
36 | const struct hda_verb *init_verbs[5]; /* initialization verbs | 36 | const struct hda_verb *init_verbs[6]; /* initialization verbs |
37 | * don't forget NULL termination! | 37 | * don't forget NULL termination! |
38 | */ | 38 | */ |
39 | unsigned int num_init_verbs; | 39 | unsigned int num_init_verbs; |
@@ -331,36 +331,11 @@ static int ad198x_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
331 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | 331 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
332 | } | 332 | } |
333 | 333 | ||
334 | static int ad198x_alt_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
335 | struct hda_codec *codec, | ||
336 | unsigned int stream_tag, | ||
337 | unsigned int format, | ||
338 | struct snd_pcm_substream *substream) | ||
339 | { | ||
340 | struct ad198x_spec *spec = codec->spec; | ||
341 | snd_hda_codec_setup_stream(codec, spec->alt_dac_nid[0], stream_tag, | ||
342 | 0, format); | ||
343 | return 0; | ||
344 | } | ||
345 | |||
346 | static int ad198x_alt_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
347 | struct hda_codec *codec, | ||
348 | struct snd_pcm_substream *substream) | ||
349 | { | ||
350 | struct ad198x_spec *spec = codec->spec; | ||
351 | snd_hda_codec_cleanup_stream(codec, spec->alt_dac_nid[0]); | ||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static struct hda_pcm_stream ad198x_pcm_analog_alt_playback = { | 334 | static struct hda_pcm_stream ad198x_pcm_analog_alt_playback = { |
356 | .substreams = 1, | 335 | .substreams = 1, |
357 | .channels_min = 2, | 336 | .channels_min = 2, |
358 | .channels_max = 2, | 337 | .channels_max = 2, |
359 | /* NID is set in ad198x_build_pcms */ | 338 | /* NID is set in ad198x_build_pcms */ |
360 | .ops = { | ||
361 | .prepare = ad198x_alt_playback_pcm_prepare, | ||
362 | .cleanup = ad198x_alt_playback_pcm_cleanup | ||
363 | }, | ||
364 | }; | 339 | }; |
365 | 340 | ||
366 | /* | 341 | /* |
@@ -2239,29 +2214,6 @@ static struct snd_kcontrol_new ad1988_6stack_mixers2[] = { | |||
2239 | static struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = { | 2214 | static struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = { |
2240 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | 2215 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
2241 | 2216 | ||
2242 | HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT), | ||
2243 | HDA_BIND_MUTE("Surround Playback Switch", 0x2a, 2, HDA_INPUT), | ||
2244 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x27, 1, 2, HDA_INPUT), | ||
2245 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x27, 2, 2, HDA_INPUT), | ||
2246 | HDA_BIND_MUTE("Side Playback Switch", 0x28, 2, HDA_INPUT), | ||
2247 | HDA_BIND_MUTE("Headphone Playback Switch", 0x22, 2, HDA_INPUT), | ||
2248 | HDA_BIND_MUTE("Mono Playback Switch", 0x1e, 2, HDA_INPUT), | ||
2249 | |||
2250 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x6, HDA_INPUT), | ||
2251 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x6, HDA_INPUT), | ||
2252 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x0, HDA_INPUT), | ||
2253 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x0, HDA_INPUT), | ||
2254 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT), | ||
2255 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT), | ||
2256 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), | ||
2257 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), | ||
2258 | |||
2259 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | ||
2260 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
2261 | |||
2262 | HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x39, 0x0, HDA_OUTPUT), | ||
2263 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x3c, 0x0, HDA_OUTPUT), | ||
2264 | |||
2265 | { } /* end */ | 2217 | { } /* end */ |
2266 | }; | 2218 | }; |
2267 | 2219 | ||
@@ -2545,11 +2497,6 @@ static struct hda_verb ad1988_6stack_init_verbs[] = { | |||
2545 | }; | 2497 | }; |
2546 | 2498 | ||
2547 | static struct hda_verb ad1988_6stack_fp_init_verbs[] = { | 2499 | static struct hda_verb ad1988_6stack_fp_init_verbs[] = { |
2548 | /* Front, Surround, CLFE, side DAC; unmute as default */ | ||
2549 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2550 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2551 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2552 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2553 | /* Headphone; unmute as default */ | 2500 | /* Headphone; unmute as default */ |
2554 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2501 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2555 | /* Port-A front headphon path */ | 2502 | /* Port-A front headphon path */ |
@@ -2558,50 +2505,6 @@ static struct hda_verb ad1988_6stack_fp_init_verbs[] = { | |||
2558 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 2505 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
2559 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2506 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2560 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 2507 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
2561 | /* Port-D line-out path */ | ||
2562 | {0x29, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2563 | {0x29, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2564 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2565 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2566 | /* Port-F surround path */ | ||
2567 | {0x2a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2568 | {0x2a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2569 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2570 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2571 | /* Port-G CLFE path */ | ||
2572 | {0x27, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2573 | {0x27, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2574 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2575 | {0x24, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2576 | /* Port-H side path */ | ||
2577 | {0x28, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2578 | {0x28, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2579 | {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2580 | {0x25, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2581 | /* Mono out path */ | ||
2582 | {0x36, AC_VERB_SET_CONNECT_SEL, 0x1}, /* DAC1:04h */ | ||
2583 | {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2584 | {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
2585 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2586 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, 0xb01f}, /* unmute, 0dB */ | ||
2587 | /* Port-B front mic-in path */ | ||
2588 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2589 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
2590 | {0x39, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
2591 | /* Port-C line-in path */ | ||
2592 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2593 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
2594 | {0x3a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
2595 | {0x33, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
2596 | /* Port-E mic-in path */ | ||
2597 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2598 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
2599 | {0x3c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
2600 | {0x34, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
2601 | /* Analog CD Input */ | ||
2602 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
2603 | /* Analog Mix output amp */ | ||
2604 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ | ||
2605 | 2508 | ||
2606 | { } | 2509 | { } |
2607 | }; | 2510 | }; |
@@ -3316,20 +3219,20 @@ static int patch_ad1988(struct hda_codec *codec) | |||
3316 | spec->mixers[0] = ad1988_6stack_mixers1_rev2; | 3219 | spec->mixers[0] = ad1988_6stack_mixers1_rev2; |
3317 | else | 3220 | else |
3318 | spec->mixers[0] = ad1988_6stack_mixers1; | 3221 | spec->mixers[0] = ad1988_6stack_mixers1; |
3222 | spec->mixers[1] = ad1988_6stack_mixers2; | ||
3223 | spec->num_init_verbs = 1; | ||
3224 | spec->init_verbs[0] = ad1988_6stack_init_verbs; | ||
3319 | if (board_config == AD1988_6STACK_DIG_FP) { | 3225 | if (board_config == AD1988_6STACK_DIG_FP) { |
3320 | spec->mixers[1] = ad1988_6stack_fp_mixers; | 3226 | spec->num_mixers++; |
3227 | spec->mixers[2] = ad1988_6stack_fp_mixers; | ||
3228 | spec->num_init_verbs++; | ||
3229 | spec->init_verbs[1] = ad1988_6stack_fp_init_verbs; | ||
3321 | spec->slave_vols = ad1988_6stack_fp_slave_vols; | 3230 | spec->slave_vols = ad1988_6stack_fp_slave_vols; |
3322 | spec->slave_sws = ad1988_6stack_fp_slave_sws; | 3231 | spec->slave_sws = ad1988_6stack_fp_slave_sws; |
3323 | spec->alt_dac_nid = ad1988_alt_dac_nid; | 3232 | spec->alt_dac_nid = ad1988_alt_dac_nid; |
3324 | spec->stream_analog_alt_playback = | 3233 | spec->stream_analog_alt_playback = |
3325 | &ad198x_pcm_analog_alt_playback; | 3234 | &ad198x_pcm_analog_alt_playback; |
3326 | } else | 3235 | } |
3327 | spec->mixers[1] = ad1988_6stack_mixers2; | ||
3328 | spec->num_init_verbs = 1; | ||
3329 | if (board_config == AD1988_6STACK_DIG_FP) | ||
3330 | spec->init_verbs[0] = ad1988_6stack_fp_init_verbs; | ||
3331 | else | ||
3332 | spec->init_verbs[0] = ad1988_6stack_init_verbs; | ||
3333 | if ((board_config == AD1988_6STACK_DIG) || | 3236 | if ((board_config == AD1988_6STACK_DIG) || |
3334 | (board_config == AD1988_6STACK_DIG_FP)) { | 3237 | (board_config == AD1988_6STACK_DIG_FP)) { |
3335 | spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; | 3238 | spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; |