GNU Linux-libre 4.19.286-gnu1
[releases.git] / drivers / media / platform / sti / delta / delta-ipc.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) STMicroelectronics SA 2015
4  * Author: Hugues Fruchet <hugues.fruchet@st.com> for STMicroelectronics.
5  */
6
7 #ifndef DELTA_IPC_H
8 #define DELTA_IPC_H
9
10 int delta_ipc_init(struct delta_dev *delta);
11 void delta_ipc_exit(struct delta_dev *delta);
12
13 /*
14  * delta_ipc_open - open a decoding instance on firmware side
15  * @ctx:                (in) delta context
16  * @name:               (in) name of decoder to be used
17  * @param:              (in) open command parameters specific to decoder
18  *  @param.size:                (in) size of parameter
19  *  @param.data:                (in) virtual address of parameter
20  * @ipc_buf_size:       (in) size of IPC shared buffer between host
21  *                           and copro used to share command data.
22  *                           Client have to set here the size of the biggest
23  *                           command parameters (+ status if any).
24  *                           Allocation will be done in this function which
25  *                           will give back to client in @ipc_buf the virtual
26  *                           & physical addresses & size of shared IPC buffer.
27  *                           All the further command data (parameters + status)
28  *                           have to be written in this shared IPC buffer
29  *                           virtual memory. This is done to avoid
30  *                           unnecessary copies of command data.
31  * @ipc_buf:            (out) allocated IPC shared buffer
32  *  @ipc_buf.size:              (out) allocated size
33  *  @ipc_buf.vaddr:             (out) virtual address where to copy
34  *                                    further command data
35  * @hdl:                (out) handle of decoding instance.
36  */
37
38 int delta_ipc_open(struct delta_ctx *ctx, const char *name,
39                    struct delta_ipc_param *param, u32 ipc_buf_size,
40                    struct delta_buf **ipc_buf, void **hdl);
41
42 /*
43  * delta_ipc_set_stream - set information about stream to decoder
44  * @hdl:                (in) handle of decoding instance.
45  * @param:              (in) set stream command parameters specific to decoder
46  *  @param.size:                (in) size of parameter
47  *  @param.data:                (in) virtual address of parameter. Must be
48  *                                   within IPC shared buffer range
49  */
50 int delta_ipc_set_stream(void *hdl, struct delta_ipc_param *param);
51
52 /*
53  * delta_ipc_decode - frame decoding synchronous request, returns only
54  *                    after decoding completion on firmware side.
55  * @hdl:                (in) handle of decoding instance.
56  * @param:              (in) decode command parameters specific to decoder
57  *  @param.size:                (in) size of parameter
58  *  @param.data:                (in) virtual address of parameter. Must be
59  *                                   within IPC shared buffer range
60  * @status:             (in/out) decode command status specific to decoder
61  *  @status.size:               (in) size of status
62  *  @status.data:               (in/out) virtual address of status. Must be
63  *                                       within IPC shared buffer range.
64  *                                       Status is filled by decoding instance
65  *                                       after decoding completion.
66  */
67 int delta_ipc_decode(void *hdl, struct delta_ipc_param *param,
68                      struct delta_ipc_param *status);
69
70 /*
71  * delta_ipc_close - close decoding instance
72  * @hdl:                (in) handle of decoding instance to close.
73  */
74 void delta_ipc_close(void *hdl);
75
76 #endif /* DELTA_IPC_H */