Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34941
b: refs/heads/master
c: 160ea0d
h: refs/heads/master
i:
  34939: 7d3021a
v: v3
  • Loading branch information
Richard Fish authored and Jaroslav Kysela committed Sep 23, 2006
1 parent eadca6e commit dd0fc09
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0b59397268ed418e139db3806f7956ffcb18b33d
refs/heads/master: 160ea0dc6b86e2c0c4d325c06bf402bfdde7c1c7
63 changes: 63 additions & 0 deletions trunk/sound/pci/hda/patch_sigmatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,66 @@ static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
return 0;
}

/* add playback controls for LFE output */
static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
struct auto_pin_cfg *cfg)
{
struct sigmatel_spec *spec = codec->spec;
int err;
hda_nid_t lfe_pin = 0x0;
int i;

/*
* search speaker outs and line outs for a mono speaker pin
* with an amp. If one is found, add LFE controls
* for it.
*/
for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) {
hda_nid_t pin = spec->autocfg.speaker_pins[i];
unsigned long wcaps = get_wcaps(codec, pin);
wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
if (wcaps == AC_WCAP_OUT_AMP)
/* found a mono speaker with an amp, must be lfe */
lfe_pin = pin;
}

/* if speaker_outs is 0, then speakers may be in line_outs */
if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) {
for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
hda_nid_t pin = spec->autocfg.line_out_pins[i];
unsigned long cfg;
cfg = snd_hda_codec_read(codec, pin, 0,
AC_VERB_GET_CONFIG_DEFAULT,
0x00);
if (get_defcfg_device(cfg) == AC_JACK_SPEAKER) {
unsigned long wcaps = get_wcaps(codec, pin);
wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
if (wcaps == AC_WCAP_OUT_AMP)
/* found a mono speaker with an amp,
must be lfe */
lfe_pin = pin;
}
}
}

if (lfe_pin) {
err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
"LFE Playback Volume",
HDA_COMPOSE_AMP_VAL(lfe_pin, 1, 0,
HDA_OUTPUT));
if (err < 0)
return err;
err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
"LFE Playback Switch",
HDA_COMPOSE_AMP_VAL(lfe_pin, 1, 0,
HDA_OUTPUT));
if (err < 0)
return err;
}

return 0;
}

static int stac9200_parse_auto_config(struct hda_codec *codec)
{
struct sigmatel_spec *spec = codec->spec;
Expand All @@ -1237,6 +1297,9 @@ static int stac9200_parse_auto_config(struct hda_codec *codec)
if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0)
return err;

if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0)
return err;

if (spec->autocfg.dig_out_pin)
spec->multiout.dig_out_nid = 0x05;
if (spec->autocfg.dig_in_pin)
Expand Down

0 comments on commit dd0fc09

Please sign in to comment.