// SPDX-License-Identifier: GPL-2.0-or-later /* * ALSA interface to ivtv PCM capture streams * * Copyright (C) 2009,2012 Andy Walls <awalls@md.metrocast.net> * Copyright (C) 2009 Devin Heitmueller <dheitmueller@kernellabs.com> * * Portions of this work were sponsored by ONELAN Limited for the cx18 driver
*/
/* 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 itv->instance */
/* (2) Create a card instance */ /* use first available id if not specified otherwise*/
idx = index[itv->instance] == -1 ? SNDRV_DEFAULT_IDX1 : index[itv->instance];
ret = snd_card_new(&itv->pdev->dev,
idx,
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
THIS_MODULE, 0, &sc); if (ret) {
IVTV_ALSA_ERR("%s: snd_card_new() failed with err %d\n",
__func__, ret); goto err_exit;
}
/* (3) Create a main component */
ret = snd_ivtv_card_create(v4l2_dev, sc, &itvsc); if (ret) {
IVTV_ALSA_ERR("%s: snd_ivtv_card_create() failed with err %d\n",
__func__, ret); goto err_exit_free;
}
/* (4) Set the driver ID and name strings */
snd_ivtv_card_set_names(itvsc);
/* (5) Create other components: PCM, & proc files */
ret = snd_ivtv_pcm_create(itvsc); if (ret) {
IVTV_ALSA_ERR("%s: snd_ivtv_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 */
itv->alsa = itvsc;
/* (6) Register the card instance */
ret = snd_card_register(sc); if (ret) {
itv->alsa = NULL;
IVTV_ALSA_ERR("%s: snd_card_register() failed with err %d\n",
__func__, ret); goto err_exit_free;
}
if (v4l2_dev == NULL) {
pr_err("ivtv-alsa: %s: struct v4l2_device * is NULL\n",
__func__); return 0;
}
itv = to_ivtv(v4l2_dev); if (itv == NULL) {
pr_err("ivtv-alsa itv is NULL\n"); return 0;
}
s = &itv->streams[IVTV_ENC_STREAM_TYPE_PCM]; if (s->vdev.v4l2_dev == NULL) {
IVTV_DEBUG_ALSA_INFO("PCM stream for card is disabled - skipping\n"); return 0;
}
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.