1
2
3
4
5
6
7
8
9
10
11
12#include <sound/core.h>
13#include <sound/initval.h>
14#include <linux/export.h>
15
16#include "driver.h"
17#include "audio.h"
18
19
20
21
22int line6_init_audio(struct usb_line6 *line6)
23{
24 struct snd_card *card;
25 int err;
26
27 err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
28 THIS_MODULE, 0, &card);
29 if (err < 0)
30 return err;
31
32 line6->card = card;
33
34 strcpy(card->id, line6->properties->id);
35 strcpy(card->driver, DRIVER_NAME);
36 strcpy(card->shortname, line6->properties->name);
37
38 sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
39 dev_name(line6->ifcdev));
40 return 0;
41}
42
43
44
45
46int line6_register_audio(struct usb_line6 *line6)
47{
48 int err;
49
50 err = snd_card_register(line6->card);
51 if (err < 0)
52 return err;
53
54 return 0;
55}
56
57
58
59
60void line6_cleanup_audio(struct usb_line6 *line6)
61{
62 struct snd_card *card = line6->card;
63
64 if (card == NULL)
65 return;
66
67 snd_card_disconnect(card);
68 snd_card_free(card);
69 line6->card = NULL;
70}
71