Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293122
b: refs/heads/master
c: 527c73b
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai committed Mar 12, 2012
1 parent fd6cf85 commit 5c05c26
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 420b0febe54099ea9003bddad0a81e882a8472af
refs/heads/master: 527c73bada6f02a35983ddb34db3a0fd4360c88c
36 changes: 32 additions & 4 deletions trunk/sound/pci/hda/patch_conexant.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ struct conexant_spec {
const struct snd_kcontrol_new *mixers[5];
int num_mixers;
hda_nid_t vmaster_nid;
struct snd_kcontrol *vmaster_sw_kctl;
void (*vmaster_hook)(struct snd_kcontrol *, int);

const struct hda_verb *init_verbs[5]; /* initialization verbs
* don't forget NULL
Expand Down Expand Up @@ -513,9 +515,10 @@ static int conexant_build_controls(struct hda_codec *codec)
}
if (spec->vmaster_nid &&
!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
err = snd_hda_add_vmaster(codec, "Master Playback Switch",
NULL, slave_pfxs,
"Playback Switch");
err = __snd_hda_add_vmaster(codec, "Master Playback Switch",
NULL, slave_pfxs,
"Playback Switch", true,
&spec->vmaster_sw_kctl);
if (err < 0)
return err;
}
Expand Down Expand Up @@ -3975,6 +3978,19 @@ static void clear_unsol_on_unused_pins(struct hda_codec *codec)
}
}

/* turn on/off EAPD according to Master switch */
static void cx_auto_vmaster_hook(void *private_data, int enabled)
{
struct hda_codec *codec = private_data;
struct conexant_spec *spec = codec->spec;

if (enabled && spec->pin_eapd_ctrls) {
cx_auto_update_speakers(codec);
return;
}
cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled);
}

static void cx_auto_init_output(struct hda_codec *codec)
{
struct conexant_spec *spec = codec->spec;
Expand Down Expand Up @@ -4079,11 +4095,13 @@ static void cx_auto_init_digital(struct hda_codec *codec)

static int cx_auto_init(struct hda_codec *codec)
{
struct conexant_spec *spec = codec->spec;
/*snd_hda_sequence_write(codec, cx_auto_init_verbs);*/
cx_auto_init_output(codec);
cx_auto_init_input(codec);
cx_auto_init_digital(codec);
snd_hda_jack_report_sync(codec);
snd_ctl_sync_vmaster_hook(spec->vmaster_sw_kctl);
return 0;
}

Expand Down Expand Up @@ -4329,6 +4347,11 @@ static int cx_auto_build_controls(struct hda_codec *codec)
err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
if (err < 0)
return err;
if (spec->vmaster_hook && spec->vmaster_sw_kctl) {
snd_ctl_add_vmaster_hook(spec->vmaster_sw_kctl,
spec->vmaster_hook, codec);
snd_ctl_sync_vmaster_hook(spec->vmaster_sw_kctl);
}
return 0;
}

Expand All @@ -4353,7 +4376,6 @@ static int cx_auto_search_adcs(struct hda_codec *codec)
return 0;
}


static const struct hda_codec_ops cx_auto_patch_ops = {
.build_controls = cx_auto_build_controls,
.build_pcms = conexant_build_pcms,
Expand Down Expand Up @@ -4455,6 +4477,12 @@ static int patch_conexant_auto(struct hda_codec *codec)

apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl);

/* add EAPD vmaster hook to all HP machines */
/* NOTE: this should be applied via fixup once when the generic
* fixup code is merged to hda_codec.c
*/
spec->vmaster_hook = cx_auto_vmaster_hook;

err = cx_auto_search_adcs(codec);
if (err < 0)
return err;
Expand Down

0 comments on commit 5c05c26

Please sign in to comment.