All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: clemens@ladisch.de, tiwai@suse.de
Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sf.net
Subject: [PATCH 03/19] firewire-motu: add a structure for model-dependent parameters.
Date: Sun, 29 Jan 2017 12:54:01 +0900	[thread overview]
Message-ID: <20170129035417.2095-4-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <20170129035417.2095-1-o-takashi@sakamocchi.jp>

MOTU FireWire series doesn't tell drivers their capabilities, thus
the drivers should have model-dependent parameters and apply it to
detected models.

This commit adds a structure to represent such parameters. Capabilities
are represented by enumeration except for the number of analog line
in/out. Identification name also be in the structure because the units has
no registers for this purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/motu/motu.c |  7 +++++--
 sound/firewire/motu/motu.h | 23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/sound/firewire/motu/motu.c b/sound/firewire/motu/motu.c
index d6ce4f3..e69aa7b 100644
--- a/sound/firewire/motu/motu.c
+++ b/sound/firewire/motu/motu.c
@@ -31,9 +31,11 @@ static void name_card(struct snd_motu *motu)
 	}
 
 	strcpy(motu->card->driver, "FW-MOTU");
+	strcpy(motu->card->shortname, motu->spec->name);
+	strcpy(motu->card->mixername, motu->spec->name);
 	snprintf(motu->card->longname, sizeof(motu->card->longname),
-		 "MOTU (version:%d), GUID %08x%08x at %s, S%d",
-		 version,
+		 "MOTU %s (version:%d), GUID %08x%08x at %s, S%d",
+		 motu->spec->name, version,
 		 fw_dev->config_rom[3], fw_dev->config_rom[4],
 		 dev_name(&motu->unit->device), 100 << fw_dev->max_speed);
 }
@@ -101,6 +103,7 @@ static int motu_probe(struct fw_unit *unit,
 	if (motu == NULL)
 		return -ENOMEM;
 
+	motu->spec = (const struct snd_motu_spec *)entry->driver_data;
 	motu->unit = fw_unit_get(unit);
 	dev_set_drvdata(&unit->device, motu);
 
diff --git a/sound/firewire/motu/motu.h b/sound/firewire/motu/motu.h
index eb0ffd5..cb7324d 100644
--- a/sound/firewire/motu/motu.h
+++ b/sound/firewire/motu/motu.h
@@ -29,6 +29,29 @@ struct snd_motu {
 
 	bool registered;
 	struct delayed_work dwork;
+
+	/* Model dependent information. */
+	const struct snd_motu_spec *spec;
+};
+
+enum snd_motu_spec_flags {
+	SND_MOTU_SPEC_SUPPORT_CLOCK_X2	= 0x0001,
+	SND_MOTU_SPEC_SUPPORT_CLOCK_X4	= 0x0002,
+	SND_MOTU_SPEC_TX_MICINST_CHUNK	= 0x0004,
+	SND_MOTU_SPEC_TX_RETURN_CHUNK	= 0x0008,
+	SND_MOTU_SPEC_TX_REVERB_CHUNK	= 0x0010,
+	SND_MOTU_SPEC_TX_AESEBU_CHUNK	= 0x0020,
+	SND_MOTU_SPEC_HAS_OPT_IFACE_A	= 0x0040,
+	SND_MOTU_SPEC_HAS_OPT_IFACE_B	= 0x0080,
+	SND_MOTU_SPEC_HAS_MIDI		= 0x0100,
+};
+
+struct snd_motu_spec {
+	const char *const name;
+	enum snd_motu_spec_flags flags;
+
+	unsigned char analog_in_ports;
+	unsigned char analog_out_ports;
 };
 
 #endif
-- 
2.9.3

  parent reply	other threads:[~2017-01-29  3:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-29  3:53 [PATCH 00/19][RFC v2] ALSA: firewire-motu: new driver for MOTU FireWire series Takashi Sakamoto
2017-01-29  3:53 ` [PATCH 01/19] firewire-motu: add skeleton for Mark of the unicorn (MOTU) " Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 02/19] firewire-motu: postpone sound card registration Takashi Sakamoto
2017-01-29  3:54 ` Takashi Sakamoto [this message]
2017-01-29  3:54 ` [PATCH 04/19] firewire-motu: add an abstraction layer for three types of protocols Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 05/19] firewire-lib: record cycle count for the first packet Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 06/19] firewire-lib: add support for source packet header field in CIP header Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 07/19] firewire-lib: enable CIP_DBC_IS_END_EVENT for both directions of stream Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 08/19] firewire-motu: add MOTU specific protocol layer Takashi Sakamoto
2017-01-29 13:16   ` [FFADO-devel] " Jonathan Woithe
2017-01-30  3:50     ` Takashi Sakamoto
2017-01-30  5:04       ` Jonathan Woithe
2017-01-30  6:11         ` Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 09/19] firewire-motu: handle transactions specific for MOTU FireWire models Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 10/19] firewire-motu: add stream management functionality Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 11/19] firewire-motu: add proc node to show current statuc of clock and packet formats Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 12/19] firewire-motu: add PCM functionality Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 13/19] firewire-motu: add MIDI functionality Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 14/19] firewire-motu: add hwdep interface Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 15/19] firewire-motu: enable to read transaction cache via " Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 16/19] firewire-motu: add support for MOTU 828 as a model with protocol version 1 Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 17/19] firewire-motu: add support for MOTU 828mk2 as a model with protocol version 2 Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 18/19] firewire-lib: add a quirk of packet without valid EOH in CIP format Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 19/19] firewire-motu: add support for MOTU 828mk3 (FireWire/Hybrid) as a model with protocol version 3 Takashi Sakamoto
2017-01-29 13:22 ` [FFADO-devel] [PATCH 00/19][RFC v2] ALSA: firewire-motu: new driver for MOTU FireWire series Jonathan Woithe
2017-01-30  3:09   ` Takashi Sakamoto
2017-01-29 13:34 ` [FFADO-devel] " Jonathan Woithe
2017-01-30  3:17   ` Takashi Sakamoto

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=20170129035417.2095-4-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=ffado-devel@lists.sf.net \
    --cc=tiwai@suse.de \
    /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.