Merge branch 'for-2.6.30' into for-2.6.31
[deliverable/linux.git] / drivers / staging / line6 / audio.c
1 /*
2 * Line6 Linux USB driver - 0.8.0
3 *
4 * Copyright (C) 2004-2009 Markus Grabner (grabner@icg.tugraz.at)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.
9 *
10 */
11
12 #include "driver.h"
13 #include "audio.h"
14
15 #include <sound/core.h>
16 #include <sound/initval.h>
17
18
19 static int line6_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
20 static char *line6_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
21
22
23 /*
24 Initialize the Line6 USB audio system.
25 */
26 int line6_init_audio(struct usb_line6 *line6)
27 {
28 static int dev;
29 struct snd_card *card;
30
31 card = snd_card_new(line6_index[dev], line6_id[dev], THIS_MODULE, 0);
32
33 if (card == NULL)
34 return -ENOMEM;
35
36 line6->card = card;
37
38 strcpy(card->driver, DRIVER_NAME);
39 strcpy(card->shortname, "Line6-USB");
40 sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
41 dev_name(line6->ifcdev)); /* 80 chars - see asound.h */
42 return 0;
43 }
44
45 /*
46 Register the Line6 USB audio system.
47 */
48 int line6_register_audio(struct usb_line6 *line6)
49 {
50 int err;
51
52 err = snd_card_register(line6->card);
53 if (err < 0)
54 return err;
55
56 return 0;
57 }
58
59 /*
60 Cleanup the Line6 USB audio system.
61 */
62 void line6_cleanup_audio(struct usb_line6 *line6)
63 {
64 struct snd_card *card = line6->card;
65
66 if (card == NULL)
67 return;
68
69 snd_card_disconnect(card);
70 snd_card_free(card);
71 line6->card = NULL;
72 }
This page took 0.032345 seconds and 6 git commands to generate.