GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / atomisp_acc.h
1 /*
2  * Support for Clovertrail PNW Camera Imaging ISP subsystem.
3  *
4  * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License version
8  * 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA.
19  *
20  */
21
22 #ifndef __ATOMISP_ACC_H__
23 #define __ATOMISP_ACC_H__
24
25 #include "../../include/linux/atomisp.h"
26 #include "atomisp_internal.h"
27
28 #include "ia_css_types.h"
29
30 /*
31  * Interface functions for AtomISP driver acceleration API implementation.
32  */
33
34 struct atomisp_sub_device;
35
36 void atomisp_acc_cleanup(struct atomisp_device *isp);
37
38 /*
39  * Free up any allocated resources.
40  * Must be called each time when the device is closed.
41  * Note that there isn't corresponding open() call;
42  * this function may be called sequentially multiple times.
43  * Must be called to free up resources before driver is unloaded.
44  */
45 void atomisp_acc_release(struct atomisp_sub_device *asd);
46
47 /* Load acceleration binary. DEPRECATED. */
48 int atomisp_acc_load(struct atomisp_sub_device *asd,
49                      struct atomisp_acc_fw_load *fw);
50
51 /* Load acceleration binary with specified properties */
52 int atomisp_acc_load_to_pipe(struct atomisp_sub_device *asd,
53                              struct atomisp_acc_fw_load_to_pipe *fw);
54
55 /* Unload specified acceleration binary */
56 int atomisp_acc_unload(struct atomisp_sub_device *asd,
57                        unsigned int *handle);
58
59 /*
60  * Map a memory region into ISP memory space.
61  */
62 int atomisp_acc_map(struct atomisp_sub_device *asd,
63                     struct atomisp_acc_map *map);
64
65 /*
66  * Unmap a mapped memory region.
67  */
68 int atomisp_acc_unmap(struct atomisp_sub_device *asd,
69                       struct atomisp_acc_map *map);
70
71 /*
72  * Set acceleration binary argument to a previously mapped memory region.
73  */
74 int atomisp_acc_s_mapped_arg(struct atomisp_sub_device *asd,
75                              struct atomisp_acc_s_mapped_arg *arg);
76
77
78 /*
79  * Start acceleration.
80  * Return immediately, acceleration is left running in background.
81  * Specify either acceleration binary or pipeline which to start.
82  */
83 int atomisp_acc_start(struct atomisp_sub_device *asd,
84                       unsigned int *handle);
85
86 /*
87  * Wait until acceleration finishes.
88  * This MUST be called after each acceleration has been started.
89  * Specify either acceleration binary or pipeline handle.
90  */
91 int atomisp_acc_wait(struct atomisp_sub_device *asd,
92                      unsigned int *handle);
93
94 /*
95  * Used by ISR to notify ACC stage finished.
96  * This is internally used and does not export as IOCTL.
97  */
98 void atomisp_acc_done(struct atomisp_sub_device *asd, unsigned int handle);
99
100 /*
101  * Appends the loaded acceleration binary extensions to the
102  * current ISP mode. Must be called just before atomisp_css_start().
103  */
104 int atomisp_acc_load_extensions(struct atomisp_sub_device *asd);
105
106 /*
107  * Must be called after streaming is stopped:
108  * unloads any loaded acceleration extensions.
109  */
110 void atomisp_acc_unload_extensions(struct atomisp_sub_device *asd);
111
112 /*
113  * Set acceleration firmware flags.
114  */
115 int atomisp_acc_set_state(struct atomisp_sub_device *asd,
116                           struct atomisp_acc_state *arg);
117
118 /*
119  * Get acceleration firmware flags.
120  */
121 int atomisp_acc_get_state(struct atomisp_sub_device *asd,
122                           struct atomisp_acc_state *arg);
123
124 #endif /* __ATOMISP_ACC_H__ */