From patchwork Fri Nov 23 04:13:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 10695025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1A525A4 for ; Fri, 23 Nov 2018 04:13:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E2602BCD8 for ; Fri, 23 Nov 2018 04:13:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CD352BD0A; Fri, 23 Nov 2018 04:13:44 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 DF9BE2BCD8 for ; Fri, 23 Nov 2018 04:13:39 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id CA809267961; Fri, 23 Nov 2018 05:13:37 +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 2B0CF267972; Fri, 23 Nov 2018 05:13:35 +0100 (CET) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by alsa0.perex.cz (Postfix) with ESMTP id 3D140267865 for ; Fri, 23 Nov 2018 05:13:31 +0100 (CET) Received: by mail-pf1-f175.google.com with SMTP id b7so2750454pfi.8 for ; Thu, 22 Nov 2018 20:13:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jXVHKp9wa4ZHSTd6/zVbUPrrnYR+rdeW+gH1+vE/MFs=; b=E/UtabFGyQJLrgDuvH6i2y7wrauX4O1XJlmst5dkekLjebv6xoj4ZnTzm2k8RxCZdc TzeIwqch/zdq8FXv6SERS3l6Xv6tt8P3Ox2//9FyPR+VQnwDV1dV4smWN2AjcjLegJ+Z a+HgHaJNhIeP7+COx4LlkQcwuhsp6S04067hORpAUAKD7HTN+3gkC5WeKiP0rudFVfMP zSVNXi+BZR8nDVOOlV+M6cG/6KNzsJDh3XAAxhYfcItvC2lbwi7e2reqb6fvDrnhgLQf heXW00dqGRvNkyaFTQDxLS8AdY9fBizIOaoApHUVO7Bnc55c0BlWpUE3CarOvMR/6fm/ 6ahQ== X-Gm-Message-State: AA+aEWZq1jeoLdgFR08ritbIG4ulQUY5AGyKJUPI2qfaJScRvymnfirM OPmZTQloqd4JNLsvn3vj83k= X-Google-Smtp-Source: AFSGD/XBrbGWg9zwy5oQuOtFa8L99zGfOkdeBurogCVue+h2ElBKX7c59iaXzZNhPoR5CP+0bBP9dg== X-Received: by 2002:a63:f844:: with SMTP id v4mr12478554pgj.82.1542946410722; Thu, 22 Nov 2018 20:13:30 -0800 (PST) Received: from localhost.localdomain ([2405:6580:9660:3200:4919:eeb8:ecba:c7a8]) by smtp.gmail.com with ESMTPSA id r83sm82199559pfc.115.2018.11.22.20.13.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 20:13:29 -0800 (PST) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Fri, 23 Nov 2018 13:13:02 +0900 Message-Id: <20181123041307.22980-1-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Cc: sbahling@suse.com, alsa-devel@alsa-project.org, ffado-devel@lists.sourceforge.net Subject: [alsa-devel] [PATCH 0/5] ALSA: firewire-tascam: support notification of 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, Units of TASCAM FireWire series transfer its state in tx isochronous packets. The way to handle change of the state is a longstanding issue since I firstly reveal the mechanism in this list[1]. In this time, Scott Bahling dedicates for further investigation to seek better implementation[2][3][4]. Finally, we identified meaning of the most of bits in the image of state, and decided which changes are worth for userspace applications to handle as events. This commit adds support notification of the events. Userspace applications can handle the notification via ALSA hwdep interface. Furthermore, they can retrieve image of the latest states via the interface. Changes from the initial proposal[5]: - obsolete usage of mmap(2) due to several disadvantages. Instead, use event queue for change notification, and add ioctl command to retrieve image of states. Changes from the latest work[6]: - To reduce time in an interrupt context in which tx isochronous packets are handled, data in the event and the image is passed to userspace in big-endian order. Additionally, image of the states are passed to userspace in big-endian order as well. Userspace applications are responsible to convert the data in host-endianness order. - improve efficiency to copy batch of events to userspace in hwdep interface - rename structure and macro name. This patchset is also available in my remote branch for backport purpose to Linux v4.17 or later[7]. I've already prepare userspace implementation; libhinwa. A 'topic/firewire-tascam-pr' remote branch includes patchset for the additional feature[8]. This library produces GObject class to handle the event notification and emits GObject signal, and has a method 'HinawaSndTscm.get_state()', with enough consideration to endianness. Developers can process change of state with these two APIs. > Scott As the above, I changed method name from 'HinawaSndTscm.get_status()'. I'd like you to change your local implementation for 'hinawa-utils'. Sorry to add further work to you. [1] http://mailman.alsa-project.org/pipermail/alsa-devel/2015-July/094817.html [2] http://mailman.alsa-project.org/pipermail/alsa-devel/2018-September/140051.html [3] http://mailman.alsa-project.org/pipermail/alsa-devel/2018-October/140593.html [4] http://mailman.alsa-project.org/pipermail/alsa-devel/2018-November/141395.html [5] https://github.com/takaswie/snd-firewire-improve/tree/topic/tascam-userspace [6] https://github.com/takaswie/snd-firewire-improve/tree/topic/tascam-userspace-take3 [7] https://github.com/takaswie/snd-firewire-improve/tree/topic/tascam-userspace-pr [8] https://github.com/takaswie/libhinawa/tree/topic/tascam-userspace-pr Regards Takashi Sakamoto (5): ALSA: firewire-tascam: pick up data of state from tx isochronous pakcets ALSA: firewire-tascam: add new hwdep ioctl command to get state image ALSA: firewire-tascam: queue events for change of control surface ALSA: firewire-tascam: apply small refactoring to handle several type of event for hwdep interface ALSA: firewire-tascam: notify events of change of state for userspace applications include/uapi/sound/firewire.h | 20 +++++ sound/firewire/tascam/amdtp-tascam.c | 51 +++++++++++- sound/firewire/tascam/tascam-hwdep.c | 115 +++++++++++++++++++++++---- sound/firewire/tascam/tascam.h | 9 +++ 4 files changed, 180 insertions(+), 15 deletions(-)