aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_generic.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-01-07 03:50:52 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-12 02:43:45 -0500
commit7385df6134888553b5ede71cd573ffe0429e2a80 (patch)
treeae8bde918bbd49bc5bd6d53f15fa79a5ac33d446 /sound/pci/hda/hda_generic.c
parent5abd4888f662cc72c8a3039a6124256691f758d0 (diff)
ALSA: hda - Prefer binding the primary CLFE output
When 5.1 or more multiple speakers with found but not enough DACs are available, it's better to bind such pins to the DACs of the primary outputs with the same channels rather than binding to the first DAC (i.e. the front channel). For the cases with two speaker pins, it's rather regarded as front + bass combination, thus it's more practical to still bind to the front, though. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_generic.c')
-rw-r--r--sound/pci/hda/hda_generic.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 0588dd6002f4..f4fa60481978 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -860,6 +860,27 @@ static struct badness_table extra_out_badness = {
860 .shared_surr_main = BAD_NO_EXTRA_SURR_DAC, 860 .shared_surr_main = BAD_NO_EXTRA_SURR_DAC,
861}; 861};
862 862
863/* get the DAC of the primary output corresponding to the given array index */
864static hda_nid_t get_primary_out(struct hda_codec *codec, int idx)
865{
866 struct hda_gen_spec *spec = codec->spec;
867 struct auto_pin_cfg *cfg = &spec->autocfg;
868
869 if (cfg->line_outs > idx)
870 return spec->private_dac_nids[idx];
871 idx -= cfg->line_outs;
872 if (spec->multi_ios > idx)
873 return spec->multi_io[idx].dac;
874 return 0;
875}
876
877/* return the DAC if it's reachable, otherwise zero */
878static inline hda_nid_t try_dac(struct hda_codec *codec,
879 hda_nid_t dac, hda_nid_t pin)
880{
881 return is_reachable_path(codec, dac, pin) ? dac : 0;
882}
883
863/* try to assign DACs to pins and return the resultant badness */ 884/* try to assign DACs to pins and return the resultant badness */
864static int try_assign_dacs(struct hda_codec *codec, int num_outs, 885static int try_assign_dacs(struct hda_codec *codec, int num_outs,
865 const hda_nid_t *pins, hda_nid_t *dacs, 886 const hda_nid_t *pins, hda_nid_t *dacs,
@@ -867,7 +888,6 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
867 const struct badness_table *bad) 888 const struct badness_table *bad)
868{ 889{
869 struct hda_gen_spec *spec = codec->spec; 890 struct hda_gen_spec *spec = codec->spec;
870 struct auto_pin_cfg *cfg = &spec->autocfg;
871 int i, j; 891 int i, j;
872 int badness = 0; 892 int badness = 0;
873 hda_nid_t dac; 893 hda_nid_t dac;
@@ -897,11 +917,12 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
897 } 917 }
898 dac = dacs[i]; 918 dac = dacs[i];
899 if (!dac) { 919 if (!dac) {
900 if (is_reachable_path(codec, dacs[0], pin)) 920 if (num_outs > 2)
901 dac = dacs[0]; 921 dac = try_dac(codec, get_primary_out(codec, i), pin);
902 else if (cfg->line_outs > i && 922 if (!dac)
903 is_reachable_path(codec, spec->private_dac_nids[i], pin)) 923 dac = try_dac(codec, dacs[0], pin);
904 dac = spec->private_dac_nids[i]; 924 if (!dac)
925 dac = try_dac(codec, get_primary_out(codec, i), pin);
905 if (dac) { 926 if (dac) {
906 if (!i) 927 if (!i)
907 badness += bad->shared_primary; 928 badness += bad->shared_primary;