diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/hda_generic.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 78897d05d80f..43c2ea539561 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -995,6 +995,8 @@ enum { | |||
995 | BAD_NO_EXTRA_SURR_DAC = 0x101, | 995 | BAD_NO_EXTRA_SURR_DAC = 0x101, |
996 | /* Primary DAC shared with main surrounds */ | 996 | /* Primary DAC shared with main surrounds */ |
997 | BAD_SHARED_SURROUND = 0x100, | 997 | BAD_SHARED_SURROUND = 0x100, |
998 | /* No independent HP possible */ | ||
999 | BAD_NO_INDEP_HP = 0x40, | ||
998 | /* Primary DAC shared with main CLFE */ | 1000 | /* Primary DAC shared with main CLFE */ |
999 | BAD_SHARED_CLFE = 0x10, | 1001 | BAD_SHARED_CLFE = 0x10, |
1000 | /* Primary DAC shared with extra surrounds */ | 1002 | /* Primary DAC shared with extra surrounds */ |
@@ -1392,6 +1394,43 @@ static int check_aamix_out_path(struct hda_codec *codec, int path_idx) | |||
1392 | return snd_hda_get_path_idx(codec, path); | 1394 | return snd_hda_get_path_idx(codec, path); |
1393 | } | 1395 | } |
1394 | 1396 | ||
1397 | /* check whether the independent HP is available with the current config */ | ||
1398 | static bool indep_hp_possible(struct hda_codec *codec) | ||
1399 | { | ||
1400 | struct hda_gen_spec *spec = codec->spec; | ||
1401 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
1402 | struct nid_path *path; | ||
1403 | int i, idx; | ||
1404 | |||
1405 | if (cfg->line_out_type == AUTO_PIN_HP_OUT) | ||
1406 | idx = spec->out_paths[0]; | ||
1407 | else | ||
1408 | idx = spec->hp_paths[0]; | ||
1409 | path = snd_hda_get_path_from_idx(codec, idx); | ||
1410 | if (!path) | ||
1411 | return false; | ||
1412 | |||
1413 | /* assume no path conflicts unless aamix is involved */ | ||
1414 | if (!spec->mixer_nid || !is_nid_contained(path, spec->mixer_nid)) | ||
1415 | return true; | ||
1416 | |||
1417 | /* check whether output paths contain aamix */ | ||
1418 | for (i = 0; i < cfg->line_outs; i++) { | ||
1419 | if (spec->out_paths[i] == idx) | ||
1420 | break; | ||
1421 | path = snd_hda_get_path_from_idx(codec, spec->out_paths[i]); | ||
1422 | if (path && is_nid_contained(path, spec->mixer_nid)) | ||
1423 | return false; | ||
1424 | } | ||
1425 | for (i = 0; i < cfg->speaker_outs; i++) { | ||
1426 | path = snd_hda_get_path_from_idx(codec, spec->speaker_paths[i]); | ||
1427 | if (path && is_nid_contained(path, spec->mixer_nid)) | ||
1428 | return false; | ||
1429 | } | ||
1430 | |||
1431 | return true; | ||
1432 | } | ||
1433 | |||
1395 | /* fill the empty entries in the dac array for speaker/hp with the | 1434 | /* fill the empty entries in the dac array for speaker/hp with the |
1396 | * shared dac pointed by the paths | 1435 | * shared dac pointed by the paths |
1397 | */ | 1436 | */ |
@@ -1545,6 +1584,9 @@ static int fill_and_eval_dacs(struct hda_codec *codec, | |||
1545 | badness += BAD_MULTI_IO; | 1584 | badness += BAD_MULTI_IO; |
1546 | } | 1585 | } |
1547 | 1586 | ||
1587 | if (spec->indep_hp && !indep_hp_possible(codec)) | ||
1588 | badness += BAD_NO_INDEP_HP; | ||
1589 | |||
1548 | /* re-fill the shared DAC for speaker / headphone */ | 1590 | /* re-fill the shared DAC for speaker / headphone */ |
1549 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | 1591 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
1550 | refill_shared_dacs(codec, cfg->hp_outs, | 1592 | refill_shared_dacs(codec, cfg->hp_outs, |
@@ -1758,6 +1800,10 @@ static int parse_output_paths(struct hda_codec *codec) | |||
1758 | cfg->speaker_pins, val); | 1800 | cfg->speaker_pins, val); |
1759 | } | 1801 | } |
1760 | 1802 | ||
1803 | /* clear indep_hp flag if not available */ | ||
1804 | if (spec->indep_hp && !indep_hp_possible(codec)) | ||
1805 | spec->indep_hp = 0; | ||
1806 | |||
1761 | kfree(best_cfg); | 1807 | kfree(best_cfg); |
1762 | return 0; | 1808 | return 0; |
1763 | } | 1809 | } |