Skip to content

Commit ef940b0

Browse files
committed
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>
1 parent 27fe48d commit ef940b0

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎Documentation/sound/alsa/HD-Audio.txt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,10 @@ The file needs to have a line `[codec]`. The next line should contain
447447
three numbers indicating the codec vendor-id (0x12345678 in the
448448
example), the codec subsystem-id (0xabcd1234) and the address (2) of
449449
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.
451454

452455
The `[model]` line allows to change the model name of the each codec.
453456
In the example above, it will be changed to model=auto.

‎sound/pci/hda/hda_hwdep.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,14 +643,14 @@ static inline int strmatch(const char *a, const char *b)
643643
static void parse_codec_mode(char *buf, struct hda_bus *bus,
644644
struct hda_codec **codecp)
645645
{
646-
unsigned int vendorid, subid, caddr;
646+
int vendorid, subid, caddr;
647647
struct hda_codec *codec;
648648

649649
*codecp = NULL;
650650
if (sscanf(buf, "%i %i %i", &vendorid, &subid, &caddr) == 3) {
651651
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) &&
654654
codec->addr == caddr) {
655655
*codecp = codec;
656656
break;

0 commit comments

Comments
 (0)