Merge tag 'gpio-v3.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6.git] / drivers / staging / line6 / audio.c
bloba92e21f7d55b83bb1b537e48259b1202271699fa
1 /*
2 * Line6 Linux USB driver - 0.9.1beta
4 * Copyright (C) 2004-2010 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 <sound/core.h>
13 #include <sound/initval.h>
14 #include <linux/export.h>
16 #include "driver.h"
17 #include "audio.h"
20 Initialize the Line6 USB audio system.
22 int line6_init_audio(struct usb_line6 *line6)
24 struct snd_card *card;
25 int err;
27 err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
28 THIS_MODULE, 0, &card);
29 if (err < 0)
30 return err;
32 line6->card = card;
34 strcpy(card->id, line6->properties->id);
35 strcpy(card->driver, DRIVER_NAME);
36 strcpy(card->shortname, line6->properties->name);
37 /* longname is 80 chars - see asound.h */
38 sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
39 dev_name(line6->ifcdev));
40 return 0;
44 Register the Line6 USB audio system.
46 int line6_register_audio(struct usb_line6 *line6)
48 int err;
50 err = snd_card_register(line6->card);
51 if (err < 0)
52 return err;
54 return 0;
58 Cleanup the Line6 USB audio system.
60 void line6_cleanup_audio(struct usb_line6 *line6)
62 struct snd_card *card = line6->card;
64 if (card == NULL)
65 return;
67 snd_card_disconnect(card);
68 snd_card_free(card);
69 line6->card = NULL;