• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ snd_card_set_dev函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中snd_card_set_dev函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_card_set_dev函数的具体用法?C++ snd_card_set_dev怎么用?C++ snd_card_set_dev使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了snd_card_set_dev函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:xiandaicxsj,项目名称:copyKvm,代码行数:27,代码来源:wavefront.c


示例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;
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:31,代码来源:sscape.c


示例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);
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:63,代码来源:pdaudiocf.c


示例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;
}
开发者ID:274914765,项目名称:C,代码行数:60,代码来源:cs4231.c


示例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;
}
开发者ID:StephenMacras,项目名称:dsl-n55u-bender,代码行数:28,代码来源:mpu401.c


示例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;
}
开发者ID:austriancoder,项目名称:v4l2-em8300-old,代码行数:28,代码来源:em8300_alsa.c


示例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;
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:60,代码来源:es1688.c


示例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;
}
开发者ID:StephenMacras,项目名称:dsl-n55u-bender,代码行数:25,代码来源:mpu401.c


示例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;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:27,代码来源:es1688.c


示例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;
}
开发者ID:AmesianX,项目名称:netlink-mmap,代码行数:60,代码来源:pxa2xx-ac97.c


示例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;
}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:34,代码来源:wavefront.c


示例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;
}
开发者ID:AiWinters,项目名称:linux,代码行数:32,代码来源:device.c


示例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;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:59,代码来源:midi.c


示例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;
}
开发者ID:idtek,项目名称:linux-2.6.11,代码行数:59,代码来源:atiixp.c


示例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;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:53,代码来源:lola.c


示例16: snd_vx222_create

static int __devinit snd_vx222_create(struct snd_card *card, struct pci_dev *pci,
				      struct snd_vx_hardware *hw,
				      struct snd_vx222 **rchip)
{
	struct vx_core *chip;
	struct snd_vx222 *vx;
	int i, err;
	static struct snd_device_ops ops = {
		.dev_free =	snd_vx222_dev_free,
	};
	struct snd_vx_ops *vx_ops;

	/* enable PCI device */
	if ((err = pci_enable_device(pci)) < 0)
		return err;
	pci_set_master(pci);

	vx_ops = hw->type == VX_TYPE_BOARD ? &vx222_old_ops : &vx222_ops;
	chip = snd_vx_create(card, hw, vx_ops,
			     sizeof(struct snd_vx222) - sizeof(struct vx_core));
	if (! chip) {
		pci_disable_device(pci);
		return -ENOMEM;
	}
	vx = (struct snd_vx222 *)chip;
	vx->pci = pci;

	if ((err = pci_request_regions(pci, CARD_NAME)) < 0) {
		snd_vx222_free(chip);
		return err;
	}
	for (i = 0; i < 2; i++)
		vx->port[i] = pci_resource_start(pci, i + 1);

	if (request_irq(pci->irq, snd_vx_irq_handler, IRQF_SHARED,
			CARD_NAME, chip)) {
		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
		snd_vx222_free(chip);
		return -EBUSY;
	}
	chip->irq = pci->irq;

	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
		snd_vx222_free(chip);
		return err;
	}

	snd_card_set_dev(card, &pci->dev);

	*rchip = vx;
	return 0;
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:52,代码来源:vx222.c


示例17: 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;

	ret = -ENOMEM;
	card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
			    THIS_MODULE, 0);
	if (!card)
		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);

	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);
	return ret;
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:51,代码来源:pxa2xx-ac97.c


示例18: rtx_ac97_create

/*
 * Use __devinit to place it in the same section as rtx_ac97_probe() (see
 * below).
 */
static int __devinit	rtx_ac97_create(struct snd_card *card,
					struct pci_dev *pdev)
{
	static struct snd_device_ops	ops = {
		.dev_free = rtx_ac97_dev_free
	};
	struct rtx_ac97			*chip;
	int				err;

	err = pci_enable_device(pdev);
	if (err < 0)
		return (err);

	chip = kzalloc(sizeof(*chip), GFP_KERNEL);
	if (!chip) {
		err = -ENOMEM;
		goto fail;
	}
	chip->pdev = pdev;
	chip->card = card;

	/* Allocate PCI stuff here */

	/*
	 * create a "fake" lowlevel (custom) device to have a dtor for our chip
	 * structure:
	 */
	err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
	if (err < 0)
		goto fail;

	/*
	 * registration of device structure this seems needed for alsa/linux
	 * internal stuff:
	 */
	snd_card_set_dev(card, &pdev->dev);

	printk(KERN_INFO "rtx_ac97: chip=0x%p created.\n", chip);

	/* attach ourselves to the card instance: */
	card->private_data = chip;

	return (0);

fail:
	if (chip)
		rtx_ac97_free(chip);
	else
		pci_disable_device(pdev);
	return (err);
}
开发者ID:npalix,项目名称:rathaxes,代码行数:55,代码来源:rtx_ac97.c


示例19: printk

struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)
{
	struct snd_card *card;
	struct cx23885_audio_dev *chip;
	int err;

	if (disable_analog_audio)
		return NULL;

	if (dev->sram_channels[AUDIO_SRAM_CHANNEL].cmds_start == 0) {
		printk(KERN_WARNING "%s(): Missing SRAM channel configuration "
			"for analog TV Audio\n", __func__);
		return NULL;
	}

	err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
			THIS_MODULE, sizeof(struct cx23885_audio_dev), &card);
	if (err < 0)
		goto error;

	chip = (struct cx23885_audio_dev *) card->private_data;
	chip->dev = dev;
	chip->pci = dev->pci;
	chip->card = card;
	spin_lock_init(&chip->lock);

	snd_card_set_dev(card, &dev->pci->dev);

	err = snd_cx23885_pcm(chip, 0, "CX23885 Digital");
	if (err < 0)
		goto error;

	strcpy(card->driver, "CX23885");
	sprintf(card->shortname, "Conexant CX23885");
	sprintf(card->longname, "%s at %s", card->shortname, dev->name);

	err = snd_card_register(card);
	if (err < 0)
		goto error;

	dprintk(0, "registered ALSA audio device\n");

	return chip;

error:
	snd_card_free(card);
	printk(KERN_ERR "%s(): Failed to register analog "
			"audio adapter\n", __func__);

	return NULL;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:51,代码来源:cx23885-alsa.c


示例20: snd_adlib_probe

static int __devinit snd_adlib_probe(struct device *dev, unsigned int n)
{
	struct snd_card *card;
	struct snd_opl3 *opl3;
	int error;

	error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
	if (error < 0) {
		dev_err(dev, "could not create card\n");
		return error;
	}

	card->private_data = request_region(port[n], 4, CRD_NAME);
	if (!card->private_data) {
		dev_err(dev, "could not grab ports\n");
		error = -EBUSY;
		goto out;
	}
	card->private_free = snd_adlib_free;

	strcpy(card->driver, DEV_NAME);
	strcpy(card->shortname, CRD_NAME);
	sprintf(card->longname, CRD_NAME " at %#lx", port[n]);

	error = snd_opl3_create(card, port[n], port[n] + 2, OPL3_HW_AUTO, 1, &opl3);
	if (error < 0) {
		dev_err(dev, "could not create OPL\n");
		goto out;
	}

	error = snd_opl3_hwdep_new(opl3, 0, 0, NULL);
	if (error < 0) {
		dev_err(dev, "could not create FM\n");
		goto out;
	}

	snd_card_set_dev(card, dev);

	error = snd_card_register(card);
	if (error < 0) {
		dev_err(dev, "could not register card\n");
		goto out;
	}

	dev_set_drvdata(dev, card);
	return 0;

out:	snd_card_free(card);
	return error;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:50,代码来源:adlib.c



注:本文中的snd_card_set_dev函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ snd_compr_get_avail函数代码示例发布时间:2022-05-30
下一篇:
C++ snd_card_register函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap