From: Takashi Iwai Subject: Re: [PATCH] alsa-lib: Provide a CLOCK_MONOTONIC_RAW timestamp type Date: Thu, 10 Jul 2014 12:22:36 +0200 Message-ID: References: <1404831152-8064-1-git-send-email-broonie@kernel.org> <53BD9A92.6090806@ladisch.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id E2C37261A40 for ; Thu, 10 Jul 2014 12:22:36 +0200 (CEST) In-Reply-To: <53BD9A92.6090806@ladisch.de> 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 To: Clemens Ladisch Cc: alsa-devel@alsa-project.org, Mark Brown , Daniel Thompson , Mark Brown List-Id: alsa-devel@alsa-project.org At Wed, 09 Jul 2014 21:40:02 +0200, Clemens Ladisch wrote: > > Takashi Iwai wrote: > > Currently, the timestamp mode is set implicitly in alsa-lib pcm_hw.c: > > - When kernel PCM protocol version is high enough, alsa-lib hw prefers > > the monotonic always (if available), then set pcm->monotonic = 1. > > - Application can ask whether the current timestamp is monotonic or > > not via snd_pcm_hw_params_is_monotonic(). > > So, only adding the flag above doesn't suffice. If we need to add a > > new mode, the API has to be extended as well. > > > > But how? The current API assumes that the monotonic mode was already > > determined before hw_params. We may add a set of new hw_params get > > and set calls for tstamp mode while keeping the old API. This would > > be one option. Another option would be to add a new PCM open flag > > SND_PCM_TSTAMP_MONOTONIC_RAW, and snd_pcm_hw_params_is_monotonic_raw() > > function. The latter is easier (a simpler addition), while the former > > is more extensible to newer formats in future. > > These timestamps cannot be handled by hardware drivers; they are always > read by the ALSA framework, in software. Furthermore, switching between > MONOTONIC and MONOTONIC_RAW is possible at any time. Therefore, the > timestamp mode should be made a part of sw_params; just add a field > named tstamp_mode ... Sounds reasonable. I'll respin the kernel patches as well. Takashi