aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorRichard Fish <bigfish@asmallpond.org>2006-09-06 07:58:25 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:46:22 -0400
commit160ea0dc6b86e2c0c4d325c06bf402bfdde7c1c7 (patch)
treee87db8537135b9e9ab21c0f57c0796f531845802 /sound
parent0b59397268ed418e139db3806f7956ffcb18b33d (diff)
[ALSA] [snd-intel-hda] enable center/LFE speaker on some laptops
This patch adds LFE mixer controls for laptops with a stac9200 and a mono speaker pin with amplifier. Signed-off-by: Richard Fish <bigfish@asmallpond.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_sigmatel.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 87169032be1f..bcbbe111ab95 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1223,6 +1223,66 @@ static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
1223 return 0; 1223 return 0;
1224} 1224}
1225 1225
1226/* add playback controls for LFE output */
1227static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
1228 struct auto_pin_cfg *cfg)
1229{
1230 struct sigmatel_spec *spec = codec->spec;
1231 int err;
1232 hda_nid_t lfe_pin = 0x0;
1233 int i;
1234
1235 /*
1236 * search speaker outs and line outs for a mono speaker pin
1237 * with an amp. If one is found, add LFE controls
1238 * for it.
1239 */
1240 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
1241 hda_nid_t pin = spec->autocfg.speaker_pins[i];
1242 unsigned long wcaps = get_wcaps(codec, pin);
1243 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
1244 if (wcaps == AC_WCAP_OUT_AMP)
1245 /* found a mono speaker with an amp, must be lfe */
1246 lfe_pin = pin;
1247 }
1248
1249 /* if speaker_outs is 0, then speakers may be in line_outs */
1250 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
1251 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
1252 hda_nid_t pin = spec->autocfg.line_out_pins[i];
1253 unsigned long cfg;
1254 cfg = snd_hda_codec_read(codec, pin, 0,
1255 AC_VERB_GET_CONFIG_DEFAULT,
1256 0x00);
1257 if (get_defcfg_device(cfg) == AC_JACK_SPEAKER) {
1258 unsigned long wcaps = get_wcaps(codec, pin);
1259 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
1260 if (wcaps == AC_WCAP_OUT_AMP)
1261 /* found a mono speaker with an amp,
1262 must be lfe */
1263 lfe_pin = pin;
1264 }
1265 }
1266 }
1267
1268 if (lfe_pin) {
1269 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
1270 "LFE Playback Volume",
1271 HDA_COMPOSE_AMP_VAL(lfe_pin, 1, 0,
1272 HDA_OUTPUT));
1273 if (err < 0)
1274 return err;
1275 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
1276 "LFE Playback Switch",
1277 HDA_COMPOSE_AMP_VAL(lfe_pin, 1, 0,
1278 HDA_OUTPUT));
1279 if (err < 0)
1280 return err;
1281 }
1282
1283 return 0;
1284}
1285
1226static int stac9200_parse_auto_config(struct hda_codec *codec) 1286static int stac9200_parse_auto_config(struct hda_codec *codec)
1227{ 1287{
1228 struct sigmatel_spec *spec = codec->spec; 1288 struct sigmatel_spec *spec = codec->spec;
@@ -1237,6 +1297,9 @@ static int stac9200_parse_auto_config(struct hda_codec *codec)
1237 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) 1297 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
1238 return err; 1298 return err;
1239 1299
1300 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
1301 return err;
1302
1240 if (spec->autocfg.dig_out_pin) 1303 if (spec->autocfg.dig_out_pin)
1241 spec->multiout.dig_out_nid = 0x05; 1304 spec->multiout.dig_out_nid = 0x05;
1242 if (spec->autocfg.dig_in_pin) 1305 if (spec->autocfg.dig_in_pin)