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 <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
7675535958
commit
468c545885
|
@ -3372,18 +3372,26 @@ static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs)
|
||||||
/* fill pin_dac_pair list from the pin and dac list */
|
/* fill pin_dac_pair list from the pin and dac list */
|
||||||
static int fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins,
|
static int fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins,
|
||||||
int num_pins, hda_nid_t *dacs, int *rest,
|
int num_pins, hda_nid_t *dacs, int *rest,
|
||||||
struct pin_dac_pair *filled, int type)
|
struct pin_dac_pair *filled, int nums,
|
||||||
|
int type)
|
||||||
{
|
{
|
||||||
int i, nums;
|
int i, start = nums;
|
||||||
|
|
||||||
nums = 0;
|
for (i = 0; i < num_pins; i++, nums++) {
|
||||||
for (i = 0; i < num_pins; i++) {
|
|
||||||
filled[nums].pin = pins[i];
|
filled[nums].pin = pins[i];
|
||||||
filled[nums].type = type;
|
filled[nums].type = type;
|
||||||
filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest);
|
filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest);
|
||||||
if (!filled[nums].dac && i > 0 && filled[0].dac)
|
if (filled[nums].dac)
|
||||||
|
continue;
|
||||||
|
if (filled[start].dac && get_connection_index(codec, pins[i], filled[start].dac) >= 0) {
|
||||||
|
filled[nums].dac = filled[start].dac | DAC_SLAVE_FLAG;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (filled[0].dac && get_connection_index(codec, pins[i], filled[0].dac) >= 0) {
|
||||||
filled[nums].dac = filled[0].dac | DAC_SLAVE_FLAG;
|
filled[nums].dac = filled[0].dac | DAC_SLAVE_FLAG;
|
||||||
nums++;
|
continue;
|
||||||
|
}
|
||||||
|
snd_printdd("Failed to find a DAC for pin 0x%x", pins[i]);
|
||||||
}
|
}
|
||||||
return nums;
|
return nums;
|
||||||
}
|
}
|
||||||
|
@ -3399,14 +3407,14 @@ static void cx_auto_parse_output(struct hda_codec *codec)
|
||||||
rest = fill_cx_auto_dacs(codec, dacs);
|
rest = fill_cx_auto_dacs(codec, dacs);
|
||||||
/* parse all analog output pins */
|
/* parse all analog output pins */
|
||||||
nums = fill_dacs_for_pins(codec, cfg->line_out_pins, cfg->line_outs,
|
nums = fill_dacs_for_pins(codec, cfg->line_out_pins, cfg->line_outs,
|
||||||
dacs, &rest, spec->dac_info,
|
dacs, &rest, spec->dac_info, 0,
|
||||||
AUTO_PIN_LINE_OUT);
|
AUTO_PIN_LINE_OUT);
|
||||||
nums += fill_dacs_for_pins(codec, cfg->hp_pins, cfg->hp_outs,
|
nums = fill_dacs_for_pins(codec, cfg->hp_pins, cfg->hp_outs,
|
||||||
dacs, &rest, spec->dac_info + nums,
|
dacs, &rest, spec->dac_info, nums,
|
||||||
AUTO_PIN_HP_OUT);
|
AUTO_PIN_HP_OUT);
|
||||||
nums += fill_dacs_for_pins(codec, cfg->speaker_pins, cfg->speaker_outs,
|
nums = fill_dacs_for_pins(codec, cfg->speaker_pins, cfg->speaker_outs,
|
||||||
dacs, &rest, spec->dac_info + nums,
|
dacs, &rest, spec->dac_info, nums,
|
||||||
AUTO_PIN_SPEAKER_OUT);
|
AUTO_PIN_SPEAKER_OUT);
|
||||||
spec->dac_info_filled = nums;
|
spec->dac_info_filled = nums;
|
||||||
/* fill multiout struct */
|
/* fill multiout struct */
|
||||||
for (i = 0; i < nums; i++) {
|
for (i = 0; i < nums; i++) {
|
||||||
|
@ -4173,9 +4181,11 @@ static int try_add_pb_volume(struct hda_codec *codec, hda_nid_t dac,
|
||||||
hda_nid_t pin, const char *name, int idx)
|
hda_nid_t pin, const char *name, int idx)
|
||||||
{
|
{
|
||||||
unsigned int caps;
|
unsigned int caps;
|
||||||
caps = query_amp_caps(codec, dac, HDA_OUTPUT);
|
if (dac && !(dac & DAC_SLAVE_FLAG)) {
|
||||||
if (caps & AC_AMPCAP_NUM_STEPS)
|
caps = query_amp_caps(codec, dac, HDA_OUTPUT);
|
||||||
return cx_auto_add_pb_volume(codec, dac, name, idx);
|
if (caps & AC_AMPCAP_NUM_STEPS)
|
||||||
|
return cx_auto_add_pb_volume(codec, dac, name, idx);
|
||||||
|
}
|
||||||
caps = query_amp_caps(codec, pin, HDA_OUTPUT);
|
caps = query_amp_caps(codec, pin, HDA_OUTPUT);
|
||||||
if (caps & AC_AMPCAP_NUM_STEPS)
|
if (caps & AC_AMPCAP_NUM_STEPS)
|
||||||
return cx_auto_add_pb_volume(codec, pin, name, idx);
|
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)
|
||||||
const char *label;
|
const char *label;
|
||||||
int idx, type;
|
int idx, type;
|
||||||
hda_nid_t dac = spec->dac_info[i].dac;
|
hda_nid_t dac = spec->dac_info[i].dac;
|
||||||
if (!dac || (dac & DAC_SLAVE_FLAG))
|
|
||||||
continue;
|
|
||||||
type = spec->dac_info[i].type;
|
type = spec->dac_info[i].type;
|
||||||
if (type == AUTO_PIN_LINE_OUT)
|
if (type == AUTO_PIN_LINE_OUT)
|
||||||
type = spec->autocfg.line_out_type;
|
type = spec->autocfg.line_out_type;
|
||||||
|
|
Loading…
Reference in New Issue