2009-02-28 03:43:04 +00:00
|
|
|
/*
|
|
|
|
* Line6 Linux USB driver - 0.8.0
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2009 Markus Grabner (grabner@icg.tugraz.at)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation, version 2.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "driver.h"
|
2009-02-28 04:45:03 +00:00
|
|
|
#include "audio.h"
|
2009-02-28 03:43:04 +00:00
|
|
|
|
|
|
|
#include <sound/core.h>
|
|
|
|
#include <sound/initval.h>
|
|
|
|
|
|
|
|
|
|
|
|
static int line6_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
|
|
|
|
static char *line6_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Initialize the Line6 USB audio system.
|
|
|
|
*/
|
|
|
|
int line6_init_audio(struct usb_line6 *line6)
|
|
|
|
{
|
2009-02-28 06:41:54 +00:00
|
|
|
static int dev;
|
2009-02-28 03:43:04 +00:00
|
|
|
struct snd_card *card;
|
2009-03-29 15:59:13 +00:00
|
|
|
int err;
|
2009-02-28 03:43:04 +00:00
|
|
|
|
2009-03-29 15:59:13 +00:00
|
|
|
err = snd_card_create(line6_index[dev], line6_id[dev], THIS_MODULE, 0,
|
|
|
|
&card);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2009-02-28 03:43:04 +00:00
|
|
|
|
|
|
|
line6->card = card;
|
|
|
|
|
|
|
|
strcpy(card->driver, DRIVER_NAME);
|
|
|
|
strcpy(card->shortname, "Line6-USB");
|
2009-02-28 03:49:00 +00:00
|
|
|
sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
|
|
|
|
dev_name(line6->ifcdev)); /* 80 chars - see asound.h */
|
2009-02-28 03:43:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Register the Line6 USB audio system.
|
|
|
|
*/
|
|
|
|
int line6_register_audio(struct usb_line6 *line6)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
2009-02-28 06:41:54 +00:00
|
|
|
err = snd_card_register(line6->card);
|
|
|
|
if (err < 0)
|
2009-02-28 03:43:04 +00:00
|
|
|
return err;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Cleanup the Line6 USB audio system.
|
|
|
|
*/
|
|
|
|
void line6_cleanup_audio(struct usb_line6 *line6)
|
|
|
|
{
|
|
|
|
struct snd_card *card = line6->card;
|
|
|
|
|
2009-02-28 04:49:46 +00:00
|
|
|
if (card == NULL)
|
2009-02-28 03:43:04 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
snd_card_disconnect(card);
|
|
|
|
snd_card_free(card);
|
2009-02-28 04:49:46 +00:00
|
|
|
line6->card = NULL;
|
2009-02-28 03:43:04 +00:00
|
|
|
}
|