1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef MIPI_CSI_DEV_H 10 #define MIPI_CSI_DEV_H 11 12 #include "hdf_base.h" 13 #include "mipi_csi_if.h" 14 15 typedef enum { 16 WORK_MODE_LVDS = 0x0, 17 WORK_MODE_MIPI = 0x1, 18 WORK_MODE_CMOS = 0x2, 19 WORK_MODE_BT1120 = 0x3, 20 WORK_MODE_SLVS = 0x4, 21 WORK_MODE_BUTT 22 } WorkMode; 23 24 typedef struct { 25 uint8_t devno; 26 PhyCmvMode cmvMode; 27 } PhyCmv; 28 29 #define CONFIG_HI_PROC_SHOW_SUPPORT 30 31 #define HI_MIPI_IOC_MAGIC 'm' 32 33 /* init data lane, input mode, data type */ 34 #define HI_MIPI_SET_DEV_ATTR _IOW(HI_MIPI_IOC_MAGIC, 0x01, ComboDevAttr) 35 36 /* set phy common mode voltage mode */ 37 #define HI_MIPI_SET_PHY_CMVMODE _IOW(HI_MIPI_IOC_MAGIC, 0x04, PhyCmv) 38 39 /* reset sensor */ 40 #define HI_MIPI_RESET_SENSOR _IOW(HI_MIPI_IOC_MAGIC, 0x05, uint8_t) 41 42 /* unreset sensor */ 43 #define HI_MIPI_UNRESET_SENSOR _IOW(HI_MIPI_IOC_MAGIC, 0x06, uint8_t) 44 45 /* reset mipi */ 46 #define HI_MIPI_RESET_MIPI _IOW(HI_MIPI_IOC_MAGIC, 0x07, uint8_t) 47 48 /* unreset mipi */ 49 #define HI_MIPI_UNRESET_MIPI _IOW(HI_MIPI_IOC_MAGIC, 0x08, uint8_t) 50 51 /* reset slvs */ 52 #define HI_MIPI_RESET_SLVS _IOW(HI_MIPI_IOC_MAGIC, 0x09, uint8_t) 53 54 /* unreset slvs */ 55 #define HI_MIPI_UNRESET_SLVS _IOW(HI_MIPI_IOC_MAGIC, 0x0a, uint8_t) 56 57 /* set mipi hs_mode */ 58 #define HI_MIPI_SET_HS_MODE _IOW(HI_MIPI_IOC_MAGIC, 0x0b, LaneDivideMode) 59 60 /* enable mipi clock */ 61 #define HI_MIPI_ENABLE_MIPI_CLOCK _IOW(HI_MIPI_IOC_MAGIC, 0x0c, uint8_t) 62 63 /* disable mipi clock */ 64 #define HI_MIPI_DISABLE_MIPI_CLOCK _IOW(HI_MIPI_IOC_MAGIC, 0x0d, uint8_t) 65 66 /* enable slvs clock */ 67 #define HI_MIPI_ENABLE_SLVS_CLOCK _IOW(HI_MIPI_IOC_MAGIC, 0x0e, uint8_t) 68 69 /* disable slvs clock */ 70 #define HI_MIPI_DISABLE_SLVS_CLOCK _IOW(HI_MIPI_IOC_MAGIC, 0x0f, uint8_t) 71 72 /* enable sensor clock */ 73 #define HI_MIPI_ENABLE_SENSOR_CLOCK _IOW(HI_MIPI_IOC_MAGIC, 0x10, uint8_t) 74 75 /* disable sensor clock */ 76 #define HI_MIPI_DISABLE_SENSOR_CLOCK _IOW(HI_MIPI_IOC_MAGIC, 0x11, uint8_t) 77 78 #define HI_MIPI_SET_EXT_DATA_TYPE _IOW(HI_MIPI_IOC_MAGIC, 0x12, ExtDataType) 79 80 int MipiCsiDevModuleInit(uint8_t id); 81 void MipiCsiDevModuleExit(uint8_t id); 82 83 #endif /* MIPI_CSI_DEV_H */ 84