Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: hda - Allow patching with any vendor/subsystem ids

In the ugly real world, there area really broken devices that don't set
codec SSID correctly. In such a case, the ID can be random, thus the
patching won't work reliably.

For applying the patch forcibly to such a device, the driver will skip
the vendor and/or subsystem ID checks when zero or a negative number is
given in [codec] section.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+7 -4
+4 -1
Documentation/sound/alsa/HD-Audio.txt
··· 447 447 three numbers indicating the codec vendor-id (0x12345678 in the 448 448 example), the codec subsystem-id (0xabcd1234) and the address (2) of 449 449 the codec. The rest patch entries are applied to this specified codec 450 - until another codec entry is given. 450 + until another codec entry is given. Passing 0 or a negative number to 451 + the first or the second value will make the check of the corresponding 452 + field be skipped. It'll be useful for really broken devices that don't 453 + initialize SSID properly. 451 454 452 455 The `[model]` line allows to change the model name of the each codec. 453 456 In the example above, it will be changed to model=auto.
+3 -3
sound/pci/hda/hda_hwdep.c
··· 643 643 static void parse_codec_mode(char *buf, struct hda_bus *bus, 644 644 struct hda_codec **codecp) 645 645 { 646 - unsigned int vendorid, subid, caddr; 646 + int vendorid, subid, caddr; 647 647 struct hda_codec *codec; 648 648 649 649 *codecp = NULL; 650 650 if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) { 651 651 list_for_each_entry(codec, &bus->codec_list, list) { 652 - if (codec->vendor_id == vendorid && 653 - codec->subsystem_id == subid && 652 + if ((vendorid <= 0 || codec->vendor_id == vendorid) && 653 + (subid <= 0 || codec->subsystem_id == subid) && 654 654 codec->addr == caddr) { 655 655 *codecp = codec; 656 656 break;