本文整理汇总了C++中snd_card_free函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_card_free函数的具体用法?C++ snd_card_free怎么用?C++ snd_card_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_card_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: snd_gusmax_probe
static int __init snd_gusmax_probe(int dev)
{
static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
static int possible_dmas[] = {5, 6, 7, 1, 3, -1};
int xirq, xdma1, xdma2, err;
snd_card_t *card;
snd_gus_card_t *gus = NULL;
cs4231_t *cs4231;
struct snd_gusmax *maxcard;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_gusmax));
if (card == NULL)
return -ENOMEM;
card->private_free = snd_gusmax_free;
maxcard = (struct snd_gusmax *)card->private_data;
maxcard->card = card;
maxcard->irq = -1;
xirq = irq[dev];
if (xirq == SNDRV_AUTO_IRQ) {
if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
snd_card_free(card);
snd_printk("unable to find a free IRQ\n");
return -EBUSY;
}
}
xdma1 = dma1[dev];
if (xdma1 == SNDRV_AUTO_DMA) {
if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
snd_card_free(card);
snd_printk("unable to find a free DMA1\n");
return -EBUSY;
}
}
xdma2 = dma2[dev];
if (xdma2 == SNDRV_AUTO_DMA) {
if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
snd_card_free(card);
snd_printk("unable to find a free DMA2\n");
return -EBUSY;
}
}
if ((err = snd_gus_create(card,
port[dev],
-xirq, xdma1, xdma2,
0, channels[dev],
pcm_channels[dev],
0, &gus)) < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_gusmax_detect(gus)) < 0) {
snd_card_free(card);
return err;
}
maxcard->gus_status_reg = gus->gf1.reg_irqstat;
maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
snd_gusmax_init(dev, card, gus);
if ((err = snd_gus_initialize(gus)) < 0) {
snd_card_free(card);
return err;
}
if (!gus->max_flag) {
printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);
snd_card_free(card);
return -ENODEV;
}
if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) {
snd_card_free(card);
printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", xirq);
return -EBUSY;
}
maxcard->irq = xirq;
if ((err = snd_cs4231_create(card,
gus->gf1.port + 0x10c, -1, xirq,
xdma2 < 0 ? xdma1 : xdma2, xdma1,
CS4231_HW_DETECT,
CS4231_HWSHARE_IRQ |
CS4231_HWSHARE_DMA1 |
CS4231_HWSHARE_DMA2,
&cs4231)) < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_cs4231_mixer(cs4231)) < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) {
snd_card_free(card);
return err;
}
//.........这里部分代码省略.........
示例2: snd_gusextreme_probe
//.........这里部分代码省略.........
struct snd_opl3 *opl3;
int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0);
if (!card)
return -EINVAL;
if (mpu_port[n] == SNDRV_AUTO_PORT)
mpu_port[n] = 0;
if (mpu_irq[n] > 15)
mpu_irq[n] = -1;
error = snd_gusextreme_es1688_create(card, dev, n, &es1688);
if (error < 0)
goto out;
if (gf1_port[n] < 0)
gf1_port[n] = es1688->port + 0x20;
error = snd_gusextreme_gus_card_create(card, dev, n, &gus);
if (error < 0)
goto out;
error = snd_gusextreme_detect(gus, es1688);
if (error < 0)
goto out;
gus->joystick_dac = joystick_dac[n];
error = snd_gus_initialize(gus);
if (error < 0)
goto out;
error = -ENODEV;
if (!gus->ess_flag) {
snd_printk(KERN_ERR "%s: GUS Extreme soundcard was not "
"detected at 0x%lx\n", dev->bus_id, gus->gf1.port);
goto out;
}
gus->codec_flag = 1;
error = snd_es1688_pcm(es1688, 0, NULL);
if (error < 0)
goto out;
error = snd_es1688_mixer(es1688);
if (error < 0)
goto out;
snd_component_add(card, "ES1688");
if (pcm_channels[n] > 0) {
error = snd_gf1_pcm_new(gus, 1, 1, NULL);
if (error < 0)
goto out;
}
error = snd_gf1_new_mixer(gus);
if (error < 0)
goto out;
error = snd_gusextreme_mixer(es1688);
if (error < 0)
goto out;
if (snd_opl3_create(card, es1688->port, es1688->port + 2,
OPL3_HW_OPL3, 0, &opl3) < 0)
printk(KERN_ERR "%s: opl3 not detected at 0x%lx\n",
dev->bus_id, es1688->port);
else {
error = snd_opl3_hwdep_new(opl3, 0, 2, NULL);
if (error < 0)
goto out;
}
if (es1688->mpu_port >= 0x300) {
error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
es1688->mpu_port, 0,
mpu_irq[n], IRQF_DISABLED, NULL);
if (error < 0)
goto out;
}
sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, "
"irq %i&%i, dma %i&%i", es1688->port,
gus->gf1.irq, es1688->irq, gus->gf1.dma1, es1688->dma8);
snd_card_set_dev(card, dev);
error = snd_card_register(card);
if (error < 0)
goto out;
dev_set_drvdata(dev, card);
return 0;
out: snd_card_free(card);
return error;
}
示例3: setup_card
static void __devinit setup_card(struct snd_usb_caiaqdev *dev)
{
int ret;
char val[4];
/* device-specific startup specials */
switch (dev->chip.usb_id) {
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2):
/* RigKontrol2 - display centered dash ('-') */
val[0] = 0x00;
val[1] = 0x00;
val[2] = 0x01;
snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 3);
break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3):
/* RigKontrol2 - display two centered dashes ('--') */
val[0] = 0x00;
val[1] = 0x40;
val[2] = 0x40;
val[3] = 0x00;
snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 4);
break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
/* Audio Kontrol 1 - make USB-LED stop blinking */
val[0] = 0x00;
snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 1);
break;
case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ):
/* Audio 8 DJ - trigger read of current settings */
dev->control_state[0] = 0xff;
snd_usb_caiaq_set_auto_msg(dev, 1, 0, 0);
snd_usb_caiaq_send_command(dev, EP1_CMD_READ_IO, NULL, 0);
if (!wait_event_timeout(dev->ep1_wait_queue,
dev->control_state[0] != 0xff, HZ))
return;
/* fix up some defaults */
if ((dev->control_state[1] != 2) ||
(dev->control_state[2] != 3) ||
(dev->control_state[4] != 2)) {
dev->control_state[1] = 2;
dev->control_state[2] = 3;
dev->control_state[4] = 2;
snd_usb_caiaq_send_command(dev,
EP1_CMD_WRITE_IO, dev->control_state, 6);
}
break;
}
if (dev->spec.num_analog_audio_out +
dev->spec.num_analog_audio_in +
dev->spec.num_digital_audio_out +
dev->spec.num_digital_audio_in > 0) {
ret = snd_usb_caiaq_audio_init(dev);
if (ret < 0)
log("Unable to set up audio system (ret=%d)\n", ret);
}
if (dev->spec.num_midi_in +
dev->spec.num_midi_out > 0) {
ret = snd_usb_caiaq_midi_init(dev);
if (ret < 0)
log("Unable to set up MIDI system (ret=%d)\n", ret);
}
#ifdef CONFIG_SND_USB_CAIAQ_INPUT
ret = snd_usb_caiaq_input_init(dev);
if (ret < 0)
log("Unable to set up input system (ret=%d)\n", ret);
#endif
/* finally, register the card and all its sub-instances */
ret = snd_card_register(dev->chip.card);
if (ret < 0) {
log("snd_card_register() returned %d\n", ret);
snd_card_free(dev->chip.card);
}
ret = snd_usb_caiaq_control_init(dev);
if (ret < 0)
log("Unable to set up control system (ret=%d)\n", ret);
}
示例4: do_registration
static void do_registration(struct work_struct *work)
{
struct snd_oxfw *oxfw = container_of(work, struct snd_oxfw, dwork.work);
int err;
if (oxfw->registered)
return;
err = snd_card_new(&oxfw->unit->device, -1, NULL, THIS_MODULE, 0,
&oxfw->card);
if (err < 0)
return;
err = name_card(oxfw);
if (err < 0)
goto error;
err = detect_quirks(oxfw);
if (err < 0)
goto error;
err = snd_oxfw_stream_discover(oxfw);
if (err < 0)
goto error;
err = snd_oxfw_stream_init_simplex(oxfw, &oxfw->rx_stream);
if (err < 0)
goto error;
if (oxfw->has_output) {
err = snd_oxfw_stream_init_simplex(oxfw, &oxfw->tx_stream);
if (err < 0)
goto error;
}
err = snd_oxfw_create_pcm(oxfw);
if (err < 0)
goto error;
snd_oxfw_proc_init(oxfw);
err = snd_oxfw_create_midi(oxfw);
if (err < 0)
goto error;
err = snd_oxfw_create_hwdep(oxfw);
if (err < 0)
goto error;
err = snd_card_register(oxfw->card);
if (err < 0)
goto error;
/*
* After registered, oxfw instance can be released corresponding to
* releasing the sound card instance.
*/
oxfw->card->private_free = oxfw_card_free;
oxfw->card->private_data = oxfw;
oxfw->registered = true;
return;
error:
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream);
if (oxfw->has_output)
snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream);
snd_card_free(oxfw->card);
dev_info(&oxfw->unit->device,
"Sound card registration failed: %d\n", err);
}
示例5: snd_ad1848_remove
static int snd_ad1848_remove(struct device *dev, unsigned int n)
{
snd_card_free(dev_get_drvdata(dev));
return 0;
}
示例6: snd_pcm_card_generic_probe
static int snd_pcm_card_generic_probe(snd_card_t ** card, pcm_hw_t * chip, int dev)
{
int err=0;
struct device_driver * dev_driver;
struct device * device;
DEBUG_PRINT_FN_CALL(("STAUD ALSA : >>> snd_pcm_card_generic_probe() dev=%d \n ",dev));
switch(dev){
case PCM0_DEVICE:
dev_driver= &alsa_pcm0_driver;
device = &alsa_pcm0_device;
break;
case PCM1_DEVICE:
dev_driver= &alsa_pcm1_driver;
device = &alsa_pcm1_device;
break;
case SPDIF_DEVICE:
dev_driver= &alsa_spdif_driver;
device = &alsa_spdif_device;
break;
case CAPTURE_DEVICE:
dev_driver= &alsa_capture_driver;
device = &alsa_capture_device;
break;
default:
printk(KERN_ALERT "STAUD ALSA : <<< EINVAL snd_pcm_card_generic_probe() Invalid Device \n ");
return -EINVAL;
}
DEBUG_PRINT(("STAUD ALSA: snd_pcm_card_generic_probe () driver register \n "));
if(driver_register(dev_driver)==0)
{
DEBUG_PRINT(("STAUD ALSA: snd_pcm_card_generic_probe () device register \n "));
if(device_register(device)!=0)
{
printk(KERN_ALERT "STAUD ALSA : <<< ENOSYS snd_pcm_card_generic_probe() Device registration failed \n ");
return -ENOSYS;
}
}
else
{
printk(KERN_ALERT "STAUD ALSA : <<< ENOSYS snd_pcm_card_generic_probe() Driver registration failed \n ");
return -ENOSYS;
}
/*Udit Kumar LDDE 2.2*/
switch(dev){
case PCM0_DEVICE:
pcm0_platform_device = to_platform_device(&alsa_pcm0_device);
break;
case PCM1_DEVICE:
pcm1_platform_device = to_platform_device(&alsa_pcm1_device);
break;
case SPDIF_DEVICE:
spdif_platform_device = to_platform_device(&alsa_spdif_device);
break;
case CAPTURE_DEVICE:
capture_platform_device = to_platform_device(&alsa_capture_device);
break;
default:
return -EINVAL;
}
/*end Udit Kumar*/
chip->card_data = &card_list[dev];
*card = snd_card_new(index[card_list[dev].major],id[card_list[dev].major], THIS_MODULE, 0);
if (card == NULL)
{
printk(KERN_ALERT "STAUD ALSA : <<< ENOMEM snd_pcm_card_generic_probe cant allocate new card of %d\n",card_list[dev].major);
return -ENOMEM;
}
if((err = main_device_allocate(*card,&card_list[dev],chip)) < 0)
{
printk(KERN_ALERT "STAUD ALSA : <<< err=%d snd_pcm_card_generic_probe main_device_allocate() failed \n",err);
snd_card_free(*card);
return err;
}
DEBUG_PRINT_FN_CALL(("STAUD ALSA : <<< snd_pcm_card_generic_probe() \n "));
return 0;
}
示例7: snd_vortex_probe
// constructor -- see "Constructor" sub-section
static int
snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
{
static int dev;
struct snd_card *card;
vortex_t *chip;
int err;
// (1)
if (dev >= SNDRV_CARDS)
return -ENODEV;
if (!enable[dev]) {
dev++;
return -ENOENT;
}
// (2)
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;
// (3)
if ((err = snd_vortex_create(card, pci, &chip)) < 0) {
snd_card_free(card);
return err;
}
snd_vortex_workaround(pci, pcifix[dev]);
// Card details needed in snd_vortex_midi
strcpy(card->driver, CARD_NAME_SHORT);
sprintf(card->shortname, "Aureal Vortex %s", CARD_NAME_SHORT);
sprintf(card->longname, "%s at 0x%lx irq %i",
card->shortname, chip->io, chip->irq);
// (4) Alloc components.
err = snd_vortex_mixer(chip);
if (err < 0) {
snd_card_free(card);
return err;
}
// ADB pcm.
err = snd_vortex_new_pcm(chip, VORTEX_PCM_ADB, NR_PCM);
if (err < 0) {
snd_card_free(card);
return err;
}
#ifndef CHIP_AU8820
// ADB SPDIF
if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_SPDIF, 1)) < 0) {
snd_card_free(card);
return err;
}
// A3D
if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_A3D, NR_A3D)) < 0) {
snd_card_free(card);
return err;
}
#endif
/*
// ADB I2S
if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_I2S, 1)) < 0) {
snd_card_free(card);
return err;
}
*/
#ifndef CHIP_AU8810
// WT pcm.
if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_WT, NR_WT)) < 0) {
snd_card_free(card);
return err;
}
#endif
if ((err = snd_vortex_midi(chip)) < 0) {
snd_card_free(card);
return err;
}
vortex_gameport_register(chip);
#if 0
if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_VORTEX_SYNTH,
sizeof(snd_vortex_synth_arg_t), &wave) < 0
|| wave == NULL) {
dev_err(card->dev, "Can't initialize Aureal wavetable synth\n");
} else {
snd_vortex_synth_arg_t *arg;
arg = SNDRV_SEQ_DEVICE_ARGPTR(wave);
strcpy(wave->name, "Aureal Synth");
arg->hwptr = vortex;
arg->index = 1;
arg->seq_ports = seq_ports[dev];
arg->max_voices = max_synth_voices[dev];
}
#endif
// (5)
if ((err = pci_read_config_word(pci, PCI_DEVICE_ID,
&(chip->device))) < 0) {
//.........这里部分代码省略.........
示例8: snd_ad1889_probe
static int
snd_ad1889_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
int err;
static int devno;
struct snd_card *card;
struct snd_ad1889 *chip;
/* (1) */
if (devno >= SNDRV_CARDS)
return -ENODEV;
if (!enable[devno]) {
devno++;
return -ENOENT;
}
/* (2) */
err = snd_card_new(&pci->dev, index[devno], id[devno], THIS_MODULE,
0, &card);
/* XXX REVISIT: we can probably allocate chip in this call */
if (err < 0)
return err;
strcpy(card->driver, "AD1889");
strcpy(card->shortname, "Analog Devices AD1889");
/* (3) */
err = snd_ad1889_create(card, pci, &chip);
if (err < 0)
goto free_and_ret;
/* (4) */
sprintf(card->longname, "%s at 0x%lx irq %i",
card->shortname, chip->bar, chip->irq);
/* (5) */
/* register AC97 mixer */
err = snd_ad1889_ac97_init(chip, ac97_quirk[devno]);
if (err < 0)
goto free_and_ret;
err = snd_ad1889_pcm_init(chip, 0);
if (err < 0)
goto free_and_ret;
/* register proc interface */
snd_ad1889_proc_init(chip);
/* (6) */
err = snd_card_register(card);
if (err < 0)
goto free_and_ret;
/* (7) */
pci_set_drvdata(pci, card);
devno++;
return 0;
free_and_ret:
snd_card_free(card);
return err;
}
示例9: snd_card_ymfpci_probe
static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
static int dev;
struct snd_card *card;
struct resource *fm_res = NULL;
struct resource *mpu_res = NULL;
struct snd_ymfpci *chip;
struct snd_opl3 *opl3;
const char *str, *model;
int err;
u16 legacy_ctrl, legacy_ctrl2, old_legacy_ctrl;
if (dev >= SNDRV_CARDS)
return -ENODEV;
if (!enable[dev]) {
dev++;
return -ENOENT;
}
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (err < 0)
return err;
switch (pci_id->device) {
case 0x0004: str = "YMF724"; model = "DS-1"; break;
case 0x000d: str = "YMF724F"; model = "DS-1"; break;
case 0x000a: str = "YMF740"; model = "DS-1L"; break;
case 0x000c: str = "YMF740C"; model = "DS-1L"; break;
case 0x0010: str = "YMF744"; model = "DS-1S"; break;
case 0x0012: str = "YMF754"; model = "DS-1E"; break;
default: model = str = "???"; break;
}
legacy_ctrl = 0;
legacy_ctrl2 = 0x0800; /* SBEN = 0, SMOD = 01, LAD = 0 */
if (pci_id->device >= 0x0010) { /* YMF 744/754 */
if (fm_port[dev] == 1) {
/* auto-detect */
fm_port[dev] = pci_resource_start(pci, 1);
}
if (fm_port[dev] > 0 &&
(fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) {
legacy_ctrl |= YMFPCI_LEGACY_FMEN;
pci_write_config_word(pci, PCIR_DSXG_FMBASE, fm_port[dev]);
}
if (mpu_port[dev] == 1) {
/* auto-detect */
mpu_port[dev] = pci_resource_start(pci, 1) + 0x20;
}
if (mpu_port[dev] > 0 &&
(mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) {
legacy_ctrl |= YMFPCI_LEGACY_MEN;
pci_write_config_word(pci, PCIR_DSXG_MPU401BASE, mpu_port[dev]);
}
} else {
switch (fm_port[dev]) {
case 0x388: legacy_ctrl2 |= 0; break;
case 0x398: legacy_ctrl2 |= 1; break;
case 0x3a0: legacy_ctrl2 |= 2; break;
case 0x3a8: legacy_ctrl2 |= 3; break;
default: fm_port[dev] = 0; break;
}
if (fm_port[dev] > 0 &&
(fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) {
legacy_ctrl |= YMFPCI_LEGACY_FMEN;
} else {
legacy_ctrl2 &= ~YMFPCI_LEGACY2_FMIO;
fm_port[dev] = 0;
}
switch (mpu_port[dev]) {
case 0x330: legacy_ctrl2 |= 0 << 4; break;
case 0x300: legacy_ctrl2 |= 1 << 4; break;
case 0x332: legacy_ctrl2 |= 2 << 4; break;
case 0x334: legacy_ctrl2 |= 3 << 4; break;
default: mpu_port[dev] = 0; break;
}
if (mpu_port[dev] > 0 &&
(mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) {
legacy_ctrl |= YMFPCI_LEGACY_MEN;
} else {
legacy_ctrl2 &= ~YMFPCI_LEGACY2_MPUIO;
mpu_port[dev] = 0;
}
}
if (mpu_res) {
legacy_ctrl |= YMFPCI_LEGACY_MIEN;
legacy_ctrl2 |= YMFPCI_LEGACY2_IMOD;
}
pci_read_config_word(pci, PCIR_DSXG_LEGACY, &old_legacy_ctrl);
pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
pci_write_config_word(pci, PCIR_DSXG_ELEGACY, legacy_ctrl2);
if ((err = snd_ymfpci_create(card, pci,
old_legacy_ctrl,
&chip)) < 0) {
snd_card_free(card);
release_and_free_resource(mpu_res);
release_and_free_resource(fm_res);
return err;
//.........这里部分代码省略.........
示例10: efw_probe
static int
efw_probe(struct fw_unit *unit,
const struct ieee1394_device_id *entry)
{
struct snd_card *card;
struct snd_efw *efw;
int card_index, err;
mutex_lock(&devices_mutex);
/* check registered cards */
for (card_index = 0; card_index < SNDRV_CARDS; ++card_index) {
if (!test_bit(card_index, devices_used) && enable[card_index])
break;
}
if (card_index >= SNDRV_CARDS) {
err = -ENOENT;
goto end;
}
err = snd_card_new(&unit->device, index[card_index], id[card_index],
THIS_MODULE, sizeof(struct snd_efw), &card);
if (err < 0)
goto end;
efw = card->private_data;
efw->card_index = card_index;
set_bit(card_index, devices_used);
card->private_free = efw_card_free;
efw->card = card;
efw->unit = fw_unit_get(unit);
mutex_init(&efw->mutex);
spin_lock_init(&efw->lock);
init_waitqueue_head(&efw->hwdep_wait);
/* prepare response buffer */
snd_efw_resp_buf_size = clamp(snd_efw_resp_buf_size,
SND_EFW_RESPONSE_MAXIMUM_BYTES, 4096U);
efw->resp_buf = kzalloc(snd_efw_resp_buf_size, GFP_KERNEL);
if (efw->resp_buf == NULL) {
err = -ENOMEM;
goto error;
}
efw->pull_ptr = efw->push_ptr = efw->resp_buf;
snd_efw_transaction_add_instance(efw);
err = get_hardware_info(efw);
if (err < 0)
goto error;
/* AudioFire8 (since 2009) and AudioFirePre8 */
if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9)
efw->is_af9 = true;
/* These models uses the same firmware. */
if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2 ||
entry->model_id == MODEL_ECHO_AUDIOFIRE_4 ||
entry->model_id == MODEL_ECHO_AUDIOFIRE_9 ||
entry->model_id == MODEL_GIBSON_RIP ||
entry->model_id == MODEL_GIBSON_GOLDTOP)
efw->is_fireworks3 = true;
snd_efw_proc_init(efw);
if (efw->midi_out_ports || efw->midi_in_ports) {
err = snd_efw_create_midi_devices(efw);
if (err < 0)
goto error;
}
err = snd_efw_create_pcm_devices(efw);
if (err < 0)
goto error;
err = snd_efw_create_hwdep_device(efw);
if (err < 0)
goto error;
err = snd_efw_stream_init_duplex(efw);
if (err < 0)
goto error;
err = snd_card_register(card);
if (err < 0) {
snd_efw_stream_destroy_duplex(efw);
goto error;
}
dev_set_drvdata(&unit->device, efw);
end:
mutex_unlock(&devices_mutex);
return err;
error:
snd_efw_transaction_remove_instance(efw);
mutex_unlock(&devices_mutex);
snd_card_free(card);
return err;
}
示例11: tm6000_audio_init
/*
* Alsa Constructor - Component probe
*/
int tm6000_audio_init(struct tm6000_core *dev)
{
struct snd_card *card;
struct snd_tm6000_card *chip;
int rc;
static int devnr;
char component[14];
struct snd_pcm *pcm;
if (!dev)
return 0;
if (devnr >= SNDRV_CARDS)
return -ENODEV;
if (!enable[devnr])
return -ENOENT;
rc = snd_card_create(index[devnr], "tm6000", THIS_MODULE, 0, &card);
if (rc < 0) {
snd_printk(KERN_ERR "cannot create card instance %d\n", devnr);
return rc;
}
strcpy(card->driver, "tm6000-alsa");
strcpy(card->shortname, "TM5600/60x0");
sprintf(card->longname, "TM5600/60x0 Audio at bus %d device %d",
dev->udev->bus->busnum, dev->udev->devnum);
sprintf(component, "USB%04x:%04x",
le16_to_cpu(dev->udev->descriptor.idVendor),
le16_to_cpu(dev->udev->descriptor.idProduct));
snd_component_add(card, component);
snd_card_set_dev(card, &dev->udev->dev);
chip = kzalloc(sizeof(struct snd_tm6000_card), GFP_KERNEL);
if (!chip) {
rc = -ENOMEM;
goto error;
}
chip->core = dev;
chip->card = card;
dev->adev = chip;
spin_lock_init(&chip->reg_lock);
rc = snd_pcm_new(card, "TM6000 Audio", 0, 0, 1, &pcm);
if (rc < 0)
goto error_chip;
pcm->info_flags = 0;
pcm->private_data = chip;
strcpy(pcm->name, "Trident TM5600/60x0");
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_tm6000_pcm_ops);
INIT_WORK(&dev->wq_trigger, audio_trigger);
rc = snd_card_register(card);
if (rc < 0)
goto error_chip;
dprintk(1,"Registered audio driver for %s\n", card->longname);
return 0;
error_chip:
kfree(chip);
dev->adev = NULL;
error:
snd_card_free(card);
return rc;
}
示例12: snd_sgalaxy_probe
static int __init snd_sgalaxy_probe(int dev)
{
static int possible_irqs[] = {7, 9, 10, 11, -1};
static int possible_dmas[] = {1, 3, 0, -1};
int err, xirq, xdma1;
snd_card_t *card;
ad1848_t *chip;
if (sbport[dev] == SNDRV_AUTO_PORT) {
snd_printk("specify SB port\n");
return -EINVAL;
}
if (wssport[dev] == SNDRV_AUTO_PORT) {
snd_printk("specify WSS port\n");
return -EINVAL;
}
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
xirq = irq[dev];
if (xirq == SNDRV_AUTO_IRQ) {
if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
snd_card_free(card);
snd_printk("unable to find a free IRQ\n");
return -EBUSY;
}
}
xdma1 = dma1[dev];
if (xdma1 == SNDRV_AUTO_DMA) {
if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
snd_card_free(card);
snd_printk("unable to find a free DMA\n");
return -EBUSY;
}
}
if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_ad1848_create(card, wssport[dev] + 4,
xirq, xdma1,
AD1848_HW_DETECT, &chip)) < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) {
snd_printdd("sgalaxy - error creating new ad1848 PCM device\n");
snd_card_free(card);
return err;
}
if ((err = snd_ad1848_mixer(chip)) < 0) {
snd_printdd("sgalaxy - error creating new ad1848 mixer\n");
snd_card_free(card);
return err;
}
if (snd_sgalaxy_mixer(chip) < 0) {
snd_printdd("sgalaxy - the mixer rewrite failed\n");
snd_card_free(card);
return err;
}
strcpy(card->driver, "Sound Galaxy");
strcpy(card->shortname, "Sound Galaxy");
sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d",
wssport[dev], xirq, xdma1);
if ((err = snd_card_register(card)) < 0) {
snd_card_free(card);
return err;
}
snd_sgalaxy_cards[dev] = card;
return 0;
}
示例13: cx23885_audio_unregister
/*
* ALSA destructor
*/
void cx23885_audio_unregister(struct cx23885_dev *dev)
{
struct cx23885_audio_dev *chip = dev->audio_dev;
snd_card_free(chip->card);
}
示例14: snd_vortex_remove
// destructor -- see "Destructor" sub-section
static void snd_vortex_remove(struct pci_dev *pci)
{
snd_card_free(pci_get_drvdata(pci));
}
示例15: DriverProbe
//+++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Function Name: DriverProbe
//
// Description: 'probe' call back function
//
//------------------------------------------------------------
static int __devinit DriverProbe(struct platform_device *pdev)
{
struct snd_card *card;
int err,error;
DEBUG("\n %lx:DriverProbe \n",jiffies);
err = -ENODEV;
if (!enable)
return err;
err = -ENOMEM;
err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, sizeof(brcm_alsa_chip_t), &card);
if (!card)
goto err;
g_brcm_alsa_chip = (brcm_alsa_chip_t*)card->private_data;
g_brcm_alsa_chip->card = card;
card->dev = &pdev->dev;
//Coverity - Function does not return error b
strncpy(card->driver, pdev->dev.driver->name, sizeof(card->driver)-1);
card->driver[15] = '\0';
//PCM interface
err = PcmDeviceNew(card);
if (err)
goto err;
//CTRL interface
err = ControlDeviceNew(card);
if (err)
goto err;
strcpy(card->driver, "Broadcom");
strcpy(card->shortname, "Broadcom ALSA");
error = sprintf(card->longname, "Broadcom ALSA PCM %i", 0);
DEBUG("\n probe card->longname ret = %d\n",error);
err = snd_card_register(card);
if (err==0)
{
int ret;
platform_set_drvdata(pdev, card);
ret = BrcmCreateAuddrv_testSysFs(card);
if(ret!=0)
DEBUG("ALSA DriverProbe Error to create sysfs for Auddrv test ret = %d\n", ret);
ret = BrcmCreateControlSysFs(card);
if(ret!=0)
DEBUG("ALSA DriverProbe Error to create sysfs for FMDirectPlay ret = %d\n", ret);
return 0;
}
err:
DEBUG("\n probe failed =%d\n",err);
if (card)
{
error = snd_card_free(card);
DEBUG("\n probe snd_card_free ret = %d\n",error);
}
g_brcm_alsa_chip=NULL;
return err;
}