Skip to content

Commit a235d5b

Browse files
committed
ALSA: hda: Allow model option to specify PCI SSID alias
There are tons of quirks for HD-audio and many of them are without model string, hence it's not trivial to apply the same quirk for a new device. This patch makes it easier: namely, the model string accepts a form as "XXXX:YYYY" (a pair of hex numbers of the subsystem-vendor and subsystem-device IDs), to specify the alias of PCI (or codec) SSID. e.g. passing model=1234:abcd would apply the quirk that matches with the given SSID 1234:abcd instead of the actual SSID. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 73355dd commit a235d5b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sound/pci/hda/hda_auto_parser.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,8 @@ EXPORT_SYMBOL_GPL(snd_hda_pick_pin_fixup);
971971
* When a special model string "nofixup" is given, also no fixup is applied.
972972
*
973973
* The function tries to find the matching model name at first, if given.
974+
* If the model string contains the SSID alias, try to look up with the given
975+
* alias ID.
974976
* If nothing matched, try to look up the PCI SSID.
975977
* If still nothing matched, try to look up the codec SSID.
976978
*/
@@ -983,6 +985,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
983985
int id = HDA_FIXUP_ID_NOT_SET;
984986
const char *name = NULL;
985987
const char *type = NULL;
988+
int vendor, device;
986989

987990
if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
988991
return;
@@ -1013,6 +1016,16 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
10131016
if (!quirk)
10141017
return;
10151018

1019+
/* match with the SSID alias given by the model string "XXXX:YYYY" */
1020+
if (codec->modelname &&
1021+
sscanf(codec->modelname, "%04x:%04x", &vendor, &device) == 2) {
1022+
q = snd_pci_quirk_lookup_id(vendor, device, quirk);
1023+
if (q) {
1024+
type = "alias SSID";
1025+
goto found_device;
1026+
}
1027+
}
1028+
10161029
/* match with the PCI SSID */
10171030
q = snd_pci_quirk_lookup(codec->bus->pci, quirk);
10181031
if (q) {

0 commit comments

Comments
 (0)