GNU Linux-libre 4.14.324-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / css_2401_csi2p_system / ibuf_ctrl_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 __IBUF_CTRL_GLOBAL_H_INCLUDED__
16 #define __IBUF_CTRL_GLOBAL_H_INCLUDED__
17
18 #include <type_support.h>
19
20 #include <ibuf_cntrl_defs.h>    /* _IBUF_CNTRL_RECALC_WORDS_STATUS,
21                                  * _IBUF_CNTRL_ARBITERS_STATUS,
22                                  * _IBUF_CNTRL_PROC_REG_ALIGN,
23                                  * etc.
24                                  */
25
26 /* Definition of contents of main controller state register is lacking
27  * in ibuf_cntrl_defs.h, so define these here:
28  */
29 #define _IBUF_CNTRL_MAIN_CNTRL_FSM_MASK                 0xf
30 #define _IBUF_CNTRL_MAIN_CNTRL_FSM_NEXT_COMMAND_CHECK   0x9
31 #define _IBUF_CNTRL_MAIN_CNTRL_MEM_INP_BUF_ALLOC        (1 << 8)
32 #define _IBUF_CNTRL_DMA_SYNC_WAIT_FOR_SYNC              1
33 #define _IBUF_CNTRL_DMA_SYNC_FSM_WAIT_FOR_ACK           (0x3 << 1)
34
35 typedef struct ib_buffer_s      ib_buffer_t;
36 struct  ib_buffer_s {
37         uint32_t        start_addr;     /* start address of the buffer in the
38                                          * "input-buffer hardware block"
39                                          */
40
41         uint32_t        stride;         /* stride per buffer line (in bytes) */
42         uint32_t        lines;          /* lines in the buffer */
43 };
44
45 typedef struct ibuf_ctrl_cfg_s ibuf_ctrl_cfg_t;
46 struct ibuf_ctrl_cfg_s {
47
48         bool online;
49
50         struct {
51                 /* DMA configuration */
52                 uint32_t channel;
53                 uint32_t cmd; /* must be _DMA_V2_MOVE_A2B_NO_SYNC_CHK_COMMAND */
54
55                 /* DMA reconfiguration */
56                 uint32_t shift_returned_items;
57                 uint32_t elems_per_word_in_ibuf;
58                 uint32_t elems_per_word_in_dest;
59         } dma_cfg;
60
61         ib_buffer_t ib_buffer;
62
63         struct {
64                 uint32_t stride;
65                 uint32_t start_addr;
66                 uint32_t lines;
67         } dest_buf_cfg;
68
69         uint32_t items_per_store;
70         uint32_t stores_per_frame;
71
72         struct {
73                 uint32_t sync_cmd;      /* must be _STREAM2MMIO_CMD_TOKEN_SYNC_FRAME */
74                 uint32_t store_cmd;     /* must be _STREAM2MMIO_CMD_TOKEN_STORE_PACKETS */
75         } stream2mmio_cfg;
76 };
77
78 extern const uint32_t N_IBUF_CTRL_PROCS[N_IBUF_CTRL_ID];
79
80 #endif /* __IBUF_CTRL_GLOBAL_H_INCLUDED__ */