]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/staging/line6/audio.c
Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
[mirror_ubuntu-artful-kernel.git] / drivers / staging / line6 / audio.c
CommitLineData
705ececd 1/*
e1a164d7 2 * Line6 Linux USB driver - 0.9.1beta
705ececd 3 *
1027f476 4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
705ececd
MG
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
705ececd
MG
12#include <sound/core.h>
13#include <sound/initval.h>
8e336a72 14#include <linux/export.h>
705ececd 15
1027f476
MG
16#include "driver.h"
17#include "audio.h"
18
705ececd
MG
19/*
20 Initialize the Line6 USB audio system.
21*/
22int line6_init_audio(struct usb_line6 *line6)
23{
705ececd 24 struct snd_card *card;
a405f43e 25 int err;
705ececd 26
b029a940
TI
27 err = snd_card_new(line6->ifcdev,
28 SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
29 THIS_MODULE, 0, &card);
a405f43e
AB
30 if (err < 0)
31 return err;
705ececd
MG
32
33 line6->card = card;
34
1027f476 35 strcpy(card->id, line6->properties->id);
705ececd 36 strcpy(card->driver, DRIVER_NAME);
1027f476 37 strcpy(card->shortname, line6->properties->name);
027360c5
GKH
38 /* longname is 80 chars - see asound.h */
39 sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
40 dev_name(line6->ifcdev));
705ececd
MG
41 return 0;
42}
43
44/*
45 Register the Line6 USB audio system.
46*/
47int line6_register_audio(struct usb_line6 *line6)
48{
49 int err;
50
dfc70567
GKH
51 err = snd_card_register(line6->card);
52 if (err < 0)
705ececd
MG
53 return err;
54
55 return 0;
56}
57
58/*
59 Cleanup the Line6 USB audio system.
60*/
61void line6_cleanup_audio(struct usb_line6 *line6)
62{
63 struct snd_card *card = line6->card;
64
536165d8 65 if (card == NULL)
705ececd
MG
66 return;
67
68 snd_card_disconnect(card);
69 snd_card_free(card);
536165d8 70 line6->card = NULL;
705ececd 71}