• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * vsp1_dl.h  --  R-Car VSP1 Display List
4  *
5  * Copyright (C) 2015 Renesas Corporation
6  *
7  * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8  */
9 #ifndef __VSP1_DL_H__
10 #define __VSP1_DL_H__
11 
12 #include <linux/types.h>
13 
14 struct vsp1_device;
15 struct vsp1_dl_body;
16 struct vsp1_dl_body_pool;
17 struct vsp1_dl_list;
18 struct vsp1_dl_manager;
19 
20 /* Keep these flags in sync with VSP1_DU_STATUS_* in include/media/vsp1.h. */
21 #define VSP1_DL_FRAME_END_COMPLETED		BIT(0)
22 #define VSP1_DL_FRAME_END_WRITEBACK		BIT(1)
23 #define VSP1_DL_FRAME_END_INTERNAL		BIT(2)
24 
25 /**
26  * struct vsp1_dl_ext_cmd - Extended Display command
27  * @pool: pool to which this command belongs
28  * @free: entry in the pool of free commands list
29  * @opcode: command type opcode
30  * @flags: flags used by the command
31  * @cmds: array of command bodies for this extended cmd
32  * @num_cmds: quantity of commands in @cmds array
33  * @cmd_dma: DMA address of the command body
34  * @data: memory allocation for command-specific data
35  * @data_dma: DMA address for command-specific data
36  */
37 struct vsp1_dl_ext_cmd {
38 	struct vsp1_dl_cmd_pool *pool;
39 	struct list_head free;
40 
41 	u8 opcode;
42 	u32 flags;
43 
44 	struct vsp1_pre_ext_dl_body *cmds;
45 	unsigned int num_cmds;
46 	dma_addr_t cmd_dma;
47 
48 	void *data;
49 	dma_addr_t data_dma;
50 };
51 
52 void vsp1_dlm_setup(struct vsp1_device *vsp1);
53 
54 struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1,
55 					unsigned int index,
56 					unsigned int prealloc);
57 void vsp1_dlm_destroy(struct vsp1_dl_manager *dlm);
58 void vsp1_dlm_reset(struct vsp1_dl_manager *dlm);
59 unsigned int vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm);
60 struct vsp1_dl_body *vsp1_dlm_dl_body_get(struct vsp1_dl_manager *dlm);
61 
62 struct vsp1_dl_list *vsp1_dl_list_get(struct vsp1_dl_manager *dlm);
63 void vsp1_dl_list_put(struct vsp1_dl_list *dl);
64 struct vsp1_dl_body *vsp1_dl_list_get_body0(struct vsp1_dl_list *dl);
65 struct vsp1_dl_ext_cmd *vsp1_dl_get_pre_cmd(struct vsp1_dl_list *dl);
66 void vsp1_dl_list_commit(struct vsp1_dl_list *dl, unsigned int dl_flags);
67 
68 struct vsp1_dl_body_pool *
69 vsp1_dl_body_pool_create(struct vsp1_device *vsp1, unsigned int num_bodies,
70 			 unsigned int num_entries, size_t extra_size);
71 void vsp1_dl_body_pool_destroy(struct vsp1_dl_body_pool *pool);
72 struct vsp1_dl_body *vsp1_dl_body_get(struct vsp1_dl_body_pool *pool);
73 void vsp1_dl_body_put(struct vsp1_dl_body *dlb);
74 
75 void vsp1_dl_body_write(struct vsp1_dl_body *dlb, u32 reg, u32 data);
76 int vsp1_dl_list_add_body(struct vsp1_dl_list *dl, struct vsp1_dl_body *dlb);
77 int vsp1_dl_list_add_chain(struct vsp1_dl_list *head, struct vsp1_dl_list *dl);
78 
79 #endif /* __VSP1_DL_H__ */
80