From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60D51C432C3 for ; Thu, 14 Nov 2019 17:11:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B131207DD for ; Thu, 14 Nov 2019 17:11:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbfKNRLC (ORCPT ); Thu, 14 Nov 2019 12:11:02 -0500 Received: from mx2.suse.de ([195.135.220.15]:52442 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726957AbfKNRLB (ORCPT ); Thu, 14 Nov 2019 12:11:01 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 48218AF10; Thu, 14 Nov 2019 17:10:59 +0000 (UTC) Date: Thu, 14 Nov 2019 18:10:57 +0100 Message-ID: From: Takashi Iwai To: Andrew Gabbasov Cc: , , "Jaroslav Kysela" , Takashi Iwai , Timo Wischer Subject: Re: [PATCH v3 0/7] ALSA: aloop: Support sound timer as clock source instead of jiffies In-Reply-To: <20191111110846.18223-1-andrew_gabbasov@mentor.com> References: <20191111110846.18223-1-andrew_gabbasov@mentor.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Nov 2019 12:08:39 +0100, Andrew Gabbasov wrote: > > This patch set is an updated version of patches by Timo Wischer: > https://mailman.alsa-project.org/pipermail/alsa-devel/2019-March/146871.html > > This patch set is required for forwarding audio data between a HW sound > card and an aloop device without the usage of an asynchronous sample rate > converter. > > Most of sound and timers related code is kept the same as in previous set. > The code, related to snd_pcm_link() functionality and its using for > timer source setting, is removed (as rejected earlier). The changes in this > update are mainly related to the parameters handling and some cleanup. > > The timer source can be initially selected by "timer_source" kernel module > parameter. It is supposed to have the following format: > [:](|)[{.,}[{.,}]] > For example: "hw:I82801AAICH.1.0", or "1.1", or just "I82801AAICH". > (Prefix is ignored, just allowed here to be able to use the strings, > the user got used to). > Although the parsing function recognizes both '.' and ',' as a separator, > module parameters handling routines use ',' to separate parameters for > different module instances (array elements), so we have to use '.' > to separate device and subdevice numbers from the card name or number > in module parameters. > Empty string indicates using jiffies as a timer source. > > Besides "static" selection of timer source at module load time, > it is possible to dynamically change it via sound "info" interface > (using "/proc/asound//timer_source" file in read-write mode. > The contents of this file is used as a timer source string for > a particular loopback card, e.g. "hw:0,0,0" (and here ',' can be used > as a separator). > > The timer source string value can be changed at any time, but it is > latched by PCM substream open callback "loopback_open()" (the first > one for a particular cable). At this point it is actually used, > that is the string is parsed, and the timer is looked up and opened. > This seems to be a good trade-off between flexibility of updates and > synchronizations or racing complexity. > > The timer source is set for a loopback card (the same as initial setting > by module parameter), but every cable uses the value, current at the moment > of opening. Theoretically, it's possible to set the timer source for each > cable independently (via separate files), but it would be inconsistent > with the initial setting via module parameters on a per-card basis. > > v2: > https://mailman.alsa-project.org/pipermail/alsa-devel/2019-November/157961.html > > v3: > - Change sound card lookup to use snd_card_ref() and avoid direct access > to sound cards array > - Squash commits on returning error codes for timer start and stop > - Some locking related fixes > - Some code cleanup The patch won't work with the latest ALSA timer code found in my for-next branch due to the API changes. Essentially you need to rewrite as: timeri = snd_timer_instance_new(...); if (!timeri) no_memory_error; timeri->flags |= ...; timeri->ccallback = ...; .... err = snd_timer_open(timeri, ....); if (err < 0) error; thanks, Takashi From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3A7BC432C3 for ; Thu, 14 Nov 2019 17:12:00 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 62BC4206CB for ; Thu, 14 Nov 2019 17:12:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Z4pn4pYT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62BC4206CB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A66E4839; Thu, 14 Nov 2019 18:11:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A66E4839 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1573751518; bh=ePtY2/EAKeBJK2hEFzjAdUOYqDVlTadIzp+YTz7kw4I=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Z4pn4pYTuWGNPJ7ruXylu8DkUKUCmTb5P91+E+ZXNy5GgKzp1xTfzpd2uzZuPypWT f9xZjazotzM4IRbFnu8RLMy6Aky7KxfPTvZRXfqkO7UBQjbISYAMXXyaVpV+g7lG6d rrHkwXaV5Ey/hC4LCX4oq3rfjqYnTSxFgxjVJIFo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 28A63F800CC; Thu, 14 Nov 2019 18:11:08 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D36A6F800CF; Thu, 14 Nov 2019 18:11:06 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5AAC3F800CC for ; Thu, 14 Nov 2019 18:10:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5AAC3F800CC X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 48218AF10; Thu, 14 Nov 2019 17:10:59 +0000 (UTC) Date: Thu, 14 Nov 2019 18:10:57 +0100 Message-ID: From: Takashi Iwai To: Andrew Gabbasov In-Reply-To: <20191111110846.18223-1-andrew_gabbasov@mentor.com> References: <20191111110846.18223-1-andrew_gabbasov@mentor.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Timo Wischer , alsa-devel@alsa-project.org, Takashi Iwai , linux-kernel@vger.kernel.org Subject: Re: [alsa-devel] [PATCH v3 0/7] ALSA: aloop: Support sound timer as clock source instead of jiffies X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Mon, 11 Nov 2019 12:08:39 +0100, Andrew Gabbasov wrote: > > This patch set is an updated version of patches by Timo Wischer: > https://mailman.alsa-project.org/pipermail/alsa-devel/2019-March/146871.html > > This patch set is required for forwarding audio data between a HW sound > card and an aloop device without the usage of an asynchronous sample rate > converter. > > Most of sound and timers related code is kept the same as in previous set. > The code, related to snd_pcm_link() functionality and its using for > timer source setting, is removed (as rejected earlier). The changes in this > update are mainly related to the parameters handling and some cleanup. > > The timer source can be initially selected by "timer_source" kernel module > parameter. It is supposed to have the following format: > [:](|)[{.,}[{.,}]] > For example: "hw:I82801AAICH.1.0", or "1.1", or just "I82801AAICH". > (Prefix is ignored, just allowed here to be able to use the strings, > the user got used to). > Although the parsing function recognizes both '.' and ',' as a separator, > module parameters handling routines use ',' to separate parameters for > different module instances (array elements), so we have to use '.' > to separate device and subdevice numbers from the card name or number > in module parameters. > Empty string indicates using jiffies as a timer source. > > Besides "static" selection of timer source at module load time, > it is possible to dynamically change it via sound "info" interface > (using "/proc/asound//timer_source" file in read-write mode. > The contents of this file is used as a timer source string for > a particular loopback card, e.g. "hw:0,0,0" (and here ',' can be used > as a separator). > > The timer source string value can be changed at any time, but it is > latched by PCM substream open callback "loopback_open()" (the first > one for a particular cable). At this point it is actually used, > that is the string is parsed, and the timer is looked up and opened. > This seems to be a good trade-off between flexibility of updates and > synchronizations or racing complexity. > > The timer source is set for a loopback card (the same as initial setting > by module parameter), but every cable uses the value, current at the moment > of opening. Theoretically, it's possible to set the timer source for each > cable independently (via separate files), but it would be inconsistent > with the initial setting via module parameters on a per-card basis. > > v2: > https://mailman.alsa-project.org/pipermail/alsa-devel/2019-November/157961.html > > v3: > - Change sound card lookup to use snd_card_ref() and avoid direct access > to sound cards array > - Squash commits on returning error codes for timer start and stop > - Some locking related fixes > - Some code cleanup The patch won't work with the latest ALSA timer code found in my for-next branch due to the API changes. Essentially you need to rewrite as: timeri = snd_timer_instance_new(...); if (!timeri) no_memory_error; timeri->flags |= ...; timeri->ccallback = ...; .... err = snd_timer_open(timeri, ....); if (err < 0) error; thanks, Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel