openwrt/target/linux/bcm27xx/patches-6.1/950-0888-v4l2-Add-pisp-compression-format-support-to-v4l2.patch
Marty Jones 2e715fb4fc bcm27xx: update 6.1 patches to latest version
Add support for BCM2712 (Raspberry Pi 5).
3bb5880ab3
Patches were generated from the diff between linux kernel branch linux-6.1.y
and rpi-6.1.y from raspberry pi kernel source:
- git format-patch linux-6.1.y...rpi-6.1.y

Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2710/RPi3B, bcm2711/RPi4B

Signed-off-by: Marty Jones <mj8263788@gmail.com>
[Remove applied and reverted patches, squash patches and config commits]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-01-25 17:46:45 +01:00

76 lines
3.5 KiB
Diff

From 3a419974ba02d32795a5ecfaf3c020f23173b6a1 Mon Sep 17 00:00:00 2001
From: Naushir Patuck <naush@raspberrypi.com>
Date: Tue, 14 Feb 2023 20:58:59 +0000
Subject: [PATCH] v4l2: Add pisp compression format support to v4l2
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
drivers/media/v4l2-core/v4l2-ioctl.c | 12 ++++++++----
include/uapi/linux/media-bus-format.h | 14 ++++++++++++++
include/uapi/linux/videodev2.h | 12 ++++++++----
3 files changed, 30 insertions(+), 8 deletions(-)
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1507,10 +1507,14 @@ static void v4l_fill_fmtdesc(struct v4l2
case V4L2_PIX_FMT_QC08C: descr = "QCOM Compressed 8-bit Format"; break;
case V4L2_PIX_FMT_QC10C: descr = "QCOM Compressed 10-bit Format"; break;
case V4L2_PIX_FMT_RPI_BE: descr = "PiSP Opaque Format"; break;
- case V4L2_PIX_FMT_PISP_COMP_RGGB:
- case V4L2_PIX_FMT_PISP_COMP_GRBG:
- case V4L2_PIX_FMT_PISP_COMP_GBRG:
- case V4L2_PIX_FMT_PISP_COMP_BGGR: descr = "PiSP Bayer Compressed Format"; break;
+ case V4L2_PIX_FMT_PISP_COMP1_RGGB:
+ case V4L2_PIX_FMT_PISP_COMP1_GRBG:
+ case V4L2_PIX_FMT_PISP_COMP1_GBRG:
+ case V4L2_PIX_FMT_PISP_COMP1_BGGR: descr = "PiSP Bayer Comp 1"; break;
+ case V4L2_PIX_FMT_PISP_COMP2_RGGB:
+ case V4L2_PIX_FMT_PISP_COMP2_GRBG:
+ case V4L2_PIX_FMT_PISP_COMP2_GBRG:
+ case V4L2_PIX_FMT_PISP_COMP2_BGGR: descr = "PiSP Bayer Comp 2"; break;
default:
if (fmt->description[0])
return;
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -175,4 +175,18 @@
/* Sensor ancillary metadata formats - next is 0x7002 */
#define MEDIA_BUS_FMT_SENSOR_DATA 0x7002
+/* PiSP Formats */
+#define MEDIA_BUS_FMT_PISP_COMP1_RGGB 0x8001
+#define MEDIA_BUS_FMT_PISP_COMP1_GRBG 0x8002
+#define MEDIA_BUS_FMT_PISP_COMP1_GBRG 0x8003
+#define MEDIA_BUS_FMT_PISP_COMP1_BGGR 0x8004
+#define MEDIA_BUS_FMT_PISP_COMP2_RGGB 0x8005
+#define MEDIA_BUS_FMT_PISP_COMP2_GRBG 0x8006
+#define MEDIA_BUS_FMT_PISP_COMP2_GBRG 0x8007
+#define MEDIA_BUS_FMT_PISP_COMP2_BGGR 0x8008
+
+#define MEDIA_BUS_FMT_PISP_FE_CONFIG 0x8100
+#define MEDIA_BUS_FMT_PISP_FE_STATS 0x8101
+#define MEDIA_BUS_FMT_PISP_BE_CONFIG 0x8200
+
#endif /* __LINUX_MEDIA_BUS_FORMAT_H */
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -795,10 +795,14 @@ struct v4l2_pix_format {
/* The pixel format for all our buffers (the precise format is found in the config buffer). */
#define V4L2_PIX_FMT_RPI_BE v4l2_fourcc('R', 'P', 'B', 'P')
-#define V4L2_PIX_FMT_PISP_COMP_RGGB v4l2_fourcc('P', 'C', 'R', 'G')
-#define V4L2_PIX_FMT_PISP_COMP_GRBG v4l2_fourcc('P', 'C', 'G', 'R')
-#define V4L2_PIX_FMT_PISP_COMP_GBRG v4l2_fourcc('P', 'C', 'G', 'B')
-#define V4L2_PIX_FMT_PISP_COMP_BGGR v4l2_fourcc('P', 'C', 'B', 'G')
+#define V4L2_PIX_FMT_PISP_COMP1_RGGB v4l2_fourcc('P', 'C', '1', 'R')
+#define V4L2_PIX_FMT_PISP_COMP1_GRBG v4l2_fourcc('P', 'C', '1', 'G')
+#define V4L2_PIX_FMT_PISP_COMP1_GBRG v4l2_fourcc('P', 'C', '1', 'g')
+#define V4L2_PIX_FMT_PISP_COMP1_BGGR v4l2_fourcc('P', 'C', '1', 'B')
+#define V4L2_PIX_FMT_PISP_COMP2_RGGB v4l2_fourcc('P', 'C', '2', 'R')
+#define V4L2_PIX_FMT_PISP_COMP2_GRBG v4l2_fourcc('P', 'C', '2', 'G')
+#define V4L2_PIX_FMT_PISP_COMP2_GBRG v4l2_fourcc('P', 'C', '2', 'g')
+#define V4L2_PIX_FMT_PISP_COMP2_BGGR v4l2_fourcc('P', 'C', '2', 'B')
/* SDR formats - used only for Software Defined Radio devices */
#define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */