Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 287186
b: refs/heads/master
c: e9d010c
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai committed Feb 2, 2012
1 parent 9796319 commit 2e431a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 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: 924339239fd5ba3e505f9420d41f0939196f3530
refs/heads/master: e9d010c2e8f03952e67a6fd8aed0f0dc92084ccc
27 changes: 21 additions & 6 deletions trunk/sound/pci/hda/patch_via.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ struct via_spec {
unsigned int no_pin_power_ctl;
enum VIA_HDA_CODEC codec_type;

/* analog low-power control */
bool alc_mode;

/* smart51 setup */
unsigned int smart51_nums;
hda_nid_t smart51_pins[2];
Expand Down Expand Up @@ -758,6 +761,7 @@ static int via_pin_power_ctl_put(struct snd_kcontrol *kcontrol,
return 0;
spec->no_pin_power_ctl = val;
set_widgets_power_state(codec);
analog_low_current_mode(codec);
return 1;
}

Expand Down Expand Up @@ -1045,13 +1049,19 @@ static bool is_aa_path_mute(struct hda_codec *codec)
}

/* enter/exit analog low-current mode */
static void analog_low_current_mode(struct hda_codec *codec)
static void __analog_low_current_mode(struct hda_codec *codec, bool force)
{
struct via_spec *spec = codec->spec;
bool enable;
unsigned int verb, parm;

enable = is_aa_path_mute(codec) && !spec->opened_streams;
if (spec->no_pin_power_ctl)
enable = false;
else
enable = is_aa_path_mute(codec) && !spec->opened_streams;
if (enable == spec->alc_mode && !force)
return;
spec->alc_mode = enable;

/* decide low current mode's verb & parameter */
switch (spec->codec_type) {
Expand Down Expand Up @@ -1083,6 +1093,11 @@ static void analog_low_current_mode(struct hda_codec *codec)
snd_hda_codec_write(codec, codec->afg, 0, verb, parm);
}

static void analog_low_current_mode(struct hda_codec *codec)
{
return __analog_low_current_mode(codec, false);
}

/*
* generic initialization of ADC, input mixers and output mixers
*/
Expand Down Expand Up @@ -1508,10 +1523,6 @@ static int via_build_controls(struct hda_codec *codec)
return err;
}

/* init power states */
set_widgets_power_state(codec);
analog_low_current_mode(codec);

via_free_kctls(codec); /* no longer needed */

err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
Expand Down Expand Up @@ -2782,6 +2793,10 @@ static int via_init(struct hda_codec *codec)
for (i = 0; i < spec->num_iverbs; i++)
snd_hda_sequence_write(codec, spec->init_verbs[i]);

/* init power states */
set_widgets_power_state(codec);
__analog_low_current_mode(codec, true);

via_auto_init_multi_out(codec);
via_auto_init_hp_out(codec);
via_auto_init_speaker_out(codec);
Expand Down

0 comments on commit 2e431a7

Please sign in to comment.