Commit 9edf723f authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: firewire-digi00x: add skeleton for Digi 002/003 family

This commit adds a new driver for Digidesign 002/003 family. This commit
just creates/removes card instance according to bus event. More functions
will be added in following commits.

Digidesign 002/003 family consists of:
 * Agere FW802B for IEEE 1394 PHY layer
 * PDI 1394L40 for IEEE 1394 LINK layer and IEC 61883 interface
 * ALTERA ACEX EP1K50 for IEC 61883 layer and DSP controller
 * ADSP-21065L for signal processing

[minor cleanup using skip_spaces() by tiwai]
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3c95e0c5
...@@ -120,4 +120,18 @@ config SND_BEBOB ...@@ -120,4 +120,18 @@ config SND_BEBOB
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called snd-bebob. will be called snd-bebob.
config SND_FIREWIRE_DIGI00X
tristate "Digidesign Digi 002/003 family support"
select SND_FIREWIRE_LIB
help
Say Y here to include support for Digidesign Digi 002/003 family.
* Digi 002 Console
* Digi 002 Rack
* Digi 003 Console
* Digi 003 Rack
* Digi 003 Rack+
To compile this driver as a module, choose M here: the module
will be called snd-firewire-digi00x.
endif # SND_FIREWIRE endif # SND_FIREWIRE
...@@ -11,3 +11,4 @@ obj-$(CONFIG_SND_ISIGHT) += snd-isight.o ...@@ -11,3 +11,4 @@ obj-$(CONFIG_SND_ISIGHT) += snd-isight.o
obj-$(CONFIG_SND_SCS1X) += snd-scs1x.o obj-$(CONFIG_SND_SCS1X) += snd-scs1x.o
obj-$(CONFIG_SND_FIREWORKS) += fireworks/ obj-$(CONFIG_SND_FIREWORKS) += fireworks/
obj-$(CONFIG_SND_BEBOB) += bebob/ obj-$(CONFIG_SND_BEBOB) += bebob/
obj-$(CONFIG_SND_FIREWIRE_DIGI00X) += digi00x/
snd-firewire-digi00x-objs := digi00x.o
obj-$(CONFIG_SND_FIREWIRE_DIGI00X) += snd-firewire-digi00x.o
/*
* digi00x.c - a part of driver for Digidesign Digi 002/003 family
*
* Copyright (c) 2014-2015 Takashi Sakamoto
*
* Licensed under the terms of the GNU General Public License, version 2.
*/
#include "digi00x.h"
MODULE_DESCRIPTION("Digidesign Digi 002/003 family Driver");
MODULE_AUTHOR("Takashi Sakamoto <o-takashi@sakamocchi.jp>");
MODULE_LICENSE("GPL v2");
#define VENDOR_DIGIDESIGN 0x00a07e
#define MODEL_DIGI00X 0x000002
static int name_card(struct snd_dg00x *dg00x)
{
struct fw_device *fw_dev = fw_parent_device(dg00x->unit);
char name[32] = {0};
char *model;
int err;
err = fw_csr_string(dg00x->unit->directory, CSR_MODEL, name,
sizeof(name));
if (err < 0)
return err;
model = skip_spaces(name);
strcpy(dg00x->card->driver, "Digi00x");
strcpy(dg00x->card->shortname, model);
strcpy(dg00x->card->mixername, model);
snprintf(dg00x->card->longname, sizeof(dg00x->card->longname),
"Digidesign %s, GUID %08x%08x at %s, S%d", model,
cpu_to_be32(fw_dev->config_rom[3]),
cpu_to_be32(fw_dev->config_rom[4]),
dev_name(&dg00x->unit->device), 100 << fw_dev->max_speed);
return 0;
}
static void dg00x_card_free(struct snd_card *card)
{
struct snd_dg00x *dg00x = card->private_data;
fw_unit_put(dg00x->unit);
mutex_destroy(&dg00x->mutex);
}
static int snd_dg00x_probe(struct fw_unit *unit,
const struct ieee1394_device_id *entry)
{
struct snd_card *card;
struct snd_dg00x *dg00x;
int err;
/* create card */
err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE,
sizeof(struct snd_dg00x), &card);
if (err < 0)
return err;
card->private_free = dg00x_card_free;
/* initialize myself */
dg00x = card->private_data;
dg00x->card = card;
dg00x->unit = fw_unit_get(unit);
mutex_init(&dg00x->mutex);
err = name_card(dg00x);
if (err < 0)
goto error;
err = snd_card_register(card);
if (err < 0)
goto error;
dev_set_drvdata(&unit->device, dg00x);
return err;
error:
snd_card_free(card);
return err;
}
static void snd_dg00x_update(struct fw_unit *unit)
{
return;
}
static void snd_dg00x_remove(struct fw_unit *unit)
{
struct snd_dg00x *dg00x = dev_get_drvdata(&unit->device);
/* No need to wait for releasing card object in this context. */
snd_card_free_when_closed(dg00x->card);
}
static const struct ieee1394_device_id snd_dg00x_id_table[] = {
/* Both of 002/003 use the same ID. */
{
.match_flags = IEEE1394_MATCH_VENDOR_ID |
IEEE1394_MATCH_MODEL_ID,
.vendor_id = VENDOR_DIGIDESIGN,
.model_id = MODEL_DIGI00X,
},
{}
};
MODULE_DEVICE_TABLE(ieee1394, snd_dg00x_id_table);
static struct fw_driver dg00x_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "snd-firewire-digi00x",
.bus = &fw_bus_type,
},
.probe = snd_dg00x_probe,
.update = snd_dg00x_update,
.remove = snd_dg00x_remove,
.id_table = snd_dg00x_id_table,
};
static int __init snd_dg00x_init(void)
{
return driver_register(&dg00x_driver.driver);
}
static void __exit snd_dg00x_exit(void)
{
driver_unregister(&dg00x_driver.driver);
}
module_init(snd_dg00x_init);
module_exit(snd_dg00x_exit);
/*
* digi00x.h - a part of driver for Digidesign Digi 002/003 family
*
* Copyright (c) 2014-2015 Takashi Sakamoto
*
* Licensed under the terms of the GNU General Public License, version 2.
*/
#ifndef SOUND_DIGI00X_H_INCLUDED
#define SOUND_DIGI00X_H_INCLUDED
#include <linux/compat.h>
#include <linux/device.h>
#include <linux/firewire.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/initval.h>
#include "../lib.h"
struct snd_dg00x {
struct snd_card *card;
struct fw_unit *unit;
struct mutex mutex;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment