From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Problem with Avermedia 771 Date: Wed, 20 Oct 2004 15:17:59 +0200 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <416ED29A.7060200@qanu.de> <20041015101119.GH3866@bytesex> <20041018130114.GA5476@bytesex> <20041019161340.GA12001@bytesex> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Wed_Oct_20_15:17:59_2004-1" Return-path: In-Reply-To: Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Gerd Knorr Cc: Jaroslav Kysela , Clemens Ladisch , Holger Waechtler , dvb list , alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Wed_Oct_20_15:17:59_2004-1 Content-Type: text/plain; charset=US-ASCII At Wed, 20 Oct 2004 15:06:38 +0200, I wrote: > > > So we'll have to build a whitelist from scratch from user feedback, and > > maybe add a insmod option so you can ask the driver to grab the device > > even if not whitelisted for easy use. > > We have some options for this kind of behavior: > > 1. the driver has one pci_driver struct, and its pci_id array includes > the default entries (with PCI_ANY_ID for subsystem ids). > > In this case, the driver checks the pci id in probe and rejects > unless it's in the whitelist or a specific module option is given. The experimental patch for this is below. Takashi --Multipart_Wed_Oct_20_15:17:59_2004-1 Content-Type: text/plain; charset=US-ASCII Index: alsa-kernel/pci/bt87x.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/bt87x.c,v retrieving revision 1.14 diff -u -r1.14 bt87x.c --- alsa-kernel/pci/bt87x.c 29 Sep 2004 16:17:59 -0000 1.14 +++ alsa-kernel/pci/bt87x.c 20 Oct 2004 13:17:26 -0000 @@ -45,6 +45,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ static int digital_rate[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 }; /* digital input rate */ +static int load_all; /* allow to load the non-whitelisted cards */ static int boot_devs; module_param_array(index, int, boot_devs, 0444); @@ -55,6 +56,8 @@ MODULE_PARM_DESC(enable, "Enable Bt87x soundcard"); module_param_array(digital_rate, int, boot_devs, 0444); MODULE_PARM_DESC(digital_rate, "Digital input rate for Bt87x soundcard"); +module_param(load_all, bool, 0444); +MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards"); #ifndef PCI_VENDOR_ID_BROOKTREE @@ -148,6 +151,9 @@ #endif #define CLOCK_DIV_MAX 15 +#define DRIVER_DEFAULT_ENTRY (1<<24) +#define DRIVER_RATE_MASK ((1<<24)-1) + #define ERROR_INTERRUPTS (INT_FBUS | INT_FTRGT | INT_PPERR | \ INT_RIPERR | INT_PABORT | INT_OCERR) #define MY_INTERRUPTS (INT_RISCI | ERROR_INTERRUPTS) @@ -746,6 +752,11 @@ bt87x_t *chip; int err; + if (pci_id->driver_data & DRIVER_DEFAULT_ENTRY) { + if (! load_all) + return -ENODEV; + } + if (dev >= SNDRV_CARDS) return -ENODEV; if (!enable[dev]) { @@ -764,7 +775,7 @@ if (digital_rate[dev] > 0) chip->dig_rate = digital_rate[dev]; else - chip->dig_rate = (int)pci_id->driver_data; + chip->dig_rate = (int)(pci_id->driver_data & DRIVER_RATE_MASK); err = snd_bt87x_pcm(chip, DEVICE_DIGITAL, "Bt87x Digital"); if (err < 0) @@ -819,8 +830,8 @@ BT_DEVICE(878, 0x0070, 0xff01, 44100), /* Osprey 200 */ /* default entries for 32kHz and generic Bt87x cards */ - BT_DEVICE(878, PCI_ANY_ID, PCI_ANY_ID, 32000), - BT_DEVICE(879, PCI_ANY_ID, PCI_ANY_ID, 32000), + BT_DEVICE(878, PCI_ANY_ID, PCI_ANY_ID, 32000 | DRIVER_DEFAULT_ENTRY), + BT_DEVICE(879, PCI_ANY_ID, PCI_ANY_ID, 32000 | DRIVER_DEFAULT_ENTRY), { } }; MODULE_DEVICE_TABLE(pci, snd_bt87x_ids); --Multipart_Wed_Oct_20_15:17:59_2004-1-- ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl