Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp568517lqc; Fri, 8 Mar 2024 06:04:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU4lAxvcI6S73q0d9xGkeB36vzkRH4OWEFknyR1tMhTJ1rhPEltLnEQY0pM176k9dJrA/OjrSJD/i7Sfme/Jvcjjdr3eX8VKEe5mn5sWg== X-Google-Smtp-Source: AGHT+IHbdqvahPd2NMPyh+NVU1/cwu2Ks/h2l6hRqmnLMMEdOx9F+uK1bip9hf8bcRDThmSwDfaT X-Received: by 2002:a92:cda2:0:b0:365:1035:83ab with SMTP id g2-20020a92cda2000000b00365103583abmr25287280ild.32.1709906688788; Fri, 08 Mar 2024 06:04:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709906688; cv=pass; d=google.com; s=arc-20160816; b=siJrv2o8FZjDHQ20gxrU6ZYyjxrjfsMfgCcMZc2OCKwjIuAXzj108fX0AU2+DWzaI0 WP4pqj+H4s6sH6/BJ7DYn/P7WUCRNJFQdffTOLwM7C2qTsHxgD2Jg57JO93yLevQmq7q cr6P1pxBwbUbmn3GXDuDRvt7lMeALiJQPHjrCEdAX0CBB+tO5VmkXIYuFXoWNm58Dcu3 hoHgg7J2BIo1ePi84rRDaKqASH3ilVocOyQQfHkdJ3miuIZMVUEZ4sNnwJzD17gqqqtI ZpMhSIikMxyhYj3LISKVNbueXGfgN4Firql09pbGHxQvQCR6KiUL39Yc9/E60JhonJNc 3pbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=pqeku34QO8gpfw1pAstoxXMR1diHpMWhIGKgpQnAH54=; fh=q/m5WiYnkCI4np0O66mx/odt3JuMB5n5BE0GpP4SpGE=; b=HNx1ik66eawH/nAsapy/wELXH8y7JOHkmEFSVB0gTPX0tAwX6duRCl69UZcqvi8GfC CUo6QXShJeh8+ARgsfPPPE1ggNBlqFtFj0J4Bb7T7XhP47AuhEPTddlosMG2JHH0Atjn 4YICKndQRQcz1rgR+sY6xm9RQrJJpZQUCSwvwjeCUhgOxPXWJh3RquwacvF2k8osM5R8 Hzp3j9NZiNJLTL8VHImPGCHbThQKE0WIofyGTorv+JAmC59wZB3TkeOiPxOEUdAg0RCE Sc/s0sgSR+K/R/LaE6GS5NUljvMyqJv11012fI+IvqU2+PsklhsbQO6LRwtkgQa5Q+d+ 8mgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-97134-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97134-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b4-20020a920b04000000b0036391b3e279si6247186ilf.199.2024.03.08.06.04.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 06:04:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97134-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-97134-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97134-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B936728128F for ; Fri, 8 Mar 2024 14:04:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEC7F3FBA5; Fri, 8 Mar 2024 14:04:29 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B734A1F944; Fri, 8 Mar 2024 14:04:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709906668; cv=none; b=ffN66Zbeldvo4B52OgyFjDXEWKHq1QCYd1ZzEVGaxMjAXYW7p4fXTHMpZ+Y5WU4qxcG+UqBeiD1hg6iGsQM9foDU79YO4y9XBZQ2saRneB3jMjS1SRMJbRXAhOmnZ5FM43PaixTDNGukCmvUshumugNgTfqs/NwVJrjZgHsmrLU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709906668; c=relaxed/simple; bh=X/qOhJGEXalirpDNKgd2DyuOgUy8yBNgZHo89ncIZVA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aWzLN988gj+9IOrqlRZlgqYZ51B4juErGDYJ3nSCZnPp2qlT3cLySnhg3fMic//M7HyYOdt1m/H8/Ca68ymsv64MbIsdK9DB+e4ZyWi9mG1ezvzxIukqYRP2yHzpBdzSPUkj1I4X5/39bDlg4oW60rO+QKyTSAbHFFFZgNl9jJs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C76FC433F1; Fri, 8 Mar 2024 14:04:24 +0000 (UTC) Message-ID: Date: Fri, 8 Mar 2024 15:04:23 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v13 09/16] media: uapi: Define audio sample format fourcc type Content-Language: en-US, nl To: Shengjiu Wang Cc: Shengjiu Wang , sakari.ailus@iki.fi, tfiga@chromium.org, m.szyprowski@samsung.com, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org References: <1708936109-11587-1-git-send-email-shengjiu.wang@nxp.com> <1708936109-11587-10-git-send-email-shengjiu.wang@nxp.com> <56368a0d-6ada-4ab6-8389-b4bd20d6efc4@xs4all.nl> From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWLfJLobMWhQii0Zd83hGT9SIt9uHaHjgwmtTH7MSTIiaY6N14nw2Ud C6Uykc1va0Wqqc2ov5ihgk/2k2SKa02ookQI3e79laOrbZl5BOXNKR9LguuOZdX4XYR3Zi6/ BsJ7pVCK9xkiVf8svlEl94IHb+sa1KrlgGv3fn5xgzDw8Z222TfFceDL/2EzUyTdWc4GaPMC E/c1B4UOle6ZHg02+I8tZicjzj5+yffv1lB5A1btG+AmoZrgf0X2O1B96fqgHx8w9PIpVERN YsmkfxvhfP3MO3oHh8UY1OLKdlKamMneCLk2up1Zlli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pC5inPxIgR1+ZFvQrAV36SvLFfuMhyCAxV6WBlQc85ArOiQZB Wm7L0repwr7zEJFEkdy8C81WRhMdPvHkAIh3RoY1SGcdB7rB3wCzfYkAuCBqaF7Zgfw8xkad KEiQTexRbM1sc/I8ACpla3N26SfQwrfg6V7TIoweP0RwDrcf5PVvwSWsRQp2LxFCkwnCXOra gYmkrmv0duG1FStpY+IIQn1TOkuXrciTVfZY1cZD0aVxwlxXBnUNZZNslldvXFtndxR0SFat sflovhDxKyhFwXOP0Rv8H378/+14TaykknRBIKEc0+lcr+EMOSUR5eg4aURb8Gc3Uc7fgQ6q UssTXzHPyj1hAyDpfu8DzAwlh4kKFTodxSsKAjI45SLjadSc94/5Gy8645Y1KgBzBPTH7Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 08/03/2024 2:52 pm, Shengjiu Wang wrote: > On Fri, Mar 8, 2024 at 8:06 PM Hans Verkuil wrote: >> >> On 08/03/2024 12:52 pm, Shengjiu Wang wrote: >>> On Fri, Mar 8, 2024 at 3:34 PM Hans Verkuil wrote: >>>> >>>> Hi Shengjiu, >>>> >>>> After thinking it over I think this patch can be improved: >>>> >>>> On 26/02/2024 9:28 am, Shengjiu Wang wrote: >>>>> The audio sample format definition is from alsa, >>>>> the header file is include/uapi/sound/asound.h, but >>>>> don't include this header file directly, because in >>>>> user space, there is another copy in alsa-lib. >>>>> There will be conflict in userspace for include >>>>> videodev2.h & asound.h and asoundlib.h >>>>> >>>>> Here still use the fourcc format. >>>>> >>>>> Signed-off-by: Shengjiu Wang >>>>> --- >>>>> .../userspace-api/media/v4l/pixfmt-audio.rst | 87 +++++++++++++++++++ >>>>> .../userspace-api/media/v4l/pixfmt.rst | 1 + >>>>> drivers/media/v4l2-core/v4l2-ioctl.c | 13 +++ >>>>> include/uapi/linux/videodev2.h | 23 +++++ >>>>> 4 files changed, 124 insertions(+) >>>>> create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-audio.rst >>>>> >>>>> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-audio.rst b/Documentation/userspace-api/media/v4l/pixfmt-audio.rst >>>>> new file mode 100644 >>>>> index 000000000000..04b4a7fbd8f4 >>>>> --- /dev/null >>>>> +++ b/Documentation/userspace-api/media/v4l/pixfmt-audio.rst >>>>> @@ -0,0 +1,87 @@ >>>>> +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later >>>>> + >>>>> +.. _pixfmt-audio: >>>>> + >>>>> +************* >>>>> +Audio Formats >>>>> +************* >>>>> + >>>>> +These formats are used for :ref:`audiomem2mem` interface only. >>>> >>>> Here you should also document that all these fourccs start with 'AU' and are >>>> reserved for mappings of the snd_pcm_format_t type. >>>> >>>> Also document the v4l2_fourcc_to_audfmt define and the v4l2_audfmt_to_fourcc >>>> define (see also below). >>> >>> How about below description? >>> ' >>> All these fourccs starting with 'AU' are reserved for mappings >> >> All these fourccs -> All FourCCs >> >>> of the snd_pcm_format_t type. >>> >>> The v4l2_audfmt_to_fourcc() is defined to convert snd_pcm_format_t >> >> convert -> convert the >> >>> type to fourcc. The first character is 'A', the second character >> >> fourcc -> a FourCC >> >>> is 'U', the third character is ten's digit of snd_pcm_format_t, >>> the fourth character is unit's digit of snd_pcm_format_t. >> >> "is 'U', and the remaining two characters is the snd_pcm_format_t >> value in ASCII. Example: SNDRV_PCM_FORMAT_S16_LE (with value 2) >> maps to 'AU02' and SNDRV_PCM_FORMAT_S24_3LE (with value 32) maps >> to 'AU32'." >> >>> >>> The v4l2_fourcc_to_audfmt() is defined to convert these fourccs to >> >> fourccs -> FourCCs >> >>> snd_pcm_format_t type. >> >> BTW, given the way snd_pcm_format_t is defined I am fairly certain >> some casts are needed for the v4l2_audfmt_to_fourcc define. >> >> Regards, >> >> Hans >> >>> ' >>> Best regards >>> Shengjiu Wang >>>> >>>>> + >>>>> +.. tabularcolumns:: |p{5.8cm}|p{1.2cm}|p{10.3cm}| >>>>> + >>>>> +.. cssclass:: longtable >>>>> + >>>>> +.. flat-table:: Audio Format >>>>> + :header-rows: 1 >>>>> + :stub-columns: 0 >>>>> + :widths: 3 1 4 >>>>> + >>>>> + * - Identifier >>>>> + - Code >>>>> + - Details >>>>> + * .. _V4L2-AUDIO-FMT-S8: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_S8`` >>>>> + - 'S8' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_S8 in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-S16-LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_S16_LE`` >>>>> + - 'S16_LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_S16_LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-U16-LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_U16_LE`` >>>>> + - 'U16_LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_U16_LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-S24-LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_S24_LE`` >>>>> + - 'S24_LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_S24_LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-U24-LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_U24_LE`` >>>>> + - 'U24_LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_U24_LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-S32-LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_S32_LE`` >>>>> + - 'S32_LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_S32_LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-U32-LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_U32_LE`` >>>>> + - 'U32_LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_U32_LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-FLOAT-LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_FLOAT_LE`` >>>>> + - 'FLOAT_LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_FLOAT_LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-IEC958-SUBFRAME-LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_IEC958_SUBFRAME_LE`` >>>>> + - 'IEC958_SUBFRAME_LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-S24-3LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_S24_3LE`` >>>>> + - 'S24_3LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_S24_3LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-U24-3LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_U24_3LE`` >>>>> + - 'U24_3LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_U24_3LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-S20-3LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_S20_3LE`` >>>>> + - 'S20_3LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_S24_3LE in ALSA >>>>> + * .. _V4L2-AUDIO-FMT-U20-3LE: >>>>> + >>>>> + - ``V4L2_AUDIO_FMT_U20_3LE`` >>>>> + - 'U20_3LE' >>>>> + - Corresponds to SNDRV_PCM_FORMAT_U20_3LE in ALSA >>>>> diff --git a/Documentation/userspace-api/media/v4l/pixfmt.rst b/Documentation/userspace-api/media/v4l/pixfmt.rst >>>>> index 11dab4a90630..2eb6fdd3b43d 100644 >>>>> --- a/Documentation/userspace-api/media/v4l/pixfmt.rst >>>>> +++ b/Documentation/userspace-api/media/v4l/pixfmt.rst >>>>> @@ -36,3 +36,4 @@ see also :ref:`VIDIOC_G_FBUF `.) >>>>> colorspaces >>>>> colorspaces-defs >>>>> colorspaces-details >>>>> + pixfmt-audio >>>>> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c >>>>> index 961abcdf7290..be229c69e991 100644 >>>>> --- a/drivers/media/v4l2-core/v4l2-ioctl.c >>>>> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c >>>>> @@ -1471,6 +1471,19 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) >>>>> case V4L2_PIX_FMT_Y210: descr = "10-bit YUYV Packed"; break; >>>>> case V4L2_PIX_FMT_Y212: descr = "12-bit YUYV Packed"; break; >>>>> case V4L2_PIX_FMT_Y216: descr = "16-bit YUYV Packed"; break; >>>>> + case V4L2_AUDIO_FMT_S8: descr = "8-bit Signed"; break; >>>>> + case V4L2_AUDIO_FMT_S16_LE: descr = "16-bit Signed LE"; break; >>>>> + case V4L2_AUDIO_FMT_U16_LE: descr = "16-bit Unsigned LE"; break; >>>>> + case V4L2_AUDIO_FMT_S24_LE: descr = "24(32)-bit Signed LE"; break; >>>>> + case V4L2_AUDIO_FMT_U24_LE: descr = "24(32)-bit Unsigned LE"; break; >>>>> + case V4L2_AUDIO_FMT_S32_LE: descr = "32-bit Signed LE"; break; >>>>> + case V4L2_AUDIO_FMT_U32_LE: descr = "32-bit Unsigned LE"; break; >>>>> + case V4L2_AUDIO_FMT_FLOAT_LE: descr = "32-bit Float LE"; break; >>>>> + case V4L2_AUDIO_FMT_IEC958_SUBFRAME_LE: descr = "32-bit IEC958 LE"; break; >>>>> + case V4L2_AUDIO_FMT_S24_3LE: descr = "24(24)-bit Signed LE"; break; >>>>> + case V4L2_AUDIO_FMT_U24_3LE: descr = "24(24)-bit Unsigned LE"; break; >>>>> + case V4L2_AUDIO_FMT_S20_3LE: descr = "20(24)-bit Signed LE"; break; >>>>> + case V4L2_AUDIO_FMT_U20_3LE: descr = "20(24)-bit Unsigned LE"; break; >>>>> >>>>> default: >>>>> /* Compressed formats */ >>>>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h >>>>> index 2c03d2dfadbe..673a6235a029 100644 >>>>> --- a/include/uapi/linux/videodev2.h >>>>> +++ b/include/uapi/linux/videodev2.h >>>>> @@ -843,6 +843,29 @@ struct v4l2_pix_format { >>>>> #define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */ >>>>> #define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */ >>>>> >>>>> +/* >>>>> + * Audio-data formats >>>>> + * All these audio formats use a fourcc starting with 'AU' >>>>> + * followed by the SNDRV_PCM_FORMAT_ value from asound.h. >>>> >>>> Also document here that fourccs starting with 'AU' are reserved for >>>> the snd_pcm_format_t to fourcc mappings. >>>> >>>> That to avoid that someone adds a 'AUXX' fourcc later. >>>> >>>>> + */ >>>>> +#define V4L2_AUDIO_FMT_S8 v4l2_fourcc('A', 'U', '0', '0') >>>>> +#define V4L2_AUDIO_FMT_S16_LE v4l2_fourcc('A', 'U', '0', '2') >>>>> +#define V4L2_AUDIO_FMT_U16_LE v4l2_fourcc('A', 'U', '0', '4') >>>>> +#define V4L2_AUDIO_FMT_S24_LE v4l2_fourcc('A', 'U', '0', '6') >>>>> +#define V4L2_AUDIO_FMT_U24_LE v4l2_fourcc('A', 'U', '0', '8') >>>>> +#define V4L2_AUDIO_FMT_S32_LE v4l2_fourcc('A', 'U', '1', '0') >>>>> +#define V4L2_AUDIO_FMT_U32_LE v4l2_fourcc('A', 'U', '1', '2') >>>>> +#define V4L2_AUDIO_FMT_FLOAT_LE v4l2_fourcc('A', 'U', '1', '4') >>>>> +#define V4L2_AUDIO_FMT_IEC958_SUBFRAME_LE v4l2_fourcc('A', 'U', '1', '8') >>>>> +#define V4L2_AUDIO_FMT_S24_3LE v4l2_fourcc('A', 'U', '3', '2') >>>>> +#define V4L2_AUDIO_FMT_U24_3LE v4l2_fourcc('A', 'U', '3', '4') >>>>> +#define V4L2_AUDIO_FMT_S20_3LE v4l2_fourcc('A', 'U', '3', '6') >>>>> +#define V4L2_AUDIO_FMT_U20_3LE v4l2_fourcc('A', 'U', '3', '8') >>>>> + >>>>> +#define v4l2_fourcc_to_audfmt(fourcc) \ >>>>> + (__force snd_pcm_format_t)(((((fourcc) >> 16) & 0xff) - '0') * 10 \ >>>>> + + ((((fourcc) >> 24) & 0xff) - '0')) >>>>> + >>>> >>>> As I suggested in an earlier reply, add this: >>>> >>>> #define v4l2_audfmt_to_fourcc(audfmt) \ >>>> v4l2_fourcc('A', 'U', '0' + (audfmt) / 10, '0' + (audfmt) % 10) >>>> >>>> Even though it is not used in the drivers, since this is a public header used >>>> by drivers and applications, it makes sense to provide the reverse mapping as well. >>>> >>>> Please test it in actual code to make sure there are no compilation warnings. > > I test this definition, the compiler doesn't report warning. typedef int __bitwise snd_pcm_format_t; And __bitwise is apparently a sparse static analyzer attribute, so I suspect that the v4l2_audfmt_to_fourcc definition will cause a sparse warning. So you need to check with sparse. Regards, Hans > > best regards > Shengjiu Wang > >>>> >>>> Regards, >>>> >>>> Hans >>>> >>>>> /* priv field value to indicates that subsequent fields are valid. */ >>>>> #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe >>>>> >>>> >>