From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752515AbdKVX2E (ORCPT ); Wed, 22 Nov 2017 18:28:04 -0500 Received: from smtp-proxy003.phy.lolipop.jp ([157.7.104.44]:38745 "EHLO smtp-proxy003.phy.lolipop.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751982AbdKVX1Q (ORCPT ); Wed, 22 Nov 2017 18:27:16 -0500 Subject: Re: [PATCH 1/2] ALSA: pcm: add SNDRV_PCM_FORMAT_{S, U}20_4 To: "Maciej S. Szmigiero" , Timur Tabi , Nicolin Chen , Xiubo Li , Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, Liam Girdwood , linux-kernel , Mark Brown , Fabio Estevam , linuxppc-dev@lists.ozlabs.org References: <53d527c0-89f6-d501-09e9-1effea8a5bac@maciej.szmigiero.name> From: Takashi Sakamoto Message-ID: Date: Thu, 23 Nov 2017 08:27:10 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <53d527c0-89f6-d501-09e9-1effea8a5bac@maciej.szmigiero.name> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Nov 23 2017 04:17, Maciej S. Szmigiero wrote: > This format is similar to existing SNDRV_PCM_FORMAT_{S,U}20_3 that keep > 20-bit PCM samples in 3 bytes, however i.MX6 platform SSI FIFO does not > allow 3-byte accesses (including DMA) so a 4-byte format is needed for it. > > Signed-off-by: Maciej S. Szmigiero > --- > include/sound/pcm.h | 8 ++++++++ > include/sound/soc-dai.h | 2 ++ > include/uapi/sound/asound.h | 10 +++++++++- > sound/core/pcm_misc.c | 16 ++++++++++++++++ > 4 files changed, 35 insertions(+), 1 deletion(-) > > ... > > diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h > index c227ccba60ae..69b661816491 100644 > --- a/include/uapi/sound/asound.h > +++ b/include/uapi/sound/asound.h > @@ -236,7 +236,11 @@ typedef int __bitwise snd_pcm_format_t; > #define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ > #define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ > #define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ > -#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE > +#define SNDRV_PCM_FORMAT_S20_4LE ((__force snd_pcm_format_t) 53) /* in four bytes */ > +#define SNDRV_PCM_FORMAT_S20_4BE ((__force snd_pcm_format_t) 54) /* in four bytes */ > +#define SNDRV_PCM_FORMAT_U20_4LE ((__force snd_pcm_format_t) 55) /* in four bytes */ > +#define SNDRV_PCM_FORMAT_U20_4BE ((__force snd_pcm_format_t) 56) /* in four bytes */ > +#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U20_4BE In my opinion, for this type of definition, it's better to declare left/right-adjusted or padding side. (Of course, silence definition is already a hint, however the lack of information forces developers to have a careful behaviour to handle entries on the list.) (I note that in current ALSA PCM interface there's no way to deliver MSB/LSB-first information about sample format.) Additionally, alsa-lib includes some codes related to the definition[1]. If you'd like to thing goes well out of ALSA SoC part, it's better to submit changes to the library as well. [1] http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_misc.c;h=5420b1895713a3aec3624a5218794a7b49baf167;hb=HEAD Regards Takashi Sakamoto