/* Numbrs steps from "Writing an ALSA Driver" by Takashi Iwai */
/* (1) Check and increment the device index */ /* This is a no-op for us. We'll use the cx->instance */
/* (2) Create a card instance */
ret = snd_card_new(&cx->pci_dev->dev,
SNDRV_DEFAULT_IDX1, /* use first available id */
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
THIS_MODULE, 0, &sc); if (ret) {
CX18_ALSA_ERR("%s: snd_card_new() failed with err %d\n",
__func__, ret); goto err_exit;
}
/* (3) Create a main component */
ret = snd_cx18_card_create(v4l2_dev, sc, &cxsc); if (ret) {
CX18_ALSA_ERR("%s: snd_cx18_card_create() failed with err %d\n",
__func__, ret); goto err_exit_free;
}
/* (4) Set the driver ID and name strings */
snd_cx18_card_set_names(cxsc);
ret = snd_cx18_pcm_create(cxsc); if (ret) {
CX18_ALSA_ERR("%s: snd_cx18_pcm_create() failed with err %d\n",
__func__, ret); goto err_exit_free;
} /* FIXME - proc files */
/* (7) Set the driver data and return 0 */ /* We do this out of normal order for PCI drivers to avoid races */
cx->alsa = cxsc;
/* (6) Register the card instance */
ret = snd_card_register(sc); if (ret) {
cx->alsa = NULL;
CX18_ALSA_ERR("%s: snd_card_register() failed with err %d\n",
__func__, ret); goto err_exit_free;
}
if (v4l2_dev == NULL) {
printk(KERN_ERR "cx18-alsa: %s: struct v4l2_device * is NULL\n",
__func__); return0;
}
cx = to_cx18(v4l2_dev); if (cx == NULL) {
printk(KERN_ERR "cx18-alsa cx is NULL\n"); return0;
}
s = &cx->streams[CX18_ENC_STREAM_TYPE_PCM]; if (s->video_dev.v4l2_dev == NULL) {
CX18_DEBUG_ALSA_INFO("%s: PCM stream for card is disabled - skipping\n",
__func__); return0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.