From patchwork Wed Mar 22 12:30:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 9638691 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 10A4460327 for ; Wed, 22 Mar 2017 12:40:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3CF028473 for ; Wed, 22 Mar 2017 12:40:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4AE128491; Wed, 22 Mar 2017 12:40:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 703B528473 for ; Wed, 22 Mar 2017 12:40:55 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6EE332673C8; Wed, 22 Mar 2017 13:30:44 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2148B2673C0; Wed, 22 Mar 2017 13:30:43 +0100 (CET) Received: from smtp-proxy004.phy.lolipop.jp (smtp-proxy004.phy.lolipop.jp [157.7.104.45]) by alsa0.perex.cz (Postfix) with ESMTP id 480D52673BC for ; Wed, 22 Mar 2017 13:30:39 +0100 (CET) Received: from smtp-proxy004.phy.lolipop.lan (HELO smtp-proxy004.phy.lolipop.jp) (172.19.44.45) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp-proxy004.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Wed, 22 Mar 2017 21:30:37 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp-proxy004.phy.lolipop.jp (LOLIPOP-Fsecure); Wed, 22 Mar 2017 21:30:28 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Wed, 22 Mar 2017 21:30:13 +0900 Message-Id: <20170322123028.24148-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170322123028.24148-1-o-takashi@sakamocchi.jp> References: <20170322123028.24148-1-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sf.net Subject: [alsa-devel] [PATCH 03/18] ALSA: firewire-motu: add a structure for model-dependent parameters. X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP MOTU FireWire series doesn't tell drivers their capabilities, thus the drivers should have and apply model-dependent parameters 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 --- sound/firewire/motu/motu.c | 10 +++++++--- sound/firewire/motu/motu.h | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/sound/firewire/motu/motu.c b/sound/firewire/motu/motu.c index bdd82dd..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); @@ -142,7 +145,7 @@ static void motu_bus_update(struct fw_unit *unit) snd_fw_schedule_registration(unit, &motu->dwork); } -#define SND_MOTU_DEV_ENTRY(model) \ +#define SND_MOTU_DEV_ENTRY(model, data) \ { \ .match_flags = IEEE1394_MATCH_VENDOR_ID | \ IEEE1394_MATCH_MODEL_ID | \ @@ -150,6 +153,7 @@ static void motu_bus_update(struct fw_unit *unit) .vendor_id = OUI_MOTU, \ .model_id = model, \ .specifier_id = OUI_MOTU, \ + .driver_data = (kernel_ulong_t)data, \ } static const struct ieee1394_device_id motu_id_table[] = { 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