aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-08-23 08:57:08 -0400
committerTakashi Iwai <tiwai@suse.de>2011-08-23 08:57:08 -0400
commit1f015f5fdc4003f3f2a7c66efdb1acf7a2d230bf (patch)
tree39fbd0da4a83749fa57d91220b4a8fea02101afd /sound
parent3c715a98844f72cec0fa3ef2b68232b8f751468b (diff)
ALSA: hda - Fix double-headphone/speaker paths for Cxt auto-parser
When multiple headphones or speakers are assigned but no individual DACs are available, the driver should take the first HP/SPK DAC instead of another primary output. The patch adds a bit-flag to dac field of struct pin_dac_pair indicating that it's a slave DAC. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_conexant.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 502fc9499453..4c462c3d6462 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3348,6 +3348,8 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t pin,
3348 3348
3349#define MAX_AUTO_DACS 5 3349#define MAX_AUTO_DACS 5
3350 3350
3351#define DAC_SLAVE_FLAG 0x8000 /* filled dac is a slave */
3352
3351/* fill analog DAC list from the widget tree */ 3353/* fill analog DAC list from the widget tree */
3352static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs) 3354static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs)
3353{ 3355{
@@ -3379,6 +3381,8 @@ static int fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins,
3379 filled[nums].pin = pins[i]; 3381 filled[nums].pin = pins[i];
3380 filled[nums].type = type; 3382 filled[nums].type = type;
3381 filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest); 3383 filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest);
3384 if (!filled[nums].dac && i > 0 && filled[0].dac)
3385 filled[nums].dac = filled[0].dac | DAC_SLAVE_FLAG;
3382 nums++; 3386 nums++;
3383 } 3387 }
3384 return nums; 3388 return nums;
@@ -3407,7 +3411,7 @@ static void cx_auto_parse_output(struct hda_codec *codec)
3407 /* fill multiout struct */ 3411 /* fill multiout struct */
3408 for (i = 0; i < nums; i++) { 3412 for (i = 0; i < nums; i++) {
3409 hda_nid_t dac = spec->dac_info[i].dac; 3413 hda_nid_t dac = spec->dac_info[i].dac;
3410 if (!dac) 3414 if (!dac || (dac & DAC_SLAVE_FLAG))
3411 continue; 3415 continue;
3412 switch (spec->dac_info[i].type) { 3416 switch (spec->dac_info[i].type) {
3413 case AUTO_PIN_LINE_OUT: 3417 case AUTO_PIN_LINE_OUT:
@@ -4035,6 +4039,8 @@ static void cx_auto_init_output(struct hda_codec *codec)
4035 nid = spec->dac_info[i].dac; 4039 nid = spec->dac_info[i].dac;
4036 if (!nid) 4040 if (!nid)
4037 nid = spec->multiout.dac_nids[0]; 4041 nid = spec->multiout.dac_nids[0];
4042 else if (nid & DAC_SLAVE_FLAG)
4043 nid &= ~DAC_SLAVE_FLAG;
4038 select_connection(codec, spec->dac_info[i].pin, nid); 4044 select_connection(codec, spec->dac_info[i].pin, nid);
4039 } 4045 }
4040 if (spec->auto_mute) { 4046 if (spec->auto_mute) {
@@ -4191,7 +4197,8 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
4191 for (i = 0; i < spec->dac_info_filled; i++) { 4197 for (i = 0; i < spec->dac_info_filled; i++) {
4192 const char *label; 4198 const char *label;
4193 int idx, type; 4199 int idx, type;
4194 if (!spec->dac_info[i].dac) 4200 hda_nid_t dac = spec->dac_info[i].dac;
4201 if (!dac || (dac & DAC_SLAVE_FLAG))
4195 continue; 4202 continue;
4196 type = spec->dac_info[i].type; 4203 type = spec->dac_info[i].type;
4197 if (type == AUTO_PIN_LINE_OUT) 4204 if (type == AUTO_PIN_LINE_OUT)
@@ -4211,7 +4218,7 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
4211 idx = num_spk++; 4218 idx = num_spk++;
4212 break; 4219 break;
4213 } 4220 }
4214 err = try_add_pb_volume(codec, spec->dac_info[i].dac, 4221 err = try_add_pb_volume(codec, dac,
4215 spec->dac_info[i].pin, 4222 spec->dac_info[i].pin,
4216 label, idx); 4223 label, idx);
4217 if (err < 0) 4224 if (err < 0)