From patchwork Fri Feb 6 16:16:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Cussins X-Patchwork-Id: 5793081 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 12D539F336 for ; Fri, 6 Feb 2015 16:19:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 379E220173 for ; Fri, 6 Feb 2015 16:19:28 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id F1C7020138 for ; Fri, 6 Feb 2015 16:19:26 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 32104265314; Fri, 6 Feb 2015 17:19:26 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 1A7A3265335; Fri, 6 Feb 2015 17:17:54 +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 AE3E726549C; Fri, 6 Feb 2015 17:17:52 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by alsa0.perex.cz (Postfix) with ESMTP id 95C5726532C for ; Fri, 6 Feb 2015 17:16:40 +0100 (CET) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 205DF20B53 for ; Fri, 6 Feb 2015 11:16:40 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Fri, 06 Feb 2015 11:16:40 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=eml.cc; h= x-sasl-enc:from:to:cc:subject:date:message-id:in-reply-to :references; s=mesmtp; bh=pguZFviOiIOJ5UbXTF/9/exXg7U=; b=GCcCQE UKH6jJfZw7KBa7oX6XmukGk10QeZfzuPjvImC/RoXFYlR0BuZ8JAwoV3aKevoKs5 Ld+ByD6xcz7Qrc6BeaZ9EYDSv9OZxKUOYTLqppTeyTUhDNvkgnK9lbn9FXrf2gtI 4hjHYs6jvR+nZGbV5qLKCk5osz4VUAaer6n8g= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:cc:subject:date :message-id:in-reply-to:references; s=smtpout; bh=pguZFviOiIOJ5U bXTF/9/exXg7U=; b=LcJx/CtKvF7bSjNh7RQqzdZ8wKrryOeYzw/60b3xaJXbI9 1OH0XTLpNs4k0I2NqbgIA1HQeOBtQgSQOVzhgBhEJaRr3DmOLJ9xLmw5yJcHmCnL xHOOU8j2U6h0cGVNZ48x8Azf4sA+eUpkZllETGEyFzHr4i71PGdPNqTWtJFl8= X-Sasl-enc: 3C2hp0W7RmcE8Ex3/aARM7H8a1ybZJ6LlkStVOoGQbo5 1423239399 Received: from PC816.linn.co.uk (unknown [195.59.102.251]) by mail.messagingengine.com (Postfix) with ESMTPA id 3056A68011D; Fri, 6 Feb 2015 11:16:39 -0500 (EST) From: Tim Cussins To: alsa-devel@alsa-project.org Date: Fri, 6 Feb 2015 16:16:27 +0000 Message-Id: <1423239388-17745-2-git-send-email-timcussins@eml.cc> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423239388-17745-1-git-send-email-timcussins@eml.cc> References: <1423239388-17745-1-git-send-email-timcussins@eml.cc> Cc: Tim Cussins Subject: [alsa-devel] [PATCH v3 kernel 2/3] Extend snd_pcm_ops and snd_pcm_runtime 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 snd_pcm_ops picks up methods for: - start_at - start_at_abort - start_at_gettime For startat requests involving audio hardware clocks, ALSA core delegates to the driver using these methods, should they exist. snd_pcm_runtime gains fields that contain the current state of the startat timer, if any. This allows cancellation and querying. Signed-off-by: Tim Cussins diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 07299b2..a414fec 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -73,6 +73,9 @@ struct snd_pcm_ops { snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); int (*wall_clock)(struct snd_pcm_substream *substream, struct timespec *audio_ts); + int (*start_at)(struct snd_pcm_substream *substream, int startat_clock_type, const struct timespec *ts); + int (*start_at_abort)(struct snd_pcm_substream *substream); + int (*start_at_gettime)(struct snd_pcm_substream *substream, int startat_clock_type, struct timespec *current_time); int (*copy)(struct snd_pcm_substream *substream, int channel, snd_pcm_uframes_t pos, void __user *buf, snd_pcm_uframes_t count); @@ -368,6 +371,12 @@ struct snd_pcm_runtime { #ifdef CONFIG_SND_PCM_XRUN_DEBUG struct snd_pcm_hwptr_log *hwptr_log; #endif + + bool startat_timer_running; + /* The following values are valid if startat_timer_running == true */ + int startat_clock_type; /* startat clock type of current timer */ + struct timespec startat_start_time; /* start time of current timer */ + void* startat_timer_data; /* data associated with current timer */ }; struct snd_pcm_group { /* keep linked substreams */