xref: /linux/drivers/staging/media/atomisp/pci/hive_isp_css_common/gdc_global.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
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 __GDC_GLOBAL_H_INCLUDED__
17 #define __GDC_GLOBAL_H_INCLUDED__
18 
19 #define IS_GDC_VERSION_2
20 
21 #include <type_support.h>
22 #include "gdc_v2_defs.h"
23 
24 /*
25  * Storage addresses for packed data transfer
26  */
27 #define GDC_PARAM_ICX_LEFT_ROUNDED_IDX            0
28 #define GDC_PARAM_OXDIM_FLOORED_IDX               1
29 #define GDC_PARAM_OXDIM_LAST_IDX                  2
30 #define GDC_PARAM_WOIX_LAST_IDX                   3
31 #define GDC_PARAM_IY_TOPLEFT_IDX                  4
32 #define GDC_PARAM_CHUNK_CNT_IDX                   5
33 /*#define GDC_PARAM_ELEMENTS_PER_XMEM_ADDR_IDX    6 */		/* Derived from bpp */
34 #define GDC_PARAM_BPP_IDX                         6
35 #define GDC_PARAM_BLOCK_HEIGHT_IDX                7
36 /*#define GDC_PARAM_DMA_CHANNEL_STRIDE_A_IDX      8*/		/* The DMA stride == the GDC buffer stride */
37 #define GDC_PARAM_WOIX_IDX                        8
38 #define GDC_PARAM_DMA_CHANNEL_STRIDE_B_IDX        9
39 #define GDC_PARAM_DMA_CHANNEL_WIDTH_A_IDX        10
40 #define GDC_PARAM_DMA_CHANNEL_WIDTH_B_IDX        11
41 #define GDC_PARAM_VECTORS_PER_LINE_IN_IDX        12
42 #define GDC_PARAM_VECTORS_PER_LINE_OUT_IDX       13
43 #define GDC_PARAM_VMEM_IN_DIMY_IDX               14
44 #define GDC_PARAM_COMMAND_IDX                    15
45 #define N_GDC_PARAM                              16
46 
47 /* Because of the packed parameter transfer max(params) == max(fragments) */
48 #define	N_GDC_FRAGMENTS		N_GDC_PARAM
49 
50 /* The GDC is capable of higher internal precision than the parameter data structures */
51 #define HRT_GDC_COORD_SCALE_BITS	6
52 #define HRT_GDC_COORD_SCALE			BIT(HRT_GDC_COORD_SCALE_BITS)
53 
54 typedef enum {
55 	GDC_CH0_ID = 0,
56 	N_GDC_CHANNEL_ID
57 } gdc_channel_ID_t;
58 
59 typedef enum {
60 	gdc_8_bpp  = 8,
61 	gdc_10_bpp = 10,
62 	gdc_12_bpp = 12,
63 	gdc_14_bpp = 14
64 } gdc_bits_per_pixel_t;
65 
66 typedef struct gdc_scale_param_mem_s {
67 	u16  params[N_GDC_PARAM];
68 	u16  ipx_start_array[N_GDC_PARAM];
69 	u16  ibuf_offset[N_GDC_PARAM];
70 	u16  obuf_offset[N_GDC_PARAM];
71 } gdc_scale_param_mem_t;
72 
73 typedef struct gdc_warp_param_mem_s {
74 	u32      origin_x;
75 	u32      origin_y;
76 	u32      in_addr_offset;
77 	u32      in_block_width;
78 	u32      in_block_height;
79 	u32      p0_x;
80 	u32      p0_y;
81 	u32      p1_x;
82 	u32      p1_y;
83 	u32      p2_x;
84 	u32      p2_y;
85 	u32      p3_x;
86 	u32      p3_y;
87 	u32      padding[3];
88 } gdc_warp_param_mem_t;
89 
90 #endif /* __GDC_GLOBAL_H_INCLUDED__ */
91