/* max9286 */
SC_P_MIPI_DSI0_GPIO0_00 摄像头电源power-gpios
SC_P_MIPI_CSI0_MCLK_OUT 摄像头信号触发,需要26HZ的pwm,gpi-gpios
SC_P_ADC_IN0 pwn-gpios
/* i2c */
SC_P_MIPI_CSI0_I2C0_SDA
SC_P_MIPI_CSI0_I2C0_SCL
pinctrl_max9286: csi_pwn{
fsl,pins = <
SC_P_MIPI_CSI0_GPIO0_00_LSIO_GPIO1_IO27 0x18000000
SC_P_MIPI_CSI0_MCLK_OUT_LSIO_GPIO1_IO24 0x18000000
SC_P_ADC_IN0_LSIO_GPIO3_IO18 0x18000000
SC_P_SPDIF0_TX_LSIO_GPIO2_IO15 0x1C000020
//SC_P_MIPI_DSI1_GPIO0_01_LSIO_GPIO1_IO23 0x1C000000 //Camera_PWR_EN
SC_P_MIPI_DSI0_GPIO0_00_LSIO_GPIO1_IO18 0x1C000000
>;
};
i2c0_mipi_csi0: i2c@58226000 {
compatible = "fsl,imx8qm-lpi2c";
assigned-clocks = <&clk_post IMX8QM_CSI0_I2C0_CLK>;
assigned-clock-rates = <24000000>;
status = "okay";
max9286_mipi@48 {
compatible = "maxim,max9286_mipi";
reg = <0x48>;
pinctrl-0 = <&pinctrl_max9286>;
pinctrl-names = "default";
clocks = <&clk IMX8QM_CLK_DUMMY>;
clock-names = "capture_mclk";
mclk = <81000000>;
mclk_source = <0>;
pwn-gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
power-gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
gpi-gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
virtual-channel;
port {
max9286_0_ep: endpoint {
remote-endpoint = <&mipi_csi0_ep>;
data-lanes = <1 2 3 4>;
};
};
};
};
&isi_0 {
status = "okay";
};
&isi_1 {
status = "okay";
};
&isi_2 {
status = "okay";
};
&isi_3 {
status = "okay";
};
CONFIG_IMX8_MEDIA_DEVICE=m
CONFIG_VIDEO_V4L2_SUBDEV_API=y
# CONFIG_USB_GSPCA is not set
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_VIDEO_MXC_CAPTURE=y
CONFIG_VIDEO_MX8_CAPTURE=y
CONFIG_IMX8_CAPTURE_DRIVER=m
CONFIG_IMX8_MIPI_CSI2=m
CONFIG_MXC_CAMERA_OV5640_MIPI_V3=m
CONFIG_GMSL_MAX9286=m
CONFIG_CAMERA_ACTION=m
CONFIG_VIDEO_MXC_CSI_CAMERA=y
CONFIG_MXC_MIPI_CSI=y
CONFIG_MXC_CAMERA_OV5640_MIPI_V2=y
CONFIG_V4L_MEM2MEM_DRIVERS=y
ADD0 ADD1都为low,所以地址为0x48
imx-test例程里面有v4l2将摄像头的buffer映射到drm的buffer里面。
mx8_v4l2_cap_drm_64 -cam 1 -fmt RGBP -ow 1280 -oh 720 -fr 30
用法如下:
mx8_v4l2_cap_drm_64
-num
-of save to file
-l
-log
-cam 0bxxxx,xxxx
-d "/dev/videoX" if user use this option, -cam should be 1
-p test performance, need to combine with "-of" option
-m specify camera sensor capture mode(mode:0, 1, 2, 3, 4)
-fr support 15fps and 30fps
-fmt support XR24, AR24, RGBP, RGB3, BGR3, YUV4, YM24, YUYV and NV12, only XR24, AR24 and RGBP support playback
-ow specify output width
-oh specify output height
-hflip enable horizontal flip, num: 0->disable or 1->enable
-vflip enable vertical flip, num: 0->disable or 1->enable
-alpha enable and set global alpha for camera, num equal to 0~255
example:
./mx8_cap -cam 1 capture data from video0 and playback
./mx8_cap -cam 3 capture data from video0/1 and playback
./mx8_cap -cam 7 -of capture data from video0~2 and save to 0~2.BX24
./mx8_cap -cam 255 -of capture data from video0~7 and save to 0~7.BX24
./mx8_cap -cam 0xff -of capture data from video0~7 and save to 0~7.BX24
./mx8_cap -cam 1 -fmt NV12 -of capture data from video0 and save to 0.NV12
./mx8_cap -cam 1 -of -p test video0 performace
mek_8q:/ # mx8_v4l2_cap_drm_64 -cam 1 -fmt RGBP -ow 1280 -oh 720 -fr 30
(init_video_channel:499): init channel[0] v4l2_dev_name=/dev/video0 w/h=(1280,720)
(open_drm_device:600): drm device '/dev/dri/card0' does not support dumb buffers
(open_drm_device:607): Open /dev/dri/card1 success
(open_v4l2_device:640): open /dev/video0 success
(modeset_setup_dev:855): DRM bufffer[0] addr=0x0xf8c2eb70d000 size=4147200 w/h=(1920,1080) buf_id=84
(modeset_setup_dev:855): DRM bufffer[1] addr=0x0xf8c2eb318000 size=4147200 w/h=(1920,1080) buf_id=85
(config_video_channel:933): xres=1920, y_res=1080
(v4l2_setup_dev:1071): Get chip ident: imx8_max9286_mipi_0
(v4l2_enum_fmt:1019): index=0 pixelformat=RGBP
(v4l2_enum_fmt:1019): index=1 pixelformat=RGB3
(v4l2_enum_fmt:1019): index=2 pixelformat=BX24
(v4l2_enum_fmt:1019): index=3 pixelformat=BGR3
(v4l2_enum_fmt:1019): index=4 pixelformat=BA24
[ 1410.398430] input fmt YUV4
[ 1410.406431] output fmt RGBP
(v4l2_enum_fmt:1019): index=5 pixelformat=YUYV
(v4l2_enum_fmt:1019): index=6 pixelformat=YUV4
(v4l2_enum_fmt:1019): index=7 pixelformat=NV12
(v4l2_enum_fmt:1019): index=8 pixelformat=YM24
(v4l2_enum_fmt:1019): index=9 pixelformat=XR24
(v4l2_enum_fmt:1019): index=10 pixelformat=AR24
(v4l2_enum_fmt:1019): index=11 pixelformat=UYVY
(v4l2_enum_fmt:1019): index=12 pixelformat=RGB4
(v4l2_enum_fmt:1015): channel VIDIOC_ENUM_FMT fail
(v4l2_setup_dev:1156): planes=1 WxH@fps = 1280x720@30
(get_memory_map_info:1206): V4L2 buffer[0]->planes[0]:startAddr=0x0xf8c2eb156000, offset=0x0, buf_size=1843200
(get_memory_map_info:1206): V4L2 buffer[1]->planes[0]:startAddr=0x0xf8c2eaf94000, offset=0x1c2000, buf_size
指出几个重要寄存器:
96705:
max9271_write_reg(max9286_data, 0, 0x07, 0x94);
max9271_write_reg(max9286_data, 0, 0x04, 0x43);
max9271_write_reg(max9286_data, 0, 0x42, 0x5F);
9286:
max9286_write_reg(max9286_data, 0x12, 0xF3);
max9286_write_reg(max9286_data, 0x01, 0xE2);
接下来就不公布了,有不懂的可以留言。