@@ -982,65 +982,66 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
982
982
const struct snd_pci_quirk * q ;
983
983
int id = HDA_FIXUP_ID_NOT_SET ;
984
984
const char * name = NULL ;
985
+ const char * type = NULL ;
985
986
986
987
if (codec -> fixup_id != HDA_FIXUP_ID_NOT_SET )
987
988
return ;
988
989
989
990
/* when model=nofixup is given, don't pick up any fixups */
990
991
if (codec -> modelname && !strcmp (codec -> modelname , "nofixup" )) {
991
- codec -> fixup_list = NULL ;
992
- codec -> fixup_name = NULL ;
993
- codec -> fixup_id = HDA_FIXUP_ID_NO_FIXUP ;
992
+ id = HDA_FIXUP_ID_NO_FIXUP ;
993
+ fixlist = NULL ;
994
994
codec_dbg (codec , "%s: picked no fixup (nofixup specified)\n" ,
995
995
codec -> core .chip_name );
996
- return ;
996
+ goto found ;
997
997
}
998
998
999
+ /* match with the model name string */
999
1000
if (codec -> modelname && models ) {
1000
1001
while (models -> name ) {
1001
1002
if (!strcmp (codec -> modelname , models -> name )) {
1002
- codec -> fixup_id = models -> id ;
1003
- codec -> fixup_name = models -> name ;
1004
- codec -> fixup_list = fixlist ;
1003
+ id = models -> id ;
1004
+ name = models -> name ;
1005
1005
codec_dbg (codec , "%s: picked fixup %s (model specified)\n" ,
1006
1006
codec -> core .chip_name , codec -> fixup_name );
1007
- return ;
1007
+ goto found ;
1008
1008
}
1009
1009
models ++ ;
1010
1010
}
1011
1011
}
1012
- if (quirk ) {
1013
- q = snd_pci_quirk_lookup (codec -> bus -> pci , quirk );
1014
- if (q ) {
1015
- id = q -> value ;
1016
- #ifdef CONFIG_SND_DEBUG_VERBOSE
1017
- name = q -> name ;
1018
- codec_dbg (codec , "%s: picked fixup %s (PCI SSID%s)\n" ,
1019
- codec -> core .chip_name , name , q -> subdevice_mask ? "" : " - vendor generic" );
1020
- #endif
1021
- }
1012
+
1013
+ if (!quirk )
1014
+ return ;
1015
+
1016
+ /* match with the PCI SSID */
1017
+ q = snd_pci_quirk_lookup (codec -> bus -> pci , quirk );
1018
+ if (q ) {
1019
+ type = "PCI SSID" ;
1020
+ goto found_device ;
1022
1021
}
1023
- if (id < 0 && quirk ) {
1024
- for (q = quirk ; q -> subvendor || q -> subdevice ; q ++ ) {
1025
- unsigned int vendorid =
1026
- q -> subdevice | (q -> subvendor << 16 );
1027
- unsigned int mask = 0xffff0000 | q -> subdevice_mask ;
1028
- if ((codec -> core .subsystem_id & mask ) == (vendorid & mask )) {
1029
- id = q -> value ;
1030
- #ifdef CONFIG_SND_DEBUG_VERBOSE
1031
- name = q -> name ;
1032
- codec_dbg (codec , "%s: picked fixup %s (codec SSID)\n" ,
1033
- codec -> core .chip_name , name );
1034
- #endif
1035
- break ;
1036
- }
1037
- }
1022
+
1023
+ /* match with the codec SSID */
1024
+ q = snd_pci_quirk_lookup_id (codec -> core .subsystem_id >> 16 ,
1025
+ codec -> core .subsystem_id & 0xffff ,
1026
+ quirk );
1027
+ if (q ) {
1028
+ type = "codec SSID" ;
1029
+ goto found_device ;
1038
1030
}
1039
1031
1032
+ return ; /* no matching */
1033
+
1034
+ found_device :
1035
+ id = q -> value ;
1036
+ #ifdef CONFIG_SND_DEBUG_VERBOSE
1037
+ name = q -> name ;
1038
+ #endif
1039
+ codec_dbg (codec , "%s: picked fixup %s for %s %04x:%04x\n" ,
1040
+ codec -> core .chip_name , name ? name : "" ,
1041
+ type , q -> subvendor , q -> subdevice );
1042
+ found :
1040
1043
codec -> fixup_id = id ;
1041
- if (id >= 0 ) {
1042
- codec -> fixup_list = fixlist ;
1043
- codec -> fixup_name = name ;
1044
- }
1044
+ codec -> fixup_list = fixlist ;
1045
+ codec -> fixup_name = name ;
1045
1046
}
1046
1047
EXPORT_SYMBOL_GPL (snd_hda_pick_fixup );
0 commit comments