Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353110
b: refs/heads/master
c: 3a65bcd
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai committed Jan 12, 2013
1 parent 032a1ac commit 196608d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 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: 54d778b31c98b305bf47fbbabd4107a3898ebe66
refs/heads/master: 3a65bcdc577a338712c2eaefc194909de79d4982
34 changes: 22 additions & 12 deletions trunk/sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2002,24 +2002,24 @@ static int check_dyn_adc_switch(struct hda_codec *codec)
{
struct hda_gen_spec *spec = codec->spec;
struct hda_input_mux *imux = &spec->input_mux;
hda_nid_t adc_nids[ARRAY_SIZE(spec->adc_nids)];
unsigned int ok_bits;
int i, n, nums;
hda_nid_t pin, adc;

again:
nums = 0;
ok_bits = 0;
for (n = 0; n < spec->num_adc_nids; n++) {
adc = spec->adc_nids[n];
for (i = 0; i < imux->num_items; i++) {
pin = spec->imux_pins[i];
if (!is_reachable_path(codec, pin, adc))
if (!spec->input_paths[i][n])
break;
}
if (i >= imux->num_items)
adc_nids[nums++] = adc;
if (i >= imux->num_items) {
ok_bits |= (1 << n);
nums++;
}
}

if (!nums) {
if (!ok_bits) {
if (spec->shared_mic_hp) {
spec->shared_mic_hp = 0;
imux->num_items = 1;
Expand All @@ -2028,10 +2028,8 @@ static int check_dyn_adc_switch(struct hda_codec *codec)

/* check whether ADC-switch is possible */
for (i = 0; i < imux->num_items; i++) {
pin = spec->imux_pins[i];
for (n = 0; n < spec->num_adc_nids; n++) {
adc = spec->adc_nids[n];
if (is_reachable_path(codec, pin, adc)) {
if (spec->input_paths[i][n]) {
spec->dyn_adc_idx[i] = n;
break;
}
Expand All @@ -2041,7 +2039,19 @@ static int check_dyn_adc_switch(struct hda_codec *codec)
snd_printdd("hda-codec: enabling ADC switching\n");
spec->dyn_adc_switch = 1;
} else if (nums != spec->num_adc_nids) {
memcpy(spec->adc_nids, adc_nids, nums * sizeof(hda_nid_t));
/* shrink the invalid adcs and input paths */
nums = 0;
for (n = 0; n < spec->num_adc_nids; n++) {
if (!(ok_bits & (1 << n)))
continue;
if (n != nums) {
spec->adc_nids[nums] = spec->adc_nids[n];
for (i = 0; i < imux->num_items; i++)
spec->input_paths[i][nums] =
spec->input_paths[i][n];
}
nums++;
}
spec->num_adc_nids = nums;
}

Expand Down

0 comments on commit 196608d

Please sign in to comment.