1 /* SPDX-License-Identifier: GPL-2.0 */
2 /**
3 Support for Intel Camera Imaging ISP subsystem.
4 Copyright (c) 2010 - 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 _IA_CSS_ISP_PARAM_TYPES_H_
17 #define _IA_CSS_ISP_PARAM_TYPES_H_
18 
19 #include "ia_css_types.h"
20 #include <platform_support.h>
21 #include <system_global.h>
22 
23 /* Short hands */
24 #define IA_CSS_ISP_DMEM IA_CSS_ISP_DMEM0
25 #define IA_CSS_ISP_VMEM IA_CSS_ISP_VMEM0
26 
27 /* The driver depends on this, to be removed later. */
28 #define IA_CSS_NUM_ISP_MEMORIES IA_CSS_NUM_MEMORIES
29 
30 /* Explicit member numbering to avoid fish type checker bug */
31 enum ia_css_param_class {
32 	IA_CSS_PARAM_CLASS_PARAM  = 0,	/* Late binding parameters, like 3A */
33 	IA_CSS_PARAM_CLASS_CONFIG = 1,	/* Pipe config time parameters, like resolution */
34 	IA_CSS_PARAM_CLASS_STATE  = 2,  /* State parameters, like tnr buffer index */
35 #if 0 /* Not yet implemented */
36 	IA_CSS_PARAM_CLASS_FRAME  = 3,  /* Frame time parameters, like output buffer */
37 #endif
38 };
39 
40 #define IA_CSS_NUM_PARAM_CLASSES (IA_CSS_PARAM_CLASS_STATE + 1)
41 
42 /* ISP parameter descriptor */
43 struct ia_css_isp_parameter {
44 	u32 offset; /* Offset in isp_<mem>)parameters, etc. */
45 	u32 size;   /* Disabled if 0 */
46 };
47 
48 /* Address/size of each parameter class in each isp memory, host memory pointers */
49 struct ia_css_isp_param_host_segments {
50 	struct ia_css_host_data params[IA_CSS_NUM_PARAM_CLASSES][IA_CSS_NUM_MEMORIES];
51 };
52 
53 /* Address/size of each parameter class in each isp memory, css memory pointers */
54 struct ia_css_isp_param_css_segments {
55 	struct ia_css_data      params[IA_CSS_NUM_PARAM_CLASSES][IA_CSS_NUM_MEMORIES];
56 };
57 
58 /* Address/size of each parameter class in each isp memory, isp memory pointers */
59 struct ia_css_isp_param_isp_segments {
60 	struct ia_css_isp_data  params[IA_CSS_NUM_PARAM_CLASSES][IA_CSS_NUM_MEMORIES];
61 };
62 
63 /* Memory offsets in binary info */
64 struct ia_css_isp_param_memory_offsets {
65 	u32 offsets[IA_CSS_NUM_PARAM_CLASSES];  /** offset wrt hdr in bytes */
66 };
67 
68 /* Offsets for ISP kernel parameters per isp memory.
69  * Only relevant for standard ISP binaries, not ACC or SP.
70  */
71 union ia_css_all_memory_offsets {
72 	struct {
73 		CSS_ALIGN(struct ia_css_memory_offsets	      *param, 8);
74 		CSS_ALIGN(struct ia_css_config_memory_offsets *config, 8);
75 		CSS_ALIGN(struct ia_css_state_memory_offsets  *state, 8);
76 	} offsets;
77 	struct {
78 		CSS_ALIGN(void *ptr, 8);
79 	} array[IA_CSS_NUM_PARAM_CLASSES];
80 };
81 
82 #endif /* _IA_CSS_ISP_PARAM_TYPES_H_ */
83