aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2014-07-22 08:09:34 -0400
committerTakashi Iwai <tiwai@suse.de>2014-07-22 08:26:50 -0400
commitf5662e1cbf3f0939a6e033a00c542be4a0c2edee (patch)
tree5838be80537428235822d74a665a8b9f35d2bbcc
parent9dc12862da9d56ef4da646ba540c4f58b78738fc (diff)
ALSA: hda - Refactor quirk picking and change quirk priority
Previously, calling one quirk function first and another later would make the latter one take priority, this is now changed to make the former take priority. By adding two special values for fixup_id we can also get rid of the fixup_forced flag. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_auto_parser.c15
-rw-r--r--sound/pci/hda/hda_codec.c1
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_local.h2
-rw-r--r--sound/pci/hda/patch_cirrus.c4
-rw-r--r--sound/pci/hda/patch_sigmatel.c4
6 files changed, 17 insertions, 10 deletions
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index a9790198aa17..51dea49aadd4 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -854,7 +854,7 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec,
854{ 854{
855 const struct snd_hda_pin_quirk *pq; 855 const struct snd_hda_pin_quirk *pq;
856 856
857 if (codec->fixup_forced) 857 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
858 return; 858 return;
859 859
860 for (pq = pin_quirk; pq->subvendor; pq++) { 860 for (pq = pin_quirk; pq->subvendor; pq++) {
@@ -880,14 +880,17 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
880 const struct hda_fixup *fixlist) 880 const struct hda_fixup *fixlist)
881{ 881{
882 const struct snd_pci_quirk *q; 882 const struct snd_pci_quirk *q;
883 int id = -1; 883 int id = HDA_FIXUP_ID_NOT_SET;
884 const char *name = NULL; 884 const char *name = NULL;
885 885
886 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
887 return;
888
886 /* when model=nofixup is given, don't pick up any fixups */ 889 /* when model=nofixup is given, don't pick up any fixups */
887 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) { 890 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) {
888 codec->fixup_list = NULL; 891 codec->fixup_list = NULL;
889 codec->fixup_id = -1; 892 codec->fixup_name = NULL;
890 codec->fixup_forced = 1; 893 codec->fixup_id = HDA_FIXUP_ID_NO_FIXUP;
891 return; 894 return;
892 } 895 }
893 896
@@ -897,13 +900,12 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
897 codec->fixup_id = models->id; 900 codec->fixup_id = models->id;
898 codec->fixup_name = models->name; 901 codec->fixup_name = models->name;
899 codec->fixup_list = fixlist; 902 codec->fixup_list = fixlist;
900 codec->fixup_forced = 1;
901 return; 903 return;
902 } 904 }
903 models++; 905 models++;
904 } 906 }
905 } 907 }
906 if (id < 0 && quirk) { 908 if (quirk) {
907 q = snd_pci_quirk_lookup(codec->bus->pci, quirk); 909 q = snd_pci_quirk_lookup(codec->bus->pci, quirk);
908 if (q) { 910 if (q) {
909 id = q->value; 911 id = q->value;
@@ -927,7 +929,6 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
927 } 929 }
928 } 930 }
929 931
930 codec->fixup_forced = 0;
931 codec->fixup_id = id; 932 codec->fixup_id = id;
932 if (id >= 0) { 933 if (id >= 0) {
933 codec->fixup_list = fixlist; 934 codec->fixup_list = fixlist;
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 47a617786fca..ec6a7d0d1886 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1476,6 +1476,7 @@ int snd_hda_codec_new(struct hda_bus *bus,
1476 1476
1477 INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); 1477 INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work);
1478 codec->depop_delay = -1; 1478 codec->depop_delay = -1;
1479 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
1479 1480
1480#ifdef CONFIG_PM 1481#ifdef CONFIG_PM
1481 spin_lock_init(&codec->power_lock); 1482 spin_lock_init(&codec->power_lock);
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index f84a40ef42af..bbc5a1392c75 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -402,7 +402,6 @@ struct hda_codec {
402 402
403 /* fix-up list */ 403 /* fix-up list */
404 int fixup_id; 404 int fixup_id;
405 unsigned int fixup_forced:1; /* fixup explicitly set by user */
406 const struct hda_fixup *fixup_list; 405 const struct hda_fixup *fixup_list;
407 const char *fixup_name; 406 const char *fixup_name;
408 407
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index aa374ad4b5d0..364bb413e02a 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -438,6 +438,8 @@ struct snd_hda_pin_quirk {
438 438
439#endif 439#endif
440 440
441#define HDA_FIXUP_ID_NOT_SET -1
442#define HDA_FIXUP_ID_NO_FIXUP -2
441 443
442/* fixup types */ 444/* fixup types */
443enum { 445enum {
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 387f0b551889..3db724eaa53c 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -657,8 +657,10 @@ static void cs4208_fixup_mac(struct hda_codec *codec,
657{ 657{
658 if (action != HDA_FIXUP_ACT_PRE_PROBE) 658 if (action != HDA_FIXUP_ACT_PRE_PROBE)
659 return; 659 return;
660
661 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
660 snd_hda_pick_fixup(codec, NULL, cs4208_mac_fixup_tbl, cs4208_fixups); 662 snd_hda_pick_fixup(codec, NULL, cs4208_mac_fixup_tbl, cs4208_fixups);
661 if (codec->fixup_id < 0 || codec->fixup_id == CS4208_MAC_AUTO) 663 if (codec->fixup_id == HDA_FIXUP_ID_NOT_SET)
662 codec->fixup_id = CS4208_GPIO0; /* default fixup */ 664 codec->fixup_id = CS4208_GPIO0; /* default fixup */
663 snd_hda_apply_fixup(codec, action); 665 snd_hda_apply_fixup(codec, action);
664} 666}
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 946ae4094aa3..8dc681593920 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3449,9 +3449,11 @@ static void stac922x_fixup_intel_mac_auto(struct hda_codec *codec,
3449{ 3449{
3450 if (action != HDA_FIXUP_ACT_PRE_PROBE) 3450 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3451 return; 3451 return;
3452
3453 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
3452 snd_hda_pick_fixup(codec, NULL, stac922x_intel_mac_fixup_tbl, 3454 snd_hda_pick_fixup(codec, NULL, stac922x_intel_mac_fixup_tbl,
3453 stac922x_fixups); 3455 stac922x_fixups);
3454 if (codec->fixup_id != STAC_INTEL_MAC_AUTO) 3456 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
3455 snd_hda_apply_fixup(codec, action); 3457 snd_hda_apply_fixup(codec, action);
3456} 3458}
3457 3459