All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: clemens@ladisch.de
Cc: alsa-devel@alsa-project.org, Robin Gareus <robin@gareus.org>,
	Damien Zammit <damien@zamaudio.com>,
	ffado-devel@lists.sf.net
Subject: [RFC][PATCH 08/37] ALSA: firewire-digi00x: add skelton for Digi 002/003 family
Date: Sat, 11 Jul 2015 23:12:19 +0900	[thread overview]
Message-ID: <1436623968-10780-9-git-send-email-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <1436623968-10780-1-git-send-email-o-takashi@sakamocchi.jp>

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

Cc: Damien Zammit <damien@zamaudio.com>
Cc: Robin Gareus <robin@gareus.org>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/Kconfig           |  14 ++++
 sound/firewire/Makefile          |   1 +
 sound/firewire/digi00x/Makefile  |   2 +
 sound/firewire/digi00x/digi00x.c | 141 +++++++++++++++++++++++++++++++++++++++
 sound/firewire/digi00x/digi00x.h |  32 +++++++++
 5 files changed, 190 insertions(+)
 create mode 100644 sound/firewire/digi00x/Makefile
 create mode 100644 sound/firewire/digi00x/digi00x.c
 create mode 100644 sound/firewire/digi00x/digi00x.h

diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig
index 8850b7d..c6b8828 100644
--- a/sound/firewire/Kconfig
+++ b/sound/firewire/Kconfig
@@ -120,4 +120,18 @@ config SND_BEBOB
           To compile this driver as a module, choose M here: the module
           will be called snd-bebob.
 
+config SND_FIREWIRE_DIGI00X
+	tristate "Digidesign 002/003 family support"
+	select SND_FIREWIRE_LIB
+	help
+	 Say Y here to include support for Digidesign 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
diff --git a/sound/firewire/Makefile b/sound/firewire/Makefile
index 6a8a713..5325d15 100644
--- a/sound/firewire/Makefile
+++ b/sound/firewire/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_SND_ISIGHT) += snd-isight.o
 obj-$(CONFIG_SND_SCS1X) += snd-scs1x.o
 obj-$(CONFIG_SND_FIREWORKS) += fireworks/
 obj-$(CONFIG_SND_BEBOB) += bebob/
+obj-$(CONFIG_SND_FIREWIRE_DIGI00X) += digi00x/
diff --git a/sound/firewire/digi00x/Makefile b/sound/firewire/digi00x/Makefile
new file mode 100644
index 0000000..b5176b6
--- /dev/null
+++ b/sound/firewire/digi00x/Makefile
@@ -0,0 +1,2 @@
+snd-firewire-digi00x-objs := digi00x.o
+obj-m += snd-firewire-digi00x.o
diff --git a/sound/firewire/digi00x/digi00x.c b/sound/firewire/digi00x/digi00x.c
new file mode 100644
index 0000000..2bdf987
--- /dev/null
+++ b/sound/firewire/digi00x/digi00x.c
@@ -0,0 +1,141 @@
+/*
+ * 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 002/003 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 = name;
+	if (model[0] == ' ')
+		model = strchr(model, ' ') + 1;
+
+	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);
diff --git a/sound/firewire/digi00x/digi00x.h b/sound/firewire/digi00x/digi00x.h
new file mode 100644
index 0000000..0bb2ca3
--- /dev/null
+++ b/sound/firewire/digi00x/digi00x.h
@@ -0,0 +1,32 @@
+/*
+ * 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
-- 
2.1.4

  parent reply	other threads:[~2015-07-11 14:13 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-11 14:12 [RFC][PATCH 00/37] ALSA: firewire: support AMDTP variants Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 01/37] ALSA: firewire-lib: rename 'amdtp' to 'amdtp-stream' for functional separation Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 02/37] ALSA: firewire-lib: functional separation between packet stream and data block format Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 03/37] ALSA: firewire-lib: add helper functions for asynchronous MIDI port Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 04/37] ALSA: firewire-lib: serialize request transaction and response transaction Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 05/37] ALSA: firewire-lib: schedule tasklet again when MIDI substream has rest of MIDI messages Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 06/37] ALSA: firewire-lib: add throttle for MIDI data rate Takashi Sakamoto
2015-07-12  8:31   ` [FFADO-devel] " Jonathan Woithe
2015-07-11 14:12 ` [RFC][PATCH 07/37] ALSA: firewire-lib: avoid endless loop to transfer MIDI messages at fatal error Takashi Sakamoto
2015-07-11 14:12 ` Takashi Sakamoto [this message]
2015-07-11 14:12 ` [RFC][PATCH 09/37] ALSA: firewire-digi00x: add protocol layer Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 10/37] ALSA: firewire-digi00x: add stream functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 11/37] ALSA: firewire-digi00x: add proc node to show clock status Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 12/37] ALSA: firewire-digi00x: add PCM functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 13/37] ALSA: firewire-digi00x: add MIDI functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 14/37] ALSA: firewire-digi00x: add hwdep interface Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 15/37] ALSA: firewire-digi00x: add support for asynchronous messaging Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 16/37] ALSA: firewire-digi00x: add support for MIDI ports for machine control Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 17/37] ALSA: firewire-tascam: add skeleton for TASCAM FireWire series Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 18/37] ALSA: firewire-tascam: add a structure for model-dependent parameters Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 19/37] ALSA: firewire-tascam: add proc node to show firmware information Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 20/37] ALSA: firewire-tascam: add specific protocol layer Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 21/37] ALSA: firewire-tascam: add streaming functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 22/37] ALSA: firewire-tascam: add PCM functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 23/37] ALSA: firewire-tascam: add transaction functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 24/37] ALSA: firewire-tascam: add MIDI functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 25/37] ALSA: firewire-tascam: add hwdep interface Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 26/37] ALSA: firewire-tascam: add MMAP support to show status and control message Takashi Sakamoto
2015-07-20 14:23   ` Takashi Iwai
2015-07-22 14:53     ` Takashi Sakamoto
2015-07-21 14:06   ` Clemens Ladisch
2015-07-22 15:19     ` Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 27/37] ALSA: firewire-lib: add support for source packet header field in CIP header Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 28/37] ALSA: firewire-lib: enable protocol layer to handle current cycle count Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 29/37] ALSA: firewire-motu: add skeleton for Mark of the unicorn (MOTU) FireWire series Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 30/37] ALSA: firewire-motu: add a structure for model-dependent parameters Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 31/37] ALSA: firewire-motu: add MOTU specific protocol layer Takashi Sakamoto
2015-07-12  1:05   ` [FFADO-devel] " Jonathan Woithe
2015-07-15 16:10     ` Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 32/37] ALSA: firewire-motu: add stream functionality Takashi Sakamoto
2015-07-13 11:09   ` [FFADO-devel] " Jonathan Woithe
2015-07-13 11:23   ` Jonathan Woithe
2015-07-11 14:12 ` [RFC][PATCH 33/37] ALSA: firewire-motu: add transaction functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 34/37] ALSA: firewire-motu: add proc node to show the status of internal clock Takashi Sakamoto
2015-07-13 11:28   ` [FFADO-devel] " Jonathan Woithe
2015-07-11 14:12 ` [RFC][PATCH 35/37] ALSA: firewire-motu: add PCM functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 36/37] ALSA: firewire-motu: add MIDI functionality Takashi Sakamoto
2015-07-11 14:12 ` [RFC][PATCH 37/37] ALSA: firewire-motu: add hwdep interface Takashi Sakamoto
2015-07-13 10:58   ` [FFADO-devel] " Jonathan Woithe
2015-07-11 14:33 ` [RFC][PATCH 00/37] ALSA: firewire: support AMDTP variants Takashi Sakamoto
2015-07-12  8:46 ` [FFADO-devel] " Jonathan Woithe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436623968-10780-9-git-send-email-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=damien@zamaudio.com \
    --cc=ffado-devel@lists.sf.net \
    --cc=robin@gareus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.