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_MAX_CSI_NUM 4 13 14 #define RKCIF_API_VERSION KERNEL_VERSION(0, 2, 0) 15 16 #define V4L2_EVENT_RESET_DEV 0X1001 17 18 #define RKCIF_CMD_GET_CSI_MEMORY_MODE \ 19 _IOR('V', BASE_VIDIOC_PRIVATE + 0, int) 20 21 #define RKCIF_CMD_SET_CSI_MEMORY_MODE \ 22 _IOW('V', BASE_VIDIOC_PRIVATE + 1, int) 23 24 #define RKCIF_CMD_GET_SCALE_BLC \ 25 _IOR('V', BASE_VIDIOC_PRIVATE + 2, struct bayer_blc) 26 27 #define RKCIF_CMD_SET_SCALE_BLC \ 28 _IOW('V', BASE_VIDIOC_PRIVATE + 3, struct bayer_blc) 29 30 #define RKCIF_CMD_SET_FPS \ 31 _IOW('V', BASE_VIDIOC_PRIVATE + 4, struct rkcif_fps) 32 33 #define RKCIF_CMD_SET_RESET \ 34 _IOW('V', BASE_VIDIOC_PRIVATE + 6, int) 35 36 #define RKCIF_CMD_SET_CSI_IDX \ 37 _IOW('V', BASE_VIDIOC_PRIVATE + 7, struct rkcif_csi_info) 38 39 /* cif memory mode 40 * 0: raw12/raw10/raw8 8bit memory compact 41 * 1: raw12/raw10 16bit memory one pixel 42 * low align for rv1126/rv1109/rk356x 43 * |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| 44 * | -| -| -| -|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| 45 * 2: raw12/raw10 16bit memory one pixel 46 * high align for rv1126/rv1109/rk356x 47 * |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| 48 * |11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| -| -| -| -| 49 * 50 * note: rv1109/rv1126/rk356x dvp only support uncompact mode, 51 * and can be set low align or high align 52 */ 53 54 enum cif_csi_lvds_memory { 55 CSI_LVDS_MEM_COMPACT = 0, 56 CSI_LVDS_MEM_WORD_LOW_ALIGN = 1, 57 CSI_LVDS_MEM_WORD_HIGH_ALIGN = 2, 58 }; 59 60 /* black level for scale image 61 * The sequence of pattern00~03 is the same as the output of sensor bayer 62 */ 63 64 struct bayer_blc { 65 __u8 pattern00; 66 __u8 pattern01; 67 __u8 pattern02; 68 __u8 pattern03; 69 }; 70 71 struct rkcif_fps { 72 int ch_num; 73 int fps; 74 }; 75 76 struct rkcif_csi_info { 77 int csi_num; 78 int csi_idx[RKCIF_MAX_CSI_NUM]; 79 int dphy_vendor[RKCIF_MAX_CSI_NUM]; 80 }; 81 82 #endif 83