本文整理汇总了C++中snd_card_new函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_card_new函数的具体用法?C++ snd_card_new怎么用?C++ snd_card_new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_card_new函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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
示例2: snd_mpu401_create
static int snd_mpu401_create(int dev, struct snd_card **rcard)
{
struct snd_card *card;
int err;
*rcard = NULL;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
strcpy(card->driver, "MPU-401 UART");
strcpy(card->shortname, card->driver);
sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]);
if (irq[dev] >= 0) {
sprintf(card->longname + strlen(card->longname), "irq %d", irq[dev]);
} else {
strcat(card->longname, "polled");
}
if ((err = snd_mpu401_uart_new(card, 0,
MPU401_HW_MPU401,
port[dev], 0,
irq[dev], irq[dev] >= 0 ? IRQF_DISABLED : 0, NULL)) < 0) {
printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
goto _err;
}
*rcard = card;
return 0;
_err:
snd_card_free(card);
return err;
}
开发者ID:StephenMacras,项目名称:dsl-n55u-bender,代码行数:33,代码来源:mpu401.c
示例3: hda_tegra_probe
static int hda_tegra_probe(struct platform_device *pdev)
{
const unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR;
struct snd_card *card;
struct azx *chip;
struct hda_tegra *hda;
int err;
hda = devm_kzalloc(&pdev->dev, sizeof(*hda), GFP_KERNEL);
if (!hda)
return -ENOMEM;
hda->dev = &pdev->dev;
chip = &hda->chip;
err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, 0, &card);
if (err < 0) {
dev_err(&pdev->dev, "Error creating card!\n");
return err;
}
err = hda_tegra_create(card, driver_flags, hda);
if (err < 0)
goto out_free;
card->private_data = chip;
dev_set_drvdata(&pdev->dev, card);
schedule_work(&hda->probe_work);
return 0;
out_free:
snd_card_free(card);
return err;
}
开发者ID:513855417,项目名称:linux,代码行数:35,代码来源:hda_tegra.c
示例4: 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
示例5: poseidon_audio_init
int poseidon_audio_init(struct poseidon *p)
{
struct poseidon_audio *pa = &p->audio;
struct snd_card *card;
struct snd_pcm *pcm;
int ret;
ret = snd_card_new(&p->interface->dev, -1, "Telegent",
THIS_MODULE, 0, &card);
if (ret != 0)
return ret;
ret = snd_pcm_new(card, "poseidon audio", 0, 0, 1, &pcm);
if (ret < 0) {
snd_card_free(card);
return ret;
}
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_capture_ops);
pcm->info_flags = 0;
pcm->private_data = p;
strcpy(pcm->name, "poseidon audio capture");
strcpy(card->driver, "ALSA driver");
strcpy(card->shortname, "poseidon Audio");
strcpy(card->longname, "poseidon ALSA Audio");
if (snd_card_register(card)) {
snd_card_free(card);
return -ENOMEM;
}
pa->card = card;
return 0;
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:33,代码来源:pd-alsa.c
示例6: 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
示例7: snd_atiixp_probe
static int __devinit snd_atiixp_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
static int dev;
snd_card_t *card;
atiixp_t *chip;
unsigned char revision;
int err;
if (dev >= SNDRV_CARDS)
return -ENODEV;
if (!enable[dev]) {
dev++;
return -ENOENT;
}
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
strcpy(card->driver, spdif_aclink[dev] ? "ATIIXP" : "ATIIXP-SPDMA");
strcpy(card->shortname, "ATI IXP");
if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
goto __error;
if ((err = snd_atiixp_aclink_reset(chip)) < 0)
goto __error;
chip->spdif_over_aclink = spdif_aclink[dev];
if ((err = snd_atiixp_mixer_new(chip, ac97_clock[dev], ac97_quirk[dev])) < 0)
goto __error;
if ((err = snd_atiixp_pcm_new(chip)) < 0)
goto __error;
snd_atiixp_proc_init(chip);
snd_atiixp_chip_start(chip);
snprintf(card->longname, sizeof(card->longname),
"%s rev %x with %s at %#lx, irq %i", card->shortname, revision,
chip->ac97[0] ? snd_ac97_get_short_name(chip->ac97[0]) : "?",
chip->addr, chip->irq);
snd_card_set_pm_callback(card, snd_atiixp_suspend, snd_atiixp_resume, chip);
if ((err = snd_card_register(card)) < 0)
goto __error;
pci_set_drvdata(pci, card);
dev++;
return 0;
__error:
snd_card_free(card);
return err;
}
开发者ID:idtek,项目名称:linux-2.6.11,代码行数:60,代码来源:atiixp.c
示例8: do_registration
static void do_registration(struct work_struct *work)
{
struct snd_motu *motu = container_of(work, struct snd_motu, dwork.work);
int err;
if (motu->registered)
return;
err = snd_card_new(&motu->unit->device, -1, NULL, THIS_MODULE, 0,
&motu->card);
if (err < 0)
return;
name_card(motu);
err = snd_motu_transaction_register(motu);
if (err < 0)
goto error;
err = snd_motu_stream_init_duplex(motu);
if (err < 0)
goto error;
snd_motu_proc_init(motu);
err = snd_motu_create_pcm_devices(motu);
if (err < 0)
goto error;
if (motu->spec->flags & SND_MOTU_SPEC_HAS_MIDI) {
err = snd_motu_create_midi_devices(motu);
if (err < 0)
goto error;
}
err = snd_motu_create_hwdep_device(motu);
if (err < 0)
goto error;
err = snd_card_register(motu->card);
if (err < 0)
goto error;
/*
* After registered, motu instance can be released corresponding to
* releasing the sound card instance.
*/
motu->card->private_free = motu_card_free;
motu->card->private_data = motu;
motu->registered = true;
return;
error:
snd_motu_transaction_unregister(motu);
snd_card_free(motu->card);
dev_info(&motu->unit->device,
"Sound card registration failed: %d\n", err);
}
开发者ID:asmalldev,项目名称:linux,代码行数:58,代码来源:motu.c
示例9: snd_cs4231_probe
static int snd_cs4231_probe(struct device *dev, unsigned int n)
{
struct snd_card *card;
struct snd_wss *chip;
struct snd_pcm *pcm;
int error;
error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card);
if (error < 0)
return error;
error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n],
WSS_HW_DETECT, 0, &chip);
if (error < 0)
goto out;
card->private_data = chip;
error = snd_wss_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_wss_mixer(chip);
if (error < 0)
goto out;
error = snd_wss_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],
NULL) < 0)
dev_warn(dev, "MPU401 not detected\n");
}
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:383530895,项目名称:linux,代码行数:57,代码来源:cs4231.c
示例10: do_registration
static void do_registration(struct work_struct *work)
{
struct snd_dg00x *dg00x =
container_of(work, struct snd_dg00x, dwork.work);
int err;
if (dg00x->registered)
return;
err = snd_card_new(&dg00x->unit->device, -1, NULL, THIS_MODULE, 0,
&dg00x->card);
if (err < 0)
return;
err = name_card(dg00x);
if (err < 0)
goto error;
err = snd_dg00x_stream_init_duplex(dg00x);
if (err < 0)
goto error;
snd_dg00x_proc_init(dg00x);
err = snd_dg00x_create_pcm_devices(dg00x);
if (err < 0)
goto error;
err = snd_dg00x_create_midi_devices(dg00x);
if (err < 0)
goto error;
err = snd_dg00x_create_hwdep_device(dg00x);
if (err < 0)
goto error;
err = snd_dg00x_transaction_register(dg00x);
if (err < 0)
goto error;
err = snd_card_register(dg00x->card);
if (err < 0)
goto error;
dg00x->card->private_free = dg00x_card_free;
dg00x->card->private_data = dg00x;
dg00x->registered = true;
return;
error:
snd_dg00x_transaction_unregister(dg00x);
snd_dg00x_stream_destroy_duplex(dg00x);
snd_card_free(dg00x->card);
dev_info(&dg00x->unit->device,
"Sound card registration failed: %d\n", err);
}
开发者ID:513855417,项目名称:linux,代码行数:56,代码来源:digi00x.c
示例11: do_registration
static void do_registration(struct work_struct *work)
{
struct snd_motu *motu = container_of(work, struct snd_motu, dwork.work);
int err;
if (motu->registered)
return;
err = snd_card_new(&motu->unit->device, -1, NULL, THIS_MODULE, 0,
&motu->card);
if (err < 0)
return;
motu->card->private_free = motu_card_free;
motu->card->private_data = motu;
name_card(motu);
err = snd_motu_transaction_register(motu);
if (err < 0)
goto error;
err = snd_motu_stream_init_duplex(motu);
if (err < 0)
goto error;
snd_motu_proc_init(motu);
err = snd_motu_create_pcm_devices(motu);
if (err < 0)
goto error;
if ((motu->spec->flags & SND_MOTU_SPEC_RX_MIDI_2ND_Q) ||
(motu->spec->flags & SND_MOTU_SPEC_RX_MIDI_3RD_Q) ||
(motu->spec->flags & SND_MOTU_SPEC_TX_MIDI_2ND_Q) ||
(motu->spec->flags & SND_MOTU_SPEC_TX_MIDI_3RD_Q)) {
err = snd_motu_create_midi_devices(motu);
if (err < 0)
goto error;
}
err = snd_motu_create_hwdep_device(motu);
if (err < 0)
goto error;
err = snd_card_register(motu->card);
if (err < 0)
goto error;
motu->registered = true;
return;
error:
snd_card_free(motu->card);
dev_info(&motu->unit->device,
"Sound card registration failed: %d\n", err);
}
开发者ID:Anjali05,项目名称:linux,代码行数:56,代码来源:motu.c
示例12: do_registration
static void do_registration(struct work_struct *work)
{
struct snd_tscm *tscm = container_of(work, struct snd_tscm, dwork.work);
int err;
err = snd_card_new(&tscm->unit->device, -1, NULL, THIS_MODULE, 0,
&tscm->card);
if (err < 0)
return;
err = identify_model(tscm);
if (err < 0)
goto error;
err = snd_tscm_transaction_register(tscm);
if (err < 0)
goto error;
err = snd_tscm_stream_init_duplex(tscm);
if (err < 0)
goto error;
snd_tscm_proc_init(tscm);
err = snd_tscm_create_pcm_devices(tscm);
if (err < 0)
goto error;
err = snd_tscm_create_midi_devices(tscm);
if (err < 0)
goto error;
err = snd_tscm_create_hwdep_device(tscm);
if (err < 0)
goto error;
err = snd_card_register(tscm->card);
if (err < 0)
goto error;
/*
* After registered, tscm instance can be released corresponding to
* releasing the sound card instance.
*/
tscm->card->private_free = tscm_card_free;
tscm->card->private_data = tscm;
tscm->registered = true;
return;
error:
snd_tscm_transaction_unregister(tscm);
snd_tscm_stream_destroy_duplex(tscm);
snd_card_free(tscm->card);
dev_info(&tscm->unit->device,
"Sound card registration failed: %d\n", err);
}
开发者ID:Lyude,项目名称:linux,代码行数:56,代码来源:tascam.c
示例13: brcm_alsa_omx_probe
static int __devinit brcm_alsa_omx_probe(struct platform_device *pdev)
{
struct snd_card *card;
int err;
DEBUG("\n %lx:probe \n",jiffies);
err = -ENODEV;
if (!enable)
return err;
err = -ENOMEM;
card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, sizeof(brcm_alsa_chip_t));
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;
strncpy(card->driver, pdev->dev.driver->name, sizeof(card->driver));
//PCM interface
err = brcm_alsa_omx_pcm_new(card);
if (err)
goto err;
//CTRL interface
err = brcm_alsa_omx_ctl_new(card);
if (err)
goto err;
//TODO: other interface
strcpy(card->driver, "Broadcom");
strcpy(card->shortname, "Broadcom ALSA");
sprintf(card->longname, "Broadcom ALSA PCM %i", 0);
err = snd_card_register(card);
if (err==0)
{
platform_set_drvdata(pdev, card);
return 0;
}
err:
DEBUG("\n probe failed =%d\n",err);
if (card)
snd_card_free(card);
g_brcm_alsa_chip=NULL;
return err;
}
开发者ID:kzlin129,项目名称:tt-gpl,代码行数:56,代码来源:brcm_alsa_dev.c
示例14: snd_via82xx_probe
static int snd_via82xx_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
struct snd_card *card;
struct via82xx_modem *chip;
int chip_type = 0, card_type;
unsigned int i;
int err;
err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card);
if (err < 0)
return err;
card_type = pci_id->driver_data;
switch (card_type) {
case TYPE_CARD_VIA82XX_MODEM:
strcpy(card->driver, "VIA82XX-MODEM");
sprintf(card->shortname, "VIA 82XX modem");
break;
default:
dev_err(card->dev, "invalid card type %d\n", card_type);
err = -EINVAL;
goto __error;
}
if ((err = snd_via82xx_create(card, pci, chip_type, pci->revision,
ac97_clock, &chip)) < 0)
goto __error;
card->private_data = chip;
if ((err = snd_via82xx_mixer_new(chip)) < 0)
goto __error;
if ((err = snd_via686_pcm_new(chip)) < 0 )
goto __error;
/* disable interrupts */
for (i = 0; i < chip->num_devs; i++)
snd_via82xx_channel_reset(chip, &chip->devs[i]);
sprintf(card->longname, "%s at 0x%lx, irq %d",
card->shortname, chip->port, chip->irq);
snd_via82xx_proc_init(chip);
if ((err = snd_card_register(card)) < 0) {
snd_card_free(card);
return err;
}
pci_set_drvdata(pci, card);
return 0;
__error:
snd_card_free(card);
return err;
}
开发者ID:020gzh,项目名称:linux,代码行数:55,代码来源:via82xx_modem.c
示例15: snd_card_new
static struct snd_card *snd_bcm2835_card_new(struct device *dev)
{
struct snd_card *card;
int ret;
ret = snd_card_new(dev, -1, NULL, THIS_MODULE, 0, &card);
if (ret)
return ERR_PTR(ret);
return card;
}
开发者ID:the-snowwhite,项目名称:linux-socfpga,代码行数:11,代码来源:bcm2835.c
示例16: 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
示例17: do_registration
static void do_registration(struct work_struct *work)
{
struct snd_ff *ff = container_of(work, struct snd_ff, dwork.work);
int err;
if (ff->registered)
return;
err = snd_card_new(&ff->unit->device, -1, NULL, THIS_MODULE, 0,
&ff->card);
if (err < 0)
return;
ff->card->private_free = ff_card_free;
ff->card->private_data = ff;
err = snd_ff_transaction_register(ff);
if (err < 0)
goto error;
name_card(ff);
err = snd_ff_stream_init_duplex(ff);
if (err < 0)
goto error;
snd_ff_proc_init(ff);
err = snd_ff_create_midi_devices(ff);
if (err < 0)
goto error;
err = snd_ff_create_pcm_devices(ff);
if (err < 0)
goto error;
err = snd_ff_create_hwdep_devices(ff);
if (err < 0)
goto error;
err = snd_card_register(ff->card);
if (err < 0)
goto error;
ff->registered = true;
return;
error:
snd_card_free(ff->card);
dev_info(&ff->unit->device,
"Sound card registration failed: %d\n", err);
}
开发者ID:markus-oberhumer,项目名称:linux,代码行数:51,代码来源:ff.c
示例18: 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_new(&dev->pci->dev,
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);
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:020gzh,项目名称:linux,代码行数:50,代码来源:cx23885-alsa.c
示例19: usbtv_audio_init
int usbtv_audio_init(struct usbtv *usbtv)
{
int rv;
struct snd_card *card;
struct snd_pcm *pcm;
INIT_WORK(&usbtv->snd_trigger, snd_usbtv_trigger);
atomic_set(&usbtv->snd_stream, 0);
rv = snd_card_new(&usbtv->udev->dev, SNDRV_DEFAULT_IDX1, "usbtv",
THIS_MODULE, 0, &card);
if (rv < 0)
return rv;
strlcpy(card->driver, usbtv->dev->driver->name, sizeof(card->driver));
strlcpy(card->shortname, "usbtv", sizeof(card->shortname));
snprintf(card->longname, sizeof(card->longname),
"USBTV Audio at bus %d device %d", usbtv->udev->bus->busnum,
usbtv->udev->devnum);
snd_card_set_dev(card, usbtv->dev);
usbtv->snd = card;
rv = snd_pcm_new(card, "USBTV Audio", 0, 0, 1, &pcm);
if (rv < 0)
goto err;
strlcpy(pcm->name, "USBTV Audio Input", sizeof(pcm->name));
pcm->info_flags = 0;
pcm->private_data = usbtv;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usbtv_pcm_ops);
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_KERNEL), USBTV_AUDIO_BUFFER,
USBTV_AUDIO_BUFFER);
rv = snd_card_register(card);
if (rv)
goto err;
return 0;
err:
usbtv->snd = NULL;
snd_card_free(card);
return rv;
}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:49,代码来源:usbtv-audio.c
示例20: snd_als300_probe
static int snd_als300_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
static int dev;
struct snd_card *card;
struct snd_als300 *chip;
int err, chip_type;
if (dev >= SNDRV_CARDS)
return -ENODEV;
if (!enable[dev]) {
dev++;
return -ENOENT;
}
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
0, &card);
if (err < 0)
return err;
chip_type = pci_id->driver_data;
if ((err = snd_als300_create(card, pci, chip_type, &chip)) < 0) {
snd_card_free(card);
return err;
}
card->private_data = chip;
strcpy(card->driver, "ALS300");
if (chip->chip_type == DEVICE_ALS300_PLUS)
/* don't know much about ALS300+ yet
* print revision number for now */
sprintf(card->shortname, "ALS300+ (Rev. %d)", chip->revision);
else
sprintf(card->shortname, "ALS300 (Rev. %c)", 'A' +
chip->revision - 1);
sprintf(card->longname, "%s at 0x%lx irq %i",
card->shortname, chip->port, chip->irq);
if ((err = snd_card_register(card)) < 0) {
snd_card_free(card);
return err;
}
pci_set_drvdata(pci, card);
dev++;
return 0;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:48,代码来源:als300.c
注:本文中的snd_card_new函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论