.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * BIOS auto-parser helper functions for HD-audio |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2012 Takashi Iwai <tiwai@suse.de> |
---|
5 | | - * |
---|
6 | | - * This driver is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | 6 | */ |
---|
11 | 7 | |
---|
12 | 8 | #include <linux/slab.h> |
---|
13 | 9 | #include <linux/export.h> |
---|
14 | 10 | #include <linux/sort.h> |
---|
15 | 11 | #include <sound/core.h> |
---|
16 | | -#include "hda_codec.h" |
---|
| 12 | +#include <sound/hda_codec.h> |
---|
17 | 13 | #include "hda_local.h" |
---|
18 | 14 | #include "hda_auto_parser.h" |
---|
19 | 15 | |
---|
.. | .. |
---|
354 | 350 | */ |
---|
355 | 351 | if (!cfg->line_outs && cfg->hp_outs > 1 && |
---|
356 | 352 | !(cond_flags & HDA_PINCFG_NO_HP_FIXUP)) { |
---|
357 | | - int i = 0; |
---|
| 353 | + i = 0; |
---|
358 | 354 | while (i < cfg->hp_outs) { |
---|
359 | 355 | /* The real HPs should have the sequence 0x0f */ |
---|
360 | 356 | if ((hp_out[i].seq & 0x0f) == 0x0f) { |
---|
.. | .. |
---|
827 | 823 | snd_hda_set_pin_ctl_cache(codec, cfg->nid, cfg->val); |
---|
828 | 824 | } |
---|
829 | 825 | |
---|
830 | | -static void apply_fixup(struct hda_codec *codec, int id, int action, int depth) |
---|
| 826 | +void __snd_hda_apply_fixup(struct hda_codec *codec, int id, int action, int depth) |
---|
831 | 827 | { |
---|
832 | 828 | const char *modelname = codec->fixup_name; |
---|
833 | 829 | |
---|
.. | .. |
---|
837 | 833 | if (++depth > 10) |
---|
838 | 834 | break; |
---|
839 | 835 | if (fix->chained_before) |
---|
840 | | - apply_fixup(codec, fix->chain_id, action, depth + 1); |
---|
| 836 | + __snd_hda_apply_fixup(codec, fix->chain_id, action, depth + 1); |
---|
841 | 837 | |
---|
842 | 838 | switch (fix->type) { |
---|
843 | 839 | case HDA_FIXUP_PINS: |
---|
.. | .. |
---|
878 | 874 | id = fix->chain_id; |
---|
879 | 875 | } |
---|
880 | 876 | } |
---|
| 877 | +EXPORT_SYMBOL_GPL(__snd_hda_apply_fixup); |
---|
881 | 878 | |
---|
882 | 879 | /** |
---|
883 | 880 | * snd_hda_apply_fixup - Apply the fixup chain with the given action |
---|
.. | .. |
---|
887 | 884 | void snd_hda_apply_fixup(struct hda_codec *codec, int action) |
---|
888 | 885 | { |
---|
889 | 886 | if (codec->fixup_list) |
---|
890 | | - apply_fixup(codec, codec->fixup_id, action, 0); |
---|
| 887 | + __snd_hda_apply_fixup(codec, codec->fixup_id, action, 0); |
---|
891 | 888 | } |
---|
892 | 889 | EXPORT_SYMBOL_GPL(snd_hda_apply_fixup); |
---|
893 | 890 | |
---|
894 | 891 | #define IGNORE_SEQ_ASSOC (~(AC_DEFCFG_SEQUENCE | AC_DEFCFG_DEF_ASSOC)) |
---|
895 | 892 | |
---|
896 | 893 | static bool pin_config_match(struct hda_codec *codec, |
---|
897 | | - const struct hda_pintbl *pins) |
---|
| 894 | + const struct hda_pintbl *pins, |
---|
| 895 | + bool match_all_pins) |
---|
898 | 896 | { |
---|
899 | 897 | const struct hda_pincfg *pin; |
---|
900 | 898 | int i; |
---|
.. | .. |
---|
918 | 916 | return false; |
---|
919 | 917 | } |
---|
920 | 918 | } |
---|
921 | | - if (!found && (cfg & 0xf0000000) != 0x40000000) |
---|
| 919 | + if (match_all_pins && |
---|
| 920 | + !found && (cfg & 0xf0000000) != 0x40000000) |
---|
922 | 921 | return false; |
---|
923 | 922 | } |
---|
924 | 923 | |
---|
.. | .. |
---|
930 | 929 | * @codec: the HDA codec |
---|
931 | 930 | * @pin_quirk: zero-terminated pin quirk list |
---|
932 | 931 | * @fixlist: the fixup list |
---|
| 932 | + * @match_all_pins: all valid pins must match with the table entries |
---|
933 | 933 | */ |
---|
934 | 934 | void snd_hda_pick_pin_fixup(struct hda_codec *codec, |
---|
935 | 935 | const struct snd_hda_pin_quirk *pin_quirk, |
---|
936 | | - const struct hda_fixup *fixlist) |
---|
| 936 | + const struct hda_fixup *fixlist, |
---|
| 937 | + bool match_all_pins) |
---|
937 | 938 | { |
---|
938 | 939 | const struct snd_hda_pin_quirk *pq; |
---|
939 | 940 | |
---|
.. | .. |
---|
945 | 946 | continue; |
---|
946 | 947 | if (codec->core.vendor_id != pq->codec) |
---|
947 | 948 | continue; |
---|
948 | | - if (pin_config_match(codec, pq->pins)) { |
---|
| 949 | + if (pin_config_match(codec, pq->pins, match_all_pins)) { |
---|
949 | 950 | codec->fixup_id = pq->value; |
---|
950 | 951 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
---|
951 | 952 | codec->fixup_name = pq->name; |
---|