From patchwork Fri Apr 25 13:44:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 4062801 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EBF2BBFF02 for ; Fri, 25 Apr 2014 13:58:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EC202039C for ; Fri, 25 Apr 2014 13:58:57 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E529F2039D for ; Fri, 25 Apr 2014 13:58:55 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id ADA7626567A; Fri, 25 Apr 2014 15:58:54 +0200 (CEST) Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id EDFE8265496; Fri, 25 Apr 2014 15:46:00 +0200 (CEST) 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 E4FAE2654BD; Fri, 25 Apr 2014 15:45:58 +0200 (CEST) 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 smtp310.phy.lolipop.jp (smtp310.phy.lolipop.jp [210.157.22.78]) by alsa0.perex.cz (Postfix) with ESMTP id 4473F26548D for ; Fri, 25 Apr 2014 15:45:44 +0200 (CEST) Received: from smtp310.phy.lolipop.lan (HELO smtp310.phy.lolipop.jp) (172.17.1.10) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp310.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Fri, 25 Apr 2014 22:45:43 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp310.phy.lolipop.jp (LOLIPOP-Fsecure); Fri, 25 Apr 2014 22:45:31 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de, perex@perex.cz Date: Fri, 25 Apr 2014 22:44:44 +0900 Message-Id: <1398433530-13136-4-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398433530-13136-1-git-send-email-o-takashi@sakamocchi.jp> References: <1398433530-13136-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, linux1394-devel@lists.sourceforge.net, ffado-devel@lists.sf.net Subject: [alsa-devel] [PATCH 03/49] firewire-lib: Add 'direction' member to 'amdtp_stream' 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 amdtp_stream structure to indicate its direction. This patch also adds 'direction' argument to amdtp_stream_init() function to determine its direction. The amdtp_stream_init() function is exported and used by firewire-speakers and dice so this patch also affects them. This patch just add them. Actual implementation will be done by followed patches. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp.c | 4 +++- sound/firewire/amdtp.h | 7 +++++++ sound/firewire/dice.c | 2 +- sound/firewire/speakers.c | 3 ++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c index 38013f9..95c5a15 100644 --- a/sound/firewire/amdtp.c +++ b/sound/firewire/amdtp.c @@ -53,12 +53,14 @@ static void pcm_period_tasklet(unsigned long data); * amdtp_stream_init - initialize an AMDTP stream structure * @s: the AMDTP stream to initialize * @unit: the target of the stream + * @dir: the direction of stream * @flags: the packet transmission method to use */ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, - enum cip_flags flags) + enum amdtp_stream_direction dir, enum cip_flags flags) { s->unit = fw_unit_get(unit); + s->direction = dir; s->flags = flags; s->context = ERR_PTR(-1); mutex_init(&s->mutex); diff --git a/sound/firewire/amdtp.h b/sound/firewire/amdtp.h index 60028c7..019134e 100644 --- a/sound/firewire/amdtp.h +++ b/sound/firewire/amdtp.h @@ -48,9 +48,15 @@ struct fw_unit; struct fw_iso_context; struct snd_pcm_substream; +enum amdtp_stream_direction { + AMDTP_OUT_STREAM = 0, + AMDTP_IN_STREAM +}; + struct amdtp_stream { struct fw_unit *unit; enum cip_flags flags; + enum amdtp_stream_direction direction; struct fw_iso_context *context; struct mutex mutex; @@ -85,6 +91,7 @@ struct amdtp_stream { }; int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, + enum amdtp_stream_direction dir, enum cip_flags flags); void amdtp_stream_destroy(struct amdtp_stream *s); diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c index ca12fcb..26b2158 100644 --- a/sound/firewire/dice.c +++ b/sound/firewire/dice.c @@ -1360,7 +1360,7 @@ static int dice_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) goto err_owner; dice->resources.channels_mask = 0x00000000ffffffffuLL; - err = amdtp_stream_init(&dice->stream, unit, + err = amdtp_stream_init(&dice->stream, unit, AMDTP_OUT_STREAM, CIP_BLOCKING | CIP_HI_DUALWIRE); if (err < 0) goto err_resources; diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c index 2096ad7..c07e7cd 100644 --- a/sound/firewire/speakers.c +++ b/sound/firewire/speakers.c @@ -683,7 +683,8 @@ static int fwspk_probe(struct fw_unit *unit, if (err < 0) goto err_unit; - err = amdtp_stream_init(&fwspk->stream, unit, CIP_NONBLOCKING); + err = amdtp_stream_init(&fwspk->stream, unit, AMDTP_OUT_STREAM, + CIP_NONBLOCKING); if (err < 0) goto err_connection;