* [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats
2025-06-23 14:43 [PATCH v5 0/6] Extend RAW format support for rzg2l-cru driver Daniel Scally
@ 2025-06-23 14:43 ` Daniel Scally
2025-06-24 10:25 ` Sakari Ailus
2025-06-23 14:43 ` [PATCH v5 2/6] media: rzg2l-cru: Add vidioc_enum_framesizes() Daniel Scally
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Daniel Scally @ 2025-06-23 14:43 UTC (permalink / raw)
To: linux-media
Cc: sakari.ailus, laurent.pinchart, prabhakar.mahadev-lad.rj,
jacopo.mondi, dan.scally, Hans Verkuil, Daniel Scally,
Laurent Pinchart
From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
The Renesas Camera Receiver Unit in the RZ/V2H SoC can output RAW
data captured from an image sensor without conversion to an RGB/YUV
format. In that case the data are packed into 64-bit blocks, with a
variable amount of padding in the most significant bits depending on
the bitdepth of the data. Add new V4L2 pixel format codes for the new
formats, along with documentation to describe them.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
---
Changes in v5:
- None
Changes in v4:
- Removed references to "Bayer" or "srgb"
Changes in v3:
- Switched from bayer-order specific formats to generic RAWnn
Changes in v2:
- Added labels to the new formats in the documentation file
- Added 20-bit formats
---
.../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
.../userspace-api/media/v4l/pixfmt-rawnn-cru.rst | 143 +++++++++++++++++++++
drivers/media/v4l2-core/v4l2-common.c | 6 +
drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
include/uapi/linux/videodev2.h | 6 +
5 files changed, 160 insertions(+)
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
index ed3eb432967d9845d3d65150831d8a7f62dec994..20a8aa04330479ed4d44c8e4fc3d57db8c2e6933 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
@@ -31,3 +31,4 @@ orders. See also `the Wikipedia article on Bayer filter
pixfmt-srggb14
pixfmt-srggb14p
pixfmt-srggb16
+ pixfmt-rawnn-cru
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
new file mode 100644
index 0000000000000000000000000000000000000000..d786833d0cf355b3955fe63d85c8a211a7a4fb23
--- /dev/null
+++ b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
@@ -0,0 +1,143 @@
+.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+
+.. _v4l2-pix-fmt-cru-raw10:
+.. _v4l2-pix-fmt-cru-raw12:
+.. _v4l2-pix-fmt-cru-raw14:
+.. _v4l2-pix-fmt-cru-raw20:
+
+**********************************************************************************************************************************
+V4L2_PIX_FMT_CRU_RAW10 ('CR10'), V4L2_PIX_FMT_CRU_RAW12 ('CR12'), V4L2_PIX_FMT_CRU_RAW14 ('CR14'), V4L2_PIX_FMT_CRU_RAW20 ('CR20')
+**********************************************************************************************************************************
+
+===============================================================
+Renesas RZ/V2H Camera Receiver Unit 64-bit packed pixel formats
+===============================================================
+
+| V4L2_PIX_FMT_CRU_RAW10 (CR10)
+| V4L2_PIX_FMT_CRU_RAW12 (CR12)
+| V4L2_PIX_FMT_CRU_RAW14 (CR14)
+| V4L2_PIX_FMT_CRU_RAW20 (CR20)
+
+Description
+===========
+
+These pixel formats are some of the RAW outputs for the Camera Receiver Unit in
+the Renesas RZ/V2H SoC. They are raw formats which pack pixels contiguously into
+64-bit units, with the 4 or 8 most significant bits padded.
+
+**Byte Order**
+
+.. flat-table:: RAW formats
+ :header-rows: 2
+ :stub-columns: 0
+ :widths: 36 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
+ :fill-cells:
+
+ * - :rspan:`1` Pixel Format Code
+ - :cspan:`63` Data organization
+ * - 63
+ - 62
+ - 61
+ - 60
+ - 59
+ - 58
+ - 57
+ - 56
+ - 55
+ - 54
+ - 53
+ - 52
+ - 51
+ - 50
+ - 49
+ - 48
+ - 47
+ - 46
+ - 45
+ - 44
+ - 43
+ - 42
+ - 41
+ - 40
+ - 39
+ - 38
+ - 37
+ - 36
+ - 35
+ - 34
+ - 33
+ - 32
+ - 31
+ - 30
+ - 29
+ - 28
+ - 27
+ - 26
+ - 25
+ - 24
+ - 23
+ - 22
+ - 21
+ - 20
+ - 19
+ - 18
+ - 17
+ - 16
+ - 15
+ - 14
+ - 13
+ - 12
+ - 11
+ - 10
+ - 9
+ - 8
+ - 7
+ - 6
+ - 5
+ - 4
+ - 3
+ - 2
+ - 1
+ - 0
+ * - V4L2_PIX_FMT_CRU_RAW10
+ - 0
+ - 0
+ - 0
+ - 0
+ - :cspan:`9` P5
+ - :cspan:`9` P4
+ - :cspan:`9` P3
+ - :cspan:`9` P2
+ - :cspan:`9` P1
+ - :cspan:`9` P0
+ * - V4L2_PIX_FMT_CRU_RAW12
+ - 0
+ - 0
+ - 0
+ - 0
+ - :cspan:`11` P4
+ - :cspan:`11` P3
+ - :cspan:`11` P2
+ - :cspan:`11` P1
+ - :cspan:`11` P0
+ * - V4L2_PIX_FMT_CRU_RAW14
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - 0
+ - :cspan:`13` P3
+ - :cspan:`13` P2
+ - :cspan:`13` P1
+ - :cspan:`13` P0
+ * - V4L2_PIX_FMT_CRU_RAW20
+ - 0
+ - 0
+ - 0
+ - 0
+ - :cspan:`19` P2
+ - :cspan:`19` P1
+ - :cspan:`19` P0
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index bd160a8c9efedbcefc58b8ecc829e902f392e5c5..d162cebfc4159ff3913416ebb5eaa06e968d0e89 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -344,6 +344,12 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
{ .format = V4L2_PIX_FMT_SGBRG12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SGRBG12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_SRGGB12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .bpp_div = { 1, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
+
+ /* Renesas Camera Data Receiver Unit formats, bayer order agnostic */
+ { .format = V4L2_PIX_FMT_CRU_RAW10, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .bpp_div = { 6, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
+ { .format = V4L2_PIX_FMT_CRU_RAW12, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .bpp_div = { 5, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
+ { .format = V4L2_PIX_FMT_CRU_RAW14, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .bpp_div = { 4, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
+ { .format = V4L2_PIX_FMT_CRU_RAW20, .pixel_enc = V4L2_PIXEL_ENC_BAYER, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .bpp_div = { 3, 1, 1, 1 }, .hdiv = 1, .vdiv = 1 },
};
unsigned int i;
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 650dc1956f73d2f1943b56c42140c7b8d757259f..c5c2586b11fb1d389b89838449be2e8637b7b6b5 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1413,6 +1413,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_SGBRG10DPCM8: descr = "8-bit Bayer GBGB/RGRG (DPCM)"; break;
case V4L2_PIX_FMT_SGRBG10DPCM8: descr = "8-bit Bayer GRGR/BGBG (DPCM)"; break;
case V4L2_PIX_FMT_SRGGB10DPCM8: descr = "8-bit Bayer RGRG/GBGB (DPCM)"; break;
+ case V4L2_PIX_FMT_CRU_RAW10: descr = "10-bit Raw CRU Packed"; break;
case V4L2_PIX_FMT_SBGGR12: descr = "12-bit Bayer BGBG/GRGR"; break;
case V4L2_PIX_FMT_SGBRG12: descr = "12-bit Bayer GBGB/RGRG"; break;
case V4L2_PIX_FMT_SGRBG12: descr = "12-bit Bayer GRGR/BGBG"; break;
@@ -1421,6 +1422,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_SGBRG12P: descr = "12-bit Bayer GBGB/RGRG Packed"; break;
case V4L2_PIX_FMT_SGRBG12P: descr = "12-bit Bayer GRGR/BGBG Packed"; break;
case V4L2_PIX_FMT_SRGGB12P: descr = "12-bit Bayer RGRG/GBGB Packed"; break;
+ case V4L2_PIX_FMT_CRU_RAW12: descr = "12-bit Raw CRU Packed"; break;
case V4L2_PIX_FMT_SBGGR14: descr = "14-bit Bayer BGBG/GRGR"; break;
case V4L2_PIX_FMT_SGBRG14: descr = "14-bit Bayer GBGB/RGRG"; break;
case V4L2_PIX_FMT_SGRBG14: descr = "14-bit Bayer GRGR/BGBG"; break;
@@ -1429,10 +1431,12 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_SGBRG14P: descr = "14-bit Bayer GBGB/RGRG Packed"; break;
case V4L2_PIX_FMT_SGRBG14P: descr = "14-bit Bayer GRGR/BGBG Packed"; break;
case V4L2_PIX_FMT_SRGGB14P: descr = "14-bit Bayer RGRG/GBGB Packed"; break;
+ case V4L2_PIX_FMT_CRU_RAW14: descr = "14-bit Raw CRU Packed"; break;
case V4L2_PIX_FMT_SBGGR16: descr = "16-bit Bayer BGBG/GRGR"; break;
case V4L2_PIX_FMT_SGBRG16: descr = "16-bit Bayer GBGB/RGRG"; break;
case V4L2_PIX_FMT_SGRBG16: descr = "16-bit Bayer GRGR/BGBG"; break;
case V4L2_PIX_FMT_SRGGB16: descr = "16-bit Bayer RGRG/GBGB"; break;
+ case V4L2_PIX_FMT_CRU_RAW20: descr = "14-bit Raw CRU Packed"; break;
case V4L2_PIX_FMT_SN9C20X_I420: descr = "GSPCA SN9C20X I420"; break;
case V4L2_PIX_FMT_SPCA501: descr = "GSPCA SPCA501"; break;
case V4L2_PIX_FMT_SPCA505: descr = "GSPCA SPCA505"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 9e3b366d5fc79d8a04c6f0752858fc23363db65c..13f741c94e49ff6c199efc7a213c4e0de74780fa 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -840,6 +840,12 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_PISP_COMP2_BGGR v4l2_fourcc('P', 'C', '2', 'B') /* PiSP 8-bit mode 2 compressed BGGR bayer */
#define V4L2_PIX_FMT_PISP_COMP2_MONO v4l2_fourcc('P', 'C', '2', 'M') /* PiSP 8-bit mode 2 compressed monochrome */
+/* Renesas RZ/V2H CRU packed formats. 64-bit units with contiguous pixels */
+#define V4L2_PIX_FMT_CRU_RAW10 v4l2_fourcc('C', 'R', '1', '0')
+#define V4L2_PIX_FMT_CRU_RAW12 v4l2_fourcc('C', 'R', '1', '2')
+#define V4L2_PIX_FMT_CRU_RAW14 v4l2_fourcc('C', 'R', '1', '4')
+#define V4L2_PIX_FMT_CRU_RAW20 v4l2_fourcc('C', 'R', '2', '0')
+
/* SDR formats - used only for Software Defined Radio devices */
#define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
#define V4L2_SDR_FMT_CU16LE v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats
2025-06-23 14:43 ` [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats Daniel Scally
@ 2025-06-24 10:25 ` Sakari Ailus
2025-06-24 12:40 ` Dan Scally
2025-06-24 15:20 ` Laurent Pinchart
0 siblings, 2 replies; 13+ messages in thread
From: Sakari Ailus @ 2025-06-24 10:25 UTC (permalink / raw)
To: Daniel Scally
Cc: linux-media, laurent.pinchart, prabhakar.mahadev-lad.rj,
jacopo.mondi, Hans Verkuil, Daniel Scally, Laurent Pinchart
Hi Daniel,
Thanks for the set.
On Mon, Jun 23, 2025 at 03:43:18PM +0100, Daniel Scally wrote:
> From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
>
> The Renesas Camera Receiver Unit in the RZ/V2H SoC can output RAW
> data captured from an image sensor without conversion to an RGB/YUV
> format. In that case the data are packed into 64-bit blocks, with a
> variable amount of padding in the most significant bits depending on
> the bitdepth of the data. Add new V4L2 pixel format codes for the new
> formats, along with documentation to describe them.
>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
> ---
> Changes in v5:
>
> - None
>
> Changes in v4:
>
> - Removed references to "Bayer" or "srgb"
>
> Changes in v3:
>
> - Switched from bayer-order specific formats to generic RAWnn
>
> Changes in v2:
>
> - Added labels to the new formats in the documentation file
> - Added 20-bit formats
> ---
> .../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
> .../userspace-api/media/v4l/pixfmt-rawnn-cru.rst | 143 +++++++++++++++++++++
> drivers/media/v4l2-core/v4l2-common.c | 6 +
> drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
> include/uapi/linux/videodev2.h | 6 +
> 5 files changed, 160 insertions(+)
>
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> index ed3eb432967d9845d3d65150831d8a7f62dec994..20a8aa04330479ed4d44c8e4fc3d57db8c2e6933 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> @@ -31,3 +31,4 @@ orders. See also `the Wikipedia article on Bayer filter
> pixfmt-srggb14
> pixfmt-srggb14p
> pixfmt-srggb16
> + pixfmt-rawnn-cru
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
> new file mode 100644
> index 0000000000000000000000000000000000000000..d786833d0cf355b3955fe63d85c8a211a7a4fb23
> --- /dev/null
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
> @@ -0,0 +1,143 @@
> +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> +
> +.. _v4l2-pix-fmt-cru-raw10:
> +.. _v4l2-pix-fmt-cru-raw12:
> +.. _v4l2-pix-fmt-cru-raw14:
> +.. _v4l2-pix-fmt-cru-raw20:
> +
> +**********************************************************************************************************************************
> +V4L2_PIX_FMT_CRU_RAW10 ('CR10'), V4L2_PIX_FMT_CRU_RAW12 ('CR12'), V4L2_PIX_FMT_CRU_RAW14 ('CR14'), V4L2_PIX_FMT_CRU_RAW20 ('CR20')
> +**********************************************************************************************************************************
Regarding naming, could these be called V4L2_PIX_FMT_RAW_CRUxx, to align
the naming with the new raw formats?
<URL:https://www.retiisi.eu/~sailus/v4l2/tmp/common-raw/userspace-api/media/v4l/pixfmt-raw-generic.html>
If you rebase on the metadata series, I can pick this patch in the set. My
objective is to get this merged in this cycle, which of course also depends
on review feedback.
--
Regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats
2025-06-24 10:25 ` Sakari Ailus
@ 2025-06-24 12:40 ` Dan Scally
2025-06-24 15:20 ` Laurent Pinchart
1 sibling, 0 replies; 13+ messages in thread
From: Dan Scally @ 2025-06-24 12:40 UTC (permalink / raw)
To: Sakari Ailus
Cc: linux-media, laurent.pinchart, prabhakar.mahadev-lad.rj,
jacopo.mondi, Hans Verkuil, Daniel Scally, Laurent Pinchart
Hi Sakari
On 24/06/2025 11:25, Sakari Ailus wrote:
> Hi Daniel,
>
> Thanks for the set.
>
> On Mon, Jun 23, 2025 at 03:43:18PM +0100, Daniel Scally wrote:
>> From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
>>
>> The Renesas Camera Receiver Unit in the RZ/V2H SoC can output RAW
>> data captured from an image sensor without conversion to an RGB/YUV
>> format. In that case the data are packed into 64-bit blocks, with a
>> variable amount of padding in the most significant bits depending on
>> the bitdepth of the data. Add new V4L2 pixel format codes for the new
>> formats, along with documentation to describe them.
>>
>> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
>> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
>> Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
>> ---
>> Changes in v5:
>>
>> - None
>>
>> Changes in v4:
>>
>> - Removed references to "Bayer" or "srgb"
>>
>> Changes in v3:
>>
>> - Switched from bayer-order specific formats to generic RAWnn
>>
>> Changes in v2:
>>
>> - Added labels to the new formats in the documentation file
>> - Added 20-bit formats
>> ---
>> .../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
>> .../userspace-api/media/v4l/pixfmt-rawnn-cru.rst | 143 +++++++++++++++++++++
>> drivers/media/v4l2-core/v4l2-common.c | 6 +
>> drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
>> include/uapi/linux/videodev2.h | 6 +
>> 5 files changed, 160 insertions(+)
>>
>> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
>> index ed3eb432967d9845d3d65150831d8a7f62dec994..20a8aa04330479ed4d44c8e4fc3d57db8c2e6933 100644
>> --- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
>> +++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
>> @@ -31,3 +31,4 @@ orders. See also `the Wikipedia article on Bayer filter
>> pixfmt-srggb14
>> pixfmt-srggb14p
>> pixfmt-srggb16
>> + pixfmt-rawnn-cru
>> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..d786833d0cf355b3955fe63d85c8a211a7a4fb23
>> --- /dev/null
>> +++ b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
>> @@ -0,0 +1,143 @@
>> +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
>> +
>> +.. _v4l2-pix-fmt-cru-raw10:
>> +.. _v4l2-pix-fmt-cru-raw12:
>> +.. _v4l2-pix-fmt-cru-raw14:
>> +.. _v4l2-pix-fmt-cru-raw20:
>> +
>> +**********************************************************************************************************************************
>> +V4L2_PIX_FMT_CRU_RAW10 ('CR10'), V4L2_PIX_FMT_CRU_RAW12 ('CR12'), V4L2_PIX_FMT_CRU_RAW14 ('CR14'), V4L2_PIX_FMT_CRU_RAW20 ('CR20')
>> +**********************************************************************************************************************************
> Regarding naming, could these be called V4L2_PIX_FMT_RAW_CRUxx, to align
> the naming with the new raw formats?
> <URL:https://www.retiisi.eu/~sailus/v4l2/tmp/common-raw/userspace-api/media/v4l/pixfmt-raw-generic.html>
>
> If you rebase on the metadata series, I can pick this patch in the set. My
> objective is to get this merged in this cycle, which of course also depends
> on review feedback.
Sounds good - I'm happy to rename them sure.
Thanks
Dan
>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats
2025-06-24 10:25 ` Sakari Ailus
2025-06-24 12:40 ` Dan Scally
@ 2025-06-24 15:20 ` Laurent Pinchart
2025-06-24 21:35 ` Sakari Ailus
1 sibling, 1 reply; 13+ messages in thread
From: Laurent Pinchart @ 2025-06-24 15:20 UTC (permalink / raw)
To: Sakari Ailus
Cc: Daniel Scally, linux-media, prabhakar.mahadev-lad.rj,
jacopo.mondi, Hans Verkuil, Daniel Scally
On Tue, Jun 24, 2025 at 10:25:19AM +0000, Sakari Ailus wrote:
> On Mon, Jun 23, 2025 at 03:43:18PM +0100, Daniel Scally wrote:
> > From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
> >
> > The Renesas Camera Receiver Unit in the RZ/V2H SoC can output RAW
> > data captured from an image sensor without conversion to an RGB/YUV
> > format. In that case the data are packed into 64-bit blocks, with a
> > variable amount of padding in the most significant bits depending on
> > the bitdepth of the data. Add new V4L2 pixel format codes for the new
> > formats, along with documentation to describe them.
> >
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
> > ---
> > Changes in v5:
> >
> > - None
> >
> > Changes in v4:
> >
> > - Removed references to "Bayer" or "srgb"
> >
> > Changes in v3:
> >
> > - Switched from bayer-order specific formats to generic RAWnn
> >
> > Changes in v2:
> >
> > - Added labels to the new formats in the documentation file
> > - Added 20-bit formats
> > ---
> > .../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
> > .../userspace-api/media/v4l/pixfmt-rawnn-cru.rst | 143 +++++++++++++++++++++
> > drivers/media/v4l2-core/v4l2-common.c | 6 +
> > drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
> > include/uapi/linux/videodev2.h | 6 +
> > 5 files changed, 160 insertions(+)
> >
> > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> > index ed3eb432967d9845d3d65150831d8a7f62dec994..20a8aa04330479ed4d44c8e4fc3d57db8c2e6933 100644
> > --- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> > +++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> > @@ -31,3 +31,4 @@ orders. See also `the Wikipedia article on Bayer filter
> > pixfmt-srggb14
> > pixfmt-srggb14p
> > pixfmt-srggb16
> > + pixfmt-rawnn-cru
> > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..d786833d0cf355b3955fe63d85c8a211a7a4fb23
> > --- /dev/null
> > +++ b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
> > @@ -0,0 +1,143 @@
> > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> > +
> > +.. _v4l2-pix-fmt-cru-raw10:
> > +.. _v4l2-pix-fmt-cru-raw12:
> > +.. _v4l2-pix-fmt-cru-raw14:
> > +.. _v4l2-pix-fmt-cru-raw20:
> > +
> > +**********************************************************************************************************************************
> > +V4L2_PIX_FMT_CRU_RAW10 ('CR10'), V4L2_PIX_FMT_CRU_RAW12 ('CR12'), V4L2_PIX_FMT_CRU_RAW14 ('CR14'), V4L2_PIX_FMT_CRU_RAW20 ('CR20')
> > +**********************************************************************************************************************************
>
> Regarding naming, could these be called V4L2_PIX_FMT_RAW_CRUxx, to align
> the naming with the new raw formats?
> <URL:https://www.retiisi.eu/~sailus/v4l2/tmp/common-raw/userspace-api/media/v4l/pixfmt-raw-generic.html>
>
> If you rebase on the metadata series, I can pick this patch in the set. My
> objective is to get this merged in this cycle, which of course also depends
> on review feedback.
Your set is big enough :-)
Unless I'm missing something, this patch doesn't depend on the metadata
series. I plan to pick up Dan's next version (with the formats renamed)
and send a pull request.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats
2025-06-24 15:20 ` Laurent Pinchart
@ 2025-06-24 21:35 ` Sakari Ailus
2025-06-24 22:02 ` Laurent Pinchart
0 siblings, 1 reply; 13+ messages in thread
From: Sakari Ailus @ 2025-06-24 21:35 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Daniel Scally, linux-media, prabhakar.mahadev-lad.rj,
jacopo.mondi, Hans Verkuil, Daniel Scally
Hi Laurent, Dan,
On Tue, Jun 24, 2025 at 06:20:33PM +0300, Laurent Pinchart wrote:
> On Tue, Jun 24, 2025 at 10:25:19AM +0000, Sakari Ailus wrote:
> > On Mon, Jun 23, 2025 at 03:43:18PM +0100, Daniel Scally wrote:
> > > From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
> > >
> > > The Renesas Camera Receiver Unit in the RZ/V2H SoC can output RAW
> > > data captured from an image sensor without conversion to an RGB/YUV
> > > format. In that case the data are packed into 64-bit blocks, with a
> > > variable amount of padding in the most significant bits depending on
> > > the bitdepth of the data. Add new V4L2 pixel format codes for the new
> > > formats, along with documentation to describe them.
> > >
> > > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > > Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
> > > ---
> > > Changes in v5:
> > >
> > > - None
> > >
> > > Changes in v4:
> > >
> > > - Removed references to "Bayer" or "srgb"
> > >
> > > Changes in v3:
> > >
> > > - Switched from bayer-order specific formats to generic RAWnn
> > >
> > > Changes in v2:
> > >
> > > - Added labels to the new formats in the documentation file
> > > - Added 20-bit formats
> > > ---
> > > .../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
> > > .../userspace-api/media/v4l/pixfmt-rawnn-cru.rst | 143 +++++++++++++++++++++
> > > drivers/media/v4l2-core/v4l2-common.c | 6 +
> > > drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
> > > include/uapi/linux/videodev2.h | 6 +
> > > 5 files changed, 160 insertions(+)
> > >
> > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> > > index ed3eb432967d9845d3d65150831d8a7f62dec994..20a8aa04330479ed4d44c8e4fc3d57db8c2e6933 100644
> > > --- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> > > +++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> > > @@ -31,3 +31,4 @@ orders. See also `the Wikipedia article on Bayer filter
> > > pixfmt-srggb14
> > > pixfmt-srggb14p
> > > pixfmt-srggb16
> > > + pixfmt-rawnn-cru
> > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
> > > new file mode 100644
> > > index 0000000000000000000000000000000000000000..d786833d0cf355b3955fe63d85c8a211a7a4fb23
> > > --- /dev/null
> > > +++ b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
> > > @@ -0,0 +1,143 @@
> > > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> > > +
> > > +.. _v4l2-pix-fmt-cru-raw10:
> > > +.. _v4l2-pix-fmt-cru-raw12:
> > > +.. _v4l2-pix-fmt-cru-raw14:
> > > +.. _v4l2-pix-fmt-cru-raw20:
> > > +
> > > +**********************************************************************************************************************************
> > > +V4L2_PIX_FMT_CRU_RAW10 ('CR10'), V4L2_PIX_FMT_CRU_RAW12 ('CR12'), V4L2_PIX_FMT_CRU_RAW14 ('CR14'), V4L2_PIX_FMT_CRU_RAW20 ('CR20')
> > > +**********************************************************************************************************************************
> >
> > Regarding naming, could these be called V4L2_PIX_FMT_RAW_CRUxx, to align
> > the naming with the new raw formats?
> > <URL:https://www.retiisi.eu/~sailus/v4l2/tmp/common-raw/userspace-api/media/v4l/pixfmt-raw-generic.html>
> >
> > If you rebase on the metadata series, I can pick this patch in the set. My
> > objective is to get this merged in this cycle, which of course also depends
> > on review feedback.
>
> Your set is big enough :-)
>
> Unless I'm missing something, this patch doesn't depend on the metadata
> series. I plan to pick up Dan's next version (with the formats renamed)
> and send a pull request.
That works, too. I believe people are generally happy with the approach of
conveying the color pattern. But you still need the metadata series for
these to work I suppose?
Do you btw. intend to use these in conjunction with the usual Bayer mbus
codes? It might be useful to have helpers for this purpose but we could add
them later on (and probably not just for that).
--
Regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats
2025-06-24 21:35 ` Sakari Ailus
@ 2025-06-24 22:02 ` Laurent Pinchart
2025-06-24 22:41 ` Dan Scally
0 siblings, 1 reply; 13+ messages in thread
From: Laurent Pinchart @ 2025-06-24 22:02 UTC (permalink / raw)
To: Sakari Ailus
Cc: Daniel Scally, linux-media, prabhakar.mahadev-lad.rj,
jacopo.mondi, Hans Verkuil, Daniel Scally
On Tue, Jun 24, 2025 at 09:35:04PM +0000, Sakari Ailus wrote:
> On Tue, Jun 24, 2025 at 06:20:33PM +0300, Laurent Pinchart wrote:
> > On Tue, Jun 24, 2025 at 10:25:19AM +0000, Sakari Ailus wrote:
> > > On Mon, Jun 23, 2025 at 03:43:18PM +0100, Daniel Scally wrote:
> > > > From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
> > > >
> > > > The Renesas Camera Receiver Unit in the RZ/V2H SoC can output RAW
> > > > data captured from an image sensor without conversion to an RGB/YUV
> > > > format. In that case the data are packed into 64-bit blocks, with a
> > > > variable amount of padding in the most significant bits depending on
> > > > the bitdepth of the data. Add new V4L2 pixel format codes for the new
> > > > formats, along with documentation to describe them.
> > > >
> > > > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > > > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > > > Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
> > > > ---
> > > > Changes in v5:
> > > >
> > > > - None
> > > >
> > > > Changes in v4:
> > > >
> > > > - Removed references to "Bayer" or "srgb"
> > > >
> > > > Changes in v3:
> > > >
> > > > - Switched from bayer-order specific formats to generic RAWnn
> > > >
> > > > Changes in v2:
> > > >
> > > > - Added labels to the new formats in the documentation file
> > > > - Added 20-bit formats
> > > > ---
> > > > .../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
> > > > .../userspace-api/media/v4l/pixfmt-rawnn-cru.rst | 143 +++++++++++++++++++++
> > > > drivers/media/v4l2-core/v4l2-common.c | 6 +
> > > > drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
> > > > include/uapi/linux/videodev2.h | 6 +
> > > > 5 files changed, 160 insertions(+)
> > > >
> > > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> > > > index ed3eb432967d9845d3d65150831d8a7f62dec994..20a8aa04330479ed4d44c8e4fc3d57db8c2e6933 100644
> > > > --- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> > > > +++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
> > > > @@ -31,3 +31,4 @@ orders. See also `the Wikipedia article on Bayer filter
> > > > pixfmt-srggb14
> > > > pixfmt-srggb14p
> > > > pixfmt-srggb16
> > > > + pixfmt-rawnn-cru
> > > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
> > > > new file mode 100644
> > > > index 0000000000000000000000000000000000000000..d786833d0cf355b3955fe63d85c8a211a7a4fb23
> > > > --- /dev/null
> > > > +++ b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
> > > > @@ -0,0 +1,143 @@
> > > > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> > > > +
> > > > +.. _v4l2-pix-fmt-cru-raw10:
> > > > +.. _v4l2-pix-fmt-cru-raw12:
> > > > +.. _v4l2-pix-fmt-cru-raw14:
> > > > +.. _v4l2-pix-fmt-cru-raw20:
> > > > +
> > > > +**********************************************************************************************************************************
> > > > +V4L2_PIX_FMT_CRU_RAW10 ('CR10'), V4L2_PIX_FMT_CRU_RAW12 ('CR12'), V4L2_PIX_FMT_CRU_RAW14 ('CR14'), V4L2_PIX_FMT_CRU_RAW20 ('CR20')
> > > > +**********************************************************************************************************************************
> > >
> > > Regarding naming, could these be called V4L2_PIX_FMT_RAW_CRUxx, to align
> > > the naming with the new raw formats?
> > > <URL:https://www.retiisi.eu/~sailus/v4l2/tmp/common-raw/userspace-api/media/v4l/pixfmt-raw-generic.html>
> > >
> > > If you rebase on the metadata series, I can pick this patch in the set. My
> > > objective is to get this merged in this cycle, which of course also depends
> > > on review feedback.
> >
> > Your set is big enough :-)
> >
> > Unless I'm missing something, this patch doesn't depend on the metadata
> > series. I plan to pick up Dan's next version (with the formats renamed)
> > and send a pull request.
>
> That works, too. I believe people are generally happy with the approach of
> conveying the color pattern. But you still need the metadata series for
> these to work I suppose?
Not with this patch series, as far as I can tell.
> Do you btw. intend to use these in conjunction with the usual Bayer mbus
> codes? It might be useful to have helpers for this purpose but we could add
> them later on (and probably not just for that).
See patch 6/6, the regularo bayer media bus codes are used with these
pixel formats.
Ideally I'd ditch the bayer media bus codes and use the raw media bus
codes, but those are not in mainline yet. It would add a dependency on
the metadata series.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats
2025-06-24 22:02 ` Laurent Pinchart
@ 2025-06-24 22:41 ` Dan Scally
0 siblings, 0 replies; 13+ messages in thread
From: Dan Scally @ 2025-06-24 22:41 UTC (permalink / raw)
To: Laurent Pinchart, Sakari Ailus
Cc: linux-media, prabhakar.mahadev-lad.rj, jacopo.mondi, Hans Verkuil,
Daniel Scally
Hi Laurent, Sakari
On 24/06/2025 23:02, Laurent Pinchart wrote:
> On Tue, Jun 24, 2025 at 09:35:04PM +0000, Sakari Ailus wrote:
>> On Tue, Jun 24, 2025 at 06:20:33PM +0300, Laurent Pinchart wrote:
>>> On Tue, Jun 24, 2025 at 10:25:19AM +0000, Sakari Ailus wrote:
>>>> On Mon, Jun 23, 2025 at 03:43:18PM +0100, Daniel Scally wrote:
>>>>> From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
>>>>>
>>>>> The Renesas Camera Receiver Unit in the RZ/V2H SoC can output RAW
>>>>> data captured from an image sensor without conversion to an RGB/YUV
>>>>> format. In that case the data are packed into 64-bit blocks, with a
>>>>> variable amount of padding in the most significant bits depending on
>>>>> the bitdepth of the data. Add new V4L2 pixel format codes for the new
>>>>> formats, along with documentation to describe them.
>>>>>
>>>>> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>>>>> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
>>>>> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
>>>>> Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
>>>>> ---
>>>>> Changes in v5:
>>>>>
>>>>> - None
>>>>>
>>>>> Changes in v4:
>>>>>
>>>>> - Removed references to "Bayer" or "srgb"
>>>>>
>>>>> Changes in v3:
>>>>>
>>>>> - Switched from bayer-order specific formats to generic RAWnn
>>>>>
>>>>> Changes in v2:
>>>>>
>>>>> - Added labels to the new formats in the documentation file
>>>>> - Added 20-bit formats
>>>>> ---
>>>>> .../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
>>>>> .../userspace-api/media/v4l/pixfmt-rawnn-cru.rst | 143 +++++++++++++++++++++
>>>>> drivers/media/v4l2-core/v4l2-common.c | 6 +
>>>>> drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
>>>>> include/uapi/linux/videodev2.h | 6 +
>>>>> 5 files changed, 160 insertions(+)
>>>>>
>>>>> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
>>>>> index ed3eb432967d9845d3d65150831d8a7f62dec994..20a8aa04330479ed4d44c8e4fc3d57db8c2e6933 100644
>>>>> --- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
>>>>> +++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
>>>>> @@ -31,3 +31,4 @@ orders. See also `the Wikipedia article on Bayer filter
>>>>> pixfmt-srggb14
>>>>> pixfmt-srggb14p
>>>>> pixfmt-srggb16
>>>>> + pixfmt-rawnn-cru
>>>>> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
>>>>> new file mode 100644
>>>>> index 0000000000000000000000000000000000000000..d786833d0cf355b3955fe63d85c8a211a7a4fb23
>>>>> --- /dev/null
>>>>> +++ b/Documentation/userspace-api/media/v4l/pixfmt-rawnn-cru.rst
>>>>> @@ -0,0 +1,143 @@
>>>>> +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
>>>>> +
>>>>> +.. _v4l2-pix-fmt-cru-raw10:
>>>>> +.. _v4l2-pix-fmt-cru-raw12:
>>>>> +.. _v4l2-pix-fmt-cru-raw14:
>>>>> +.. _v4l2-pix-fmt-cru-raw20:
>>>>> +
>>>>> +**********************************************************************************************************************************
>>>>> +V4L2_PIX_FMT_CRU_RAW10 ('CR10'), V4L2_PIX_FMT_CRU_RAW12 ('CR12'), V4L2_PIX_FMT_CRU_RAW14 ('CR14'), V4L2_PIX_FMT_CRU_RAW20 ('CR20')
>>>>> +**********************************************************************************************************************************
>>>> Regarding naming, could these be called V4L2_PIX_FMT_RAW_CRUxx, to align
>>>> the naming with the new raw formats?
>>>> <URL:https://www.retiisi.eu/~sailus/v4l2/tmp/common-raw/userspace-api/media/v4l/pixfmt-raw-generic.html>
>>>>
>>>> If you rebase on the metadata series, I can pick this patch in the set. My
>>>> objective is to get this merged in this cycle, which of course also depends
>>>> on review feedback.
>>> Your set is big enough :-)
>>>
>>> Unless I'm missing something, this patch doesn't depend on the metadata
>>> series. I plan to pick up Dan's next version (with the formats renamed)
>>> and send a pull request.
>> That works, too. I believe people are generally happy with the approach of
>> conveying the color pattern. But you still need the metadata series for
>> these to work I suppose?
> Not with this patch series, as far as I can tell.
No; I'm not using the metadata series - this works without it.
>
>> Do you btw. intend to use these in conjunction with the usual Bayer mbus
>> codes? It might be useful to have helpers for this purpose but we could add
>> them later on (and probably not just for that).
> See patch 6/6, the regularo bayer media bus codes are used with these
> pixel formats.
Indeed
> Ideally I'd ditch the bayer media bus codes and use the raw media bus
> codes, but those are not in mainline yet. It would add a dependency on
> the metadata series.
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v5 2/6] media: rzg2l-cru: Add vidioc_enum_framesizes()
2025-06-23 14:43 [PATCH v5 0/6] Extend RAW format support for rzg2l-cru driver Daniel Scally
2025-06-23 14:43 ` [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats Daniel Scally
@ 2025-06-23 14:43 ` Daniel Scally
2025-06-23 14:43 ` [PATCH v5 3/6] media: platform: rzg2l-cru: Use v4l2_get_link_freq() Daniel Scally
` (3 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Daniel Scally @ 2025-06-23 14:43 UTC (permalink / raw)
To: linux-media
Cc: sakari.ailus, laurent.pinchart, prabhakar.mahadev-lad.rj,
jacopo.mondi, dan.scally, Hans Verkuil, Daniel Scally,
Laurent Pinchart
From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
Add a callback to implement the VIDIOC_ENUM_FRAMESIZES ioctl for the
CRU driver.
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
---
Changes in v5:
- None
Changes in v4:
- New patch
---
.../media/platform/renesas/rzg2l-cru/rzg2l-video.c | 26 ++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
index 067c6af14e956d42bb82328cb33c91df6b7f1d54..a92c6fc4dfaff7931700e967460802725c3dcd56 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
@@ -1031,6 +1031,31 @@ static int rzg2l_cru_enum_fmt_vid_cap(struct file *file, void *priv,
return 0;
}
+static int rzg2l_cru_enum_framesizes(struct file *file, void *fh,
+ struct v4l2_frmsizeenum *fsize)
+{
+ struct rzg2l_cru_dev *cru = video_drvdata(file);
+ const struct rzg2l_cru_info *info = cru->info;
+ const struct rzg2l_cru_ip_format *fmt;
+
+ if (fsize->index)
+ return -EINVAL;
+
+ fmt = rzg2l_cru_ip_format_to_fmt(fsize->pixel_format);
+ if (!fmt)
+ return -EINVAL;
+
+ fsize->type = V4L2_FRMIVAL_TYPE_CONTINUOUS;
+ fsize->stepwise.min_width = RZG2L_CRU_MIN_INPUT_WIDTH;
+ fsize->stepwise.max_width = info->max_width;
+ fsize->stepwise.step_width = 1;
+ fsize->stepwise.min_height = RZG2L_CRU_MIN_INPUT_HEIGHT;
+ fsize->stepwise.max_height = info->max_height;
+ fsize->stepwise.step_height = 1;
+
+ return 0;
+}
+
static const struct v4l2_ioctl_ops rzg2l_cru_ioctl_ops = {
.vidioc_querycap = rzg2l_cru_querycap,
.vidioc_try_fmt_vid_cap = rzg2l_cru_try_fmt_vid_cap,
@@ -1047,6 +1072,7 @@ static const struct v4l2_ioctl_ops rzg2l_cru_ioctl_ops = {
.vidioc_prepare_buf = vb2_ioctl_prepare_buf,
.vidioc_streamon = vb2_ioctl_streamon,
.vidioc_streamoff = vb2_ioctl_streamoff,
+ .vidioc_enum_framesizes = rzg2l_cru_enum_framesizes,
};
/* -----------------------------------------------------------------------------
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 3/6] media: platform: rzg2l-cru: Use v4l2_get_link_freq()
2025-06-23 14:43 [PATCH v5 0/6] Extend RAW format support for rzg2l-cru driver Daniel Scally
2025-06-23 14:43 ` [PATCH v5 1/6] media: v4l2: Add Renesas Camera Receiver Unit pixel formats Daniel Scally
2025-06-23 14:43 ` [PATCH v5 2/6] media: rzg2l-cru: Add vidioc_enum_framesizes() Daniel Scally
@ 2025-06-23 14:43 ` Daniel Scally
2025-06-23 14:43 ` [PATCH v5 4/6] media: platform: rzg2l-cru: Use v4l2_fill_pixfmt() Daniel Scally
` (2 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Daniel Scally @ 2025-06-23 14:43 UTC (permalink / raw)
To: linux-media
Cc: sakari.ailus, laurent.pinchart, prabhakar.mahadev-lad.rj,
jacopo.mondi, dan.scally, Hans Verkuil, Daniel Scally,
Laurent Pinchart
From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
The rzg2l_csi2_calc_mbps() function currently tries to calculate the
link frequency for a CSI2 bus using the V4L2_CID_PIXEL_RATE control
of the remote subdevice. Switch the function to v4l2_get_link_freq()
which correctly targets V4L2_CID_LINK_FREQ before falling back on
V4L2_CID_PIXEL_RATE if the former is unavailable.
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
---
Changes in v5:
- Switched to passing the pad to v4l2_get_link_freq() instead of the
V4L2 control handler
- Corrected the frequency returned
Changes in v4:
- Used separate s64 variable as return value for v4l2_get_link_freq()
and as the mbps variable for do_div() to avoid compilation warnings.
Changes in v3:
- Fixed mbps sign
Changes in v2:
- None
---
.../media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 33 +++++++++++++---------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
index 9243306e2aa98587ed8aa70bc91f9ca4758362c8..cec165551183afb71ae019b277c46a17a0f8096d 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
@@ -282,15 +282,18 @@ static int rzg2l_csi2_calc_mbps(struct rzg2l_csi2 *csi2)
const struct rzg2l_csi2_format *format;
const struct v4l2_mbus_framefmt *fmt;
struct v4l2_subdev_state *state;
- struct v4l2_ctrl *ctrl;
+ struct media_pad *remote_pad;
u64 mbps;
+ s64 ret;
- /* Read the pixel rate control from remote. */
- ctrl = v4l2_ctrl_find(source->ctrl_handler, V4L2_CID_PIXEL_RATE);
- if (!ctrl) {
- dev_err(csi2->dev, "no pixel rate control in subdev %s\n",
- source->name);
- return -EINVAL;
+ if (!csi2->remote_source)
+ return -ENODEV;
+
+ remote_pad = media_pad_remote_pad_unique(&csi2->pads[RZG2L_CSI2_SINK]);
+ if (IS_ERR(remote_pad)) {
+ dev_err(csi2->dev, "can't get source pad of %s (%ld)\n",
+ csi2->remote_source->name, PTR_ERR(remote_pad));
+ return PTR_ERR(remote_pad);
}
state = v4l2_subdev_lock_and_get_active_state(&csi2->subdev);
@@ -298,12 +301,16 @@ static int rzg2l_csi2_calc_mbps(struct rzg2l_csi2 *csi2)
format = rzg2l_csi2_code_to_fmt(fmt->code);
v4l2_subdev_unlock_state(state);
- /*
- * Calculate hsfreq in Mbps
- * hsfreq = (pixel_rate * bits_per_sample) / number_of_lanes
- */
- mbps = v4l2_ctrl_g_ctrl_int64(ctrl) * format->bpp;
- do_div(mbps, csi2->lanes * 1000000);
+ /* Read the link frequency from remote subdevice. */
+ ret = v4l2_get_link_freq(remote_pad, format->bpp, csi2->lanes * 2);
+ if (ret < 0) {
+ dev_err(csi2->dev, "can't retrieve link freq from subdev %s\n",
+ source->name);
+ return -EINVAL;
+ }
+
+ mbps = ret * 2;
+ do_div(mbps, 1000000);
return mbps;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 4/6] media: platform: rzg2l-cru: Use v4l2_fill_pixfmt()
2025-06-23 14:43 [PATCH v5 0/6] Extend RAW format support for rzg2l-cru driver Daniel Scally
` (2 preceding siblings ...)
2025-06-23 14:43 ` [PATCH v5 3/6] media: platform: rzg2l-cru: Use v4l2_get_link_freq() Daniel Scally
@ 2025-06-23 14:43 ` Daniel Scally
2025-06-23 14:43 ` [PATCH v5 5/6] media: rzg2l-cru: Support multiple mbus codes per pixel format Daniel Scally
2025-06-23 14:43 ` [PATCH v5 6/6] media: platform: rzg2l-cru: Add support for RAW10/12/14 data Daniel Scally
5 siblings, 0 replies; 13+ messages in thread
From: Daniel Scally @ 2025-06-23 14:43 UTC (permalink / raw)
To: linux-media
Cc: sakari.ailus, laurent.pinchart, prabhakar.mahadev-lad.rj,
jacopo.mondi, dan.scally, Hans Verkuil, Daniel Scally,
Laurent Pinchart
From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
Rather than open-code a calculation of the format's bytesperline
and sizeimage, use the v4l2_fill_pixfmt() helper. This makes it
easier to support the CRU packed pixel formats without over
complicating the driver.
This change makes the .bpp member of struct rzg2l_cru_ip_format
superfluous - remove them.
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
---
Changes in v5:
- None
Changes in v4:
- None
Changes in v3:
- None
Changes in v2:
- Minor changes due to rebase
---
drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 2 --
drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 5 -----
drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 10 +---------
3 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
index c30f3b2812846a804168c9c2f7e0433a672c602f..8d74bdfae7c854f8f4c9c82303b455ef8c6d5db3 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
@@ -68,7 +68,6 @@ struct rzg2l_cru_ip {
* @datatype: MIPI CSI2 data type
* @format: 4CC format identifier (V4L2_PIX_FMT_*)
* @icndmr: ICnDMR register value
- * @bpp: bytes per pixel
* @yuv: Flag to indicate whether the format is YUV-based.
*/
struct rzg2l_cru_ip_format {
@@ -76,7 +75,6 @@ struct rzg2l_cru_ip_format {
u32 datatype;
u32 format;
u32 icndmr;
- u8 bpp;
bool yuv;
};
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c
index 7836c7cd53dc3ff9a2c8c5e53be0265a20956e30..15fc1028082add27ad3d6fa9e1314b6240ff0d4e 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c
@@ -16,7 +16,6 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
.code = MEDIA_BUS_FMT_UYVY8_1X16,
.datatype = MIPI_CSI2_DT_YUV422_8B,
.format = V4L2_PIX_FMT_UYVY,
- .bpp = 2,
.icndmr = ICnDMR_YCMODE_UYVY,
.yuv = true,
},
@@ -24,7 +23,6 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
.code = MEDIA_BUS_FMT_SBGGR8_1X8,
.format = V4L2_PIX_FMT_SBGGR8,
.datatype = MIPI_CSI2_DT_RAW8,
- .bpp = 1,
.icndmr = 0,
.yuv = false,
},
@@ -32,7 +30,6 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
.code = MEDIA_BUS_FMT_SGBRG8_1X8,
.format = V4L2_PIX_FMT_SGBRG8,
.datatype = MIPI_CSI2_DT_RAW8,
- .bpp = 1,
.icndmr = 0,
.yuv = false,
},
@@ -40,7 +37,6 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
.code = MEDIA_BUS_FMT_SGRBG8_1X8,
.format = V4L2_PIX_FMT_SGRBG8,
.datatype = MIPI_CSI2_DT_RAW8,
- .bpp = 1,
.icndmr = 0,
.yuv = false,
},
@@ -48,7 +44,6 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
.code = MEDIA_BUS_FMT_SRGGB8_1X8,
.format = V4L2_PIX_FMT_SRGGB8,
.datatype = MIPI_CSI2_DT_RAW8,
- .bpp = 1,
.icndmr = 0,
.yuv = false,
},
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
index a92c6fc4dfaff7931700e967460802725c3dcd56..650a23f7b5bd61ee035dd35d1754c5d9b5e614f6 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
@@ -941,15 +941,7 @@ static void rzg2l_cru_format_align(struct rzg2l_cru_dev *cru,
v4l_bound_align_image(&pix->width, 320, info->max_width, 1,
&pix->height, 240, info->max_height, 2, 0);
- if (info->has_stride) {
- u32 stride = clamp(pix->bytesperline, pix->width * fmt->bpp,
- RZG2L_CRU_STRIDE_MAX);
- pix->bytesperline = round_up(stride, RZG2L_CRU_STRIDE_ALIGN);
- } else {
- pix->bytesperline = pix->width * fmt->bpp;
- }
-
- pix->sizeimage = pix->bytesperline * pix->height;
+ v4l2_fill_pixfmt(pix, pix->pixelformat, pix->width, pix->height);
dev_dbg(cru->dev, "Format %ux%u bpl: %u size: %u\n",
pix->width, pix->height, pix->bytesperline, pix->sizeimage);
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 5/6] media: rzg2l-cru: Support multiple mbus codes per pixel format
2025-06-23 14:43 [PATCH v5 0/6] Extend RAW format support for rzg2l-cru driver Daniel Scally
` (3 preceding siblings ...)
2025-06-23 14:43 ` [PATCH v5 4/6] media: platform: rzg2l-cru: Use v4l2_fill_pixfmt() Daniel Scally
@ 2025-06-23 14:43 ` Daniel Scally
2025-06-23 14:43 ` [PATCH v5 6/6] media: platform: rzg2l-cru: Add support for RAW10/12/14 data Daniel Scally
5 siblings, 0 replies; 13+ messages in thread
From: Daniel Scally @ 2025-06-23 14:43 UTC (permalink / raw)
To: linux-media
Cc: sakari.ailus, laurent.pinchart, prabhakar.mahadev-lad.rj,
jacopo.mondi, dan.scally, Hans Verkuil, Daniel Scally,
Laurent Pinchart
From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
As a preliminary step for supporting the CRU pixel formats, extend
the driver such that multiple media bus codes can support each of
the output pixel formats.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
---
Changes in v5:
- None
Changes in v4:
- None
Changes in v3:
- New patch due to changes to patch 1
---
.../media/platform/renesas/rzg2l-cru/rzg2l-cru.h | 8 ++-
.../media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 67 +++++++++++++++++-----
.../media/platform/renesas/rzg2l-cru/rzg2l-video.c | 2 +-
3 files changed, 61 insertions(+), 16 deletions(-)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
index 8d74bdfae7c854f8f4c9c82303b455ef8c6d5db3..49b11d0b814850042d1b3ca3b72725d0220c2987 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
@@ -71,7 +71,11 @@ struct rzg2l_cru_ip {
* @yuv: Flag to indicate whether the format is YUV-based.
*/
struct rzg2l_cru_ip_format {
- u32 code;
+ /*
+ * RAW output formats might be produced by RAW media codes with any one
+ * of the 4 common bayer patterns.
+ */
+ u32 codes[4];
u32 datatype;
u32 format;
u32 icndmr;
@@ -190,6 +194,8 @@ struct v4l2_mbus_framefmt *rzg2l_cru_ip_get_src_fmt(struct rzg2l_cru_dev *cru);
const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code);
const struct rzg2l_cru_ip_format *rzg2l_cru_ip_format_to_fmt(u32 format);
const struct rzg2l_cru_ip_format *rzg2l_cru_ip_index_to_fmt(u32 index);
+bool rzg2l_cru_ip_fmt_supports_mbus_code(const struct rzg2l_cru_ip_format *fmt,
+ unsigned int code);
void rzg2l_cru_enable_interrupts(struct rzg2l_cru_dev *cru);
void rzg2l_cru_disable_interrupts(struct rzg2l_cru_dev *cru);
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c
index 15fc1028082add27ad3d6fa9e1314b6240ff0d4e..fbbcdb96c4570baf07cc9685c2fc847fb489df89 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c
@@ -13,35 +13,45 @@
static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
{
- .code = MEDIA_BUS_FMT_UYVY8_1X16,
+ .codes = {
+ MEDIA_BUS_FMT_UYVY8_1X16,
+ },
.datatype = MIPI_CSI2_DT_YUV422_8B,
.format = V4L2_PIX_FMT_UYVY,
.icndmr = ICnDMR_YCMODE_UYVY,
.yuv = true,
},
{
- .code = MEDIA_BUS_FMT_SBGGR8_1X8,
+ .codes = {
+ MEDIA_BUS_FMT_SBGGR8_1X8,
+ },
.format = V4L2_PIX_FMT_SBGGR8,
.datatype = MIPI_CSI2_DT_RAW8,
.icndmr = 0,
.yuv = false,
},
{
- .code = MEDIA_BUS_FMT_SGBRG8_1X8,
+ .codes = {
+ MEDIA_BUS_FMT_SGBRG8_1X8,
+ },
.format = V4L2_PIX_FMT_SGBRG8,
.datatype = MIPI_CSI2_DT_RAW8,
.icndmr = 0,
.yuv = false,
},
{
- .code = MEDIA_BUS_FMT_SGRBG8_1X8,
+ .codes = {
+ MEDIA_BUS_FMT_SGRBG8_1X8,
+ },
.format = V4L2_PIX_FMT_SGRBG8,
.datatype = MIPI_CSI2_DT_RAW8,
.icndmr = 0,
.yuv = false,
},
{
- .code = MEDIA_BUS_FMT_SRGGB8_1X8,
+ .codes = {
+ MEDIA_BUS_FMT_SRGGB8_1X8,
+ },
.format = V4L2_PIX_FMT_SRGGB8,
.datatype = MIPI_CSI2_DT_RAW8,
.icndmr = 0,
@@ -51,11 +61,14 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code)
{
- unsigned int i;
+ unsigned int i, j;
- for (i = 0; i < ARRAY_SIZE(rzg2l_cru_ip_formats); i++)
- if (rzg2l_cru_ip_formats[i].code == code)
- return &rzg2l_cru_ip_formats[i];
+ for (i = 0; i < ARRAY_SIZE(rzg2l_cru_ip_formats); i++) {
+ for (j = 0; j < ARRAY_SIZE(rzg2l_cru_ip_formats[i].codes); j++) {
+ if (rzg2l_cru_ip_formats[i].codes[j] == code)
+ return &rzg2l_cru_ip_formats[i];
+ }
+ }
return NULL;
}
@@ -80,6 +93,17 @@ const struct rzg2l_cru_ip_format *rzg2l_cru_ip_index_to_fmt(u32 index)
return &rzg2l_cru_ip_formats[index];
}
+bool rzg2l_cru_ip_fmt_supports_mbus_code(const struct rzg2l_cru_ip_format *fmt,
+ unsigned int code)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(fmt->codes); i++)
+ if (fmt->codes[i] == code)
+ return true;
+
+ return false;
+}
struct v4l2_mbus_framefmt *rzg2l_cru_ip_get_src_fmt(struct rzg2l_cru_dev *cru)
{
struct v4l2_subdev_state *state;
@@ -157,7 +181,7 @@ static int rzg2l_cru_ip_set_format(struct v4l2_subdev *sd,
sink_format = v4l2_subdev_state_get_format(state, fmt->pad);
if (!rzg2l_cru_ip_code_to_fmt(fmt->format.code))
- sink_format->code = rzg2l_cru_ip_formats[0].code;
+ sink_format->code = rzg2l_cru_ip_formats[0].codes[0];
else
sink_format->code = fmt->format.code;
@@ -183,11 +207,26 @@ static int rzg2l_cru_ip_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
struct v4l2_subdev_mbus_code_enum *code)
{
- if (code->index >= ARRAY_SIZE(rzg2l_cru_ip_formats))
- return -EINVAL;
+ unsigned int index = code->index;
+ unsigned int i, j;
- code->code = rzg2l_cru_ip_formats[code->index].code;
- return 0;
+ for (i = 0; i < ARRAY_SIZE(rzg2l_cru_ip_formats); i++) {
+ const struct rzg2l_cru_ip_format *fmt = &rzg2l_cru_ip_formats[i];
+
+ for (j = 0; j < ARRAY_SIZE(fmt->codes); j++) {
+ if (!fmt->codes[j])
+ continue;
+
+ if (!index) {
+ code->code = fmt->codes[j];
+ return 0;
+ }
+
+ index--;
+ }
+ }
+
+ return -EINVAL;
}
static int rzg2l_cru_ip_enum_frame_size(struct v4l2_subdev *sd,
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
index 650a23f7b5bd61ee035dd35d1754c5d9b5e614f6..8e83eb5ed5c32e1ee1a8355dc6144eb18ca598cf 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
@@ -1147,7 +1147,7 @@ static int rzg2l_cru_video_link_validate(struct media_link *link)
if (fmt.format.width != cru->format.width ||
fmt.format.height != cru->format.height ||
fmt.format.field != cru->format.field ||
- video_fmt->code != fmt.format.code)
+ !rzg2l_cru_ip_fmt_supports_mbus_code(video_fmt, fmt.format.code))
return -EPIPE;
return 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH v5 6/6] media: platform: rzg2l-cru: Add support for RAW10/12/14 data
2025-06-23 14:43 [PATCH v5 0/6] Extend RAW format support for rzg2l-cru driver Daniel Scally
` (4 preceding siblings ...)
2025-06-23 14:43 ` [PATCH v5 5/6] media: rzg2l-cru: Support multiple mbus codes per pixel format Daniel Scally
@ 2025-06-23 14:43 ` Daniel Scally
5 siblings, 0 replies; 13+ messages in thread
From: Daniel Scally @ 2025-06-23 14:43 UTC (permalink / raw)
To: linux-media
Cc: sakari.ailus, laurent.pinchart, prabhakar.mahadev-lad.rj,
jacopo.mondi, dan.scally, Hans Verkuil, Daniel Scally
From: Daniel Scally <dan.scally+renesas@ideasonboard.com>
Add support to the rzg2l-cru driver to capture 10/12/14 bit bayer
data and output it into the CRU's 64-bit packed pixel format.
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
---
Changes in v5:
- None
Changes in v4:
- None
Changes in v3:
- Fewer new entries as the RAWnn pixel formats support multiple mbus
codes
Changes in v2:
- Minor updates accounting for rebase
---
.../media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 12 ++++++++
.../media/platform/renesas/rzg2l-cru/rzg2l-ip.c | 36 ++++++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
index cec165551183afb71ae019b277c46a17a0f8096d..1520211e74185fea3bca85f36239254f6b4651db 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
@@ -232,6 +232,18 @@ static const struct rzg2l_csi2_format rzg2l_csi2_formats[] = {
{ .code = MEDIA_BUS_FMT_SGBRG8_1X8, .bpp = 8, },
{ .code = MEDIA_BUS_FMT_SGRBG8_1X8, .bpp = 8, },
{ .code = MEDIA_BUS_FMT_SRGGB8_1X8, .bpp = 8, },
+ { .code = MEDIA_BUS_FMT_SBGGR10_1X10, .bpp = 10, },
+ { .code = MEDIA_BUS_FMT_SGBRG10_1X10, .bpp = 10, },
+ { .code = MEDIA_BUS_FMT_SGRBG10_1X10, .bpp = 10, },
+ { .code = MEDIA_BUS_FMT_SRGGB10_1X10, .bpp = 10, },
+ { .code = MEDIA_BUS_FMT_SBGGR12_1X12, .bpp = 12, },
+ { .code = MEDIA_BUS_FMT_SGBRG12_1X12, .bpp = 12, },
+ { .code = MEDIA_BUS_FMT_SGRBG12_1X12, .bpp = 12, },
+ { .code = MEDIA_BUS_FMT_SRGGB12_1X12, .bpp = 12, },
+ { .code = MEDIA_BUS_FMT_SBGGR14_1X14, .bpp = 14, },
+ { .code = MEDIA_BUS_FMT_SGBRG14_1X14, .bpp = 14, },
+ { .code = MEDIA_BUS_FMT_SGRBG14_1X14, .bpp = 14, },
+ { .code = MEDIA_BUS_FMT_SRGGB14_1X14, .bpp = 14, },
};
static inline struct rzg2l_csi2 *sd_to_csi2(struct v4l2_subdev *sd)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c
index fbbcdb96c4570baf07cc9685c2fc847fb489df89..2a2cb008a0ddcf3a55602d7aa0752711b302899f 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c
@@ -57,6 +57,42 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = {
.icndmr = 0,
.yuv = false,
},
+ {
+ .codes = {
+ MEDIA_BUS_FMT_SBGGR10_1X10,
+ MEDIA_BUS_FMT_SGBRG10_1X10,
+ MEDIA_BUS_FMT_SGRBG10_1X10,
+ MEDIA_BUS_FMT_SRGGB10_1X10
+ },
+ .format = V4L2_PIX_FMT_CRU_RAW10,
+ .datatype = MIPI_CSI2_DT_RAW10,
+ .icndmr = 0,
+ .yuv = false,
+ },
+ {
+ .codes = {
+ MEDIA_BUS_FMT_SBGGR12_1X12,
+ MEDIA_BUS_FMT_SGBRG12_1X12,
+ MEDIA_BUS_FMT_SGRBG12_1X12,
+ MEDIA_BUS_FMT_SRGGB12_1X12
+ },
+ .format = V4L2_PIX_FMT_CRU_RAW12,
+ .datatype = MIPI_CSI2_DT_RAW12,
+ .icndmr = 0,
+ .yuv = false,
+ },
+ {
+ .codes = {
+ MEDIA_BUS_FMT_SBGGR14_1X14,
+ MEDIA_BUS_FMT_SGBRG14_1X14,
+ MEDIA_BUS_FMT_SGRBG14_1X14,
+ MEDIA_BUS_FMT_SRGGB14_1X14
+ },
+ .format = V4L2_PIX_FMT_CRU_RAW14,
+ .datatype = MIPI_CSI2_DT_RAW14,
+ .icndmr = 0,
+ .yuv = false,
+ },
};
const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code)
--
2.34.1
^ permalink raw reply related [flat|nested] 13+ messages in thread