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