From patchwork Fri Nov 23 04:13:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 10695029 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 9C0655A4 for ; Fri, 23 Nov 2018 04:13:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89AED2BCD8 for ; Fri, 23 Nov 2018 04:13:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CE5D2BD0A; Fri, 23 Nov 2018 04:13:55 +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 D1FF42BCD8 for ; Fri, 23 Nov 2018 04:13:54 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 28804267A80; Fri, 23 Nov 2018 05:13:41 +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 4A516267A72; Fri, 23 Nov 2018 05:13:38 +0100 (CET) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by alsa0.perex.cz (Postfix) with ESMTP id D6E71267865 for ; Fri, 23 Nov 2018 05:13:35 +0100 (CET) Received: by mail-pg1-f195.google.com with SMTP id z10so2504095pgp.7 for ; Thu, 22 Nov 2018 20:13:35 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=UVPZYJxiAi2usovOvc9eTE7LO9iav0k1hS0g4TIruJs=; b=DUUZLzdDWRToNNAHnK3v5W/vCCs452PKWkm8SINhG/06QS+fTO4oQs90HJHyW79AK6 yb/YLd9hDoGIybD8ZWgDJwXvk/7ndrxOI5trQogasBC7cFg/r2HfeR1fCE0D8P5euKhQ 01UGd08ZNM1H33MTT+QSwMLd1bg8glf2CcepFJ6JS0UtdFkUo+t76Gk2cJEVI0kg0ywW s1xHj4noHFQ36JufHdNJfTziFX8KVBXbRxhY5w/Rb1YQXIcpXohmyGZC2wRrc9V8mBhA i0GQe9fC13TTEncPRkXLFz1Th3t4mctIfwV55ERdxMhX6UbHlcjXRWrWSa08+yJpsIQ9 vvVA== X-Gm-Message-State: AA+aEWY1l9whDk8Lv4VTpkpdFxMGccz3WuJZmRp9QkX9HI1z6IKV3dKS AV0JEwVWrWBOKhcPrHJvpu0= X-Google-Smtp-Source: AFSGD/VU8q7XWLA1wUl3QBIyxpjXQTmCdhsQN9lF8S2HvMlckMxdki+EbyLtjcVMUuviz4wLECmQNQ== X-Received: by 2002:a63:e20a:: with SMTP id q10mr12236312pgh.206.1542946414809; Thu, 22 Nov 2018 20:13:34 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 20:13:34 -0800 (PST) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Fri, 23 Nov 2018 13:13:04 +0900 Message-Id: <20181123041307.22980-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123041307.22980-1-o-takashi@sakamocchi.jp> References: <20181123041307.22980-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: sbahling@suse.com, alsa-devel@alsa-project.org, ffado-devel@lists.sourceforge.net Subject: [alsa-devel] [PATCH 2/5] ALSA: firewire-tascam: add new hwdep ioctl command to get state image 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 In a previous commit, ALSA firewire-tascam driver stores state image from tx isochronous packets. This image includes states of knob, fader, button of control surface, level of gain/volume of each physical inputs/outputs, and so on. It's useful for userspace applications to read whole of the image. This commit adds a unique ioctl command for ALSA hwdep interface for the purpose. For actual meaning of each bits in this image, please refer to discussion in alsa-devel[1]. [1] http://mailman.alsa-project.org/pipermail/alsa-devel/2018-October/140785.html Signed-off-by: Takashi Sakamoto --- include/uapi/sound/firewire.h | 5 +++++ sound/firewire/tascam/tascam-hwdep.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/uapi/sound/firewire.h b/include/uapi/sound/firewire.h index b9bc4bb1756b..012f81bf4750 100644 --- a/include/uapi/sound/firewire.h +++ b/include/uapi/sound/firewire.h @@ -66,6 +66,7 @@ union snd_firewire_event { #define SNDRV_FIREWIRE_IOCTL_GET_INFO _IOR('H', 0xf8, struct snd_firewire_get_info) #define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9) #define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa) +#define SNDRV_FIREWIRE_IOCTL_TASCAM_STATE _IOR('H', 0xfb, struct snd_firewire_tascam_state) #define SNDRV_FIREWIRE_TYPE_DICE 1 #define SNDRV_FIREWIRE_TYPE_FIREWORKS 2 @@ -90,4 +91,8 @@ struct snd_firewire_get_info { #define SNDRV_FIREWIRE_TASCAM_STATE_COUNT 64 +struct snd_firewire_tascam_state { + __be32 data[SNDRV_FIREWIRE_TASCAM_STATE_COUNT]; +}; + #endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */ diff --git a/sound/firewire/tascam/tascam-hwdep.c b/sound/firewire/tascam/tascam-hwdep.c index 4e4c1e9020e8..a80397116c48 100644 --- a/sound/firewire/tascam/tascam-hwdep.c +++ b/sound/firewire/tascam/tascam-hwdep.c @@ -123,6 +123,14 @@ static int hwdep_unlock(struct snd_tscm *tscm) return err; } +static int tscm_hwdep_state(struct snd_tscm *tscm, void __user *arg) +{ + if (copy_to_user(arg, tscm->state, sizeof(tscm->state))) + return -EFAULT; + + return 0; +} + static int hwdep_release(struct snd_hwdep *hwdep, struct file *file) { struct snd_tscm *tscm = hwdep->private_data; @@ -147,6 +155,8 @@ static int hwdep_ioctl(struct snd_hwdep *hwdep, struct file *file, return hwdep_lock(tscm); case SNDRV_FIREWIRE_IOCTL_UNLOCK: return hwdep_unlock(tscm); + case SNDRV_FIREWIRE_IOCTL_TASCAM_STATE: + return tscm_hwdep_state(tscm, (void __user *)arg); default: return -ENOIOCTLCMD; }