diff options
Diffstat (limited to 'include/sound/core.h')
-rw-r--r-- | include/sound/core.h | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index 521f036cce99..4b9e609975ab 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -211,9 +211,40 @@ extern struct class *sound_class; | |||
211 | 211 | ||
212 | void snd_request_card(int card); | 212 | void snd_request_card(int card); |
213 | 213 | ||
214 | int snd_register_device(int type, struct snd_card *card, int dev, | 214 | int snd_register_device_for_dev(int type, struct snd_card *card, |
215 | const struct file_operations *f_ops, void *private_data, | 215 | int dev, |
216 | const char *name); | 216 | const struct file_operations *f_ops, |
217 | void *private_data, | ||
218 | const char *name, | ||
219 | struct device *device); | ||
220 | |||
221 | /** | ||
222 | * snd_register_device - Register the ALSA device file for the card | ||
223 | * @type: the device type, SNDRV_DEVICE_TYPE_XXX | ||
224 | * @card: the card instance | ||
225 | * @dev: the device index | ||
226 | * @f_ops: the file operations | ||
227 | * @private_data: user pointer for f_ops->open() | ||
228 | * @name: the device file name | ||
229 | * | ||
230 | * Registers an ALSA device file for the given card. | ||
231 | * The operators have to be set in reg parameter. | ||
232 | * | ||
233 | * This function uses the card's device pointer to link to the | ||
234 | * correct &struct device. | ||
235 | * | ||
236 | * Returns zero if successful, or a negative error code on failure. | ||
237 | */ | ||
238 | static inline int snd_register_device(int type, struct snd_card *card, int dev, | ||
239 | const struct file_operations *f_ops, | ||
240 | void *private_data, | ||
241 | const char *name) | ||
242 | { | ||
243 | return snd_register_device_for_dev(type, card, dev, f_ops, | ||
244 | private_data, name, | ||
245 | snd_card_get_device_link(card)); | ||
246 | } | ||
247 | |||
217 | int snd_unregister_device(int type, struct snd_card *card, int dev); | 248 | int snd_unregister_device(int type, struct snd_card *card, int dev); |
218 | void *snd_lookup_minor_data(unsigned int minor, int type); | 249 | void *snd_lookup_minor_data(unsigned int minor, int type); |
219 | int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, | 250 | int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, |
@@ -396,6 +427,29 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
396 | #endif | 427 | #endif |
397 | #endif | 428 | #endif |
398 | 429 | ||
399 | #include "typedefs.h" | 430 | /* PCI quirk list helper */ |
431 | struct snd_pci_quirk { | ||
432 | unsigned short subvendor; /* PCI subvendor ID */ | ||
433 | unsigned short subdevice; /* PCI subdevice ID */ | ||
434 | int value; /* value */ | ||
435 | #ifdef CONFIG_SND_DEBUG_DETECT | ||
436 | const char *name; /* name of the device (optional) */ | ||
437 | #endif | ||
438 | }; | ||
439 | |||
440 | #define _SND_PCI_QUIRK_ID(vend,dev) \ | ||
441 | .subvendor = (vend), .subdevice = (dev) | ||
442 | #define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)} | ||
443 | #ifdef CONFIG_SND_DEBUG_DETECT | ||
444 | #define SND_PCI_QUIRK(vend,dev,xname,val) \ | ||
445 | {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)} | ||
446 | #else | ||
447 | #define SND_PCI_QUIRK(vend,dev,xname,val) \ | ||
448 | {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)} | ||
449 | #endif | ||
450 | |||
451 | const struct snd_pci_quirk * | ||
452 | snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list); | ||
453 | |||
400 | 454 | ||
401 | #endif /* __SOUND_CORE_H */ | 455 | #endif /* __SOUND_CORE_H */ |