Lines Matching +full:module +full:- +full:instance
1 // SPDX-License-Identifier: GPL-2.0-or-later
11 #include "ivtv-driver.h"
12 #include "ivtv-version.h"
13 #include "ivtv-alsa.h"
14 #include "ivtv-alsa-pcm.h"
48 return to_ivtv(v4l2_dev)->alsa; in to_snd_ivtv_card()
56 if (itvsc->v4l2_dev != NULL) in snd_ivtv_card_free()
57 to_ivtv(itvsc->v4l2_dev)->alsa = NULL; in snd_ivtv_card_free()
59 /* FIXME - take any other stopping actions needed */ in snd_ivtv_card_free()
68 snd_ivtv_card_free(sc->private_data); in snd_ivtv_card_private_free()
69 sc->private_data = NULL; in snd_ivtv_card_private_free()
70 sc->private_free = NULL; in snd_ivtv_card_private_free()
79 return -ENOMEM; in snd_ivtv_card_create()
81 (*itvsc)->v4l2_dev = v4l2_dev; in snd_ivtv_card_create()
82 (*itvsc)->sc = sc; in snd_ivtv_card_create()
84 sc->private_data = *itvsc; in snd_ivtv_card_create()
85 sc->private_free = snd_ivtv_card_private_free; in snd_ivtv_card_create()
92 struct ivtv *itv = to_ivtv(itvsc->v4l2_dev); in snd_ivtv_card_set_names()
93 struct snd_card *sc = itvsc->sc; in snd_ivtv_card_set_names()
95 /* sc->driver is used by alsa-lib's configurator: simple, unique */ in snd_ivtv_card_set_names()
96 strscpy(sc->driver, "CX2341[56]", sizeof(sc->driver)); in snd_ivtv_card_set_names()
98 /* sc->shortname is a symlink in /proc/asound: IVTV-M -> cardN */ in snd_ivtv_card_set_names()
99 snprintf(sc->shortname, sizeof(sc->shortname), "IVTV-%d", in snd_ivtv_card_set_names()
100 itv->instance); in snd_ivtv_card_set_names()
102 /* sc->longname is read from /proc/asound/cards */ in snd_ivtv_card_set_names()
103 snprintf(sc->longname, sizeof(sc->longname), in snd_ivtv_card_set_names()
104 "CX2341[56] #%d %s TV/FM Radio/Line-In Capture", in snd_ivtv_card_set_names()
105 itv->instance, itv->card_name); in snd_ivtv_card_set_names()
120 /* This is a no-op for us. We'll use the itv->instance */ in snd_ivtv_init()
122 /* (2) Create a card instance */ in snd_ivtv_init()
124 idx = index[itv->instance] == -1 ? SNDRV_DEFAULT_IDX1 : index[itv->instance]; in snd_ivtv_init()
125 ret = snd_card_new(&itv->pdev->dev, in snd_ivtv_init()
153 /* FIXME - proc files */ in snd_ivtv_init()
157 itv->alsa = itvsc; in snd_ivtv_init()
159 /* (6) Register the card instance */ in snd_ivtv_init()
162 itv->alsa = NULL; in snd_ivtv_init()
168 IVTV_ALSA_INFO("%s: Instance %d registered as ALSA card %d\n", in snd_ivtv_init()
169 __func__, itv->instance, sc->number); in snd_ivtv_init()
183 struct v4l2_device *v4l2_dev = &itv->v4l2_dev; in ivtv_alsa_load()
187 pr_err("ivtv-alsa: %s: struct v4l2_device * is NULL\n", in ivtv_alsa_load()
194 pr_err("ivtv-alsa itv is NULL\n"); in ivtv_alsa_load()
198 s = &itv->streams[IVTV_ENC_STREAM_TYPE_PCM]; in ivtv_alsa_load()
199 if (s->vdev.v4l2_dev == NULL) { in ivtv_alsa_load()
200 IVTV_DEBUG_ALSA_INFO("PCM stream for card is disabled - skipping\n"); in ivtv_alsa_load()
204 if (itv->alsa != NULL) { in ivtv_alsa_load()
214 IVTV_DEBUG_ALSA_INFO("created ivtv ALSA interface instance\n"); in ivtv_alsa_load()
221 pr_info("ivtv-alsa: module loading...\n"); in ivtv_alsa_init()
228 struct ivtv *itv = to_ivtv(itvsc->v4l2_dev); in snd_ivtv_exit()
230 /* FIXME - pointer checks & shutdown itvsc */ in snd_ivtv_exit()
232 snd_card_free(itvsc->sc); in snd_ivtv_exit()
233 itv->alsa = NULL; in snd_ivtv_exit()
242 pr_err("ivtv-alsa: %s: struct v4l2_device * is NULL\n", in ivtv_alsa_exit_callback()
263 pr_info("ivtv-alsa: module unloading...\n"); in ivtv_alsa_exit()
270 pr_info("ivtv-alsa: module unload complete\n"); in ivtv_alsa_exit()