media: v4l: ti-vpe: Add CAL v4l2 camera capture driver
Subsystems (2)
v2 cover media: v4l: ti-vpe: Add CAL v4l2 camera capture driver
The Camera Adaptation Layer (CAL) is a block which consists of a dual port CSI2/MIPI camera capture engine.
This camera engine is currently found on DRA72xx family of devices.
Port #0 can handle CSI2 camera connected to up to 4 data lanes. Port #1 can handle CSI2 camera connected to up to 2 data lanes.
The driver implements the required API/ioctls to be V4L2 compliant. Driver supports the following:
- V4L2 API using DMABUF/MMAP buffer access based on videobuf2 api
- Asynchronous sensor sub device registration
- DT support
Currently each port is designed to connect to a single sub-device. In other words port aggregation is not currently supported.
Changes since v1:
- Remove unnecessary format description
- Reworked how transient frame format is maintained
in order to make it easier to use the fill helper functions
- Added a per port list of active frame format
- Reworked an added missing vb2 cleanup code
- Fix a module load/unload kernel oops
- Switch to use proper int64 get function for pixel rate control
=====
Here is a sample output of the v4l2-compliance tool:
# ./v4l2-compliance -f -s -v -d /dev/video0 Driver Info: Driver name : cal Card type : cal Bus info : platform:cal-000
Capabilities : 0x85200001 Video Capture Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x05200001 Video Capture Read/Write Streaming Extended Pix Format
Compliance test for device /dev/video0 (not using libv4l2):
Required ioctls:
test VIDIOC_QUERYCAP: OK
Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Test input 0:
Control ioctls:
info: checking v4l2_queryctrl of control 'User Controls' (0x00980001)
info: checking v4l2_queryctrl of control 'Horizontal Flip' (0x00980914)
info: checking v4l2_queryctrl of control 'Vertical Flip' (0x00980915)
info: checking v4l2_queryctrl of control 'Image Processing Controls' (0x009f0001)
info: checking v4l2_queryctrl of control 'Pixel Rate' (0x009f0902)
info: checking v4l2_queryctrl of control 'Horizontal Flip' (0x00980914)
info: checking v4l2_queryctrl of control 'Vertical Flip' (0x00980915) test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
info: checking control 'User Controls' (0x00980001)
info: checking control 'Horizontal Flip' (0x00980914)
info: checking control 'Vertical Flip' (0x00980915)
info: checking control 'Image Processing Controls' (0x009f0001)
info: checking control 'Pixel Rate' (0x009f0902)
test VIDIOC_G/S_CTRL: OK
info: checking extended control 'User Controls' (0x00980001)
info: checking extended control 'Horizontal Flip' (0x00980914)
info: checking extended control 'Vertical Flip' (0x00980915)
info: checking extended control 'Image Processing Controls' (0x009f0001)
info: checking extended control 'Pixel Rate' (0x009f0902)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
info: checking control event 'User Controls' (0x00980001)
info: checking control event 'Horizontal Flip' (0x00980914)
info: checking control event 'Vertical Flip' (0x00980915)
info: checking control event 'Image Processing Controls' (0x009f0001)
info: checking control event 'Pixel Rate' (0x009f0902)
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 5 Private Controls: 0
Format ioctls:
info: found 1 frameintervals for pixel format 47425247 and size 1920x1080
info: found 1 framesizes for pixel format 47425247
info: found 1 formats for buftype 1
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
info: test buftype Video Capture test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported)
Test input 0:
Streaming ioctls:
test read/write: OK Video Capture: Buffer: 0 Sequence: 0 Field: None Timestamp: 353.276293s Buffer: 1 Sequence: 1 Field: None Timestamp: 353.298270s Buffer: 2 Sequence: 2 Field: None Timestamp: 353.320238s Buffer: 0 Sequence: 3 Field: None Timestamp: 353.342223s Buffer: 1 Sequence: 4 Field: None Timestamp: 353.364199s Buffer: 2 Sequence: 5 Field: None Timestamp: 353.386175s Buffer: 0 Sequence: 6 Field: None Timestamp: 353.408152s Buffer: 1 Sequence: 7 Field: None Timestamp: 353.430128s Buffer: 2 Sequence: 8 Field: None Timestamp: 353.452105s Buffer: 0 Sequence: 9 Field: None Timestamp: 353.474074s Buffer: 1 Sequence: 10 Field: None Timestamp: 353.496058s Buffer: 2 Sequence: 11 Field: None Timestamp: 353.518034s Buffer: 0 Sequence: 12 Field: None Timestamp: 353.540010s Buffer: 1 Sequence: 13 Field: None Timestamp: 353.561978s Buffer: 2 Sequence: 14 Field: None Timestamp: 353.583963s Buffer: 0 Sequence: 15 Field: None Timestamp: 353.605940s Buffer: 1 Sequence: 16 Field: None Timestamp: 353.627916s Buffer: 2 Sequence: 17 Field: None Timestamp: 353.649893s Buffer: 0 Sequence: 18 Field: None Timestamp: 353.671869s Buffer: 1 Sequence: 19 Field: None Timestamp: 353.693846s Buffer: 2 Sequence: 20 Field: None Timestamp: 353.715815s Buffer: 0 Sequence: 21 Field: None Timestamp: 353.737799s Buffer: 1 Sequence: 22 Field: None Timestamp: 353.759775s Buffer: 2 Sequence: 23 Field: None Timestamp: 353.781751s Buffer: 0 Sequence: 24 Field: None Timestamp: 353.803728s Buffer: 1 Sequence: 25 Field: None Timestamp: 353.825698s Buffer: 2 Sequence: 26 Field: None Timestamp: 353.847681s Buffer: 0 Sequence: 27 Field: None Timestamp: 353.869658s Buffer: 1 Sequence: 28 Field: None Timestamp: 353.891634s Buffer: 2 Sequence: 29 Field: None Timestamp: 353.913610s Buffer: 0 Sequence: 30 Field: None Timestamp: 353.935587s Buffer: 1 Sequence: 31 Field: None Timestamp: 353.957564s Buffer: 2 Sequence: 32 Field: None Timestamp: 353.979533s Buffer: 0 Sequence: 33 Field: None Timestamp: 354.001510s Buffer: 1 Sequence: 34 Field: None Timestamp: 354.023493s Buffer: 2 Sequence: 35 Field: None Timestamp: 354.045469s Buffer: 0 Sequence: 36 Field: None Timestamp: 354.067446s Buffer: 1 Sequence: 37 Field: None Timestamp: 354.089422s Buffer: 2 Sequence: 38 Field: None Timestamp: 354.111399s Buffer: 0 Sequence: 39 Field: None Timestamp: 354.133375s Buffer: 1 Sequence: 40 Field: None Timestamp: 354.155351s Buffer: 2 Sequence: 41 Field: None Timestamp: 354.177328s Buffer: 0 Sequence: 42 Field: None Timestamp: 354.199304s Buffer: 1 Sequence: 43 Field: None Timestamp: 354.221274s Buffer: 2 Sequence: 44 Field: None Timestamp: 354.243257s Buffer: 0 Sequence: 45 Field: None Timestamp: 354.265234s Buffer: 1 Sequence: 46 Field: None Timestamp: 354.287210s Buffer: 2 Sequence: 47 Field: None Timestamp: 354.309187s Buffer: 0 Sequence: 48 Field: None Timestamp: 354.331163s Buffer: 1 Sequence: 49 Field: None Timestamp: 354.353140s Buffer: 2 Sequence: 50 Field: None Timestamp: 354.375116s Buffer: 0 Sequence: 51 Field: None Timestamp: 354.397093s Buffer: 1 Sequence: 52 Field: None Timestamp: 354.419069s Buffer: 2 Sequence: 53 Field: None Timestamp: 354.441038s Buffer: 0 Sequence: 54 Field: None Timestamp: 354.463022s Buffer: 1 Sequence: 55 Field: None Timestamp: 354.484998s Buffer: 2 Sequence: 56 Field: None Timestamp: 354.506975s Buffer: 0 Sequence: 57 Field: None Timestamp: 354.528952s Buffer: 1 Sequence: 58 Field: None Timestamp: 354.550928s Buffer: 2 Sequence: 59 Field: None Timestamp: 354.572904s Video Capture (polling): Buffer: 0 Sequence: 60 Field: None Timestamp: 354.594881s Buffer: 1 Sequence: 61 Field: None Timestamp: 354.616857s Buffer: 2 Sequence: 62 Field: None Timestamp: 354.638834s Buffer: 0 Sequence: 63 Field: None Timestamp: 354.660810s Buffer: 1 Sequence: 64 Field: None Timestamp: 354.682787s Buffer: 2 Sequence: 65 Field: None Timestamp: 354.704764s Buffer: 0 Sequence: 66 Field: None Timestamp: 354.726733s Buffer: 1 Sequence: 67 Field: None Timestamp: 354.748716s Buffer: 2 Sequence: 68 Field: None Timestamp: 354.770693s Buffer: 0 Sequence: 69 Field: None Timestamp: 354.792669s Buffer: 1 Sequence: 70 Field: None Timestamp: 354.814645s Buffer: 2 Sequence: 71 Field: None Timestamp: 354.836615s Buffer: 0 Sequence: 72 Field: None Timestamp: 354.858591s Buffer: 1 Sequence: 73 Field: None Timestamp: 354.880575s Buffer: 2 Sequence: 74 Field: None Timestamp: 354.902552s Buffer: 0 Sequence: 75 Field: None Timestamp: 354.924528s Buffer: 1 Sequence: 76 Field: None Timestamp: 354.946505s Buffer: 2 Sequence: 77 Field: None Timestamp: 354.968481s Buffer: 0 Sequence: 78 Field: None Timestamp: 354.990457s Buffer: 1 Sequence: 79 Field: None Timestamp: 355.012434s Buffer: 2 Sequence: 80 Field: None Timestamp: 355.034411s Buffer: 0 Sequence: 81 Field: None Timestamp: 355.056387s Buffer: 1 Sequence: 82 Field: None Timestamp: 355.078364s Buffer: 2 Sequence: 83 Field: None Timestamp: 355.100340s Buffer: 0 Sequence: 84 Field: None Timestamp: 355.122316s Buffer: 1 Sequence: 85 Field: None Timestamp: 355.144293s Buffer: 2 Sequence: 86 Field: None Timestamp: 355.166269s Buffer: 0 Sequence: 87 Field: None Timestamp: 355.188246s Buffer: 1 Sequence: 88 Field: None Timestamp: 355.210223s Buffer: 2 Sequence: 89 Field: None Timestamp: 355.232199s Buffer: 0 Sequence: 90 Field: None Timestamp: 355.254176s Buffer: 1 Sequence: 91 Field: None Timestamp: 355.276152s Buffer: 2 Sequence: 92 Field: None Timestamp: 355.298128s Buffer: 0 Sequence: 93 Field: None Timestamp: 355.320096s Buffer: 1 Sequence: 94 Field: None Timestamp: 355.342081s Buffer: 2 Sequence: 95 Field: None Timestamp: 355.364058s Buffer: 0 Sequence: 96 Field: None Timestamp: 355.386035s Buffer: 1 Sequence: 97 Field: None Timestamp: 355.408011s Buffer: 2 Sequence: 98 Field: None Timestamp: 355.429987s Buffer: 0 Sequence: 99 Field: None Timestamp: 355.451964s Buffer: 1 Sequence: 100 Field: None Timestamp: 355.473933s Buffer: 2 Sequence: 101 Field: None Timestamp: 355.495917s Buffer: 0 Sequence: 102 Field: None Timestamp: 355.517893s Buffer: 1 Sequence: 103 Field: None Timestamp: 355.539870s Buffer: 2 Sequence: 104 Field: None Timestamp: 355.561837s Buffer: 0 Sequence: 105 Field: None Timestamp: 355.583823s Buffer: 1 Sequence: 106 Field: None Timestamp: 355.605799s Buffer: 2 Sequence: 107 Field: None Timestamp: 355.627775s Buffer: 0 Sequence: 108 Field: None Timestamp: 355.649752s Buffer: 1 Sequence: 109 Field: None Timestamp: 355.671729s Buffer: 2 Sequence: 110 Field: None Timestamp: 355.693705s Buffer: 0 Sequence: 111 Field: None Timestamp: 355.715681s Buffer: 1 Sequence: 112 Field: None Timestamp: 355.737657s Buffer: 2 Sequence: 113 Field: None Timestamp: 355.759634s Buffer: 0 Sequence: 114 Field: None Timestamp: 355.781610s Buffer: 1 Sequence: 115 Field: None Timestamp: 355.803580s Buffer: 2 Sequence: 116 Field: None Timestamp: 355.825556s Buffer: 0 Sequence: 117 Field: None Timestamp: 355.847541s Buffer: 1 Sequence: 118 Field: None Timestamp: 355.869517s Buffer: 2 Sequence: 119 Field: None Timestamp: 355.891493s test MMAP: OK test USERPTR: OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device
Stream using all formats:
test MMAP for Format GRBG, Frame Size [email protected] Hz: Stride 1920, Field None: OK
Total: 46, Succeeded: 46, Failed: 0, Warnings: 0
Benoit Parrot (2):
media: v4l: ti-vpe: Add CAL v4l2 camera capture driver
media: v4l: ti-vpe: Document CAL driver
Documentation/devicetree/bindings/media/ti-cal.txt | 70 + drivers/media/platform/Kconfig | 12 + drivers/media/platform/Makefile | 2 + drivers/media/platform/ti-vpe/Makefile | 4 + drivers/media/platform/ti-vpe/cal.c | 2161 ++++++++++++++++++++ drivers/media/platform/ti-vpe/cal_regs.h | 779 +++++++ 6 files changed, 3028 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/ti-cal.txt create mode 100644 drivers/media/platform/ti-vpe/cal.c create mode 100644 drivers/media/platform/ti-vpe/cal_regs.h
Signature · 1 line
1.8.5.1
PATCH v2 1/2 media: v4l: ti-vpe: Add CAL v4l2 camera capture driver
The Camera Adaptation Layer (CAL) is a block which consists of a dual port CSI2/MIPI camera capture engine.
Port #0 can handle CSI2 camera connected to up to 4 data lanes. Port #1 can handle CSI2 camera connected to up to 2 data lanes. The driver implements the required API/ioctls to be V4L2 compliant. Driver supports the following:
- V4L2 API using DMABUF/MMAP buffer access based on videobuf2 api
- Asynchronous sensor sub device registration
- DT support
--- drivers/media/platform/Kconfig | 12 + drivers/media/platform/Makefile | 2 + drivers/media/platform/ti-vpe/Makefile | 4 + drivers/media/platform/ti-vpe/cal.c | 2161 ++++++++++++++++++++++++++++++ drivers/media/platform/ti-vpe/cal_regs.h | 779 +++++++++++ 5 files changed, 2958 insertions(+) create mode 100644 drivers/media/platform/ti-vpe/cal.c create mode 100644 drivers/media/platform/ti-vpe/cal_regs.h
drivers/media/platform/Kconfig +12 -0
@@ -120,6 +120,18 @@ source "drivers/media/platform/s5p-tv/Kconfig" source "drivers/media/platform/am437x/Kconfig" source "drivers/media/platform/xilinx/Kconfig" +config VIDEO_TI_CAL + tristate "TI CAL (Camera Adaptation Layer) driver" + depends on VIDEO_DEV && VIDEO_V4L2 && SOC_DRA7XX + depends on VIDEO_V4L2_SUBDEV_API + depends on VIDEOBUF2_DMA_CONTIG + default n + ---help--- + Support for the TI CAL (Camera Adaptation Layer) block + found on DRA72X SoC. + In TI Technical Reference Manual this module is referred as + Camera Interface Subsystem (CAMSS). + endif # V4L_PLATFORM_DRIVERS menuconfig V4L_MEM2MEM_DRIVERS
drivers/media/platform/Makefile +2 -0
@@ -18,6 +18,8 @@ obj-$(CONFIG_VIDEO_VIM2M) += vim2m.o obj-$(CONFIG_VIDEO_TI_VPE) += ti-vpe/ +obj-$(CONFIG_VIDEO_TI_CAL) += ti-vpe/ + obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o obj-$(CONFIG_VIDEO_CODA) += coda/
drivers/media/platform/ti-vpe/Makefile +4 -0
@@ -3,3 +3,7 @@ obj-$(CONFIG_VIDEO_TI_VPE) += ti-vpe.o ti-vpe-y := vpe.o sc.o csc.o vpdma.o ccflags-$(CONFIG_VIDEO_TI_VPE_DEBUG) += -DDEBUG + +obj-$(CONFIG_VIDEO_TI_CAL) += ti-cal.o + +ti-cal-y := cal.o
drivers/media/platform/ti-vpe/cal.c new file +2161 -0
2,161 lines not on this page · raw message
drivers/media/platform/ti-vpe/cal_regs.h new file +779 -0
779 lines not on this page · raw message
Signature · 1 line
1.8.5.1
PATCH v2 2/2 media: v4l: ti-vpe: Document CAL driver
In reply to Benoit ParrotDevice Tree bindings for the Camera Adaptation Layer (CAL) driver
--- Documentation/devicetree/bindings/media/ti-cal.txt | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/ti-cal.txt
Documentation/devicetree/bindings/media/ti-cal.txt new file +70 -0
@@ -0,0 +1,70 @@ +Texas Instruments DRA72x CAMERA ADAPTATION LAYER (CAL) +------------------------------------------------------ + +The Camera Adaptation Layer (CAL) is a key component for image capture +applications. The capture module provides the system interface and the +processing capability to connect CSI2 image-sensor modules to the +DRA72x device. + +Required properties: +- compatible: must be "ti,cal" +- reg: physical base address and length of the registers set for the 4 + memory regions required; +- reg-names: name associated with the memory regions described is <reg>; +- interrupts: should contain IRQ line for the CAL; + +CAL supports 2 camera port nodes on MIPI bus. Each CSI2 camera port nodes +should contain a 'port' child node with child 'endpoint' node. Please +refer to the bindings defined in +Documentation/devicetree/bindings/media/video-interfaces.txt. + +Example: + cal: cal@4845b000 { + compatible = "ti,cal"; + ti,hwmods = "cal"; + reg = <0x4845B000 0x400>, + <0x4845B800 0x40>, + <0x4845B900 0x40>, + <0x4A002e94 0x4>; + reg-names = "cal_top", + "cal_rx_core0", + "cal_rx_core1", + "camerrx_control"; + interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + + csi2_0: port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + endpoint { + slave-mode; + remote-endpoint = <&ar0330_1>; + }; + }; + csi2_1: port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + }; + }; + + i2c5: i2c@4807c000 { + ar0330@10 { + compatible = "ti,ar0330"; + reg = <0x10>; + + port { + #address-cells = <1>; + #size-cells = <0>; + + ar0330_1: endpoint { + reg = <0>; + clock-lanes = <1>; + data-lanes = <0 2 3 4>; + remote-endpoint = <&csi2_0>; + }; + }; + }; + };
Signature · 1 line
1.8.5.1
Quoted 26 lines · Benoit Parrot
The Camera Adaptation Layer (CAL) is a block which consists of a dual port CSI2/MIPI camera capture engine.
Port #0 can handle CSI2 camera connected to up to 4 data lanes. Port #1 can handle CSI2 camera connected to up to 2 data lanes. The driver implements the required API/ioctls to be V4L2 compliant. Driver supports the following:
- V4L2 API using DMABUF/MMAP buffer access based on videobuf2 api
- Asynchronous sensor sub device registration
- DT supportSigned-off-by Benoit Parrot <[email protected]>--- drivers/media/platform/Kconfig | 12 + drivers/media/platform/Makefile | 2 + drivers/media/platform/ti-vpe/Makefile | 4 + drivers/media/platform/ti-vpe/cal.c | 2161 ++++++++++++++++++++++++++++++ drivers/media/platform/ti-vpe/cal_regs.h | 779 +++++++++++ 5 files changed, 2958 insertions(+) create mode 100644 drivers/media/platform/ti-vpe/cal.c create mode 100644 drivers/media/platform/ti-vpe/cal_regs.hdrivers/media/platform/Kconfig +0
-0
drivers/media/platform/Kconfig source "drivers/media/platform/s5p-tv/Kconfig" · line 127
Quoted 8 lines
drivers/media/platform/Kconfig +5
-0@@ -120,6 +120,18 @@ source "drivers/media/platform/s5p-tv/Kconfig" source "drivers/media/platform/am437x/Kconfig" source "drivers/media/platform/xilinx/Kconfig" +config VIDEO_TI_CAL + tristate "TI CAL (Camera Adaptation Layer) driver" + depends on VIDEO_DEV && VIDEO_V4L2 && SOC_DRA7XX + depends on VIDEO_V4L2_SUBDEV_API + depends on VIDEOBUF2_DMA_CONTIG
This should be:
depends on VIDEO_DEV && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
depends on SOC_DRA7XX || COMPILE_TEST
select VIDEOBUF2_DMA_CONTIGdrivers/media/platform/Kconfig source "drivers/media/platform/s5p-tv/Kconfig" · line 137
Quoted 10 lines
drivers/media/platform/Kconfig +7
-0+ default n + ---help--- + Support for the TI CAL (Camera Adaptation Layer) block + found on DRA72X SoC. + In TI Technical Reference Manual this module is referred as + Camera Interface Subsystem (CAMSS). + endif # V4L_PLATFORM_DRIVERS menuconfig V4L_MEM2MEM_DRIVERS
By compiling with COMPILE_TEST I found a number of compile warnings and it also no longer compiled due to vb2 changes. Both are fixed in the patch below.
SoB for the patch: Signed-off-by: Hans Verkuil <[email protected]>
That said, I'll postpone merging this until the remainder of the vb2 split patches have been merged. When that's done this driver will have to be changed some more.
BTW, I see one 'f->fmt.pix.priv = 0;' line in cal_try_fmt_vid_cap(): this can be removed, it's no longer needed.
Regards,
Hans
drivers/media/platform/ti-vpe/cal.c +28 -28
@@ -200,7 +200,7 @@ static char *fourcc_to_str(u32 fmt)/* buffer for one video frame */ struct cal_buffer {/* common v4l buffer stuff -- must be first */ -struct vb2_buffer vb; +struct vb2_v4l2_buffer vb;struct list_head list;const struct cal_fmt *fmt; };
@@ -400,8 +400,8 @@ static struct cm_data *cm_create(struct cal_dev *dev)return cm->base; } -cal_dbg (1 , dev,"ioresource %s at %x - %x\n" , - cm->res->name, cm->res->start, cm->res->end); +cal_dbg (1 , dev,"ioresource %s at %pa - %pa\n" , + cm->res->name, &cm->res->start, &cm->res->end);return cm; }
@@ -510,8 +510,8 @@ static struct cc_data *cc_create(struct cal_dev *dev, unsigned int core)return cc->base; } -cal_dbg (1 , dev,"ioresource %s at %x - %x\n" , - cc->res->name, cc->res->start, cc->res->end); +cal_dbg (1 , dev,"ioresource %s at %pa - %pa\n" , + cc->res->name, &cc->res->start, &cc->res->end);return cc; }
@@ -565,13 +565,13 @@ static void cal_top_reset(struct cal_dev *dev)static void cal_quickdump_regs (struct cal_dev *dev) { -cal_info (dev,"CAL Registers @ 0x%08x:\n" , dev->res->start); +cal_info (dev,"CAL Registers @ 0x%pa:\n" , &dev->res->start);print_hex_dump (KERN_INFO ,"" ,DUMP_PREFIX_OFFSET ,16 ,4 , dev->base, (dev->res->end - dev->res->start +1 ), false);if (!dev->ctx[0 ]) { -cal_info (dev,"CSI2 Core 0 Registers @ 0x%08x:\n" , - dev->ctx[0 ]->cc->res->start); +cal_info (dev,"CSI2 Core 0 Registers @ %pa:\n" , + &dev->ctx[0 ]->cc->res->start); print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 4, dev->ctx[0]->cc->base, (dev->ctx[0]->cc->res->end -
@@ -580,8 +580,8 @@ static void cal_quickdump_regs(struct cal_dev *dev) }if (!dev->ctx[1 ]) { -cal_info (dev,"CSI2 Core 1 Registers @ 0x%08x:\n" , - dev->ctx[1 ]->cc->res->start); +cal_info (dev,"CSI2 Core 1 Registers @ %pa:\n" , + &dev->ctx[1 ]->cc->res->start); print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 4, dev->ctx[1]->cc->base, (dev->ctx[1]->cc->res->end -
@@ -589,8 +589,8 @@ static void cal_quickdump_regs(struct cal_dev *dev) false); } -cal_info (dev,"CAMERRX_Control Registers @ 0x%08x:\n" , - dev->cm->res->start); +cal_info (dev,"CAMERRX_Control Registers @ %pa:\n" , + &dev->cm->res->start);print_hex_dump (KERN_INFO ,"" ,DUMP_PREFIX_OFFSET ,16 ,4 , dev->cm->base, (dev->cm->res->end - dev->cm->res->start +1 ), false);
@@ -995,17 +995,17 @@ static inline void cal_schedule_next_buffer(struct cal_ctx *ctx) ctx->next_frm = buf;list_del (&buf->list); - addr =vb2_dma_contig_plane_dma_addr (&buf->vb,0 ); + addr =vb2_dma_contig_plane_dma_addr (&buf->vb.vb2_buf,0 );cal_wr_dma_addr (ctx, addr); }static inline void cal_process_buffer_complete (struct cal_ctx *ctx) { -v4l2_get_timestamp (&ctx->cur_frm->vb.v4l2_buf.timestamp); - ctx->cur_frm->vb.v4l2_buf.field = ctx->m_fmt.field; - ctx->cur_frm->vb.v4l2_buf.sequence = ctx->sequence++; +v4l2_get_timestamp (&ctx->cur_frm->vb.timestamp); + ctx->cur_frm->vb.field = ctx->m_fmt.field; + ctx->cur_frm->vb.sequence = ctx->sequence++; -vb2_buffer_done (&ctx->cur_frm->vb,VB2_BUF_STATE_DONE ); +vb2_buffer_done (&ctx->cur_frm->vb.vb2_buf,VB2_BUF_STATE_DONE ); ctx->cur_frm = ctx->next_frm; }
@@ -1452,7 +1452,7 @@ static int cal_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,static int cal_buffer_prepare (struct vb2_buffer *vb) {struct cal_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue); - struct cal_buffer *buf = container_of(vb, struct cal_buffer, vb); + struct cal_buffer *buf = container_of(vb, struct cal_buffer, vb.vb2_buf);unsigned long size;BUG_ON (NULL == ctx->fmt);
@@ -1465,14 +1465,14 @@ static int cal_buffer_prepare(struct vb2_buffer *vb)return -EINVAL ; } -vb2_set_plane_payload (&buf->vb,0 , size); +vb2_set_plane_payload (&buf->vb.vb2_buf,0 , size);return 0 ; }static void cal_buffer_queue (struct vb2_buffer *vb) {struct cal_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue); - struct cal_buffer *buf = container_of(vb, struct cal_buffer, vb); + struct cal_buffer *buf = container_of(vb, struct cal_buffer, vb.vb2_buf);struct cal_dmaqueue *vidq = &ctx->vidq;unsigned long flags =0 ;
@@ -1506,7 +1506,7 @@ static int cal_start_streaming(struct vb2_queue *vq, unsigned int count)list_del (&buf->list);spin_unlock_irqrestore (&ctx->slock, flags); - addr =vb2_dma_contig_plane_dma_addr (&ctx->cur_frm->vb,0 ); + addr =vb2_dma_contig_plane_dma_addr (&ctx->cur_frm->vb.vb2_buf,0 ); ctx->sequence =0 ;ctx_dbg (3 , ctx,"enable_irqs\n" );
@@ -1543,7 +1543,7 @@ static int cal_start_streaming(struct vb2_queue *vq, unsigned int count) err:list_for_each_entry_safe (buf, tmp, &dma_q->active, list) {list_del (&buf->list); -vb2_buffer_done (&buf->vb,VB2_BUF_STATE_QUEUED ); +vb2_buffer_done (&buf->vb.vb2_buf,VB2_BUF_STATE_QUEUED ); }return ret; }
@@ -1572,14 +1572,14 @@ static void cal_stop_streaming(struct vb2_queue *vq)spin_lock_irqsave (&ctx->slock, flags);list_for_each_entry_safe (buf, tmp, &dma_q->active, list) {list_del (&buf->list); -vb2_buffer_done (&buf->vb,VB2_BUF_STATE_ERROR ); +vb2_buffer_done (&buf->vb.vb2_buf,VB2_BUF_STATE_ERROR ); }if (ctx->cur_frm == ctx->next_frm) { -vb2_buffer_done (&ctx->cur_frm->vb,VB2_BUF_STATE_ERROR ); +vb2_buffer_done (&ctx->cur_frm->vb.vb2_buf,VB2_BUF_STATE_ERROR ); }else { -vb2_buffer_done (&ctx->cur_frm->vb,VB2_BUF_STATE_ERROR ); -vb2_buffer_done (&ctx->next_frm->vb,VB2_BUF_STATE_ERROR ); +vb2_buffer_done (&ctx->cur_frm->vb.vb2_buf,VB2_BUF_STATE_ERROR ); +vb2_buffer_done (&ctx->next_frm->vb.vb2_buf,VB2_BUF_STATE_ERROR ); } ctx->cur_frm =NULL ; ctx->next_frm =NULL ;
@@ -2063,8 +2063,8 @@ static int cal_probe(struct platform_device *pdev)if (IS_ERR (dev->base))return PTR_ERR (dev->base); -cal_dbg (1 , dev,"ioresource %s at %x - %x\n" , - dev->res->name, dev->res->start, dev->res->end); +cal_dbg (1 , dev,"ioresource %s at %pa - %pa\n" , + dev->res->name, &dev->res->start, &dev->res->end); irq =platform_get_irq (pdev,0 );cal_dbg (1 , dev,"got irq# %d\n" , irq);
Quoted 56 lines · Hans Verkuil
Quoted 26 lines · Benoit Parrot
The Camera Adaptation Layer (CAL) is a block which consists of a dual port CSI2/MIPI camera capture engine.
Port #0 can handle CSI2 camera connected to up to 4 data lanes. Port #1 can handle CSI2 camera connected to up to 2 data lanes. The driver implements the required API/ioctls to be V4L2 compliant. Driver supports the following:
- V4L2 API using DMABUF/MMAP buffer access based on videobuf2 api
- Asynchronous sensor sub device registration
- DT supportSigned-off-by Benoit Parrot <[email protected]>--- drivers/media/platform/Kconfig | 12 + drivers/media/platform/Makefile | 2 + drivers/media/platform/ti-vpe/Makefile | 4 + drivers/media/platform/ti-vpe/cal.c | 2161 ++++++++++++++++++++++++++++++ drivers/media/platform/ti-vpe/cal_regs.h | 779 +++++++++++ 5 files changed, 2958 insertions(+) create mode 100644 drivers/media/platform/ti-vpe/cal.c create mode 100644 drivers/media/platform/ti-vpe/cal_regs.hdrivers/media/platform/Kconfig +0
-0drivers/media/platform/Kconfig source "drivers/media/platform/s5p-tv/Kconfig" · line 127
Quoted 8 lines
drivers/media/platform/Kconfig +5
-0@@ -120,6 +120,18 @@ source "drivers/media/platform/s5p-tv/Kconfig" source "drivers/media/platform/am437x/Kconfig" source "drivers/media/platform/xilinx/Kconfig" +config VIDEO_TI_CAL + tristate "TI CAL (Camera Adaptation Layer) driver" + depends on VIDEO_DEV && VIDEO_V4L2 && SOC_DRA7XX + depends on VIDEO_V4L2_SUBDEV_API + depends on VIDEOBUF2_DMA_CONTIGThis should be:
depends on VIDEO_DEV && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API depends on SOC_DRA7XX || COMPILE_TEST select VIDEOBUF2_DMA_CONTIGdrivers/media/platform/Kconfig source "drivers/media/platform/s5p-tv/Kconfig" · line 137
Quoted 10 lines
drivers/media/platform/Kconfig +7
-0+ default n + ---help--- + Support for the TI CAL (Camera Adaptation Layer) block + found on DRA72X SoC. + In TI Technical Reference Manual this module is referred as + Camera Interface Subsystem (CAMSS). + endif # V4L_PLATFORM_DRIVERS menuconfig V4L_MEM2MEM_DRIVERSBy compiling with
COMPILE_TESTI found a number of compile warnings and it also no longer compiled due to vb2 changes. Both are fixed in the patch below.
Quoted 4 lines
SoB for the patch: Signed-off-by: Hans Verkuil <[email protected]>
That said, I'll postpone merging this until the remainder of the vb2 split patches have been merged. When that's done this driver will have to be changed some more.
OK, the vb2 split patches were just merged. Can you rebase and repost?
Thanks,
Hans
Quoted 57 lines · Hans Verkuil
Quoted 56 lines · Hans Verkuil
Quoted 26 lines · Benoit Parrot
The Camera Adaptation Layer (CAL) is a block which consists of a dual port CSI2/MIPI camera capture engine.
Port #0 can handle CSI2 camera connected to up to 4 data lanes. Port #1 can handle CSI2 camera connected to up to 2 data lanes. The driver implements the required API/ioctls to be V4L2 compliant. Driver supports the following:
- V4L2 API using DMABUF/MMAP buffer access based on videobuf2 api
- Asynchronous sensor sub device registration
- DT supportSigned-off-by Benoit Parrot <[email protected]>--- drivers/media/platform/Kconfig | 12 + drivers/media/platform/Makefile | 2 + drivers/media/platform/ti-vpe/Makefile | 4 + drivers/media/platform/ti-vpe/cal.c | 2161 ++++++++++++++++++++++++++++++ drivers/media/platform/ti-vpe/cal_regs.h | 779 +++++++++++ 5 files changed, 2958 insertions(+) create mode 100644 drivers/media/platform/ti-vpe/cal.c create mode 100644 drivers/media/platform/ti-vpe/cal_regs.hdrivers/media/platform/Kconfig +0
-0drivers/media/platform/Kconfig source "drivers/media/platform/s5p-tv/Kconfig" · line 127
Quoted 8 lines
drivers/media/platform/Kconfig +5
-0@@ -120,6 +120,18 @@ source "drivers/media/platform/s5p-tv/Kconfig" source "drivers/media/platform/am437x/Kconfig" source "drivers/media/platform/xilinx/Kconfig" +config VIDEO_TI_CAL + tristate "TI CAL (Camera Adaptation Layer) driver" + depends on VIDEO_DEV && VIDEO_V4L2 && SOC_DRA7XX + depends on VIDEO_V4L2_SUBDEV_API + depends on VIDEOBUF2_DMA_CONTIGThis should be:
depends on VIDEO_DEV && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API depends on SOC_DRA7XX || COMPILE_TEST select VIDEOBUF2_DMA_CONTIGdrivers/media/platform/Kconfig source "drivers/media/platform/s5p-tv/Kconfig" · line 137
Quoted 10 lines
drivers/media/platform/Kconfig +7
-0+ default n + ---help--- + Support for the TI CAL (Camera Adaptation Layer) block + found on DRA72X SoC. + In TI Technical Reference Manual this module is referred as + Camera Interface Subsystem (CAMSS). + endif # V4L_PLATFORM_DRIVERS menuconfig V4L_MEM2MEM_DRIVERSBy compiling with
COMPILE_TESTI found a number of compile warnings and it also no longer compiled due to vb2 changes. Both are fixed in the patch below.
Quoted 6 lines
Quoted 4 lines
SoB for the patch: Signed-off-by: Hans Verkuil <[email protected]>
That said, I'll postpone merging this until the remainder of the vb2 split patches have been merged. When that's done this driver will have to be changed some more.
OK, the vb2 split patches were just merged. Can you rebase and repost?
Ping!
I'd like to merge this driver, so if you can rebase and take care of the trivial comments I made in my review?
Thanks,
Hans