本文整理汇总了C++中snd_card_set_dev函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_card_set_dev函数的具体用法?C++ snd_card_set_dev怎么用?C++ snd_card_set_dev使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_card_set_dev函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: snd_wavefront_nonpnp_probe
static int __devinit snd_wavefront_nonpnp_probe(struct platform_device *pdev)
{
int dev = pdev->id;
struct snd_card *card;
int err;
if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
snd_printk("specify CS4232 port\n");
return -EINVAL;
}
if (ics2115_port[dev] == SNDRV_AUTO_PORT) {
snd_printk("specify ICS2115 port\n");
return -ENODEV;
}
card = snd_wavefront_card_new(dev);
if (! card)
return -ENOMEM;
snd_card_set_dev(card, &pdev->dev);
if ((err = snd_wavefront_probe(card, dev)) < 0) {
snd_card_free(card);
return err;
}
platform_set_drvdata(pdev, card);
return 0;
}
示例2: snd_sscape_probe
static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev)
{
struct snd_card *card;
struct soundscape *sscape;
int ret;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct soundscape));
if (!card)
return -ENOMEM;
sscape = get_card_soundscape(card);
sscape->type = SSCAPE;
dma[dev] &= 0x03;
ret = create_sscape(dev, card);
if (ret < 0)
goto _release_card;
snd_card_set_dev(card, pdev);
if ((ret = snd_card_register(card)) < 0) {
printk(KERN_ERR "sscape: Failed to register sound card\n");
goto _release_card;
}
dev_set_drvdata(pdev, card);
return 0;
_release_card:
snd_card_free(card);
return ret;
}
示例3: snd_pdacf_probe
/*
* snd_pdacf_attach - attach callback for cs
*/
static int snd_pdacf_probe(struct pcmcia_device *link)
{
int i, err;
struct snd_pdacf *pdacf;
struct snd_card *card;
static struct snd_device_ops ops = {
.dev_free = snd_pdacf_dev_free,
};
snd_printdd(KERN_DEBUG "pdacf_attach called\n");
/* find an empty slot from the card list */
for (i = 0; i < SNDRV_CARDS; i++) {
if (! card_list[i])
break;
}
if (i >= SNDRV_CARDS) {
snd_printk(KERN_ERR "pdacf: too many cards found\n");
return -EINVAL;
}
if (! enable[i])
return -ENODEV; /* disabled explicitly */
/* ok, create a card instance */
err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
if (err < 0) {
snd_printk(KERN_ERR "pdacf: cannot create a card instance\n");
return err;
}
pdacf = snd_pdacf_create(card);
if (!pdacf) {
snd_card_free(card);
return -ENOMEM;
}
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops);
if (err < 0) {
kfree(pdacf);
snd_card_free(card);
return err;
}
snd_card_set_dev(card, &link->dev);
pdacf->index = i;
card_list[i] = card;
pdacf->p_dev = link;
link->priv = pdacf;
link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
link->resource[0]->end = 16;
link->conf.Attributes = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.ConfigIndex = 1;
link->conf.Present = PRESENT_OPTION;
return pdacf_config(link);
}
示例4: snd_cs4231_probe
static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
{
struct snd_card *card;
struct snd_cs4231 *chip;
struct snd_pcm *pcm;
int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0);
if (!card)
return -EINVAL;
error = snd_cs4231_create(card, port[n], -1, irq[n], dma1[n], dma2[n],
CS4231_HW_DETECT, 0, &chip);
if (error < 0)
goto out;
card->private_data = chip;
error = snd_cs4231_pcm(chip, 0, &pcm);
if (error < 0)
goto out;
strcpy(card->driver, "CS4231");
strcpy(card->shortname, pcm->name);
sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
pcm->name, chip->port, irq[n], dma1[n]);
if (dma2[n] >= 0)
sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]);
error = snd_cs4231_mixer(chip);
if (error < 0)
goto out;
error = snd_cs4231_timer(chip, 0, NULL);
if (error < 0)
goto out;
if (mpu_port[n] > 0 && mpu_port[n] != SNDRV_AUTO_PORT) {
if (mpu_irq[n] == SNDRV_AUTO_IRQ)
mpu_irq[n] = -1;
if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
mpu_port[n], 0, mpu_irq[n],
mpu_irq[n] >= 0 ? IRQF_DISABLED : 0,
NULL) < 0)
printk(KERN_WARNING "%s: MPU401 not detected\n", dev->bus_id);
}
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;
}
示例5: snd_mpu401_pnp_probe
static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
const struct pnp_device_id *id)
{
static int dev;
struct snd_card *card;
int err;
for ( ; dev < SNDRV_CARDS; ++dev) {
if (!enable[dev] || !pnp[dev])
continue;
err = snd_mpu401_pnp(dev, pnp_dev, id);
if (err < 0)
return err;
err = snd_mpu401_create(dev, &card);
if (err < 0)
return err;
if ((err = snd_card_register(card)) < 0) {
snd_card_free(card);
return err;
}
snd_card_set_dev(card, &pnp_dev->dev);
pnp_set_drvdata(pnp_dev, card);
snd_mpu401_devices++;
++dev;
return 0;
}
return -ENODEV;
}
示例6: snd_em8300_create
static int snd_em8300_create(struct snd_card *card, struct em8300_s *em, em8300_alsa_t **rem8300_alsa)
{
em8300_alsa_t *em8300_alsa;
int err;
static struct snd_device_ops ops = {
.dev_free = snd_em8300_dev_free,
};
if (rem8300_alsa)
*rem8300_alsa = NULL;
em8300_alsa = (em8300_alsa_t *)kzalloc(sizeof(em8300_alsa_t), GFP_KERNEL);
if (em8300_alsa == NULL)
return -ENOMEM;
em8300_alsa->em = em;
em8300_alsa->card = card;
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, em8300_alsa, &ops)) < 0) {
snd_em8300_free(em8300_alsa);
return err;
}
snd_card_set_dev(card, &em->pci_dev->dev);
*rem8300_alsa = em8300_alsa;
return 0;
}
示例7: snd_es1688_probe
static int __devinit snd_es1688_probe(struct device *dev, unsigned int n)
{
struct snd_card *card;
struct snd_es1688 *chip;
struct snd_opl3 *opl3;
struct snd_pcm *pcm;
int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0);
if (!card)
return -EINVAL;
error = snd_es1688_legacy_create(card, dev, n, &chip);
if (error < 0)
goto out;
error = snd_es1688_pcm(chip, 0, &pcm);
if (error < 0)
goto out;
error = snd_es1688_mixer(chip);
if (error < 0)
goto out;
strcpy(card->driver, "ES1688");
strcpy(card->shortname, pcm->name);
sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name,
chip->port, chip->irq, chip->dma8);
if (snd_opl3_create(card, chip->port, chip->port + 2,
OPL3_HW_OPL3, 0, &opl3) < 0)
printk(KERN_WARNING "%s: opl3 not detected at 0x%lx\n",
dev->bus_id, chip->port);
else {
error = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
if (error < 0)
goto out;
}
if (mpu_irq[n] >= 0 && mpu_irq[n] != SNDRV_AUTO_IRQ &&
chip->mpu_port > 0) {
error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
chip->mpu_port, 0,
mpu_irq[n], IRQF_DISABLED, NULL);
if (error < 0)
goto out;
}
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;
}
示例8: snd_mpu401_probe
static int __devinit snd_mpu401_probe(struct platform_device *devptr)
{
int dev = devptr->id;
int err;
struct snd_card *card;
if (port[dev] == SNDRV_AUTO_PORT) {
snd_printk(KERN_ERR "specify port\n");
return -EINVAL;
}
if (irq[dev] == SNDRV_AUTO_IRQ) {
snd_printk(KERN_ERR "specify or disable IRQ\n");
return -EINVAL;
}
err = snd_mpu401_create(dev, &card);
if (err < 0)
return err;
snd_card_set_dev(card, &devptr->dev);
if ((err = snd_card_register(card)) < 0) {
snd_card_free(card);
return err;
}
platform_set_drvdata(devptr, card);
return 0;
}
示例9: snd_es1688_isa_probe
static int __devinit snd_es1688_isa_probe(struct device *dev, unsigned int n)
{
struct snd_card *card;
int error;
error = snd_card_create(index[n], id[n], THIS_MODULE,
sizeof(struct snd_es1688), &card);
if (error < 0)
return error;
error = snd_es1688_legacy_create(card, dev, n);
if (error < 0)
goto out;
snd_card_set_dev(card, dev);
error = snd_es1688_probe(card, n);
if (error < 0)
goto out;
dev_set_drvdata(dev, card);
return 0;
out:
snd_card_free(card);
return error;
}
示例10: pxa2xx_ac97_probe
static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
{
struct snd_card *card;
struct snd_ac97_bus *ac97_bus;
struct snd_ac97_template ac97_template;
int ret;
pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
if (dev->id >= 0) {
dev_err(&dev->dev, "PXA2xx has only one AC97 port.\n");
ret = -ENXIO;
goto err_dev;
}
ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, 0, &card);
if (ret < 0)
goto err;
card->dev = &dev->dev;
strncpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
if (ret)
goto err;
ret = pxa2xx_ac97_hw_probe(dev);
if (ret)
goto err;
ret = snd_ac97_bus(card, 0, &pxa2xx_ac97_ops, NULL, &ac97_bus);
if (ret)
goto err_remove;
memset(&ac97_template, 0, sizeof(ac97_template));
ret = snd_ac97_mixer(ac97_bus, &ac97_template, &pxa2xx_ac97_ac97);
if (ret)
goto err_remove;
snprintf(card->shortname, sizeof(card->shortname),
"%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97));
snprintf(card->longname, sizeof(card->longname),
"%s (%s)", dev->dev.driver->name, card->mixername);
if (pdata && pdata->codec_pdata[0])
snd_ac97_dev_add_pdata(ac97_bus->codec[0], pdata->codec_pdata[0]);
snd_card_set_dev(card, &dev->dev);
ret = snd_card_register(card);
if (ret == 0) {
platform_set_drvdata(dev, card);
return 0;
}
err_remove:
pxa2xx_ac97_hw_remove(dev);
err:
if (card)
snd_card_free(card);
err_dev:
return ret;
}
示例11: snd_wavefront_pnp_detect
static int snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
const struct pnp_card_device_id *pid)
{
static int dev;
struct snd_card *card;
int res;
for ( ; dev < SNDRV_CARDS; dev++) {
if (enable[dev] && isapnp[dev])
break;
}
if (dev >= SNDRV_CARDS)
return -ENODEV;
res = snd_wavefront_card_new(dev, &card);
if (res < 0)
return res;
if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) {
if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
snd_printk (KERN_ERR "isapnp detection failed\n");
snd_card_free (card);
return -ENODEV;
}
}
snd_card_set_dev(card, &pcard->card->dev);
if ((res = snd_wavefront_probe(card, dev)) < 0)
return res;
pnp_set_card_drvdata(pcard, card);
dev++;
return 0;
}
示例12: create_card
static int create_card(struct usb_device *usb_dev,
struct usb_interface *intf,
struct snd_card **cardp)
{
int devnum;
int err;
struct snd_card *card;
struct snd_usb_caiaqdev *dev;
for (devnum = 0; devnum < SNDRV_CARDS; devnum++)
if (enable[devnum] && !snd_card_used[devnum])
break;
if (devnum >= SNDRV_CARDS)
return -ENODEV;
err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
sizeof(struct snd_usb_caiaqdev), &card);
if (err < 0)
return err;
dev = caiaqdev(card);
dev->chip.dev = usb_dev;
dev->chip.card = card;
dev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor),
le16_to_cpu(usb_dev->descriptor.idProduct));
spin_lock_init(&dev->spinlock);
snd_card_set_dev(card, &intf->dev);
*cardp = card;
return 0;
}
示例13: line6_init_midi
/*
Initialize the Line6 MIDI subsystem.
*/
int line6_init_midi(struct usb_line6 *line6)
{
static struct snd_device_ops midi_ops = {
.dev_free = snd_line6_midi_free,
};
int err;
struct snd_line6_midi *line6midi;
if (!(line6->properties->capabilities & LINE6_BIT_CONTROL)) {
/* skip MIDI initialization and report success */
return 0;
}
line6midi = kzalloc(sizeof(struct snd_line6_midi), GFP_KERNEL);
if (line6midi == NULL)
return -ENOMEM;
err = line6_midibuf_init(&line6midi->midibuf_in, MIDI_BUFFER_SIZE, 0);
if (err < 0)
return err;
err = line6_midibuf_init(&line6midi->midibuf_out, MIDI_BUFFER_SIZE, 1);
if (err < 0)
return err;
line6midi->line6 = line6;
line6midi->midi_mask_transmit = 1;
line6midi->midi_mask_receive = 4;
line6->line6midi = line6midi;
err = snd_device_new(line6->card, SNDRV_DEV_RAWMIDI, line6midi,
&midi_ops);
if (err < 0)
return err;
snd_card_set_dev(line6->card, line6->ifcdev);
err = snd_line6_new_midi(line6midi);
if (err < 0)
return err;
err = device_create_file(line6->ifcdev, &dev_attr_midi_mask_transmit);
if (err < 0)
return err;
err = device_create_file(line6->ifcdev, &dev_attr_midi_mask_receive);
if (err < 0)
return err;
init_waitqueue_head(&line6midi->send_wait);
spin_lock_init(&line6midi->send_urb_lock);
spin_lock_init(&line6midi->midi_transmit_lock);
return 0;
}
示例14: snd_atiixp_create
/*
* constructor for chip instance
*/
static int __devinit snd_atiixp_create(snd_card_t *card,
struct pci_dev *pci,
atiixp_t **r_chip)
{
static snd_device_ops_t ops = {
.dev_free = snd_atiixp_dev_free,
};
atiixp_t *chip;
int err;
if ((err = pci_enable_device(pci)) < 0)
return err;
chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
if (chip == NULL) {
pci_disable_device(pci);
return -ENOMEM;
}
spin_lock_init(&chip->reg_lock);
init_MUTEX(&chip->open_mutex);
chip->card = card;
chip->pci = pci;
chip->irq = -1;
if ((err = pci_request_regions(pci, "ATI IXP AC97")) < 0) {
pci_disable_device(pci);
kfree(chip);
return err;
}
chip->addr = pci_resource_start(pci, 0);
chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0));
if (chip->remap_addr == NULL) {
snd_printk(KERN_ERR "AC'97 space ioremap problem\n");
snd_atiixp_free(chip);
return -EIO;
}
if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
snd_atiixp_free(chip);
return -EBUSY;
}
chip->irq = pci->irq;
pci_set_master(pci);
synchronize_irq(chip->irq);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
snd_atiixp_free(chip);
return err;
}
snd_card_set_dev(card, &pci->dev);
*r_chip = chip;
return 0;
}
示例15: lola_probe
static int __devinit lola_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
static int dev;
struct snd_card *card;
struct lola *chip;
int err;
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) {
snd_printk(KERN_ERR SFX "Error creating card!\n");
return err;
}
snd_card_set_dev(card, &pci->dev);
err = lola_create(card, pci, dev, &chip);
if (err < 0)
goto out_free;
card->private_data = chip;
err = lola_parse_tree(chip);
if (err < 0)
goto out_free;
err = lola_create_pcm(chip);
if (err < 0)
goto out_free;
err = lola_create_mixer(chip);
if (err < 0)
goto out_free;
lola_proc_debug_new(chip);
err = snd_card_register(card);
if (err < 0)
goto out_free;
pci_set_drvdata(pci, card);
dev++;
return err;
out_free:
snd_card_free(card);
return err;
}