Open xc-racer99 opened 5 years ago
Apparently you can attach the same camera to multiple FIMC devices. So stock uses 0 and 2, one which is used for controls, the other which is used for actual data (if I understand things correctly).
I've created a probing driver for the s5ka3dfx at https://github.com/xc-racer99/linux/tree/s5ka3dfx-wip
sudo media-ctl -p
[sudo] password for jon:
Media controller API version 5.1.0
Media device information
------------------------
driver s5p-fimc-md
model SAMSUNG S5P FIMC
serial
bus info
hw revision 0x0
driver version 5.1.0
Device topology
- entity 1: FIMC.0 (3 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev0
pad0: Sink
[fmt:YUYV2X8/640x480
crop.bounds:(0,0)/0x0
crop:(0,0)/640x480
compose.bounds:(0,0)/640x480
compose:(0,0)/640x480]
<- "S5KA3DFX 0-0062":0 [ENABLED]
pad1: Sink
[fmt:unknown/640x480
crop.bounds:(0,0)/0x0
crop:(0,0)/640x480
compose.bounds:(0,0)/640x480
compose:(0,0)/640x480]
pad2: Source
[fmt:YUYV2X8/640x480]
-> "fimc.0.capture":0 [ENABLED,IMMUTABLE]
- entity 5: fimc.0.capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video3
pad0: Sink
<- "FIMC.0":2 [ENABLED,IMMUTABLE]
- entity 9: FIMC.1 (3 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev1
pad0: Sink
[fmt:YUYV2X8/640x480
crop.bounds:(0,0)/0x0
crop:(0,0)/640x480
compose.bounds:(0,0)/640x480
compose:(0,0)/640x480]
<- "S5KA3DFX 0-0062":0 []
pad1: Sink
[fmt:unknown/640x480
crop.bounds:(0,0)/0x0
crop:(0,0)/640x480
compose.bounds:(0,0)/640x480
compose:(0,0)/640x480]
pad2: Source
[fmt:YUYV2X8/640x480]
-> "fimc.1.capture":0 [ENABLED,IMMUTABLE]
- entity 13: fimc.1.capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video5
pad0: Sink
<- "FIMC.1":2 [ENABLED,IMMUTABLE]
- entity 17: S5KA3DFX 0-0062 (1 pad, 2 links)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:UYVY2X8/640x480]
-> "FIMC.0":0 [ENABLED]
-> "FIMC.1":0 []
I have yet to actually test it, nor have I implemented the blur feature (this is non-v4l2 standard AFAIK, so would need to be a custom menu ctrl) or the variable FPS (currently set to the default auto - this is the stub commented out frame_interval functions). If it doesn't work, then we should test the FIMC device with the test bits of CIGCTRL to see if the issue is with my driver or the FIMC device itself.
Edit for future reference: To set formats, run
sudo media-ctl --verbose --set-v4l2 '"S5KA3DFX 0-0062":0[fmt:UYVY2X8/640x480]'
Although when trying to stream (eg with)
sudo v4l2-ctl --verbose -d 5 --stream-mmap=3 --stream-skip=2 --stream-to=./test.yuv --stream-count=1
we get a nullptr crash
Edit 2: Potential conversion command:
convert -size 640x480 -depth 16 uyvy:test.yuv out.jpg
Edit 3: Have now seen the test image, but don't have any sensor data yet. Commands used, assuming FIMC0 is registered as /dev/video5:
sudo media-ctl --verbose --set-v4l2 '"S5KA3DFX 0-0062":0[fmt:UYVY2X8/640x480]'
sudo media-ctl --verbose --set-v4l2 '"FIMC.0":2[fmt:UYVY2X8/640x480]'
sudo v4l2-ctl --verbose -d 5 --stream-mmap=3 --stream-skip=2 --stream-to=./test.yuv --stream-count=1
convert -size 640x480 -depth 16 uyvy:test.yuv out.jpg
This is as of revision 0acd59afb5a7352825fed7e302e2056bcc26e0f9 on my wip branch
First image data from sensor!
Obviously, I still have work to do as my roof and fan are not green and purple :)
Created branch at https://github.com/PabloPL/linux/tree/for-upstream/fimc with commits that are required. Looks like s5pv210 was never fully supported by the DT conversion, so I've done that as well. The one thing I'm unsure of is whether the samsung,lcd-wb property should be present or not. Based on the datasheet, all of the interfaces support lcd-wb. The rub is that by adding that property, the FIMC is no longer probed as it is reserved for the graphics/DRM subsystem. However, the DRM subsystem driver doesn't support the S5PV210 FIMC :) It might make the most sense to just set this for FIMC1 as that is the only one with the extended mainscaler support.
Colours are now correct, it appears that the s5ka3dfx doesn't use UYUV8 as all of the comments in the file says, but rather uses YUYV8. Go figure.
Now on to the NEC CE147 when I have a chance.
Alright I have basic ce147 at https://github.com/xc-racer99/linux/tree/ce147-v2 No capture (jpeg) functionality nor controls, but the video bit appears to work.
Out of curiosity, it appears that the camera is actually capable of 120fps for some resolutions based on the driver. I haven't actually tested them though.
The bad news is that both the ce147 and the s5ak3dfx are connected to camera port A and the FIMC driver doesn't like this. There's the video-mux driver, but the FIMC driver really doesn't like this (ie as is it gets stuck in an infinite loop, I've gotten it to succesfully probe but links between the video-mux and the sensors aren't created)
Looks like we never opened an issue for this. Cameras are:
Is connected to the FIMC; based on https://github.com/pawitp/android_kernel_samsung_aries/commit/359bccf87b04b420af2973e2088c2927414e7124 S5K is connected to FIMC0; but Android userspace opens both FIMC0 and FIMC2 for both cameras regardless.
Some more info could be found at https://blog.forkwhiletrue.me/posts/camera-on-galaxy-s3/