26 #include <linux/slab.h>
27 #include <linux/module.h>
28 #include <linux/kernel.h>
29 #include <linux/device.h>
45 #define IVTV_DEBUG_ALSA_INFO(fmt, arg...) \
47 if (ivtv_alsa_debug & 2) \
48 pr_info("%s: " fmt, "ivtv-alsa", ## arg); \
53 "Debug level (bitmask). Default: 0\n"
54 "\t\t\t 1/0x0001: warning\n"
55 "\t\t\t 2/0x0002: info\n");
67 return to_ivtv(v4l2_dev)->alsa;
89 static void snd_ivtv_card_private_free(
struct snd_card *
sc)
115 static int snd_ivtv_card_set_names(
struct snd_ivtv_card *itvsc)
129 "CX2341[56] #%d %s TV/FM Radio/Line-In Capture",
135 static int snd_ivtv_init(
struct v4l2_device *v4l2_dev)
137 struct ivtv *itv = to_ivtv(v4l2_dev);
158 ret = snd_ivtv_card_create(v4l2_dev, sc, &itvsc);
160 IVTV_ALSA_ERR(
"%s: snd_ivtv_card_create() failed with err %d\n",
166 snd_ivtv_card_set_names(itvsc);
173 " proceeding anyway\n", __func__, ret);
179 IVTV_ALSA_ERR(
"%s: snd_ivtv_pcm_create() failed with err %d\n",
193 IVTV_ALSA_ERR(
"%s: snd_card_register() failed with err %d\n",
213 if (v4l2_dev ==
NULL) {
214 pr_err(
"ivtv-alsa: %s: struct v4l2_device * is NULL\n",
219 itv = to_ivtv(v4l2_dev);
221 pr_err(
"ivtv-alsa itv is NULL\n");
228 "skipping\n", __func__);
238 if (snd_ivtv_init(v4l2_dev)) {
248 static int __init ivtv_alsa_init(
void)
250 pr_info(
"ivtv-alsa: module loading...\n");
270 if (v4l2_dev ==
NULL) {
271 pr_err(
"ivtv-alsa: %s: struct v4l2_device * is NULL\n",
276 itvsc = to_snd_ivtv_card(v4l2_dev);
283 snd_ivtv_exit(itvsc);
287 static void __exit ivtv_alsa_exit(
void)
292 pr_info(
"ivtv-alsa: module unloading...\n");
299 pr_info(
"ivtv-alsa: module unload complete\n");