GNU Linux-libre 5.19-rc6-gnu
[releases.git] / drivers / staging / media / atomisp / pci / ia_css_buffer.h
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 __IA_CSS_BUFFER_H
17 #define __IA_CSS_BUFFER_H
18
19 /* @file
20  * This file contains datastructures and types for buffers used in CSS
21  */
22
23 #include <type_support.h>
24 #include "ia_css_types.h"
25 #include "ia_css_timer.h"
26
27 /* Enumeration of buffer types. Buffers can be queued and de-queued
28  *  to hand them over between IA and ISP.
29  */
30 enum ia_css_buffer_type {
31         IA_CSS_BUFFER_TYPE_INVALID = -1,
32         IA_CSS_BUFFER_TYPE_3A_STATISTICS = 0,
33         IA_CSS_BUFFER_TYPE_DIS_STATISTICS,
34         IA_CSS_BUFFER_TYPE_LACE_STATISTICS,
35         IA_CSS_BUFFER_TYPE_INPUT_FRAME,
36         IA_CSS_BUFFER_TYPE_OUTPUT_FRAME,
37         IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME,
38         IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME,
39         IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME,
40         IA_CSS_BUFFER_TYPE_RAW_OUTPUT_FRAME,
41         IA_CSS_BUFFER_TYPE_CUSTOM_INPUT,
42         IA_CSS_BUFFER_TYPE_CUSTOM_OUTPUT,
43         IA_CSS_BUFFER_TYPE_METADATA,
44         IA_CSS_BUFFER_TYPE_PARAMETER_SET,
45         IA_CSS_BUFFER_TYPE_PER_FRAME_PARAMETER_SET,
46         IA_CSS_NUM_DYNAMIC_BUFFER_TYPE,
47         IA_CSS_NUM_BUFFER_TYPE
48 };
49
50 /* Driver API is not SP/ISP visible, 64 bit types not supported on hivecc */
51
52 /* Buffer structure. This is a container structure that enables content
53  *  independent buffer queues and access functions.
54  */
55 struct ia_css_buffer {
56         enum ia_css_buffer_type type; /** Buffer type. */
57         unsigned int exp_id;
58         /** exposure id for this buffer; 0 = not available
59              see ia_css_event_public.h for more detail. */
60         union {
61                 struct ia_css_isp_3a_statistics
62                         *stats_3a;    /** 3A statistics & optionally RGBY statistics. */
63                 struct ia_css_isp_dvs_statistics *stats_dvs;   /** DVS statistics. */
64                 struct ia_css_isp_skc_dvs_statistics *stats_skc_dvs;  /** SKC DVS statistics. */
65                 struct ia_css_frame              *frame;       /** Frame buffer. */
66                 struct ia_css_acc_param          *custom_data; /** Custom buffer. */
67                 struct ia_css_metadata           *metadata;    /** Sensor metadata. */
68         } data; /** Buffer data pointer. */
69         u64 driver_cookie; /** cookie for the driver */
70         struct ia_css_time_meas
71                 timing_data; /** timing data (readings from the timer) */
72         struct ia_css_clock_tick
73                 isys_eof_clock_tick; /** ISYS's end of frame timer tick*/
74 };
75
76 /* @brief Dequeue param buffers from sp2host_queue
77  *
78  * @return                                       None
79  *
80  * This function must be called at every driver interrupt handler to prevent
81  * overflow of sp2host_queue.
82  */
83 void
84 ia_css_dequeue_param_buffers(void);
85
86 #endif /* __IA_CSS_BUFFER_H */