diff options
author | David Henningsson <david.henningsson@canonical.com> | 2014-09-23 04:38:17 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-09-23 09:57:28 -0400 |
commit | 861a04ed15a48e9af7b591cd8ae3bc46aece1733 (patch) | |
tree | 8cab89d6faa04cff840fe155b18b480dd4dd753f | |
parent | a5062dee82826f54529c89d0e58211897b1b4c68 (diff) |
ALSA: hda - Move the function "check_amp_caps" to hda_codec.c
The next patch will use it, so make it visible across modules.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/hda_codec.c | 20 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.c | 17 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 8 |
3 files changed, 28 insertions, 17 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0aa2e1ed1dbc..15e0089492f7 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -2002,6 +2002,26 @@ u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction) | |||
2002 | EXPORT_SYMBOL_GPL(query_amp_caps); | 2002 | EXPORT_SYMBOL_GPL(query_amp_caps); |
2003 | 2003 | ||
2004 | /** | 2004 | /** |
2005 | * snd_hda_check_amp_caps - query AMP capabilities | ||
2006 | * @codec: the HD-audio codec | ||
2007 | * @nid: the NID to query | ||
2008 | * @dir: either #HDA_INPUT or #HDA_OUTPUT | ||
2009 | * | ||
2010 | * Check whether the widget has the given amp capability for the direction. | ||
2011 | */ | ||
2012 | bool snd_hda_check_amp_caps(struct hda_codec *codec, hda_nid_t nid, | ||
2013 | int dir, unsigned int bits) | ||
2014 | { | ||
2015 | if (!nid) | ||
2016 | return false; | ||
2017 | if (get_wcaps(codec, nid) & (1 << (dir + 1))) | ||
2018 | if (query_amp_caps(codec, nid, dir) & bits) | ||
2019 | return true; | ||
2020 | return false; | ||
2021 | } | ||
2022 | EXPORT_SYMBOL_GPL(snd_hda_check_amp_caps); | ||
2023 | |||
2024 | /** | ||
2005 | * snd_hda_override_amp_caps - Override the AMP capabilities | 2025 | * snd_hda_override_amp_caps - Override the AMP capabilities |
2006 | * @codec: the CODEC to clean up | 2026 | * @codec: the CODEC to clean up |
2007 | * @nid: the NID to clean up | 2027 | * @nid: the NID to clean up |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 32a85f9cac4b..64220c08bd98 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -519,18 +519,6 @@ static unsigned int amp_val_replace_channels(unsigned int val, unsigned int chs) | |||
519 | return val; | 519 | return val; |
520 | } | 520 | } |
521 | 521 | ||
522 | /* check whether the widget has the given amp capability for the direction */ | ||
523 | static bool check_amp_caps(struct hda_codec *codec, hda_nid_t nid, | ||
524 | int dir, unsigned int bits) | ||
525 | { | ||
526 | if (!nid) | ||
527 | return false; | ||
528 | if (get_wcaps(codec, nid) & (1 << (dir + 1))) | ||
529 | if (query_amp_caps(codec, nid, dir) & bits) | ||
530 | return true; | ||
531 | return false; | ||
532 | } | ||
533 | |||
534 | static bool same_amp_caps(struct hda_codec *codec, hda_nid_t nid1, | 522 | static bool same_amp_caps(struct hda_codec *codec, hda_nid_t nid1, |
535 | hda_nid_t nid2, int dir) | 523 | hda_nid_t nid2, int dir) |
536 | { | 524 | { |
@@ -540,11 +528,6 @@ static bool same_amp_caps(struct hda_codec *codec, hda_nid_t nid1, | |||
540 | query_amp_caps(codec, nid2, dir)); | 528 | query_amp_caps(codec, nid2, dir)); |
541 | } | 529 | } |
542 | 530 | ||
543 | #define nid_has_mute(codec, nid, dir) \ | ||
544 | check_amp_caps(codec, nid, dir, (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) | ||
545 | #define nid_has_volume(codec, nid, dir) \ | ||
546 | check_amp_caps(codec, nid, dir, AC_AMPCAP_NUM_STEPS) | ||
547 | |||
548 | /* look for a widget suitable for assigning a mute switch in the path */ | 531 | /* look for a widget suitable for assigning a mute switch in the path */ |
549 | static hda_nid_t look_for_out_mute_nid(struct hda_codec *codec, | 532 | static hda_nid_t look_for_out_mute_nid(struct hda_codec *codec, |
550 | struct nid_path *path) | 533 | struct nid_path *path) |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 8a018d4cbe98..7eb44e78e141 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -603,6 +603,14 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | |||
603 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); | 603 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); |
604 | int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, | 604 | int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, |
605 | unsigned int caps); | 605 | unsigned int caps); |
606 | bool snd_hda_check_amp_caps(struct hda_codec *codec, hda_nid_t nid, | ||
607 | int dir, unsigned int bits); | ||
608 | |||
609 | #define nid_has_mute(codec, nid, dir) \ | ||
610 | snd_hda_check_amp_caps(codec, nid, dir, (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) | ||
611 | #define nid_has_volume(codec, nid, dir) \ | ||
612 | snd_hda_check_amp_caps(codec, nid, dir, AC_AMPCAP_NUM_STEPS) | ||
613 | |||
606 | 614 | ||
607 | /* flags for hda_nid_item */ | 615 | /* flags for hda_nid_item */ |
608 | #define HDA_NID_ITEM_AMP (1<<0) | 616 | #define HDA_NID_ITEM_AMP (1<<0) |