aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-11-08 09:59:23 -0500
committerTakashi Iwai <tiwai@suse.de>2012-11-08 11:00:37 -0500
commitf37bc7a88d374448a1f4bba9267d308606d78bf2 (patch)
tree00d1142a082adce61d52a15ad543852af391c1a1 /sound/pci/hda
parent17a4adbe68c8e6c1fde8decb2345dc4acea87934 (diff)
ALSA: hda - Give standard "Bass Speaker" mixer for 2.1 speakers
When two built-in speakers are found on the machine, we can suppose it's rather a 2.1 speaker system with a bass output instead of front/surround channels. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_cirrus.c8
-rw-r--r--sound/pci/hda/patch_conexant.c28
-rw-r--r--sound/pci/hda/patch_sigmatel.c8
-rw-r--r--sound/pci/hda/patch_via.c6
4 files changed, 39 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index b9039dbd704d..794b0da11212 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -68,6 +68,7 @@ struct cs_spec {
68 68
69 unsigned int hp_detect:1; 69 unsigned int hp_detect:1;
70 unsigned int mic_detect:1; 70 unsigned int mic_detect:1;
71 unsigned int speaker_2_1:1;
71 /* CS421x */ 72 /* CS421x */
72 unsigned int spdif_detect:1; 73 unsigned int spdif_detect:1;
73 unsigned int sense_b:1; 74 unsigned int sense_b:1;
@@ -443,6 +444,9 @@ static int parse_output(struct hda_codec *codec)
443 spec->multiout.dac_nids = spec->dac_nid; 444 spec->multiout.dac_nids = spec->dac_nid;
444 spec->multiout.max_channels = i * 2; 445 spec->multiout.max_channels = i * 2;
445 446
447 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && i == 2)
448 spec->speaker_2_1 = 1; /* assume 2.1 speakers */
449
446 /* add HP and speakers */ 450 /* add HP and speakers */
447 extra_nids = 0; 451 extra_nids = 0;
448 for (i = 0; i < cfg->hp_outs; i++) { 452 for (i = 0; i < cfg->hp_outs; i++) {
@@ -632,7 +636,9 @@ static int add_output(struct hda_codec *codec, hda_nid_t dac, int idx,
632 index = idx; 636 index = idx;
633 break; 637 break;
634 case AUTO_PIN_SPEAKER_OUT: 638 case AUTO_PIN_SPEAKER_OUT:
635 if (num_ctls > 1) 639 if (spec->speaker_2_1)
640 name = idx ? "Bass Speaker" : "Speaker";
641 else if (num_ctls > 1)
636 name = speakers[idx]; 642 name = speakers[idx];
637 else 643 else
638 name = "Speaker"; 644 name = "Speaker";
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 252d4197f221..f8e9ff493dc7 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -472,7 +472,7 @@ static const struct snd_kcontrol_new cxt_beep_mixer[] = {
472#endif 472#endif
473 473
474static const char * const slave_pfxs[] = { 474static const char * const slave_pfxs[] = {
475 "Headphone", "Speaker", "Front", "Surround", "CLFE", 475 "Headphone", "Speaker", "Bass Speaker", "Front", "Surround", "CLFE",
476 NULL 476 NULL
477}; 477};
478 478
@@ -4116,11 +4116,26 @@ static int try_add_pb_volume(struct hda_codec *codec, hda_nid_t dac,
4116 return 0; 4116 return 0;
4117} 4117}
4118 4118
4119static bool is_2_1_speaker(struct conexant_spec *spec)
4120{
4121 int i, type, num_spk = 0;
4122
4123 for (i = 0; i < spec->dac_info_filled; i++) {
4124 type = spec->dac_info[i].type;
4125 if (type == AUTO_PIN_LINE_OUT)
4126 type = spec->autocfg.line_out_type;
4127 if (type == AUTO_PIN_SPEAKER_OUT)
4128 num_spk++;
4129 }
4130 return (num_spk == 2 && spec->autocfg.line_out_type != AUTO_PIN_LINE_OUT);
4131}
4132
4119static int cx_auto_build_output_controls(struct hda_codec *codec) 4133static int cx_auto_build_output_controls(struct hda_codec *codec)
4120{ 4134{
4121 struct conexant_spec *spec = codec->spec; 4135 struct conexant_spec *spec = codec->spec;
4122 int i, err; 4136 int i, err;
4123 int num_line = 0, num_hp = 0, num_spk = 0; 4137 int num_line = 0, num_hp = 0, num_spk = 0;
4138 bool speaker_2_1;
4124 static const char * const texts[3] = { "Front", "Surround", "CLFE" }; 4139 static const char * const texts[3] = { "Front", "Surround", "CLFE" };
4125 4140
4126 if (spec->dac_info_filled == 1) 4141 if (spec->dac_info_filled == 1)
@@ -4128,6 +4143,8 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
4128 spec->dac_info[0].pin, 4143 spec->dac_info[0].pin,
4129 "Master", 0); 4144 "Master", 0);
4130 4145
4146 speaker_2_1 = is_2_1_speaker(spec);
4147
4131 for (i = 0; i < spec->dac_info_filled; i++) { 4148 for (i = 0; i < spec->dac_info_filled; i++) {
4132 const char *label; 4149 const char *label;
4133 int idx, type; 4150 int idx, type;
@@ -4146,8 +4163,13 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
4146 idx = num_hp++; 4163 idx = num_hp++;
4147 break; 4164 break;
4148 case AUTO_PIN_SPEAKER_OUT: 4165 case AUTO_PIN_SPEAKER_OUT:
4149 label = "Speaker"; 4166 if (speaker_2_1) {
4150 idx = num_spk++; 4167 label = num_spk++ ? "Bass Speaker" : "Speaker";
4168 idx = 0;
4169 } else {
4170 label = "Speaker";
4171 idx = num_spk++;
4172 }
4151 break; 4173 break;
4152 } 4174 }
4153 err = try_add_pb_volume(codec, dac, 4175 err = try_add_pb_volume(codec, dac,
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 962a948f4f10..f799406f4404 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1081,7 +1081,7 @@ static struct snd_kcontrol_new stac_smux_mixer = {
1081 1081
1082static const char * const slave_pfxs[] = { 1082static const char * const slave_pfxs[] = {
1083 "Front", "Surround", "Center", "LFE", "Side", 1083 "Front", "Surround", "Center", "LFE", "Side",
1084 "Headphone", "Speaker", "IEC958", "PCM", 1084 "Headphone", "Speaker", "Bass Speaker", "IEC958", "PCM",
1085 NULL 1085 NULL
1086}; 1086};
1087 1087
@@ -3269,9 +3269,9 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3269 idx = i; 3269 idx = i;
3270 break; 3270 break;
3271 case AUTO_PIN_SPEAKER_OUT: 3271 case AUTO_PIN_SPEAKER_OUT:
3272 if (num_outs <= 1) { 3272 if (num_outs <= 2) {
3273 name = "Speaker"; 3273 name = i ? "Bass Speaker" : "Speaker";
3274 idx = i; 3274 idx = 0;
3275 break; 3275 break;
3276 } 3276 }
3277 /* Fall through in case of multi speaker outs */ 3277 /* Fall through in case of multi speaker outs */
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 019e1a00414a..0e9b0747adc6 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -1454,7 +1454,7 @@ static const struct hda_pcm_stream via_pcm_digital_capture = {
1454 */ 1454 */
1455static const char * const via_slave_pfxs[] = { 1455static const char * const via_slave_pfxs[] = {
1456 "Front", "Surround", "Center", "LFE", "Side", 1456 "Front", "Surround", "Center", "LFE", "Side",
1457 "Headphone", "Speaker", 1457 "Headphone", "Speaker", "Bass Speaker",
1458 NULL, 1458 NULL,
1459}; 1459};
1460 1460
@@ -1969,8 +1969,8 @@ static int via_auto_create_multi_out_ctls(struct hda_codec *codec)
1969 } else { 1969 } else {
1970 const char *pfx = chname[i]; 1970 const char *pfx = chname[i];
1971 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && 1971 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT &&
1972 cfg->line_outs == 1) 1972 cfg->line_outs <= 2)
1973 pfx = "Speaker"; 1973 pfx = i ? "Bass Speaker" : "Speaker";
1974 err = create_ch_ctls(codec, pfx, 3, true, path); 1974 err = create_ch_ctls(codec, pfx, 3, true, path);
1975 if (err < 0) 1975 if (err < 0)
1976 return err; 1976 return err;