Merge tag 'for-4.15/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device...
[sfrench/cifs-2.6.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / ia_css_buffer.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #ifndef __IA_CSS_BUFFER_H
16 #define __IA_CSS_BUFFER_H
17
18 /* @file
19  * This file contains datastructures and types for buffers used in CSS
20  */
21
22 #include <type_support.h>
23 #include "ia_css_types.h"
24 #include "ia_css_timer.h"
25
26 /* Enumeration of buffer types. Buffers can be queued and de-queued
27  *  to hand them over between IA and ISP.
28  */
29 enum ia_css_buffer_type {
30         IA_CSS_BUFFER_TYPE_INVALID = -1,
31         IA_CSS_BUFFER_TYPE_3A_STATISTICS = 0,
32         IA_CSS_BUFFER_TYPE_DIS_STATISTICS,
33         IA_CSS_BUFFER_TYPE_LACE_STATISTICS,
34         IA_CSS_BUFFER_TYPE_INPUT_FRAME,
35         IA_CSS_BUFFER_TYPE_OUTPUT_FRAME,
36         IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME,
37         IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME,
38         IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME,
39         IA_CSS_BUFFER_TYPE_RAW_OUTPUT_FRAME,
40         IA_CSS_BUFFER_TYPE_CUSTOM_INPUT,
41         IA_CSS_BUFFER_TYPE_CUSTOM_OUTPUT,
42         IA_CSS_BUFFER_TYPE_METADATA,
43         IA_CSS_BUFFER_TYPE_PARAMETER_SET,
44         IA_CSS_BUFFER_TYPE_PER_FRAME_PARAMETER_SET,
45         IA_CSS_NUM_DYNAMIC_BUFFER_TYPE,
46         IA_CSS_NUM_BUFFER_TYPE
47 };
48
49 /* Driver API is not SP/ISP visible, 64 bit types not supported on hivecc */
50 #if !defined(__ISP)
51 /* Buffer structure. This is a container structure that enables content
52  *  independent buffer queues and access functions.
53  */
54 struct ia_css_buffer {
55         enum ia_css_buffer_type type; /** Buffer type. */
56         unsigned int exp_id;
57         /** exposure id for this buffer; 0 = not available
58              see ia_css_event_public.h for more detail. */
59         union {
60                 struct ia_css_isp_3a_statistics  *stats_3a;    /** 3A statistics & optionally RGBY statistics. */
61                 struct ia_css_isp_dvs_statistics *stats_dvs;   /** DVS statistics. */
62                 struct ia_css_isp_skc_dvs_statistics *stats_skc_dvs;  /** SKC DVS statistics. */
63                 struct ia_css_frame              *frame;       /** Frame buffer. */
64                 struct ia_css_acc_param          *custom_data; /** Custom buffer. */
65                 struct ia_css_metadata           *metadata;    /** Sensor metadata. */
66         } data; /** Buffer data pointer. */
67         uint64_t driver_cookie; /** cookie for the driver */
68         struct ia_css_time_meas timing_data; /** timing data (readings from the timer) */
69         struct ia_css_clock_tick isys_eof_clock_tick; /** ISYS's end of frame timer tick*/
70 };
71
72 /* @brief Dequeue param buffers from sp2host_queue
73  *
74  * @return                                       None
75  *
76  * This function must be called at every driver interrupt handler to prevent
77  * overflow of sp2host_queue.
78  */
79 void
80 ia_css_dequeue_param_buffers(void);
81
82 #endif /* !__ISP */
83
84 #endif /* __IA_CSS_BUFFER_H */