RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / staging / line6 / audio.c
blobe2ac8d60f8c27195441bf04f5e0d8afb6917e8f0
1 /*
2 * Line6 Linux USB driver - 0.8.0
4 * Copyright (C) 2004-2009 Markus Grabner (grabner@icg.tugraz.at)
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.
12 #include "driver.h"
13 #include "audio.h"
15 #include <sound/core.h>
16 #include <sound/initval.h>
19 static int line6_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
20 static char *line6_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
24 Initialize the Line6 USB audio system.
26 int line6_init_audio(struct usb_line6 *line6)
28 static int dev;
29 struct snd_card *card;
30 int err;
32 err = snd_card_create(line6_index[dev], line6_id[dev], THIS_MODULE, 0,
33 &card);
34 if (err < 0)
35 return err;
37 line6->card = card;
39 strcpy(card->driver, DRIVER_NAME);
40 strcpy(card->shortname, "Line6-USB");
41 sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
42 dev_name(line6->ifcdev)); /* 80 chars - see asound.h */
43 return 0;
47 Register the Line6 USB audio system.
49 int line6_register_audio(struct usb_line6 *line6)
51 int err;
53 err = snd_card_register(line6->card);
54 if (err < 0)
55 return err;
57 return 0;
61 Cleanup the Line6 USB audio system.
63 void line6_cleanup_audio(struct usb_line6 *line6)
65 struct snd_card *card = line6->card;
67 if (card == NULL)
68 return;
70 snd_card_disconnect(card);
71 snd_card_free(card);
72 line6->card = NULL;