]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ALSA: hda - Expand pin_match function to match upcoming new tbls
authorHui Wang <hui.wang@canonical.com>
Mon, 2 Sep 2019 04:28:00 +0000 (06:28 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 27 Sep 2019 10:31:08 +0000 (12:31 +0200)
BugLink: https://bugs.launchpad.net/bugs/1842265
With the existing pintbl, we already have many entries in it. it is
better to figure out a new way to reduce the size of the pintbl.

We plan to define a new tbl which will match more machines with a
single tbl, To do that, this function doesn't need to match all valid
pins between machine and tbl, it just needs to match all pins defined
in the tbl with the machine.

And the plan is to move some tbls from pin_fixup_tbl to
fallback_pin_fixup_tbl gradually.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(backported from commit 0fc1e447e9e474c2460df8d0378f899b8813e1d2)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
sound/pci/hda/hda_auto_parser.c
sound/pci/hda/hda_local.h
sound/pci/hda/patch_realtek.c

index 8b1cf237b96ec4c4458f1471b250e071d0af1f30..7402f9c396124b5e7b8f86061e6157f7b484e0d2 100644 (file)
@@ -888,7 +888,8 @@ EXPORT_SYMBOL_GPL(snd_hda_apply_fixup);
 #define IGNORE_SEQ_ASSOC (~(AC_DEFCFG_SEQUENCE | AC_DEFCFG_DEF_ASSOC))
 
 static bool pin_config_match(struct hda_codec *codec,
-                            const struct hda_pintbl *pins)
+                            const struct hda_pintbl *pins,
+                            bool match_all_pins)
 {
        int i;
 
@@ -912,7 +913,8 @@ static bool pin_config_match(struct hda_codec *codec,
                                        return false;
                        }
                }
-               if (!found && (cfg & 0xf0000000) != 0x40000000)
+               if (match_all_pins &&
+                   !found && (cfg & 0xf0000000) != 0x40000000)
                        return false;
        }
 
@@ -924,10 +926,12 @@ static bool pin_config_match(struct hda_codec *codec,
  * @codec: the HDA codec
  * @pin_quirk: zero-terminated pin quirk list
  * @fixlist: the fixup list
+ * @match_all_pins: all valid pins must match with the table entries
  */
 void snd_hda_pick_pin_fixup(struct hda_codec *codec,
                            const struct snd_hda_pin_quirk *pin_quirk,
-                           const struct hda_fixup *fixlist)
+                           const struct hda_fixup *fixlist,
+                           bool match_all_pins)
 {
        const struct snd_hda_pin_quirk *pq;
 
@@ -939,7 +943,7 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec,
                        continue;
                if (codec->core.vendor_id != pq->codec)
                        continue;
-               if (pin_config_match(codec, pq->pins)) {
+               if (pin_config_match(codec, pq->pins, match_all_pins)) {
                        codec->fixup_id = pq->value;
 #ifdef CONFIG_SND_DEBUG_VERBOSE
                        codec->fixup_name = pq->name;
index 5b5c324c99b9d9261330f3ad8e160e9036559e21..4ca1b138688c8040bf2dc3c5a6fb92d7194a1492 100644 (file)
@@ -374,7 +374,8 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
                        const struct hda_fixup *fixlist);
 void snd_hda_pick_pin_fixup(struct hda_codec *codec,
                            const struct snd_hda_pin_quirk *pin_quirk,
-                           const struct hda_fixup *fixlist);
+                           const struct hda_fixup *fixlist,
+                           bool match_all_pins);
 
 /* helper macros to retrieve pin default-config values */
 #define get_defcfg_connect(cfg) \
index 848a3152f3ef8fb84eb530b67b59f9e41e809b6d..e5204d5c35ba4ca6a02f73fd63733f5cce1d4bf6 100644 (file)
@@ -7591,7 +7591,7 @@ static int patch_alc269(struct hda_codec *codec)
 
        snd_hda_pick_fixup(codec, alc269_fixup_models,
                       alc269_fixup_tbl, alc269_fixups);
-       snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
+       snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
        snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
                           alc269_fixups);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
@@ -8669,7 +8669,7 @@ static int patch_alc662(struct hda_codec *codec)
 
        snd_hda_pick_fixup(codec, alc662_fixup_models,
                       alc662_fixup_tbl, alc662_fixups);
-       snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
+       snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
        snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
 
        alc_auto_parse_customize_define(codec);