diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-03-20 13:21:03 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-03-20 13:31:18 -0400 |
commit | 967b1307b69b8ada8b331e01046ad1ef83742e99 (patch) | |
tree | 4974dfe19444e6b75223d616a1f63982c299bc02 | |
parent | 6b275b140094b701f7ad15272f0597e9d954e5e4 (diff) |
ALSA: hda - Rename power_mgmt flag with power_save_node
David suggested that the name "power_mgmt" is too ambiguous. Rename
the flag with a bit clearer one "power_save_node".
Also, add the corresponding description to HD-Audio.txt, too.
Reported-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | Documentation/sound/alsa/HD-Audio.txt | 6 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 2 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.c | 30 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 8 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 12 |
5 files changed, 31 insertions, 27 deletions
diff --git a/Documentation/sound/alsa/HD-Audio.txt b/Documentation/sound/alsa/HD-Audio.txt index 42a0a39b77e6..e7193aac669c 100644 --- a/Documentation/sound/alsa/HD-Audio.txt +++ b/Documentation/sound/alsa/HD-Audio.txt | |||
@@ -466,7 +466,11 @@ The generic parser supports the following hints: | |||
466 | - add_jack_modes (bool): add "xxx Jack Mode" enum controls to each | 466 | - add_jack_modes (bool): add "xxx Jack Mode" enum controls to each |
467 | I/O jack for allowing to change the headphone amp and mic bias VREF | 467 | I/O jack for allowing to change the headphone amp and mic bias VREF |
468 | capabilities | 468 | capabilities |
469 | - power_down_unused (bool): power down the unused widgets | 469 | - power_save_node (bool): advanced power management for each widget, |
470 | controlling the power sate (D0/D3) of each widget node depending on | ||
471 | the actual pin and stream states | ||
472 | - power_down_unused (bool): power down the unused widgets, a subset of | ||
473 | power_save_node, and will be dropped in future | ||
470 | - add_hp_mic (bool): add the headphone to capture source if possible | 474 | - add_hp_mic (bool): add the headphone to capture source if possible |
471 | - hp_mic_detect (bool): enable/disable the hp/mic shared input for a | 475 | - hp_mic_detect (bool): enable/disable the hp/mic shared input for a |
472 | single built-in mic case; default true | 476 | single built-in mic case; default true |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 148e84ce61cf..ccf355d4a8fa 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -371,7 +371,7 @@ struct hda_codec { | |||
371 | unsigned int cached_write:1; /* write only to caches */ | 371 | unsigned int cached_write:1; /* write only to caches */ |
372 | unsigned int dp_mst:1; /* support DP1.2 Multi-stream transport */ | 372 | unsigned int dp_mst:1; /* support DP1.2 Multi-stream transport */ |
373 | unsigned int dump_coef:1; /* dump processing coefs in codec proc file */ | 373 | unsigned int dump_coef:1; /* dump processing coefs in codec proc file */ |
374 | unsigned int power_mgmt:1; /* advanced PM for each widget */ | 374 | unsigned int power_save_node:1; /* advanced PM for each widget */ |
375 | #ifdef CONFIG_PM | 375 | #ifdef CONFIG_PM |
376 | unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */ | 376 | unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */ |
377 | atomic_t in_pm; /* suspend/resume being performed */ | 377 | atomic_t in_pm; /* suspend/resume being performed */ |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 1cafcbb9d391..0ef2459cd05f 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -140,9 +140,9 @@ static void parse_user_hints(struct hda_codec *codec) | |||
140 | val = snd_hda_get_bool_hint(codec, "single_adc_amp"); | 140 | val = snd_hda_get_bool_hint(codec, "single_adc_amp"); |
141 | if (val >= 0) | 141 | if (val >= 0) |
142 | codec->single_adc_amp = !!val; | 142 | codec->single_adc_amp = !!val; |
143 | val = snd_hda_get_bool_hint(codec, "power_mgmt"); | 143 | val = snd_hda_get_bool_hint(codec, "power_save_node"); |
144 | if (val >= 0) | 144 | if (val >= 0) |
145 | codec->power_mgmt = !!val; | 145 | codec->power_save_node = !!val; |
146 | 146 | ||
147 | val = snd_hda_get_bool_hint(codec, "auto_mute"); | 147 | val = snd_hda_get_bool_hint(codec, "auto_mute"); |
148 | if (val >= 0) | 148 | if (val >= 0) |
@@ -661,7 +661,7 @@ static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid, | |||
661 | struct nid_path *path = snd_array_elem(&spec->paths, n); | 661 | struct nid_path *path = snd_array_elem(&spec->paths, n); |
662 | if (!path->active) | 662 | if (!path->active) |
663 | continue; | 663 | continue; |
664 | if (codec->power_mgmt) { | 664 | if (codec->power_save_node) { |
665 | if (!path->stream_enabled) | 665 | if (!path->stream_enabled) |
666 | continue; | 666 | continue; |
667 | /* ignore unplugged paths except for DAC/ADC */ | 667 | /* ignore unplugged paths except for DAC/ADC */ |
@@ -879,8 +879,8 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path, | |||
879 | path->active = false; | 879 | path->active = false; |
880 | 880 | ||
881 | /* make sure the widget is powered up */ | 881 | /* make sure the widget is powered up */ |
882 | if (enable && (spec->power_down_unused || codec->power_mgmt)) | 882 | if (enable && (spec->power_down_unused || codec->power_save_node)) |
883 | path_power_update(codec, path, codec->power_mgmt); | 883 | path_power_update(codec, path, codec->power_save_node); |
884 | 884 | ||
885 | for (i = path->depth - 1; i >= 0; i--) { | 885 | for (i = path->depth - 1; i >= 0; i--) { |
886 | hda_nid_t nid = path->path[i]; | 886 | hda_nid_t nid = path->path[i]; |
@@ -905,7 +905,7 @@ static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path) | |||
905 | { | 905 | { |
906 | struct hda_gen_spec *spec = codec->spec; | 906 | struct hda_gen_spec *spec = codec->spec; |
907 | 907 | ||
908 | if (!(spec->power_down_unused || codec->power_mgmt) || path->active) | 908 | if (!(spec->power_down_unused || codec->power_save_node) || path->active) |
909 | return; | 909 | return; |
910 | sync_power_state_change(codec, path_power_update(codec, path, true)); | 910 | sync_power_state_change(codec, path_power_update(codec, path, true)); |
911 | } | 911 | } |
@@ -3981,7 +3981,7 @@ static hda_nid_t set_pin_power_jack(struct hda_codec *codec, hda_nid_t pin, | |||
3981 | { | 3981 | { |
3982 | bool on; | 3982 | bool on; |
3983 | 3983 | ||
3984 | if (!codec->power_mgmt) | 3984 | if (!codec->power_save_node) |
3985 | return 0; | 3985 | return 0; |
3986 | 3986 | ||
3987 | on = snd_hda_jack_detect_state(codec, pin) != HDA_JACK_NOT_PRESENT; | 3987 | on = snd_hda_jack_detect_state(codec, pin) != HDA_JACK_NOT_PRESENT; |
@@ -4038,7 +4038,7 @@ static void add_all_pin_power_ctls(struct hda_codec *codec, bool on) | |||
4038 | struct auto_pin_cfg *cfg = &spec->autocfg; | 4038 | struct auto_pin_cfg *cfg = &spec->autocfg; |
4039 | int i; | 4039 | int i; |
4040 | 4040 | ||
4041 | if (!codec->power_mgmt) | 4041 | if (!codec->power_save_node) |
4042 | return; | 4042 | return; |
4043 | add_pin_power_ctls(codec, cfg->line_outs, cfg->line_out_pins, on); | 4043 | add_pin_power_ctls(codec, cfg->line_outs, cfg->line_out_pins, on); |
4044 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | 4044 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
@@ -4067,7 +4067,7 @@ static void sync_all_pin_power_ctls(struct hda_codec *codec) | |||
4067 | struct auto_pin_cfg *cfg = &spec->autocfg; | 4067 | struct auto_pin_cfg *cfg = &spec->autocfg; |
4068 | int i; | 4068 | int i; |
4069 | 4069 | ||
4070 | if (!codec->power_mgmt) | 4070 | if (!codec->power_save_node) |
4071 | return; | 4071 | return; |
4072 | sync_pin_power_ctls(codec, cfg->line_outs, cfg->line_out_pins); | 4072 | sync_pin_power_ctls(codec, cfg->line_outs, cfg->line_out_pins); |
4073 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | 4073 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
@@ -4111,7 +4111,7 @@ static int add_fake_beep_paths(struct hda_codec *codec) | |||
4111 | hda_nid_t nid = spec->beep_nid; | 4111 | hda_nid_t nid = spec->beep_nid; |
4112 | int err; | 4112 | int err; |
4113 | 4113 | ||
4114 | if (!codec->power_mgmt || !nid) | 4114 | if (!codec->power_save_node || !nid) |
4115 | return 0; | 4115 | return 0; |
4116 | err = add_fake_paths(codec, nid, cfg->line_outs, cfg->line_out_pins); | 4116 | err = add_fake_paths(codec, nid, cfg->line_outs, cfg->line_out_pins); |
4117 | if (err < 0) | 4117 | if (err < 0) |
@@ -4233,7 +4233,7 @@ static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins, | |||
4233 | } | 4233 | } |
4234 | 4234 | ||
4235 | set_pin_eapd(codec, nid, !mute); | 4235 | set_pin_eapd(codec, nid, !mute); |
4236 | if (codec->power_mgmt) { | 4236 | if (codec->power_save_node) { |
4237 | bool on = !mute; | 4237 | bool on = !mute; |
4238 | if (on) | 4238 | if (on) |
4239 | on = snd_hda_jack_detect_state(codec, nid) | 4239 | on = snd_hda_jack_detect_state(codec, nid) |
@@ -4741,11 +4741,11 @@ static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix) | |||
4741 | * @nid: audio widget | 4741 | * @nid: audio widget |
4742 | * @on: power on/off flag | 4742 | * @on: power on/off flag |
4743 | * | 4743 | * |
4744 | * Set this in patch_ops.stream_pm. Only valid with power_mgmt flag. | 4744 | * Set this in patch_ops.stream_pm. Only valid with power_save_node flag. |
4745 | */ | 4745 | */ |
4746 | void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on) | 4746 | void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on) |
4747 | { | 4747 | { |
4748 | if (codec->power_mgmt) | 4748 | if (codec->power_save_node) |
4749 | set_path_power(codec, nid, -1, on); | 4749 | set_path_power(codec, nid, -1, on); |
4750 | } | 4750 | } |
4751 | EXPORT_SYMBOL_GPL(snd_hda_gen_stream_pm); | 4751 | EXPORT_SYMBOL_GPL(snd_hda_gen_stream_pm); |
@@ -4916,14 +4916,14 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec, | |||
4916 | dig_only: | 4916 | dig_only: |
4917 | parse_digital(codec); | 4917 | parse_digital(codec); |
4918 | 4918 | ||
4919 | if (spec->power_down_unused || codec->power_mgmt) | 4919 | if (spec->power_down_unused || codec->power_save_node) |
4920 | codec->power_filter = snd_hda_gen_path_power_filter; | 4920 | codec->power_filter = snd_hda_gen_path_power_filter; |
4921 | 4921 | ||
4922 | if (!spec->no_analog && spec->beep_nid) { | 4922 | if (!spec->no_analog && spec->beep_nid) { |
4923 | err = snd_hda_attach_beep_device(codec, spec->beep_nid); | 4923 | err = snd_hda_attach_beep_device(codec, spec->beep_nid); |
4924 | if (err < 0) | 4924 | if (err < 0) |
4925 | return err; | 4925 | return err; |
4926 | if (codec->beep && codec->power_mgmt) { | 4926 | if (codec->beep && codec->power_save_node) { |
4927 | err = add_fake_beep_paths(codec); | 4927 | err = add_fake_beep_paths(codec); |
4928 | if (err < 0) | 4928 | if (err < 0) |
4929 | return err; | 4929 | return err; |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 7e531d5cde51..5b7c173adcb8 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -4494,7 +4494,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec) | |||
4494 | return err; | 4494 | return err; |
4495 | 4495 | ||
4496 | spec = codec->spec; | 4496 | spec = codec->spec; |
4497 | codec->power_mgmt = 1; | 4497 | codec->power_save_node = 1; |
4498 | spec->linear_tone_beep = 0; | 4498 | spec->linear_tone_beep = 0; |
4499 | spec->gen.mixer_nid = 0x1d; | 4499 | spec->gen.mixer_nid = 0x1d; |
4500 | spec->have_spdif_mux = 1; | 4500 | spec->have_spdif_mux = 1; |
@@ -4600,7 +4600,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
4600 | codec->epss = 0; /* longer delay needed for D3 */ | 4600 | codec->epss = 0; /* longer delay needed for D3 */ |
4601 | 4601 | ||
4602 | spec = codec->spec; | 4602 | spec = codec->spec; |
4603 | codec->power_mgmt = 1; | 4603 | codec->power_save_node = 1; |
4604 | spec->linear_tone_beep = 0; | 4604 | spec->linear_tone_beep = 0; |
4605 | spec->gen.own_eapd_ctl = 1; | 4605 | spec->gen.own_eapd_ctl = 1; |
4606 | spec->gen.power_down_unused = 1; | 4606 | spec->gen.power_down_unused = 1; |
@@ -4650,7 +4650,7 @@ static int patch_stac92hd95(struct hda_codec *codec) | |||
4650 | codec->epss = 0; /* longer delay needed for D3 */ | 4650 | codec->epss = 0; /* longer delay needed for D3 */ |
4651 | 4651 | ||
4652 | spec = codec->spec; | 4652 | spec = codec->spec; |
4653 | codec->power_mgmt = 1; | 4653 | codec->power_save_node = 1; |
4654 | spec->linear_tone_beep = 0; | 4654 | spec->linear_tone_beep = 0; |
4655 | spec->gen.own_eapd_ctl = 1; | 4655 | spec->gen.own_eapd_ctl = 1; |
4656 | spec->gen.power_down_unused = 1; | 4656 | spec->gen.power_down_unused = 1; |
@@ -4692,7 +4692,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
4692 | return err; | 4692 | return err; |
4693 | 4693 | ||
4694 | spec = codec->spec; | 4694 | spec = codec->spec; |
4695 | codec->power_mgmt = 1; | 4695 | codec->power_save_node = 1; |
4696 | spec->linear_tone_beep = 0; | 4696 | spec->linear_tone_beep = 0; |
4697 | spec->gen.own_eapd_ctl = 1; | 4697 | spec->gen.own_eapd_ctl = 1; |
4698 | spec->gen.power_down_unused = 1; | 4698 | spec->gen.power_down_unused = 1; |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index d5d1dca4f11b..485663bb9101 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -133,7 +133,7 @@ static struct via_spec *via_new_spec(struct hda_codec *codec) | |||
133 | spec->gen.keep_eapd_on = 1; | 133 | spec->gen.keep_eapd_on = 1; |
134 | spec->gen.pcm_playback_hook = via_playback_pcm_hook; | 134 | spec->gen.pcm_playback_hook = via_playback_pcm_hook; |
135 | spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; | 135 | spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; |
136 | codec->power_mgmt = 1; | 136 | codec->power_save_node = 1; |
137 | spec->gen.power_down_unused = 1; | 137 | spec->gen.power_down_unused = 1; |
138 | return spec; | 138 | return spec; |
139 | } | 139 | } |
@@ -236,7 +236,7 @@ static int via_pin_power_ctl_get(struct snd_kcontrol *kcontrol, | |||
236 | struct snd_ctl_elem_value *ucontrol) | 236 | struct snd_ctl_elem_value *ucontrol) |
237 | { | 237 | { |
238 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 238 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
239 | ucontrol->value.enumerated.item[0] = codec->power_mgmt; | 239 | ucontrol->value.enumerated.item[0] = codec->power_save_node; |
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | 242 | ||
@@ -247,9 +247,9 @@ static int via_pin_power_ctl_put(struct snd_kcontrol *kcontrol, | |||
247 | struct via_spec *spec = codec->spec; | 247 | struct via_spec *spec = codec->spec; |
248 | bool val = !!ucontrol->value.enumerated.item[0]; | 248 | bool val = !!ucontrol->value.enumerated.item[0]; |
249 | 249 | ||
250 | if (val == codec->power_mgmt) | 250 | if (val == codec->power_save_node) |
251 | return 0; | 251 | return 0; |
252 | codec->power_mgmt = val; | 252 | codec->power_save_node = val; |
253 | spec->gen.power_down_unused = val; | 253 | spec->gen.power_down_unused = val; |
254 | analog_low_current_mode(codec); | 254 | analog_low_current_mode(codec); |
255 | return 1; | 255 | return 1; |
@@ -295,7 +295,7 @@ static void __analog_low_current_mode(struct hda_codec *codec, bool force) | |||
295 | bool enable; | 295 | bool enable; |
296 | unsigned int verb, parm; | 296 | unsigned int verb, parm; |
297 | 297 | ||
298 | if (!codec->power_mgmt) | 298 | if (!codec->power_save_node) |
299 | enable = false; | 299 | enable = false; |
300 | else | 300 | else |
301 | enable = is_aa_path_mute(codec) && !spec->gen.active_streams; | 301 | enable = is_aa_path_mute(codec) && !spec->gen.active_streams; |
@@ -517,7 +517,7 @@ static int via_parse_auto_config(struct hda_codec *codec) | |||
517 | return err; | 517 | return err; |
518 | 518 | ||
519 | /* disable widget PM at start for compatibility */ | 519 | /* disable widget PM at start for compatibility */ |
520 | codec->power_mgmt = 0; | 520 | codec->power_save_node = 0; |
521 | spec->gen.power_down_unused = 0; | 521 | spec->gen.power_down_unused = 0; |
522 | return 0; | 522 | return 0; |
523 | } | 523 | } |