Skip to content

Commit 468c545

Browse files
David Henningssontiwai
David Henningsson
authored andcommitted
ALSA: hda: Conexant: Allow different output types to share DAC
Headphones has stopped working for the original reported (a regression compared to 2.6.38). This is because Speaker and Headphones share the same DAC, in which case no Headphones volume control was created. This patch fixes so that both Speaker and Headphones volume controls are created in such scenario. BugLink: http://bugs.launchpad.net/bugs/817943 Signed-off-by: David Henningsson <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 7675535 commit 468c545

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

sound/pci/hda/patch_conexant.c

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3372,18 +3372,26 @@ static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs)
33723372
/* fill pin_dac_pair list from the pin and dac list */
33733373
static int fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins,
33743374
int num_pins, hda_nid_t *dacs, int *rest,
3375-
struct pin_dac_pair *filled, int type)
3375+
struct pin_dac_pair *filled, int nums,
3376+
int type)
33763377
{
3377-
int i, nums;
3378+
int i, start = nums;
33783379

3379-
nums = 0;
3380-
for (i = 0; i < num_pins; i++) {
3380+
for (i = 0; i < num_pins; i++, nums++) {
33813381
filled[nums].pin = pins[i];
33823382
filled[nums].type = type;
33833383
filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest);
3384-
if (!filled[nums].dac && i > 0 && filled[0].dac)
3384+
if (filled[nums].dac)
3385+
continue;
3386+
if (filled[start].dac && get_connection_index(codec, pins[i], filled[start].dac) >= 0) {
3387+
filled[nums].dac = filled[start].dac | DAC_SLAVE_FLAG;
3388+
continue;
3389+
}
3390+
if (filled[0].dac && get_connection_index(codec, pins[i], filled[0].dac) >= 0) {
33853391
filled[nums].dac = filled[0].dac | DAC_SLAVE_FLAG;
3386-
nums++;
3392+
continue;
3393+
}
3394+
snd_printdd("Failed to find a DAC for pin 0x%x", pins[i]);
33873395
}
33883396
return nums;
33893397
}
@@ -3399,14 +3407,14 @@ static void cx_auto_parse_output(struct hda_codec *codec)
33993407
rest = fill_cx_auto_dacs(codec, dacs);
34003408
/* parse all analog output pins */
34013409
nums = fill_dacs_for_pins(codec, cfg->line_out_pins, cfg->line_outs,
3402-
dacs, &rest, spec->dac_info,
3403-
AUTO_PIN_LINE_OUT);
3404-
nums += fill_dacs_for_pins(codec, cfg->hp_pins, cfg->hp_outs,
3405-
dacs, &rest, spec->dac_info + nums,
3406-
AUTO_PIN_HP_OUT);
3407-
nums += fill_dacs_for_pins(codec, cfg->speaker_pins, cfg->speaker_outs,
3408-
dacs, &rest, spec->dac_info + nums,
3409-
AUTO_PIN_SPEAKER_OUT);
3410+
dacs, &rest, spec->dac_info, 0,
3411+
AUTO_PIN_LINE_OUT);
3412+
nums = fill_dacs_for_pins(codec, cfg->hp_pins, cfg->hp_outs,
3413+
dacs, &rest, spec->dac_info, nums,
3414+
AUTO_PIN_HP_OUT);
3415+
nums = fill_dacs_for_pins(codec, cfg->speaker_pins, cfg->speaker_outs,
3416+
dacs, &rest, spec->dac_info, nums,
3417+
AUTO_PIN_SPEAKER_OUT);
34103418
spec->dac_info_filled = nums;
34113419
/* fill multiout struct */
34123420
for (i = 0; i < nums; i++) {
@@ -4173,9 +4181,11 @@ static int try_add_pb_volume(struct hda_codec *codec, hda_nid_t dac,
41734181
hda_nid_t pin, const char *name, int idx)
41744182
{
41754183
unsigned int caps;
4176-
caps = query_amp_caps(codec, dac, HDA_OUTPUT);
4177-
if (caps & AC_AMPCAP_NUM_STEPS)
4178-
return cx_auto_add_pb_volume(codec, dac, name, idx);
4184+
if (dac && !(dac & DAC_SLAVE_FLAG)) {
4185+
caps = query_amp_caps(codec, dac, HDA_OUTPUT);
4186+
if (caps & AC_AMPCAP_NUM_STEPS)
4187+
return cx_auto_add_pb_volume(codec, dac, name, idx);
4188+
}
41794189
caps = query_amp_caps(codec, pin, HDA_OUTPUT);
41804190
if (caps & AC_AMPCAP_NUM_STEPS)
41814191
return cx_auto_add_pb_volume(codec, pin, name, idx);
@@ -4198,8 +4208,6 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
41984208
const char *label;
41994209
int idx, type;
42004210
hda_nid_t dac = spec->dac_info[i].dac;
4201-
if (!dac || (dac & DAC_SLAVE_FLAG))
4202-
continue;
42034211
type = spec->dac_info[i].type;
42044212
if (type == AUTO_PIN_LINE_OUT)
42054213
type = spec->autocfg.line_out_type;

0 commit comments

Comments
 (0)