aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-07-06 12:30:08 -0400
committerTakashi Iwai <tiwai@suse.de>2011-07-07 03:35:17 -0400
commitc2d986b0d21e53453de8751ecbb317148820d065 (patch)
treec09a22f0064b85c7cd48f3f4a03e29832102799e /sound
parentf970de2555636c563935cdc2abc5684da2adacc4 (diff)
ALSA: hda - Clean-up PCM assignments in patch_realtek.c
Instead of assigning each default hda_pcm_stream pointers, do NULL-checks and assign default values in alc_build_pcms(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c229
1 files changed, 58 insertions, 171 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index b960020956c8..2e7afd434525 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4203,7 +4203,7 @@ static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
4203/* 4203/*
4204 * Analog playback callbacks 4204 * Analog playback callbacks
4205 */ 4205 */
4206static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, 4206static int alc_playback_pcm_open(struct hda_pcm_stream *hinfo,
4207 struct hda_codec *codec, 4207 struct hda_codec *codec,
4208 struct snd_pcm_substream *substream) 4208 struct snd_pcm_substream *substream)
4209{ 4209{
@@ -4212,7 +4212,7 @@ static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
4212 hinfo); 4212 hinfo);
4213} 4213}
4214 4214
4215static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, 4215static int alc_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4216 struct hda_codec *codec, 4216 struct hda_codec *codec,
4217 unsigned int stream_tag, 4217 unsigned int stream_tag,
4218 unsigned int format, 4218 unsigned int format,
@@ -4223,7 +4223,7 @@ static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4223 stream_tag, format, substream); 4223 stream_tag, format, substream);
4224} 4224}
4225 4225
4226static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, 4226static int alc_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4227 struct hda_codec *codec, 4227 struct hda_codec *codec,
4228 struct snd_pcm_substream *substream) 4228 struct snd_pcm_substream *substream)
4229{ 4229{
@@ -4234,7 +4234,7 @@ static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4234/* 4234/*
4235 * Digital out 4235 * Digital out
4236 */ 4236 */
4237static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, 4237static int alc_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
4238 struct hda_codec *codec, 4238 struct hda_codec *codec,
4239 struct snd_pcm_substream *substream) 4239 struct snd_pcm_substream *substream)
4240{ 4240{
@@ -4242,7 +4242,7 @@ static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
4242 return snd_hda_multi_out_dig_open(codec, &spec->multiout); 4242 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
4243} 4243}
4244 4244
4245static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, 4245static int alc_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4246 struct hda_codec *codec, 4246 struct hda_codec *codec,
4247 unsigned int stream_tag, 4247 unsigned int stream_tag,
4248 unsigned int format, 4248 unsigned int format,
@@ -4253,7 +4253,7 @@ static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
4253 stream_tag, format, substream); 4253 stream_tag, format, substream);
4254} 4254}
4255 4255
4256static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, 4256static int alc_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4257 struct hda_codec *codec, 4257 struct hda_codec *codec,
4258 struct snd_pcm_substream *substream) 4258 struct snd_pcm_substream *substream)
4259{ 4259{
@@ -4261,7 +4261,7 @@ static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
4261 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); 4261 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
4262} 4262}
4263 4263
4264static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, 4264static int alc_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
4265 struct hda_codec *codec, 4265 struct hda_codec *codec,
4266 struct snd_pcm_substream *substream) 4266 struct snd_pcm_substream *substream)
4267{ 4267{
@@ -4272,7 +4272,7 @@ static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
4272/* 4272/*
4273 * Analog capture 4273 * Analog capture
4274 */ 4274 */
4275static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, 4275static int alc_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4276 struct hda_codec *codec, 4276 struct hda_codec *codec,
4277 unsigned int stream_tag, 4277 unsigned int stream_tag,
4278 unsigned int format, 4278 unsigned int format,
@@ -4285,7 +4285,7 @@ static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
4285 return 0; 4285 return 0;
4286} 4286}
4287 4287
4288static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, 4288static int alc_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4289 struct hda_codec *codec, 4289 struct hda_codec *codec,
4290 struct snd_pcm_substream *substream) 4290 struct snd_pcm_substream *substream)
4291{ 4291{
@@ -4334,57 +4334,57 @@ static const struct hda_pcm_stream dualmic_pcm_analog_capture = {
4334 4334
4335/* 4335/*
4336 */ 4336 */
4337static const struct hda_pcm_stream alc880_pcm_analog_playback = { 4337static const struct hda_pcm_stream alc_pcm_analog_playback = {
4338 .substreams = 1, 4338 .substreams = 1,
4339 .channels_min = 2, 4339 .channels_min = 2,
4340 .channels_max = 8, 4340 .channels_max = 8,
4341 /* NID is set in alc_build_pcms */ 4341 /* NID is set in alc_build_pcms */
4342 .ops = { 4342 .ops = {
4343 .open = alc880_playback_pcm_open, 4343 .open = alc_playback_pcm_open,
4344 .prepare = alc880_playback_pcm_prepare, 4344 .prepare = alc_playback_pcm_prepare,
4345 .cleanup = alc880_playback_pcm_cleanup 4345 .cleanup = alc_playback_pcm_cleanup
4346 }, 4346 },
4347}; 4347};
4348 4348
4349static const struct hda_pcm_stream alc880_pcm_analog_capture = { 4349static const struct hda_pcm_stream alc_pcm_analog_capture = {
4350 .substreams = 1, 4350 .substreams = 1,
4351 .channels_min = 2, 4351 .channels_min = 2,
4352 .channels_max = 2, 4352 .channels_max = 2,
4353 /* NID is set in alc_build_pcms */ 4353 /* NID is set in alc_build_pcms */
4354}; 4354};
4355 4355
4356static const struct hda_pcm_stream alc880_pcm_analog_alt_playback = { 4356static const struct hda_pcm_stream alc_pcm_analog_alt_playback = {
4357 .substreams = 1, 4357 .substreams = 1,
4358 .channels_min = 2, 4358 .channels_min = 2,
4359 .channels_max = 2, 4359 .channels_max = 2,
4360 /* NID is set in alc_build_pcms */ 4360 /* NID is set in alc_build_pcms */
4361}; 4361};
4362 4362
4363static const struct hda_pcm_stream alc880_pcm_analog_alt_capture = { 4363static const struct hda_pcm_stream alc_pcm_analog_alt_capture = {
4364 .substreams = 2, /* can be overridden */ 4364 .substreams = 2, /* can be overridden */
4365 .channels_min = 2, 4365 .channels_min = 2,
4366 .channels_max = 2, 4366 .channels_max = 2,
4367 /* NID is set in alc_build_pcms */ 4367 /* NID is set in alc_build_pcms */
4368 .ops = { 4368 .ops = {
4369 .prepare = alc880_alt_capture_pcm_prepare, 4369 .prepare = alc_alt_capture_pcm_prepare,
4370 .cleanup = alc880_alt_capture_pcm_cleanup 4370 .cleanup = alc_alt_capture_pcm_cleanup
4371 }, 4371 },
4372}; 4372};
4373 4373
4374static const struct hda_pcm_stream alc880_pcm_digital_playback = { 4374static const struct hda_pcm_stream alc_pcm_digital_playback = {
4375 .substreams = 1, 4375 .substreams = 1,
4376 .channels_min = 2, 4376 .channels_min = 2,
4377 .channels_max = 2, 4377 .channels_max = 2,
4378 /* NID is set in alc_build_pcms */ 4378 /* NID is set in alc_build_pcms */
4379 .ops = { 4379 .ops = {
4380 .open = alc880_dig_playback_pcm_open, 4380 .open = alc_dig_playback_pcm_open,
4381 .close = alc880_dig_playback_pcm_close, 4381 .close = alc_dig_playback_pcm_close,
4382 .prepare = alc880_dig_playback_pcm_prepare, 4382 .prepare = alc_dig_playback_pcm_prepare,
4383 .cleanup = alc880_dig_playback_pcm_cleanup 4383 .cleanup = alc_dig_playback_pcm_cleanup
4384 }, 4384 },
4385}; 4385};
4386 4386
4387static const struct hda_pcm_stream alc880_pcm_digital_capture = { 4387static const struct hda_pcm_stream alc_pcm_digital_capture = {
4388 .substreams = 1, 4388 .substreams = 1,
4389 .channels_min = 2, 4389 .channels_min = 2,
4390 .channels_max = 2, 4390 .channels_max = 2,
@@ -4402,6 +4402,7 @@ static int alc_build_pcms(struct hda_codec *codec)
4402{ 4402{
4403 struct alc_spec *spec = codec->spec; 4403 struct alc_spec *spec = codec->spec;
4404 struct hda_pcm *info = spec->pcm_rec; 4404 struct hda_pcm *info = spec->pcm_rec;
4405 const struct hda_pcm_stream *p;
4405 int i; 4406 int i;
4406 4407
4407 codec->num_pcms = 1; 4408 codec->num_pcms = 1;
@@ -4414,16 +4415,18 @@ static int alc_build_pcms(struct hda_codec *codec)
4414 "%s Analog", codec->chip_name); 4415 "%s Analog", codec->chip_name);
4415 info->name = spec->stream_name_analog; 4416 info->name = spec->stream_name_analog;
4416 4417
4417 if (spec->stream_analog_playback) { 4418 if (spec->multiout.dac_nids > 0) {
4418 if (snd_BUG_ON(!spec->multiout.dac_nids)) 4419 p = spec->stream_analog_playback;
4419 return -EINVAL; 4420 if (!p)
4420 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); 4421 p = &alc_pcm_analog_playback;
4422 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *p;
4421 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; 4423 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4422 } 4424 }
4423 if (spec->stream_analog_capture) { 4425 if (spec->adc_nids) {
4424 if (snd_BUG_ON(!spec->adc_nids)) 4426 p = spec->stream_analog_capture;
4425 return -EINVAL; 4427 if (!p)
4426 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); 4428 p = &alc_pcm_analog_capture;
4429 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *p;
4427 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 4430 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4428 } 4431 }
4429 4432
@@ -4450,14 +4453,18 @@ static int alc_build_pcms(struct hda_codec *codec)
4450 info->pcm_type = spec->dig_out_type; 4453 info->pcm_type = spec->dig_out_type;
4451 else 4454 else
4452 info->pcm_type = HDA_PCM_TYPE_SPDIF; 4455 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4453 if (spec->multiout.dig_out_nid && 4456 if (spec->multiout.dig_out_nid) {
4454 spec->stream_digital_playback) { 4457 p = spec->stream_digital_playback;
4455 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); 4458 if (!p)
4459 p = &alc_pcm_digital_playback;
4460 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *p;
4456 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; 4461 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4457 } 4462 }
4458 if (spec->dig_in_nid && 4463 if (spec->dig_in_nid) {
4459 spec->stream_digital_capture) { 4464 p = spec->stream_digital_capture;
4460 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); 4465 if (!p)
4466 p = &alc_pcm_digital_capture;
4467 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *p;
4461 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; 4468 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4462 } 4469 }
4463 /* FIXME: do we need this for all Realtek codec models? */ 4470 /* FIXME: do we need this for all Realtek codec models? */
@@ -4471,14 +4478,15 @@ static int alc_build_pcms(struct hda_codec *codec)
4471 * model, configure a second analog capture-only PCM. 4478 * model, configure a second analog capture-only PCM.
4472 */ 4479 */
4473 /* Additional Analaog capture for index #2 */ 4480 /* Additional Analaog capture for index #2 */
4474 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || 4481 if (spec->alt_dac_nid || spec->num_adc_nids > 1) {
4475 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4476 codec->num_pcms = 3; 4482 codec->num_pcms = 3;
4477 info = spec->pcm_rec + 2; 4483 info = spec->pcm_rec + 2;
4478 info->name = spec->stream_name_analog; 4484 info->name = spec->stream_name_analog;
4479 if (spec->alt_dac_nid) { 4485 if (spec->alt_dac_nid) {
4480 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = 4486 p = spec->stream_analog_alt_playback;
4481 *spec->stream_analog_alt_playback; 4487 if (!p)
4488 p = &alc_pcm_analog_alt_playback;
4489 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *p;
4482 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 4490 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4483 spec->alt_dac_nid; 4491 spec->alt_dac_nid;
4484 } else { 4492 } else {
@@ -4486,9 +4494,11 @@ static int alc_build_pcms(struct hda_codec *codec)
4486 alc_pcm_null_stream; 4494 alc_pcm_null_stream;
4487 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; 4495 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4488 } 4496 }
4489 if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) { 4497 if (spec->num_adc_nids > 1) {
4490 info->stream[SNDRV_PCM_STREAM_CAPTURE] = 4498 p = spec->stream_analog_alt_capture;
4491 *spec->stream_analog_alt_capture; 4499 if (!p)
4500 p = &alc_pcm_analog_alt_capture;
4501 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *p;
4492 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 4502 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4493 spec->adc_nids[1]; 4503 spec->adc_nids[1];
4494 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = 4504 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
@@ -5901,13 +5911,6 @@ static int patch_alc880(struct hda_codec *codec)
5901 if (board_config != ALC880_AUTO) 5911 if (board_config != ALC880_AUTO)
5902 setup_preset(codec, &alc880_presets[board_config]); 5912 setup_preset(codec, &alc880_presets[board_config]);
5903 5913
5904 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5905 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5906 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5907
5908 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5909 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5910
5911 if (!spec->adc_nids && spec->input_mux) { 5914 if (!spec->adc_nids && spec->input_mux) {
5912 alc_auto_fill_adc_caps(codec); 5915 alc_auto_fill_adc_caps(codec);
5913 alc_remove_invalid_adc_nids(codec); 5916 alc_remove_invalid_adc_nids(codec);
@@ -7000,12 +7003,6 @@ static const struct hda_verb alc260_test_init_verbs[] = {
7000}; 7003};
7001#endif 7004#endif
7002 7005
7003#define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
7004#define alc260_pcm_analog_capture alc880_pcm_analog_capture
7005
7006#define alc260_pcm_digital_playback alc880_pcm_digital_playback
7007#define alc260_pcm_digital_capture alc880_pcm_digital_capture
7008
7009/* 7006/*
7010 * for BIOS auto-configuration 7007 * for BIOS auto-configuration
7011 */ 7008 */
@@ -7449,13 +7446,6 @@ static int patch_alc260(struct hda_codec *codec)
7449 if (board_config != ALC260_AUTO) 7446 if (board_config != ALC260_AUTO)
7450 setup_preset(codec, &alc260_presets[board_config]); 7447 setup_preset(codec, &alc260_presets[board_config]);
7451 7448
7452 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7453 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7454 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7455
7456 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7457 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7458
7459 if (!spec->adc_nids && spec->input_mux) { 7449 if (!spec->adc_nids && spec->input_mux) {
7460 alc_auto_fill_adc_caps(codec); 7450 alc_auto_fill_adc_caps(codec);
7461 alc_remove_invalid_adc_nids(codec); 7451 alc_remove_invalid_adc_nids(codec);
@@ -9783,12 +9773,6 @@ static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9783#define alc882_loopbacks alc880_loopbacks 9773#define alc882_loopbacks alc880_loopbacks
9784#endif 9774#endif
9785 9775
9786/* pcm configuration: identical with ALC880 */
9787#define alc882_pcm_analog_playback alc880_pcm_analog_playback
9788#define alc882_pcm_analog_capture alc880_pcm_analog_capture
9789#define alc882_pcm_digital_playback alc880_pcm_digital_playback
9790#define alc882_pcm_digital_capture alc880_pcm_digital_capture
9791
9792static const hda_nid_t alc883_slave_dig_outs[] = { 9776static const hda_nid_t alc883_slave_dig_outs[] = {
9793 ALC1200_DIGOUT_NID, 0, 9777 ALC1200_DIGOUT_NID, 0,
9794}; 9778};
@@ -11031,15 +11015,6 @@ static int patch_alc882(struct hda_codec *codec)
11031 if (board_config != ALC882_AUTO) 11015 if (board_config != ALC882_AUTO)
11032 setup_preset(codec, &alc882_presets[board_config]); 11016 setup_preset(codec, &alc882_presets[board_config]);
11033 11017
11034 spec->stream_analog_playback = &alc882_pcm_analog_playback;
11035 spec->stream_analog_capture = &alc882_pcm_analog_capture;
11036 /* FIXME: setup DAC5 */
11037 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11038 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11039
11040 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11041 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11042
11043 if (!spec->adc_nids && spec->input_mux) { 11018 if (!spec->adc_nids && spec->input_mux) {
11044 alc_auto_fill_adc_caps(codec); 11019 alc_auto_fill_adc_caps(codec);
11045 alc_remove_invalid_adc_nids(codec); 11020 alc_remove_invalid_adc_nids(codec);
@@ -12230,12 +12205,6 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = {
12230#define alc262_loopbacks alc880_loopbacks 12205#define alc262_loopbacks alc880_loopbacks
12231#endif 12206#endif
12232 12207
12233/* pcm configuration: identical with ALC880 */
12234#define alc262_pcm_analog_playback alc880_pcm_analog_playback
12235#define alc262_pcm_analog_capture alc880_pcm_analog_capture
12236#define alc262_pcm_digital_playback alc880_pcm_digital_playback
12237#define alc262_pcm_digital_capture alc880_pcm_digital_capture
12238
12239/* 12208/*
12240 * BIOS auto configuration 12209 * BIOS auto configuration
12241 */ 12210 */
@@ -12688,12 +12657,6 @@ static int patch_alc262(struct hda_codec *codec)
12688 if (board_config != ALC262_AUTO) 12657 if (board_config != ALC262_AUTO)
12689 setup_preset(codec, &alc262_presets[board_config]); 12658 setup_preset(codec, &alc262_presets[board_config]);
12690 12659
12691 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12692 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12693
12694 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12695 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12696
12697 if (!spec->adc_nids && spec->input_mux) { 12660 if (!spec->adc_nids && spec->input_mux) {
12698 alc_auto_fill_adc_caps(codec); 12661 alc_auto_fill_adc_caps(codec);
12699 alc_remove_invalid_adc_nids(codec); 12662 alc_remove_invalid_adc_nids(codec);
@@ -13352,12 +13315,6 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13352 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); 13315 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13353} 13316}
13354 13317
13355/* pcm configuration: identical with ALC880 */
13356#define alc268_pcm_analog_playback alc880_pcm_analog_playback
13357#define alc268_pcm_analog_capture alc880_pcm_analog_capture
13358#define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13359#define alc268_pcm_digital_playback alc880_pcm_digital_playback
13360
13361/* 13318/*
13362 * BIOS auto configuration 13319 * BIOS auto configuration
13363 */ 13320 */
@@ -13684,12 +13641,6 @@ static int patch_alc268(struct hda_codec *codec)
13684 if (board_config != ALC268_AUTO) 13641 if (board_config != ALC268_AUTO)
13685 setup_preset(codec, &alc268_presets[board_config]); 13642 setup_preset(codec, &alc268_presets[board_config]);
13686 13643
13687 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13688 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13689 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13690
13691 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13692
13693 has_beep = 0; 13644 has_beep = 0;
13694 for (i = 0; i < spec->num_mixers; i++) { 13645 for (i = 0; i < spec->num_mixers; i++) {
13695 if (spec->mixers[i] == alc268_beep_mixer) { 13646 if (spec->mixers[i] == alc268_beep_mixer) {
@@ -14214,12 +14165,6 @@ static const struct hda_verb alc269vb_init_verbs[] = {
14214#define alc269_loopbacks alc880_loopbacks 14165#define alc269_loopbacks alc880_loopbacks
14215#endif 14166#endif
14216 14167
14217/* pcm configuration: identical with ALC880 */
14218#define alc269_pcm_analog_playback alc880_pcm_analog_playback
14219#define alc269_pcm_analog_capture alc880_pcm_analog_capture
14220#define alc269_pcm_digital_playback alc880_pcm_digital_playback
14221#define alc269_pcm_digital_capture alc880_pcm_digital_capture
14222
14223static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = { 14168static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14224 .substreams = 1, 14169 .substreams = 1,
14225 .channels_min = 2, 14170 .channels_min = 2,
@@ -14227,9 +14172,9 @@ static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14227 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ 14172 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14228 /* NID is set in alc_build_pcms */ 14173 /* NID is set in alc_build_pcms */
14229 .ops = { 14174 .ops = {
14230 .open = alc880_playback_pcm_open, 14175 .open = alc_playback_pcm_open,
14231 .prepare = alc880_playback_pcm_prepare, 14176 .prepare = alc_playback_pcm_prepare,
14232 .cleanup = alc880_playback_pcm_cleanup 14177 .cleanup = alc_playback_pcm_cleanup
14233 }, 14178 },
14234}; 14179};
14235 14180
@@ -14868,16 +14813,7 @@ static int patch_alc269(struct hda_codec *codec)
14868 */ 14813 */
14869 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; 14814 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
14870 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; 14815 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
14871 } else if (spec->dual_adc_switch) {
14872 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14873 /* switch ADC dynamically */
14874 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
14875 } else {
14876 spec->stream_analog_playback = &alc269_pcm_analog_playback;
14877 spec->stream_analog_capture = &alc269_pcm_analog_capture;
14878 } 14816 }
14879 spec->stream_digital_playback = &alc269_pcm_digital_playback;
14880 spec->stream_digital_capture = &alc269_pcm_digital_capture;
14881 14817
14882 if (!spec->adc_nids) { /* wasn't filled automatically? use default */ 14818 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
14883 alc_auto_fill_adc_caps(codec); 14819 alc_auto_fill_adc_caps(codec);
@@ -15440,13 +15376,6 @@ static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15440 alc861_toshiba_automute(codec); 15376 alc861_toshiba_automute(codec);
15441} 15377}
15442 15378
15443/* pcm configuration: identical with ALC880 */
15444#define alc861_pcm_analog_playback alc880_pcm_analog_playback
15445#define alc861_pcm_analog_capture alc880_pcm_analog_capture
15446#define alc861_pcm_digital_playback alc880_pcm_digital_playback
15447#define alc861_pcm_digital_capture alc880_pcm_digital_capture
15448
15449
15450#define ALC861_DIGOUT_NID 0x07 15379#define ALC861_DIGOUT_NID 0x07
15451 15380
15452static const struct hda_channel_mode alc861_8ch_modes[1] = { 15381static const struct hda_channel_mode alc861_8ch_modes[1] = {
@@ -15940,12 +15869,6 @@ static int patch_alc861(struct hda_codec *codec)
15940 if (board_config != ALC861_AUTO) 15869 if (board_config != ALC861_AUTO)
15941 setup_preset(codec, &alc861_presets[board_config]); 15870 setup_preset(codec, &alc861_presets[board_config]);
15942 15871
15943 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15944 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15945
15946 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15947 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15948
15949 if (!spec->cap_mixer) 15872 if (!spec->cap_mixer)
15950 set_capture_mixer(codec); 15873 set_capture_mixer(codec);
15951 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); 15874 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
@@ -16424,12 +16347,6 @@ static void alc861vd_dallas_setup(struct hda_codec *codec)
16424#define alc861vd_loopbacks alc880_loopbacks 16347#define alc861vd_loopbacks alc880_loopbacks
16425#endif 16348#endif
16426 16349
16427/* pcm configuration: identical with ALC880 */
16428#define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16429#define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16430#define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16431#define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16432
16433/* 16350/*
16434 * configuration and preset 16351 * configuration and preset
16435 */ 16352 */
@@ -16851,12 +16768,6 @@ static int patch_alc861vd(struct hda_codec *codec)
16851 add_verb(spec, alc660vd_eapd_verbs); 16768 add_verb(spec, alc660vd_eapd_verbs);
16852 } 16769 }
16853 16770
16854 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16855 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16856
16857 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16858 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16859
16860 if (!spec->adc_nids) { 16771 if (!spec->adc_nids) {
16861 alc_auto_fill_adc_caps(codec); 16772 alc_auto_fill_adc_caps(codec);
16862 alc_remove_invalid_adc_nids(codec); 16773 alc_remove_invalid_adc_nids(codec);
@@ -17847,12 +17758,6 @@ static const struct snd_kcontrol_new alc272_nc10_mixer[] = {
17847#endif 17758#endif
17848 17759
17849 17760
17850/* pcm configuration: identical with ALC880 */
17851#define alc662_pcm_analog_playback alc880_pcm_analog_playback
17852#define alc662_pcm_analog_capture alc880_pcm_analog_capture
17853#define alc662_pcm_digital_playback alc880_pcm_digital_playback
17854#define alc662_pcm_digital_capture alc880_pcm_digital_capture
17855
17856/* 17761/*
17857 * configuration and preset 17762 * configuration and preset
17858 */ 17763 */
@@ -19040,12 +18945,6 @@ static int patch_alc662(struct hda_codec *codec)
19040 if (board_config != ALC662_AUTO) 18945 if (board_config != ALC662_AUTO)
19041 setup_preset(codec, &alc662_presets[board_config]); 18946 setup_preset(codec, &alc662_presets[board_config]);
19042 18947
19043 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19044 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19045
19046 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19047 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19048
19049 if (!spec->adc_nids) { 18948 if (!spec->adc_nids) {
19050 alc_auto_fill_adc_caps(codec); 18949 alc_auto_fill_adc_caps(codec);
19051 alc_remove_invalid_adc_nids(codec); 18950 alc_remove_invalid_adc_nids(codec);
@@ -19405,13 +19304,6 @@ static void alc680_auto_init_hp_out(struct hda_codec *codec)
19405 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); 19304 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19406} 19305}
19407 19306
19408/* pcm configuration: identical with ALC880 */
19409#define alc680_pcm_analog_playback alc880_pcm_analog_playback
19410#define alc680_pcm_analog_capture alc880_pcm_analog_capture
19411#define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19412#define alc680_pcm_digital_playback alc880_pcm_digital_playback
19413#define alc680_pcm_digital_capture alc880_pcm_digital_capture
19414
19415/* 19307/*
19416 * BIOS auto configuration 19308 * BIOS auto configuration
19417 */ 19309 */
@@ -19536,11 +19428,6 @@ static int patch_alc680(struct hda_codec *codec)
19536 if (board_config != ALC680_AUTO) 19428 if (board_config != ALC680_AUTO)
19537 setup_preset(codec, &alc680_presets[board_config]); 19429 setup_preset(codec, &alc680_presets[board_config]);
19538 19430
19539 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19540 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19541 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19542 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19543
19544 if (!spec->adc_nids) { 19431 if (!spec->adc_nids) {
19545 alc_auto_fill_adc_caps(codec); 19432 alc_auto_fill_adc_caps(codec);
19546 alc_remove_invalid_adc_nids(codec); 19433 alc_remove_invalid_adc_nids(codec);