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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 7EE3DC47089 for ; Sun, 30 May 2021 07:33:34 +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 2D56161108 for ; Sun, 30 May 2021 07:33:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D56161108 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 699E116AA; Sun, 30 May 2021 09:32:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 699E116AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1622360011; bh=Kh+a/HZqA2mPfESdkgNUDOX+ISgLBcLfpDRu6Bdl1lk=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FlHHNFQAAOV4S137dhRZN+q9ePEtmddWofYQWcwudpbP+Xe3KTheAKQw00OCCr1uo MOmdKi7bLpSaDLGXJNGwmMuW/Rr5yOQm/LPs4xHP6bWbqG1HwwH86jHZjE2gM9JjiE bJEzXcFUU8aMAdz21KRfij8JYxAAjnYN0w9/tj4M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 13659F8025B; Sun, 30 May 2021 09:32:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 95D86F80269; Sun, 30 May 2021 09:32:37 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 88D88F80109 for ; Sun, 30 May 2021 09:32:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 88D88F80109 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="rnKvKoUS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="nN3XlOos" X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622359950; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5/2b6fq5fT3YdDXha8+cbdJP5OhWthdgw2+XvU/gq5U=; b=rnKvKoUSGxQVmiGOdDd0IExOcOoRom5ijILFvsyvB2c6X7xmxi5YUu9+LE/76Wu+vVh1JF a/UAYI0dTmqfW+KDYgGDAEiHJFt/S/i7WNZwzHnEL2paRbUWFZfkvSvZ6oi1ecVRHBcJyT hW8ah7gaW+uQL8uqV+rjbRI9mRprtBU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622359950; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5/2b6fq5fT3YdDXha8+cbdJP5OhWthdgw2+XvU/gq5U=; b=nN3XlOosHmS8JK+V6xi0gt9WI3GZTjNrkYkxr0XWDoYIcxIMWRZ1SwlcZDpPh8mvwD6Ngn MPGBae0N6MIunHBA== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C61A7ACF6; Sun, 30 May 2021 07:32:30 +0000 (UTC) Date: Sun, 30 May 2021 09:32:29 +0200 Message-ID: From: Takashi Iwai To: Takashi Sakamoto Subject: Re: [PATCH] ALSA: pcm: comment about relation between msbits hw parameter and [S|U32] formats In-Reply-To: <20210529033353.21641-1-o-takashi@sakamocchi.jp> References: <20210529033353.21641-1-o-takashi@sakamocchi.jp> 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 Cc: alsa-devel@alsa-project.org 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Sat, 29 May 2021 05:33:53 +0200, Takashi Sakamoto wrote: > > Regarding to handling [U|S][32|24] PCM formats, many userspace > application developers and driver developers have confusion, since they > require them to understand justification or padding. It easily > loses consistency and soundness to operate with many type of devices. In > this commit, I attempt to solve the situation by adding comment about > relation between [S|U]32 formats and 'msbits' hardware parameter. > > The formats are used for 'left-justified' sample format, and the available > bit count in most significant bit is delivered to userspace in msbits > hardware parameter (struct snd_pcm_hw_params.msbits), which is decided by > msbits constraint added by pcm drivers (snd_pcm_hw_constraint_msbits()). > > In driver side, the msbits constraint includes two elements; the physical > width of format and the available width of the format in most significant > bit. The former is used to match SAMPLE_BITS of format. (For my > convenience, I ignore wildcard in the usage of the constraint.) > > As a result of interaction between ALSA pcm core and ALSA pcm application, > when the format in which SAMPLE_BITS equals to physical width of the > msbits constaint, the msbits parameter is set by referring to the > available width of the constraint. When the msbits parameter is not > changed in the above process, ALSA pcm core set it alternatively with > SAMPLE_BIT of chosen format. > > In userspace application side, the msbits is only available after calling > ioctl(2) with SNDRV_PCM_IOCTL_HW_PARAMS request. Even if the hardware > parameter structure includes somewhat value of SAMPLE_BITS interval > parameter as width of format, all of the width is not always available > since msbits can be less than the width. > > I note that [S|U24] formats are used for 'right-justified' 24 bit sample > formats within 32 bit frame. The first byte in most significant bit > should be invalidated. Although the msbits exposed to userspace should be > zero as invalid value, actually it is 32 from physical width of format. > > Signed-off-by: Takashi Sakamoto Thanks, applied. Takashi