diff options
| -rw-r--r-- | sound/pci/hda/hda_generic.c | 23 | ||||
| -rw-r--r-- | sound/pci/hda/hda_generic.h | 3 | ||||
| -rw-r--r-- | sound/pci/hda/patch_analog.c | 10 |
3 files changed, 35 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 249cd4615908..c7f6d1cab606 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
| @@ -474,6 +474,20 @@ static void invalidate_nid_path(struct hda_codec *codec, int idx) | |||
| 474 | memset(path, 0, sizeof(*path)); | 474 | memset(path, 0, sizeof(*path)); |
| 475 | } | 475 | } |
| 476 | 476 | ||
| 477 | /* return a DAC if paired to the given pin by codec driver */ | ||
| 478 | static hda_nid_t get_preferred_dac(struct hda_codec *codec, hda_nid_t pin) | ||
| 479 | { | ||
| 480 | struct hda_gen_spec *spec = codec->spec; | ||
| 481 | const hda_nid_t *list = spec->preferred_dacs; | ||
| 482 | |||
| 483 | if (!list) | ||
| 484 | return 0; | ||
| 485 | for (; *list; list += 2) | ||
| 486 | if (*list == pin) | ||
| 487 | return list[1]; | ||
| 488 | return 0; | ||
| 489 | } | ||
| 490 | |||
| 477 | /* look for an empty DAC slot */ | 491 | /* look for an empty DAC slot */ |
| 478 | static hda_nid_t look_for_dac(struct hda_codec *codec, hda_nid_t pin, | 492 | static hda_nid_t look_for_dac(struct hda_codec *codec, hda_nid_t pin, |
| 479 | bool is_digital) | 493 | bool is_digital) |
| @@ -1192,7 +1206,14 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs, | |||
| 1192 | continue; | 1206 | continue; |
| 1193 | } | 1207 | } |
| 1194 | 1208 | ||
| 1195 | dacs[i] = look_for_dac(codec, pin, false); | 1209 | dacs[i] = get_preferred_dac(codec, pin); |
| 1210 | if (dacs[i]) { | ||
| 1211 | if (is_dac_already_used(codec, dacs[i])) | ||
| 1212 | badness += bad->shared_primary; | ||
| 1213 | } | ||
| 1214 | |||
| 1215 | if (!dacs[i]) | ||
| 1216 | dacs[i] = look_for_dac(codec, pin, false); | ||
| 1196 | if (!dacs[i] && !i) { | 1217 | if (!dacs[i] && !i) { |
| 1197 | /* try to steal the DAC of surrounds for the front */ | 1218 | /* try to steal the DAC of surrounds for the front */ |
| 1198 | for (j = 1; j < num_outs; j++) { | 1219 | for (j = 1; j < num_outs; j++) { |
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h index 7e45cb44d151..0929a06df812 100644 --- a/sound/pci/hda/hda_generic.h +++ b/sound/pci/hda/hda_generic.h | |||
| @@ -249,6 +249,9 @@ struct hda_gen_spec { | |||
| 249 | const struct badness_table *main_out_badness; | 249 | const struct badness_table *main_out_badness; |
| 250 | const struct badness_table *extra_out_badness; | 250 | const struct badness_table *extra_out_badness; |
| 251 | 251 | ||
| 252 | /* preferred pin/DAC pairs; an array of paired NIDs */ | ||
| 253 | const hda_nid_t *preferred_dacs; | ||
| 254 | |||
| 252 | /* loopback mixing mode */ | 255 | /* loopback mixing mode */ |
| 253 | bool aamix_mode; | 256 | bool aamix_mode; |
| 254 | 257 | ||
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index cac015be3325..699262a3e07a 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
| @@ -340,6 +340,14 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
| 340 | { | 340 | { |
| 341 | int err; | 341 | int err; |
| 342 | struct ad198x_spec *spec; | 342 | struct ad198x_spec *spec; |
| 343 | static hda_nid_t preferred_pairs[] = { | ||
| 344 | 0x1a, 0x03, | ||
| 345 | 0x1b, 0x03, | ||
| 346 | 0x1c, 0x04, | ||
| 347 | 0x1d, 0x05, | ||
| 348 | 0x1e, 0x03, | ||
| 349 | 0 | ||
| 350 | }; | ||
| 343 | 351 | ||
| 344 | err = alloc_ad_spec(codec); | 352 | err = alloc_ad_spec(codec); |
| 345 | if (err < 0) | 353 | if (err < 0) |
| @@ -360,6 +368,8 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
| 360 | * So, let's disable the shared stream. | 368 | * So, let's disable the shared stream. |
| 361 | */ | 369 | */ |
| 362 | spec->gen.multiout.no_share_stream = 1; | 370 | spec->gen.multiout.no_share_stream = 1; |
| 371 | /* give fixed DAC/pin pairs */ | ||
| 372 | spec->gen.preferred_dacs = preferred_pairs; | ||
| 363 | 373 | ||
| 364 | /* AD1986A can't manage the dynamic pin on/off smoothly */ | 374 | /* AD1986A can't manage the dynamic pin on/off smoothly */ |
| 365 | spec->gen.auto_mute_via_amp = 1; | 375 | spec->gen.auto_mute_via_amp = 1; |
