Skip to content

main/linux-postmarketos-exynos4: add front camera support for i9100

Administrator requested to merge i9100-front-camera into master

This ads support for the front camera on the I9100. I submitted the patch upstream and it should land in 5.13.

I also sneaked in a kernel update to the latest stable version.

To take pictures:

  • setup the media pipeline:
    sudo apk add v4l-utils
    media-ctl --links "'s5p-mipi-csis.1':1->'FIMC.0':0[0],'s5p-mipi-csis.1':1->'FIMC.1':0[1]"
    media-ctl --set-v4l2 "'s5p-mipi-csis.1':0[fmt:VYUY8_2X8/1600x1200]"
    media-ctl --set-v4l2 "'s5p-mipi-csis.1':1[fmt:VYUY8_2X8/1600x1200]"
    media-ctl --set-v4l2 "'FIMC.1':0[fmt:VYUY8_2X8/1600x1200]"
  • install the "firmware":
    wget https://gitlab.com/uploads/-/system/personal_snippet/2101053/d4cf6655b2eb5e34f8fa6895296add34/s5k5baf-cfg.bin
    sudo cp s5k5baf-cfg.bin  /lib/firmware/postmarketos/
  • install and run fswebcam:
    sudo apk add fswebcam
    LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so fswebcam -r 1600x1200 -d /dev/video3 -v --no-banner -p VYUY --skip 3 --frames 5 --rotate 180 img.jpg

Additional notes:

  • s5k5baf-cfg.bin is just set of i2c commands (looks like sensor calibration) taken from downstream kernel which I dumped with a hacky python script into the right format (expected by the driver).

  • preloading v4l2convert.so is needed because the Samsung S5P/Exynos4 FIMC driver (which exposes the capture interface) only supports V4L2_CAP_VIDEO_CAPTURE_MPLANE and doesn't support V4L2_CAP_VIDEO_CAPTURE used by most application including fswebcam. Alternatively you can use my fork from https://github.com/timbz/fswebcam.

$ media-ctl -p
Media controller API version 5.11.11

Media device information
------------------------
driver          s5p-fimc-md
model           Samsung S5P FIMC
serial          
bus info        
hw revision     0x0
driver version  5.11.11

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:YUYV8_2X8/640x480 colorspace:jpeg
		 crop.bounds:(0,0)/0x0
		 crop:(0,0)/640x480
		 compose.bounds:(0,0)/640x480
		 compose:(0,0)/640x480]
		<- "s5p-mipi-csis.1":1 []
	pad1: Sink
		[fmt:YUV10_1X30/640x480 colorspace:jpeg
		 crop.bounds:(0,0)/0x0
		 crop:(0,0)/640x480
		 compose.bounds:(0,0)/640x480
		 compose:(0,0)/640x480]
	pad2: Source
		[fmt:YUYV8_2X8/640x480 colorspace:jpeg]
		-> "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/video1
	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:VYUY8_2X8/1600x1200 colorspace:jpeg
		 crop.bounds:(0,0)/1600x1200
		 crop:(0,0)/1600x1200
		 compose.bounds:(0,0)/1600x1200
		 compose:(0,0)/1600x1200]
		<- "s5p-mipi-csis.1":1 [ENABLED]
	pad1: Sink
		[fmt:YUV10_1X30/640x480 colorspace:jpeg
		 crop.bounds:(0,0)/1600x1200
		 crop:(0,0)/1600x1200
		 compose.bounds:(0,0)/1600x1200
		 compose:(0,0)/1600x1200]
	pad2: Source
		[fmt:VYUY8_2X8/1600x1200 colorspace:jpeg]
		-> "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/video3
	pad0: Sink
		<- "FIMC.1":2 [ENABLED,IMMUTABLE]

- entity 17: s5p-mipi-csis.1 (2 pads, 3 links)
             type Node subtype V4L flags 0
             device node name /dev/v4l-subdev2
	pad0: Sink
		<- "S5K5BAF-ISP 10-002d":1 [ENABLED,IMMUTABLE]
	pad1: Source
		-> "FIMC.0":0 []
		-> "FIMC.1":0 [ENABLED]

- entity 20: S5K5BAF-ISP 10-002d (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev4
	pad0: Sink
		[fmt:FIXED/1600x1200@923/10000 field:none colorspace:jpeg
		 crop.bounds:(0,0)/1600x1200
		 crop:(0,0)/1600x1200
		 compose.bounds:(0,0)/1600x1200
		 compose:(0,0)/1600x1200]
		<- "S5K5BAF-CIS 10-002d":0 [ENABLED,IMMUTABLE]
	pad1: Source
		[fmt:VYUY8_2X8/1600x1200@923/10000 field:none colorspace:jpeg
		 crop.bounds:(0,0)/1600x1200
		 crop:(0,0)/1600x1200]
		-> "s5p-mipi-csis.1":0 [ENABLED,IMMUTABLE]

- entity 23: S5K5BAF-CIS 10-002d (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev3
	pad0: Source
		[fmt:FIXED/1600x1200 field:none colorspace:jpeg]
		-> "S5K5BAF-ISP 10-002d":0 [ENABLED,IMMUTABLE]
Edited by Administrator

Merge request reports

Loading