GNU Linux-libre 4.14.332-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_common / input_system_global.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__
16 #define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__
17
18 #define IS_INPUT_SYSTEM_VERSION_2
19
20 #include <type_support.h>
21
22 //CSI reveiver has 3 ports.
23 #define         N_CSI_PORTS (3)
24 //AM: Use previous define for this.
25
26 //MIPI allows upto 4 channels.
27 #define         N_CHANNELS  (4) 
28 // 12KB = 256bit x 384 words
29 #define         IB_CAPACITY_IN_WORDS (384)
30
31 typedef enum {
32         MIPI_0LANE_CFG = 0,
33         MIPI_1LANE_CFG = 1,
34         MIPI_2LANE_CFG = 2,
35         MIPI_3LANE_CFG = 3,
36         MIPI_4LANE_CFG = 4
37 } mipi_lane_cfg_t;
38
39 typedef enum {
40         INPUT_SYSTEM_SOURCE_SENSOR = 0,
41         INPUT_SYSTEM_SOURCE_FIFO,
42         INPUT_SYSTEM_SOURCE_TPG,
43         INPUT_SYSTEM_SOURCE_PRBS,
44         INPUT_SYSTEM_SOURCE_MEMORY,
45         N_INPUT_SYSTEM_SOURCE
46 } input_system_source_t;
47
48 /* internal routing configuration */
49 typedef enum {
50         INPUT_SYSTEM_DISCARD_ALL = 0,
51         INPUT_SYSTEM_CSI_BACKEND = 1,
52         INPUT_SYSTEM_INPUT_BUFFER = 2, 
53         INPUT_SYSTEM_MULTICAST = 3,
54         N_INPUT_SYSTEM_CONNECTION
55 } input_system_connection_t;
56
57 typedef enum {
58         INPUT_SYSTEM_MIPI_PORT0,
59         INPUT_SYSTEM_MIPI_PORT1,
60         INPUT_SYSTEM_MIPI_PORT2,
61         INPUT_SYSTEM_ACQUISITION_UNIT,
62         N_INPUT_SYSTEM_MULTIPLEX
63 } input_system_multiplex_t;
64
65 typedef enum {
66         INPUT_SYSTEM_SINK_MEMORY = 0,
67         INPUT_SYSTEM_SINK_ISP,
68         INPUT_SYSTEM_SINK_SP,
69         N_INPUT_SYSTEM_SINK
70 } input_system_sink_t;
71
72 typedef enum {
73         INPUT_SYSTEM_FIFO_CAPTURE = 0,
74         INPUT_SYSTEM_FIFO_CAPTURE_WITH_COUNTING,
75         INPUT_SYSTEM_SRAM_BUFFERING,
76         INPUT_SYSTEM_XMEM_BUFFERING,
77         INPUT_SYSTEM_XMEM_CAPTURE,
78         INPUT_SYSTEM_XMEM_ACQUIRE,
79         N_INPUT_SYSTEM_BUFFERING_MODE
80 } buffering_mode_t;
81
82 typedef struct input_system_cfg_s       input_system_cfg_t;
83 typedef struct sync_generator_cfg_s     sync_generator_cfg_t;
84 typedef struct tpg_cfg_s                        tpg_cfg_t;
85 typedef struct prbs_cfg_s                       prbs_cfg_t;
86
87 /* MW: uint16_t should be sufficient */
88 struct input_system_cfg_s {
89         uint32_t        no_side_band;
90         uint32_t        fmt_type;
91         uint32_t        ch_id;
92         uint32_t        input_mode;
93 };
94
95 struct sync_generator_cfg_s {
96         uint32_t        width;
97         uint32_t        height;
98         uint32_t        hblank_cycles;
99         uint32_t        vblank_cycles;
100 };
101
102 /* MW: tpg & prbs are exclusive */
103 struct tpg_cfg_s {
104         uint32_t        x_mask;
105         uint32_t        y_mask;
106         uint32_t        x_delta;
107         uint32_t        y_delta;
108         uint32_t        xy_mask;
109         sync_generator_cfg_t sync_gen_cfg;
110 };
111
112 struct prbs_cfg_s {
113         uint32_t        seed;
114         sync_generator_cfg_t sync_gen_cfg;
115 };
116
117 struct gpfifo_cfg_s {
118 // TBD.
119         sync_generator_cfg_t sync_gen_cfg;
120 };
121
122 typedef struct gpfifo_cfg_s             gpfifo_cfg_t;
123
124 //ALX:Commented out to pass the compilation.
125 //typedef struct input_system_cfg_s input_system_cfg_t;
126
127 struct ib_buffer_s {
128         uint32_t        mem_reg_size;
129         uint32_t        nof_mem_regs;
130         uint32_t        mem_reg_addr;
131 };
132
133 typedef struct ib_buffer_s      ib_buffer_t;
134
135 struct csi_cfg_s {
136         uint32_t                        csi_port;
137     buffering_mode_t    buffering_mode;
138         ib_buffer_t                     csi_buffer;
139         ib_buffer_t                     acquisition_buffer;
140         uint32_t                        nof_xmem_buffers;
141 };
142
143 typedef struct csi_cfg_s         csi_cfg_t;
144
145 typedef enum {
146         INPUT_SYSTEM_CFG_FLAG_RESET     = 0,
147         INPUT_SYSTEM_CFG_FLAG_SET               = 1U << 0,
148         INPUT_SYSTEM_CFG_FLAG_BLOCKED   = 1U << 1,
149         INPUT_SYSTEM_CFG_FLAG_REQUIRED  = 1U << 2,
150         INPUT_SYSTEM_CFG_FLAG_CONFLICT  = 1U << 3       // To mark a conflicting configuration.
151 } input_system_cfg_flag_t;
152
153 typedef uint32_t input_system_config_flags_t; 
154
155 #endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */