Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353090
b: refs/heads/master
c: 7385df6
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai committed Jan 12, 2013
1 parent 46f3425 commit ce300cb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5abd4888f662cc72c8a3039a6124256691f758d0
refs/heads/master: 7385df6134888553b5ede71cd573ffe0429e2a80
33 changes: 27 additions & 6 deletions trunk/sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,14 +860,34 @@ static struct badness_table extra_out_badness = {
.shared_surr_main = BAD_NO_EXTRA_SURR_DAC,
};

/* get the DAC of the primary output corresponding to the given array index */
static hda_nid_t get_primary_out(struct hda_codec *codec, int idx)
{
struct hda_gen_spec *spec = codec->spec;
struct auto_pin_cfg *cfg = &spec->autocfg;

if (cfg->line_outs > idx)
return spec->private_dac_nids[idx];
idx -= cfg->line_outs;
if (spec->multi_ios > idx)
return spec->multi_io[idx].dac;
return 0;
}

/* return the DAC if it's reachable, otherwise zero */
static inline hda_nid_t try_dac(struct hda_codec *codec,
hda_nid_t dac, hda_nid_t pin)
{
return is_reachable_path(codec, dac, pin) ? dac : 0;
}

/* try to assign DACs to pins and return the resultant badness */
static int try_assign_dacs(struct hda_codec *codec, int num_outs,
const hda_nid_t *pins, hda_nid_t *dacs,
int *path_idx,
const struct badness_table *bad)
{
struct hda_gen_spec *spec = codec->spec;
struct auto_pin_cfg *cfg = &spec->autocfg;
int i, j;
int badness = 0;
hda_nid_t dac;
Expand Down Expand Up @@ -897,11 +917,12 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
}
dac = dacs[i];
if (!dac) {
if (is_reachable_path(codec, dacs[0], pin))
dac = dacs[0];
else if (cfg->line_outs > i &&
is_reachable_path(codec, spec->private_dac_nids[i], pin))
dac = spec->private_dac_nids[i];
if (num_outs > 2)
dac = try_dac(codec, get_primary_out(codec, i), pin);
if (!dac)
dac = try_dac(codec, dacs[0], pin);
if (!dac)
dac = try_dac(codec, get_primary_out(codec, i), pin);
if (dac) {
if (!i)
badness += bad->shared_primary;
Expand Down

0 comments on commit ce300cb

Please sign in to comment.