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