From patchwork Wed Mar 5 10:48:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 3772831 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 825929F1EE for ; Wed, 5 Mar 2014 10:57:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B563A20237 for ; Wed, 5 Mar 2014 10:57:11 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 78AE12021E for ; Wed, 5 Mar 2014 10:57:10 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2AF40265957; Wed, 5 Mar 2014 11:57:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 1A86C26595B; Wed, 5 Mar 2014 11:50:40 +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 E19012651A4; Wed, 5 Mar 2014 11:50:32 +0100 (CET) Received: from smtp311.phy.lolipop.jp (smtp311.phy.lolipop.jp [210.157.22.79]) by alsa0.perex.cz (Postfix) with ESMTP id C85372651AC for ; Wed, 5 Mar 2014 11:49:00 +0100 (CET) Received: from smtp311.phy.lolipop.lan (HELO smtp311.phy.lolipop.jp) (172.17.1.11) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp311.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Wed, 05 Mar 2014 19:49:00 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp311.phy.lolipop.jp (LOLIPOP-Fsecure); Wed, 05 Mar 2014 19:48:28 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de, perex@perex.cz Date: Wed, 5 Mar 2014 19:48:01 +0900 Message-Id: <1394016507-15761-14-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1394016507-15761-1-git-send-email-o-takashi@sakamocchi.jp> References: <5316963F.1000206@sakamocchi.jp> <1394016507-15761-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sf.net Subject: [alsa-devel] [PATCH 13/39] firewire-lib: Add 'direction' member to 'cmp_connection' structure 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 This patch adds 'direction' member to 'cmp_connection' structure to indicate the direction of connection. This patch also adds 'direction' argument to cmp_connection_init() function to determine the direction. The cmp_connection_init() function is exported and used in snd-firewire-speakers so this patch also affect it. This patch just add them. Actual implementation will be done by followed patches. --- sound/firewire/cmp.c | 3 ++- sound/firewire/cmp.h | 7 +++++++ sound/firewire/speakers.c | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sound/firewire/cmp.c b/sound/firewire/cmp.c index 17ad4f2..c7f7a31 100644 --- a/sound/firewire/cmp.c +++ b/sound/firewire/cmp.c @@ -94,6 +94,7 @@ static int pcr_modify(struct cmp_connection *c, */ int cmp_connection_init(struct cmp_connection *c, struct fw_unit *unit, + enum cmp_direction direction, unsigned int pcr_index) { __be32 mpr_be; @@ -153,7 +154,7 @@ static __be32 ipcr_set_modify(struct cmp_connection *c, __be32 ipcr) static int pcr_set_check(struct cmp_connection *c, __be32 pcr) { if (pcr & cpu_to_be32(PCR_BCAST_CONN | - PCR_P2P_CONN_MASK)) { + PCR_P2P_CONN_MASK)) { cmp_error(c, "plug is already in use\n"); return -EBUSY; } diff --git a/sound/firewire/cmp.h b/sound/firewire/cmp.h index 2320cd4..9b58448 100644 --- a/sound/firewire/cmp.h +++ b/sound/firewire/cmp.h @@ -7,6 +7,11 @@ struct fw_unit; +enum cmp_direction { + CMP_INPUT = 0, + CMP_OUTPUT, +}; + /** * struct cmp_connection - manages an isochronous connection to a device * @speed: the connection's actual speed @@ -26,10 +31,12 @@ struct cmp_connection { __be32 last_pcr_value; unsigned int pcr_index; unsigned int max_speed; + enum cmp_direction direction; }; int cmp_connection_init(struct cmp_connection *connection, struct fw_unit *unit, + enum cmp_direction direction, unsigned int pcr_index); void cmp_connection_destroy(struct cmp_connection *connection); diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c index c07e7cd..4a9b48b 100644 --- a/sound/firewire/speakers.c +++ b/sound/firewire/speakers.c @@ -679,7 +679,7 @@ static int fwspk_probe(struct fw_unit *unit, fwspk->unit = fw_unit_get(unit); fwspk->device_info = (const struct device_info *)id->driver_data; - err = cmp_connection_init(&fwspk->connection, unit, 0); + err = cmp_connection_init(&fwspk->connection, unit, CMP_INPUT, 0); if (err < 0) goto err_unit;