GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_common / host / input_formatter_local.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2010-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_FORMATTER_LOCAL_H_INCLUDED__
16 #define __INPUT_FORMATTER_LOCAL_H_INCLUDED__
17
18 #include "input_formatter_global.h"
19
20 #include "isp.h"                /* ISP_VEC_ALIGN */
21
22 typedef struct input_formatter_switch_state_s   input_formatter_switch_state_t;
23 typedef struct input_formatter_state_s                  input_formatter_state_t;
24 typedef struct input_formatter_bin_state_s              input_formatter_bin_state_t;
25
26 #define HIVE_IF_FSM_SYNC_STATUS                 0x100
27 #define HIVE_IF_FSM_SYNC_COUNTER                0x104
28 #define HIVE_IF_FSM_DEINTERLEAVING_IDX          0x114
29 #define HIVE_IF_FSM_DECIMATION_H_COUNTER        0x118
30 #define HIVE_IF_FSM_DECIMATION_V_COUNTER        0x11C
31 #define HIVE_IF_FSM_DECIMATION_BLOCK_V_COUNTER  0x120
32 #define HIVE_IF_FSM_PADDING_STATUS              0x124
33 #define HIVE_IF_FSM_PADDING_ELEMENT_COUNTER     0x128
34 #define HIVE_IF_FSM_VECTOR_SUPPORT_ERROR        0x12C
35 #define HIVE_IF_FSM_VECTOR_SUPPORT_BUFF_FULL    0x130
36 #define HIVE_IF_FSM_VECTOR_SUPPORT              0x134
37 #define HIVE_IF_FIFO_SENSOR_STATUS              0x138
38
39 /*
40  * The switch LUT's coding defines a sink for each
41  * single channel ID + channel format type. Conversely
42  * the sink (i.e. an input formatter) can be reached
43  * from multiple channel & format type combinations
44  *
45  * LUT[0,1] channel=0, format type {0,1,...31}
46  * LUT[2,3] channel=1, format type {0,1,...31}
47  * LUT[4,5] channel=2, format type {0,1,...31}
48  * LUT[6,7] channel=3, format type {0,1,...31}
49  *
50  * Each register hold 16 2-bit fields encoding the sink
51  * {0,1,2,3}, "0" means unconnected.
52  *
53  * The single FSYNCH register uses four 3-bit fields of 1-hot
54  * encoded sink information, "0" means unconnected.
55  *
56  * The encoding is redundant. The FSYNCH setting will connect
57  * a channel to a sink. At that point the LUT's belonging to
58  * that channel can be directed to another sink. Thus the data
59  * goes to another place than the synch
60  */
61 struct input_formatter_switch_state_s {
62         int     if_input_switch_lut_reg[8];
63         int     if_input_switch_fsync_lut;
64         int     if_input_switch_ch_id_fmt_type;
65         bool if_input_switch_map[HIVE_SWITCH_N_CHANNELS][HIVE_SWITCH_N_FORMATTYPES];
66 };
67
68 struct input_formatter_state_s {
69 /*      int     reset; */
70         int     start_line;
71         int     start_column;
72         int     cropped_height;
73         int     cropped_width;
74         int     ver_decimation;
75         int     hor_decimation;
76         int     ver_deinterleaving;
77         int     hor_deinterleaving;
78         int     left_padding;
79         int     eol_offset;
80         int     vmem_start_address;
81         int     vmem_end_address;
82         int     vmem_increment;
83         int     is_yuv420;
84         int     vsync_active_low;
85         int     hsync_active_low;
86         int     allow_fifo_overflow;
87         int block_fifo_when_no_req;
88         int     fsm_sync_status;
89         int     fsm_sync_counter;
90         int     fsm_crop_status;
91         int     fsm_crop_line_counter;
92         int     fsm_crop_pixel_counter;
93         int     fsm_deinterleaving_index;
94         int     fsm_dec_h_counter;
95         int     fsm_dec_v_counter;
96         int     fsm_dec_block_v_counter;
97         int     fsm_padding_status;
98         int     fsm_padding_elem_counter;
99         int     fsm_vector_support_error;
100         int     fsm_vector_buffer_full;
101         int     vector_support;
102         int     sensor_data_lost;
103 };
104
105 struct input_formatter_bin_state_s {
106         uint32_t        reset;
107         uint32_t        input_endianness;
108         uint32_t        output_endianness;
109         uint32_t        bitswap;
110         uint32_t        block_synch;
111         uint32_t        packet_synch;
112         uint32_t        readpostwrite_synch;
113         uint32_t        is_2ppc;
114         uint32_t        en_status_update;
115 };
116
117 static const unsigned int input_formatter_alignment[N_INPUT_FORMATTER_ID] = {
118         ISP_VEC_ALIGN, ISP_VEC_ALIGN, HIVE_ISP_CTRL_DATA_BYTES};
119
120 #endif /* __INPUT_FORMATTER_LOCAL_H_INCLUDED__ */