aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_generic.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-12-20 09:36:30 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-12 02:34:19 -0500
commitd5a9f1bb38354ef4786d7fd761d75594bc33f7d2 (patch)
tree6755b8d3cba32e2eb9c7235b7fe41ca5d1848f35 /sound/pci/hda/hda_generic.c
parent64049c81df38aa5f550cc0fae9c74c6bd5c31e58 (diff)
ALSA: hda - Dynamically turn on/off EAPD in generic codec driver
When spec->own_eapd_ctl isn't set, try to turn on/off EAPD on demand for each pin. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_generic.c')
-rw-r--r--sound/pci/hda/hda_generic.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index a133fcfd2fb4..46b00e0756c5 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -523,6 +523,18 @@ void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
523} 523}
524EXPORT_SYMBOL_HDA(snd_hda_activate_path); 524EXPORT_SYMBOL_HDA(snd_hda_activate_path);
525 525
526/* turn on/off EAPD on the given pin */
527static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable)
528{
529 struct hda_gen_spec *spec = codec->spec;
530 if (spec->own_eapd_ctl ||
531 !(snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_EAPD))
532 return;
533 snd_hda_codec_update_cache(codec, pin, 0,
534 AC_VERB_SET_EAPD_BTLENABLE,
535 enable ? 0x02 : 0x00);
536}
537
526 538
527/* 539/*
528 * Helper functions for creating mixer ctl elements 540 * Helper functions for creating mixer ctl elements
@@ -1485,7 +1497,9 @@ static int set_multi_io(struct hda_codec *codec, int idx, bool output)
1485 if (output) { 1497 if (output) {
1486 snd_hda_set_pin_ctl_cache(codec, nid, PIN_OUT); 1498 snd_hda_set_pin_ctl_cache(codec, nid, PIN_OUT);
1487 snd_hda_activate_path(codec, path, true, true); 1499 snd_hda_activate_path(codec, path, true, true);
1500 set_pin_eapd(codec, nid, true);
1488 } else { 1501 } else {
1502 set_pin_eapd(codec, nid, false);
1489 snd_hda_activate_path(codec, path, false, true); 1503 snd_hda_activate_path(codec, path, false, true);
1490 snd_hda_set_pin_ctl_cache(codec, nid, 1504 snd_hda_set_pin_ctl_cache(codec, nid,
1491 spec->multi_io[idx].ctl_in); 1505 spec->multi_io[idx].ctl_in);
@@ -2418,6 +2432,7 @@ static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
2418 val = 0; 2432 val = 0;
2419 val |= pin_bits; 2433 val |= pin_bits;
2420 snd_hda_set_pin_ctl(codec, nid, val); 2434 snd_hda_set_pin_ctl(codec, nid, val);
2435 set_pin_eapd(codec, nid, !mute);
2421 } 2436 }
2422} 2437}
2423 2438
@@ -3351,7 +3366,6 @@ EXPORT_SYMBOL_HDA(snd_hda_gen_build_pcms);
3351static void set_output_and_unmute(struct hda_codec *codec, hda_nid_t pin, 3366static void set_output_and_unmute(struct hda_codec *codec, hda_nid_t pin,
3352 int pin_type, hda_nid_t dac) 3367 int pin_type, hda_nid_t dac)
3353{ 3368{
3354 struct hda_gen_spec *spec = codec->spec;
3355 struct nid_path *path; 3369 struct nid_path *path;
3356 3370
3357 snd_hda_set_pin_ctl_cache(codec, pin, pin_type); 3371 snd_hda_set_pin_ctl_cache(codec, pin, pin_type);
@@ -3361,11 +3375,7 @@ static void set_output_and_unmute(struct hda_codec *codec, hda_nid_t pin,
3361 if (path->active) 3375 if (path->active)
3362 return; 3376 return;
3363 snd_hda_activate_path(codec, path, true, true); 3377 snd_hda_activate_path(codec, path, true, true);
3364 3378 set_pin_eapd(codec, pin, true);
3365 if (!spec->own_eapd_ctl &&
3366 (snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_EAPD))
3367 snd_hda_codec_update_cache(codec, pin, 0,
3368 AC_VERB_SET_EAPD_BTLENABLE, 0x02);
3369} 3379}
3370 3380
3371/* initialize primary output paths */ 3381/* initialize primary output paths */