Re: [RFC PATCH v5 09/11] media: uapi: define audio sample format fourcc type

2023-10-09 Thread Hans Verkuil
Hi Shengjiu,

On 28/09/2023 11:00, 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  | 277 ++
>  .../userspace-api/media/v4l/pixfmt.rst|   1 +
>  drivers/media/v4l2-core/v4l2-ioctl.c  |  51 
>  include/uapi/linux/videodev2.h|  56 
>  4 files changed, 385 insertions(+)
>  create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-audio.rst

I think it would make more sense if this patch came after 07/11, so swap this
and the previous patch around.

> 
> 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 ..6ff114dfc2d1
> --- /dev/null
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-audio.rst
> @@ -0,0 +1,277 @@
> +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> +
> +.. _pixfmt-audio:
> +
> +*
> +Audio Formats
> +*
> +
> +These formats are used for :ref:`audiomem2mem` interface only.
> +
> +.. 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'
> +  - Correspond to SNDRV_PCM_FORMAT_S8 in ALSA

Correspond -> Corresponds

(fix everywhere below)

> +* .. _V4L2-AUDIO-FMT-U8:
> +
> +  - ``V4L2_AUDIO_FMT_U8``
> +  - 'U8'
> +  - Correspond to SNDRV_PCM_FORMAT_U8 in ALSA
> +* .. _V4L2-AUDIO-FMT-S16-LE:
> +
> +  - ``V4L2_AUDIO_FMT_S16_LE``
> +  - 'S16_LE'
> +  - Correspond to SNDRV_PCM_FORMAT_S16_LE in ALSA
> +* .. _V4L2-AUDIO-FMT-S16-BE:
> +
> +  - ``V4L2_AUDIO_FMT_S16_BE``
> +  - 'S16_BE'
> +  - Correspond to SNDRV_PCM_FORMAT_S16_BE in ALSA
> +* .. _V4L2-AUDIO-FMT-U16-LE:
> +
> +  - ``V4L2_AUDIO_FMT_U16_LE``
> +  - 'U16_LE'
> +  - Correspond to SNDRV_PCM_FORMAT_U16_LE in ALSA
> +* .. _V4L2-AUDIO-FMT-U16-BE:
> +
> +  - ``V4L2_AUDIO_FMT_U16_BE``
> +  - 'U16_BE'
> +  - Correspond to SNDRV_PCM_FORMAT_U16_BE in ALSA
> +* .. _V4L2-AUDIO-FMT-S24-LE:
> +
> +  - ``V4L2_AUDIO_FMT_S24_LE``
> +  - 'S24_LE'
> +  - Correspond to SNDRV_PCM_FORMAT_S24_LE in ALSA
> +* .. _V4L2-AUDIO-FMT-S24-BE:
> +
> +  - ``V4L2_AUDIO_FMT_S24_BE``
> +  - 'S24_BE'
> +  - Correspond to SNDRV_PCM_FORMAT_S24_BE in ALSA
> +* .. _V4L2-AUDIO-FMT-U24-LE:
> +
> +  - ``V4L2_AUDIO_FMT_U24_LE``
> +  - 'U24_LE'
> +  - Correspond to SNDRV_PCM_FORMAT_U24_LE in ALSA
> +* .. _V4L2-AUDIO-FMT-U24-BE:
> +
> +  - ``V4L2_AUDIO_FMT_U24_BE``
> +  - 'U24_BE'
> +  - Correspond to SNDRV_PCM_FORMAT_U24_BE in ALSA
> +* .. _V4L2-AUDIO-FMT-S32-LE:
> +
> +  - ``V4L2_AUDIO_FMT_S32_LE``
> +  - 'S32_LE'
> +  - Correspond to SNDRV_PCM_FORMAT_S32_LE in ALSA
> +* .. _V4L2-AUDIO-FMT-S32-BE:
> +
> +  - ``V4L2_AUDIO_FMT_S32_BE``
> +  - 'S32_BE'
> +  - Correspond to SNDRV_PCM_FORMAT_S32_BE in ALSA
> +* .. _V4L2-AUDIO-FMT-U32-LE:
> +
> +  - ``V4L2_AUDIO_FMT_U32_LE``
> +  - 'U32_LE'
> +  - Correspond to SNDRV_PCM_FORMAT_U32_LE in ALSA
> +* .. _V4L2-AUDIO-FMT-U32-BE:
> +
> +  - ``V4L2_AUDIO_FMT_U32_BE``
> +  - 'U32_BE'
> +  - Correspond to SNDRV_PCM_FORMAT_U32_BE in ALSA
> +* .. _V4L2-AUDIO-FMT-FLOAT-LE:
> +
> +  - ``V4L2_AUDIO_FMT_FLOAT_LE``
> +  - 'FLOAT_LE'
> +  - Correspond to SNDRV_PCM_FORMAT_FLOAT_LE in ALSA
> +* .. _V4L2-AUDIO-FMT-FLOAT-BE:
> +
> +  - ``V4L2_AUDIO_FMT_FLOAT_BE``
> +  - 'FLOAT_BE'
> +  - Correspond to SNDRV_PCM_FORMAT_FLOAT_BE in ALSA
> +* .. _V4L2-AUDIO-FMT-FLOAT64-LE:
> +
> +  - ``V4L2_AUDIO_FMT_FLOAT64_LE``
> +  - 'FLOAT64_LE'
> +  - Correspond to SNDRV_PCM_FORMAT_FLOAT64_LE in ALSA
> +* .. _V4L2-AUDIO-FMT-FLOAT64-BE:
> +
> +  - ``V4L2_AUDIO_FMT_FLOAT64_BE``
> +  - 'FLOAT64_BE'
> +  - Correspond to SNDRV_PCM_FORMAT_FLOAT64_BE in ALSA
> +* .. _V4L2-AUDIO-FMT-IEC958-SUBFRAME-LE:
> +
> +  - ``V4L2_AUDIO_FMT_IEC958_SUBFRAME_LE``
> +  - 'IEC958_SUBFRAME_LE'
> +  - Correspond to SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE in ALSA
> +* .. _V4L2-AUDIO-FMT-IEC958-SUBFRAME-BE:
> +
> +  - ``V4L2_AUDIO_FMT_IEC958_SUBFRAME_BE``
> +  - 'IEC958_SUBFRAME_BE'
> +  - Correspond to SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE in ALSA
> +* .. _V4L2-AUDIO-FMT-MU-LAW:
> +
> +  - ``V4L2_AUDIO_FMT_MU_LAW``
> 

[RFC PATCH v5 09/11] media: uapi: define audio sample format fourcc type

2023-09-28 Thread Shengjiu Wang
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  | 277 ++
 .../userspace-api/media/v4l/pixfmt.rst|   1 +
 drivers/media/v4l2-core/v4l2-ioctl.c  |  51 
 include/uapi/linux/videodev2.h|  56 
 4 files changed, 385 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 ..6ff114dfc2d1
--- /dev/null
+++ b/Documentation/userspace-api/media/v4l/pixfmt-audio.rst
@@ -0,0 +1,277 @@
+.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+
+.. _pixfmt-audio:
+
+*
+Audio Formats
+*
+
+These formats are used for :ref:`audiomem2mem` interface only.
+
+.. 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'
+  - Correspond to SNDRV_PCM_FORMAT_S8 in ALSA
+* .. _V4L2-AUDIO-FMT-U8:
+
+  - ``V4L2_AUDIO_FMT_U8``
+  - 'U8'
+  - Correspond to SNDRV_PCM_FORMAT_U8 in ALSA
+* .. _V4L2-AUDIO-FMT-S16-LE:
+
+  - ``V4L2_AUDIO_FMT_S16_LE``
+  - 'S16_LE'
+  - Correspond to SNDRV_PCM_FORMAT_S16_LE in ALSA
+* .. _V4L2-AUDIO-FMT-S16-BE:
+
+  - ``V4L2_AUDIO_FMT_S16_BE``
+  - 'S16_BE'
+  - Correspond to SNDRV_PCM_FORMAT_S16_BE in ALSA
+* .. _V4L2-AUDIO-FMT-U16-LE:
+
+  - ``V4L2_AUDIO_FMT_U16_LE``
+  - 'U16_LE'
+  - Correspond to SNDRV_PCM_FORMAT_U16_LE in ALSA
+* .. _V4L2-AUDIO-FMT-U16-BE:
+
+  - ``V4L2_AUDIO_FMT_U16_BE``
+  - 'U16_BE'
+  - Correspond to SNDRV_PCM_FORMAT_U16_BE in ALSA
+* .. _V4L2-AUDIO-FMT-S24-LE:
+
+  - ``V4L2_AUDIO_FMT_S24_LE``
+  - 'S24_LE'
+  - Correspond to SNDRV_PCM_FORMAT_S24_LE in ALSA
+* .. _V4L2-AUDIO-FMT-S24-BE:
+
+  - ``V4L2_AUDIO_FMT_S24_BE``
+  - 'S24_BE'
+  - Correspond to SNDRV_PCM_FORMAT_S24_BE in ALSA
+* .. _V4L2-AUDIO-FMT-U24-LE:
+
+  - ``V4L2_AUDIO_FMT_U24_LE``
+  - 'U24_LE'
+  - Correspond to SNDRV_PCM_FORMAT_U24_LE in ALSA
+* .. _V4L2-AUDIO-FMT-U24-BE:
+
+  - ``V4L2_AUDIO_FMT_U24_BE``
+  - 'U24_BE'
+  - Correspond to SNDRV_PCM_FORMAT_U24_BE in ALSA
+* .. _V4L2-AUDIO-FMT-S32-LE:
+
+  - ``V4L2_AUDIO_FMT_S32_LE``
+  - 'S32_LE'
+  - Correspond to SNDRV_PCM_FORMAT_S32_LE in ALSA
+* .. _V4L2-AUDIO-FMT-S32-BE:
+
+  - ``V4L2_AUDIO_FMT_S32_BE``
+  - 'S32_BE'
+  - Correspond to SNDRV_PCM_FORMAT_S32_BE in ALSA
+* .. _V4L2-AUDIO-FMT-U32-LE:
+
+  - ``V4L2_AUDIO_FMT_U32_LE``
+  - 'U32_LE'
+  - Correspond to SNDRV_PCM_FORMAT_U32_LE in ALSA
+* .. _V4L2-AUDIO-FMT-U32-BE:
+
+  - ``V4L2_AUDIO_FMT_U32_BE``
+  - 'U32_BE'
+  - Correspond to SNDRV_PCM_FORMAT_U32_BE in ALSA
+* .. _V4L2-AUDIO-FMT-FLOAT-LE:
+
+  - ``V4L2_AUDIO_FMT_FLOAT_LE``
+  - 'FLOAT_LE'
+  - Correspond to SNDRV_PCM_FORMAT_FLOAT_LE in ALSA
+* .. _V4L2-AUDIO-FMT-FLOAT-BE:
+
+  - ``V4L2_AUDIO_FMT_FLOAT_BE``
+  - 'FLOAT_BE'
+  - Correspond to SNDRV_PCM_FORMAT_FLOAT_BE in ALSA
+* .. _V4L2-AUDIO-FMT-FLOAT64-LE:
+
+  - ``V4L2_AUDIO_FMT_FLOAT64_LE``
+  - 'FLOAT64_LE'
+  - Correspond to SNDRV_PCM_FORMAT_FLOAT64_LE in ALSA
+* .. _V4L2-AUDIO-FMT-FLOAT64-BE:
+
+  - ``V4L2_AUDIO_FMT_FLOAT64_BE``
+  - 'FLOAT64_BE'
+  - Correspond to SNDRV_PCM_FORMAT_FLOAT64_BE in ALSA
+* .. _V4L2-AUDIO-FMT-IEC958-SUBFRAME-LE:
+
+  - ``V4L2_AUDIO_FMT_IEC958_SUBFRAME_LE``
+  - 'IEC958_SUBFRAME_LE'
+  - Correspond to SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE in ALSA
+* .. _V4L2-AUDIO-FMT-IEC958-SUBFRAME-BE:
+
+  - ``V4L2_AUDIO_FMT_IEC958_SUBFRAME_BE``
+  - 'IEC958_SUBFRAME_BE'
+  - Correspond to SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE in ALSA
+* .. _V4L2-AUDIO-FMT-MU-LAW:
+
+  - ``V4L2_AUDIO_FMT_MU_LAW``
+  - 'MU_LAW'
+  - Correspond to SNDRV_PCM_FORMAT_MU_LAW in ALSA
+* .. _V4L2-AUDIO-FMT-A-LAW:
+
+  - ``V4L2_AUDIO_FMT_A_LAW``
+  - 'A_LAW'
+  - Correspond to SNDRV_PCM_FORMAT_A_LAW in ALSA
+* .. _V4L2-AUDIO-FMT-IMA-ADPCM:
+
+  - ``V4L2_AUDIO_FMT_IMA_ADPCM``
+  - 'IMA_ADPCM'
+  - Correspond to SNDRV_PCM_FORMAT_IMA_ADPCM in ALSA
+* .. _V4L2-AUDIO-FMT-MPEG:
+
+  - ``V4L2_AUDIO_FMT_MPEG``
+  - 'MPEG'
+  - Correspond to SNDRV_PCM_FORMAT_MPEG in ALSA
+* ..