xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/include/common/rkcif-config.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR MIT)
2  *
3  * Copyright (C) 2019 Rockchip Electronics Co., Ltd.
4  */
5 
6 #ifndef _UAPI_RKCIF_CONFIG_H
7 #define _UAPI_RKCIF_CONFIG_H
8 
9 #include <linux/types.h>
10 #include <linux/v4l2-controls.h>
11 
12 #define RKCIF_API_VERSION		KERNEL_VERSION(0, 1, 0xa)
13 
14 #define V4L2_EVENT_RESET_DEV		0X1001
15 
16 #define RKCIF_CMD_GET_CSI_MEMORY_MODE \
17 	_IOR('V', BASE_VIDIOC_PRIVATE + 0, int)
18 
19 #define RKCIF_CMD_SET_CSI_MEMORY_MODE \
20 	_IOW('V', BASE_VIDIOC_PRIVATE + 1, int)
21 
22 #define RKCIF_CMD_GET_SCALE_BLC \
23 	_IOR('V', BASE_VIDIOC_PRIVATE + 2, struct bayer_blc)
24 
25 #define RKCIF_CMD_SET_SCALE_BLC \
26 	_IOW('V', BASE_VIDIOC_PRIVATE + 3, struct bayer_blc)
27 
28 #define RKCIF_CMD_SET_FPS \
29 	_IOW('V', BASE_VIDIOC_PRIVATE + 4, struct rkcif_fps)
30 
31 #define RKCIF_CMD_SET_RESET \
32 	_IOW('V', BASE_VIDIOC_PRIVATE + 6, int)
33 
34 #define RKCIF_CMD_SET_CSI_IDX \
35 	_IOW('V', BASE_VIDIOC_PRIVATE + 7, unsigned int)
36 
37 /* cif memory mode
38  * 0: raw12/raw10/raw8 8bit memory compact
39  * 1: raw12/raw10 16bit memory one pixel
40  *    low align for rv1126/rv1109/rk356x
41  *    |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
42  *    | -| -| -| -|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
43  * 2: raw12/raw10 16bit memory one pixel
44  *    high align for rv1126/rv1109/rk356x
45  *    |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
46  *    |11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| -| -| -| -|
47  *
48  * note: rv1109/rv1126/rk356x dvp only support uncompact mode,
49  *       and can be set low align or high align
50  */
51 
52 enum cif_csi_lvds_memory {
53 	CSI_LVDS_MEM_COMPACT = 0,
54 	CSI_LVDS_MEM_WORD_LOW_ALIGN = 1,
55 	CSI_LVDS_MEM_WORD_HIGH_ALIGN = 2,
56 };
57 
58 /* black level for scale image
59  * The sequence of pattern00~03 is the same as the output of sensor bayer
60  */
61 
62 struct bayer_blc {
63 	u8 pattern00;
64 	u8 pattern01;
65 	u8 pattern02;
66 	u8 pattern03;
67 };
68 
69 struct rkcif_fps {
70 	int ch_num;
71 	int fps;
72 };
73 
74 #endif
75