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 RKCIF_CMD_GET_CSI_MEMORY_MODE _IOR('V', BASE_VIDIOC_PRIVATE + 0, int)
15 
16 #define RKCIF_CMD_SET_CSI_MEMORY_MODE _IOW('V', BASE_VIDIOC_PRIVATE + 1, int)
17 
18 #define RKCIF_CMD_GET_SCALE_BLC _IOR('V', BASE_VIDIOC_PRIVATE + 2, struct bayer_blc)
19 
20 #define RKCIF_CMD_SET_SCALE_BLC _IOW('V', BASE_VIDIOC_PRIVATE + 3, struct bayer_blc)
21 
22 /* cif memory mode
23  * 0: raw12/raw10/raw8 8bit memory compact
24  * 1: raw12/raw10 16bit memory one pixel
25  *    low align for rv1126/rv1109/rk356x
26  *    |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
27  *    | -| -| -| -|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
28  * 2: raw12/raw10 16bit memory one pixel
29  *    high align for rv1126/rv1109/rk356x
30  *    |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
31  *    |11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| -| -| -| -|
32  *
33  * note: rv1109/rv1126/rk356x dvp only support uncompact mode,
34  *       and can be set low align or high align
35  */
36 
37 enum cif_csi_lvds_memory {
38     CSI_LVDS_MEM_COMPACT = 0,
39     CSI_LVDS_MEM_WORD_LOW_ALIGN = 1,
40     CSI_LVDS_MEM_WORD_HIGH_ALIGN = 2,
41 };
42 
43 /* black level for scale image
44  * The sequence of pattern00~03 is the same as the output of sensor bayer
45  */
46 
47 struct bayer_blc {
48     u8 pattern00;
49     u8 pattern01;
50     u8 pattern02;
51     u8 pattern03;
52 };
53 #endif
54