1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  */
6 
7 #ifndef __SH_CSS_STRUCT_H
8 #define __SH_CSS_STRUCT_H
9 
10 /* This header files contains the definition of the
11    sh_css struct and friends; locigally the file would
12    probably be called sh_css.h after the pattern
13    <type>.h but sh_css.h is the predecesssor of ia_css.h
14    so this could cause confusion; hence the _struct
15    in the filename
16 */
17 
18 #include <type_support.h>
19 #include <system_local.h>
20 #include "ia_css_pipeline.h"
21 #include "ia_css_pipe_public.h"
22 #include "ia_css_frame_public.h"
23 #include "ia_css_queue.h"
24 #include "ia_css_irq.h"
25 
26 struct sh_css {
27 	struct ia_css_pipe            *active_pipes[IA_CSS_PIPELINE_NUM_MAX];
28 	/* All of the pipes created at any point of time. At this moment there can
29 	 * be no more than MAX_SP_THREADS of them because pipe_num is reused as SP
30 	 * thread_id to which a pipe's pipeline is associated. At a later point, if
31 	 * we support more pipe objects, we should add test code to test that
32 	 * possibility. Also, active_pipes[] should be able to hold only
33 	 * SH_CSS_MAX_SP_THREADS objects. Anything else is misleading. */
34 	struct ia_css_pipe            *all_pipes[IA_CSS_PIPELINE_NUM_MAX];
35 	void *(*malloc)(size_t bytes, bool zero_mem);
36 	void (*free)(void *ptr);
37 	void (*flush)(struct ia_css_acc_fw *fw);
38 
39 /* ISP2401 */
40 	void *(*malloc_ex)(size_t bytes, bool zero_mem, const char *caller_func,
41 			   int caller_line);
42 	void (*free_ex)(void *ptr, const char *caller_func, int caller_line);
43 
44 /* ISP2400 */
45 	bool stop_copy_preview;
46 
47 	bool                           check_system_idle;
48 	unsigned int                   num_cont_raw_frames;
49 	unsigned int                   num_mipi_frames[N_CSI_PORTS];
50 	struct ia_css_frame
51 		*mipi_frames[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM];
52 	struct ia_css_metadata
53 		*mipi_metadata[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM];
54 	unsigned int
55 	mipi_sizes_for_check[N_CSI_PORTS][IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT];
56 	unsigned int                   mipi_frame_size[N_CSI_PORTS];
57 	ia_css_ptr                   sp_bin_addr;
58 	hrt_data                       page_table_base_index;
59 
60 	unsigned int
61 	size_mem_words; /* \deprecated{Use ia_css_mipi_buffer_config instead.}*/
62 	enum ia_css_irq_type           irq_type;
63 	unsigned int                   pipe_counter;
64 
65 	unsigned int		type;	/* 2400 or 2401 for now */
66 };
67 
68 #define IPU_2400		1
69 #define IPU_2401		2
70 
71 #define IS_2400()		(my_css.type == IPU_2400)
72 #define IS_2401()		(my_css.type == IPU_2401)
73 
74 extern struct sh_css my_css;
75 
76 #endif /* __SH_CSS_STRUCT_H */
77