[alsa-devel] Update patch for codecs alias name for Dell

Takashi Iwai tiwai at suse.de
Wed Nov 27 11:51:55 CET 2013


At Wed, 27 Nov 2013 18:01:03 +0800,
Kailang wrote:
> 
> Hi Takashi,
> 
> Dell assigned more codecs for alias name.
> I update in attach patch.

It's better to handle the error immediately, i.e. put
  if (err < 0)
    goto error;
just after each alc_codec_rename() call.

Or, it's even better to introduce a table like

struct alc_codec_rename_pci_table {
	unsigned int codec_vendor;
	unsigned short pci_subvendor;
	unsigned short pci_subdevice;
	const char *name;
};

static struct alc_codec_rename_table rename_pci_tbl[] = {
	{ 0x10ec0280, 0x1028, 0, "ALC3220" },
	{ 0x10ec0282, 0x1028, 0, "ALC3221" },
	{ 0x10280284, 0x1028, 0, "ALC3226" },
	.....
	{ } /* terminator */
};

Then add a check like:

static int alc_codec_rename_from_preset(struct hda_codec *codec)
{
	const struct alc_codec_rename_table *p;
	const struct alc_codec_rename_pci_table *q;

	.....

	for (q = rename_pci_tbl; q->codec_vendor; q++) {
		if (q->vendor_id != codec->vendor_id)
			continue;
		if (q->pci_subsystem != codec->bus->pci->subsystem_vendor)
			continue;
		if (!q->pci_subdevice ||
		    q->pci_subdevice == codec->bus->pci->subsystem_device)
			return alc_codec_rename(codec, q->name);
	}

	return 0;
}


thanks,

Takashi


More information about the Alsa-devel mailing list